|
[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
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
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |