When we're working to support IGD GFX passthrough with qemu
upstream, instead of "-gfx_passthru" we'd like to make that
a machine option, "-machine xxx,gfx_passthru=on". This need
to bring several changes on tool side.

Signed-off-by: Tiejun Chen <tiejun.c...@intel.com>
---
 tools/libxl/libxl_dm.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index c2b0487..2b59d2c 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -318,7 +318,10 @@ static char ** 
libxl__build_device_model_args_old(libxl__gc *gc,
             flexarray_vappend(dm_args, "-net", "none", NULL);
         }
         if (libxl_defbool_val(b_info->u.hvm.gfx_passthru)) {
-            flexarray_append(dm_args, "-gfx_passthru");
+            if (b_info->device_model_version !=
+                LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
+                flexarray_append(dm_args, "-gfx_passthru");
+            }
         }
     } else {
         if (!sdl && !vnc)
@@ -702,7 +705,10 @@ static char ** 
libxl__build_device_model_args_new(libxl__gc *gc,
             flexarray_append(dm_args, "none");
         }
         if (libxl_defbool_val(b_info->u.hvm.gfx_passthru)) {
-            flexarray_append(dm_args, "-gfx_passthru");
+            if (b_info->device_model_version !=
+                LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
+                flexarray_append(dm_args, "-gfx_passthru");
+            }
         }
     } else {
         if (!sdl && !vnc) {
@@ -748,6 +754,15 @@ static char ** 
libxl__build_device_model_args_new(libxl__gc *gc,
                                             machinearg, max_ram_below_4g);
             }
         }
+
+        if (b_info->device_model_version ==
+            LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
+            if (libxl_defbool_val(b_info->u.hvm.gfx_passthru)) {
+                machinearg = libxl__sprintf(gc, "%s,gfx_passthru=on",
+                                            machinearg);
+            }
+        }
+
         flexarray_append(dm_args, machinearg);
         for (i = 0; b_info->extra_hvm && b_info->extra_hvm[i] != NULL; i++)
             flexarray_append(dm_args, b_info->extra_hvm[i]);
-- 
1.9.1


Reply via email to