[PATCH v2 1/2] [Security Check] libxl: parse the sysfsdevice parameter and pass to qemu

fred gao fred.gao at intel.com
Fri Sep 29 08:48:23 UTC 2017


Add the sysfsdevice parameter in Qemu and need to be parsed in libxl.

v2:
- add comments. (Zhang, Yulei)

Signed-off-by: fred gao <fred.gao at intel.com>
---
 tools/libxl/libxl_dm.c      | 8 ++++++++
 tools/libxl/libxl_types.idl | 1 +
 tools/xl/xl_parse.c         | 1 +
 3 files changed, 10 insertions(+)

diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 6bcff24..1e1c336 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -560,6 +560,10 @@ static int libxl__build_device_model_args_old(libxl__gc *gc,
                 flexarray_vappend(dm_args, "-vgt_monitor_config_file",
                     libxl__sprintf(gc, "%s", b_info->u.hvm.vgt_monitor_config_file), NULL);
             }
+           if (b_info->u.hvm.sysfsdevice) {
+                flexarray_vappend(dm_args, "-sysfsdevice",
+                    libxl__sprintf(gc, "%s", b_info->u.hvm.sysfsdevice), NULL);
+            }
         } else {
             switch (b_info->u.hvm.vga.kind) {
             case LIBXL_VGA_INTERFACE_TYPE_STD:
@@ -1166,6 +1170,10 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
                 flexarray_vappend(dm_args, "-vgt_monitor_config_file",
                     libxl__sprintf(gc, "%s", b_info->u.hvm.vgt_monitor_config_file), NULL);
             }
+           if (b_info->u.hvm.sysfsdevice) {
+                 flexarray_vappend(dm_args, "-sysfsdevice",
+                    libxl__sprintf(gc, "%s", b_info->u.hvm.sysfsdevice), NULL);
+             }
         } else {
             switch (b_info->u.hvm.vga.kind) {
             case LIBXL_VGA_INTERFACE_TYPE_STD:
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index 9c2181a..ac28186 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -545,6 +545,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
                                        ("vgt_fence_sz",     VgtInt),
                                        ("vgt_primary",      VgtInt),
                                        ("vgt_monitor_config_file", string),
+                                       ("sysfsdevice",      string),
                                        ("vnc",              libxl_vnc_info),
                                        # keyboard layout, default is en-us keyboard
                                        ("keymap",           string),
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index 881f70e..5f85eed 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -1966,6 +1966,7 @@ skip_usbdev:
         else
             b_info->u.hvm.vgt_primary = -1; /* not specified */
         xlu_cfg_replace_string(config, "vgt_monitor_config_file", &b_info->u.hvm.vgt_monitor_config_file, 0);
+        xlu_cfg_replace_string(config, "sysfsdevice", &b_info->u.hvm.sysfsdevice, 0);
 
         xlu_cfg_replace_string (config, "keymap", &b_info->u.hvm.keymap, 0);
         xlu_cfg_get_defbool (config, "spice", &b_info->u.hvm.spice.enable, 0);
-- 
2.7.4



More information about the intel-gvt-dev mailing list