[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XEN][RFC PATCH 13/13] tools/xl: Add new xl commands fpga-add and fpga-del


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Vikram Garhwal <fnu.vikram@xxxxxxxxxx>
  • Date: Wed, 1 Sep 2021 23:06:03 -0700
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=ykNwRHO6V8HwcABuxYp6Pws7yb5pYX82KhqW7gTX5nc=; b=CgY1gDga71hBm89KMbDdD2WJPWR2lnb/Xx0NUtEGdx/Aw+gXSQYIMeiDGyLL7+PNgMeIfowbOOSaH7E5JSBSbypdS0/VXeSh3BEKcwaHOYfuDe/st6iirOvHFrBBabzMUaKQ0Jnuvfy6lRliYhPAgAO+LgwPb05j7ix8uy4Sg+u63jMr8JgSS4eXOkeM54EVt75XTLeTsRPwhnqKsZwEwqct5IDv7ZZWoWvRQ1rk36RitMlitsv4YO81ODiL8BBmXC33L7k8CRYvUXpzkiy6QmiiPJuJvbXM3uSM/Si5wJuctlwhhH5H5QvOYTfR6QvCOIWw7JlroSUjWv05IEXO2A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PqXc9nZHuBVpovZhtd88HvzHVB8dah0yQfDIGTWKMs+Vv+T5UAMeNAT5E/D6uYfZvEm2uWuuW82J0pjvKifUUNzrwm8/+Skpdi4AgJYGFABnVQlR1QgqiMShDXODKmneMn0YfQ7HenSe8ZdVbg0X9CbRUUoQ58IXoSIVM4kcEwfMGBD8ZHvQGiV9a1oRl/njSUh56tAgKvZ0Z9VmjL7B63ywm2zS46nBMW61TPi9YYsSgCIOKhuJfFrtbgoFyEMWiDRv8iDnNrPZtzBQDaDYMbyJtGdWXnpsWvarRn7AgaWu1S4r7vT+UjOGUWcAE0JFsM8Uc/4twb5JwWjyCZYPUQ==
  • Cc: <sstabellini@xxxxxxxxxx>, <julien@xxxxxxx>, Vikram Garhwal <fnu.vikram@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Thu, 02 Sep 2021 06:51:06 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Signed-off-by: Vikram Garhwal <fnu.vikram@xxxxxxxxxx>
---
 tools/xl/xl.h           |  2 ++
 tools/xl/xl_cmdtable.c  | 12 ++++++++++++
 tools/xl/xl_vmcontrol.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 65 insertions(+)

diff --git a/tools/xl/xl.h b/tools/xl/xl.h
index 7e23f30..63be31e 100644
--- a/tools/xl/xl.h
+++ b/tools/xl/xl.h
@@ -140,6 +140,8 @@ int main_shutdown(int argc, char **argv);
 int main_reboot(int argc, char **argv);
 int main_list(int argc, char **argv);
 int main_vm_list(int argc, char **argv);
+int main_fpga_add(int argc, char **argv);
+int main_fpga_del(int argc, char **argv);
 int main_create(int argc, char **argv);
 int main_config_update(int argc, char **argv);
 int main_button_press(int argc, char **argv);
diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c
index 661323d..135fe6a 100644
--- a/tools/xl/xl_cmdtable.c
+++ b/tools/xl/xl_cmdtable.c
@@ -20,6 +20,18 @@
 #include "xl.h"
 
 const struct cmd_spec cmd_table[] = {
+    { "fpga-add",
+      &main_fpga_add, 1, 1,
+      "Add a PL block",
+      "<.dtbo>"
+      "-h print this help\n"
+    },
+    { "fpga-del",
+      &main_fpga_del, 1, 1,
+      "Remove a PL block",
+      "<full_node_path>"
+      "-h print this help\n"
+    },
     { "create",
       &main_create, 1, 1,
       "Create a domain from config file <filename>",
diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c
index 435155a..f5bfdbc 100644
--- a/tools/xl/xl_vmcontrol.c
+++ b/tools/xl/xl_vmcontrol.c
@@ -1262,6 +1262,57 @@ int main_create(int argc, char **argv)
     return 0;
 }
 
+int main_fpga_add(int argc, char **argv)
+{
+    const char *fpga_config_file = argv[1];
+    void *pfdt = NULL;
+    int rc;
+    int pfdt_size = 0;
+
+    if (fpga_config_file) {
+        rc = libxl_read_file_contents(ctx, fpga_config_file,
+                                      &pfdt, &pfdt_size);
+
+        if (rc) {
+            fprintf(stderr, "failed to read the fpga-partial device file %s\n",
+                    fpga_config_file);
+            free(pfdt);
+            return ERROR_FAIL;
+        }
+    } else {
+        fprintf(stderr, "FPGA config file is not provided\n");
+        return ERROR_FAIL;
+    }
+
+    rc = libxl_add_fpga_node(ctx, pfdt, pfdt_size);
+    if (rc)
+        fprintf(stderr, "Adding FPGA node failed\n");
+
+    free(pfdt);
+    return rc;
+}
+
+int main_fpga_del(int argc, char **argv)
+{
+    char *full_dt_node_path = argv[1];
+    int rc = 0;
+
+    if (full_dt_node_path) {
+        rc = libxl_del_fpga_node(ctx, full_dt_node_path);
+
+        fprintf(stdout, "fpga-del called for device = %s\n", 
full_dt_node_path);
+
+        if (rc)
+            fprintf(stderr, "Removing FPGA node failed\n");
+
+    } else {
+        fprintf(stderr, "No device node path provided\n");
+        return ERROR_FAIL;
+    }
+
+    return rc;
+}
+
 /*
  * Local variables:
  * mode: C
-- 
2.7.4




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.