This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-devel] xl and GFX passthrough

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] xl and GFX passthrough
From: Sergey Tovpeko <tsv.devel@xxxxxxxxx>
Date: Thu, 13 Jan 2011 12:12:45 +0300
Delivery-date: Thu, 13 Jan 2011 01:19:54 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :subject:content-type; bh=Ly/Hm6WZtSsP97DcUXHc7gl5s2YvrOY0g5AXsDnjTao=; b=mngNe+F1S8wU0HMZAfhcSto5bsfO/z70jQLN5JNmFeshWwlDoqrNFaztLT9zq5QNR0 LgNfU0RiwcxkEJmdmLD6bcDcszBELsVbARZuhsotch37xRJxNUiMuXjjtldr2ZZVCZ2k CoWDFP65k9lhuq7/ieDv7rH121tV89GrCm7cE=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; b=CFE1Jw7tL0t3xIWxkP8neprPWy/o03knWA2+Zh7lIA4iTLbDLv8msBHKZiz5HMDMzb 74q6fgaTL7xLoBz3UmyC4780SJ3v1wyEb3+WNiywqjjALj8bOO7ksEbsyMaDDBV3zGHU VvVubBu7qvYdAHtALBJlBktJ238BDF7Xnyqao=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla-Thunderbird (X11/20090103)
Hello, everybody!

I knew recently that xl doesn't yet work with GFX passthrough for HVM guest. It makes me consider that main job for GFX passthrough are going for xm toolstack. My company is very interested to use xl tool, but we need also GFX passthrough.

The issue is not very hard to solve. It just needs to teach xl to recognize 'gfx_passthru' in config file and pass it to qemu-dm. And qemu-dm will choose the specific VGA bios to load into domain's memory in case of this option.
I attached the patch, addressing this issue.

Please, consider to push it to main repository.

Thank you.


commit 2692d4133b93260aabb7bad438a0c288238d1295
Author: Sergey Tovpeko <tovpeko@xxxxxxxxx>
Date:   Fri Jul 9 20:33:39 2010 +0400

    Pass gfx_passthru option to the device_model.
    To enable gfx passthru, xl should parse 'gfx_passthru' parameter from 
config file, and pass it to qemu-dm.

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 2c3fb0f..c630193 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -1208,6 +1208,11 @@ static char ** 
libxl_build_device_model_args_old(libxl__gc *gc,
             flexarray_set(dm_args, num++, "-vcpu_avail");
             flexarray_set(dm_args, num++, libxl__sprintf(gc, "0x%x", 
+        if (info->gfx_passthru) {
+            flexarray_set(dm_args, num++, "-gfx_passthru");
+            flexarray_set(dm_args, num++, libxl__sprintf(gc, "%d", 
+        }
         for (i = 0; i < num_vifs; i++) {
             if (vifs[i].nictype == NICTYPE_IOEMU) {
                 char *smac = libxl__sprintf(gc, 
diff --git a/tools/libxl/libxl.idl b/tools/libxl/libxl.idl
index 81fcfd9..bf3c429 100644
--- a/tools/libxl/libxl.idl
+++ b/tools/libxl/libxl.idl
@@ -96,6 +96,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
     ("disable_migrate", bool),
     ("kernel",          libxl_file_reference),
     ("cpuid",           libxl_cpuid_policy_list),
+    ("gfx_passthru",    integer),
     ("hvm",             integer),
     ("u", KeyedUnion(None, "hvm",
                 [("hvm", "%s", Struct(None,
@@ -161,6 +162,7 @@ libxl_device_model_info = Struct("device_model_info",[
     ("vcpu_avail",       integer,           False, "vcpus actually available"),
     ("xen_platform_pci", integer,           False, "enable/disable the xen 
platform pci device"),
     ("extra",            libxl_string_list, False, "extra parameters pass 
directly to qemu, NULL terminated"),
+    ("gfx_passthru",     integer),
 """Device Model information.
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 1eace78..415b9b8 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -363,6 +363,7 @@ static void init_dm_info(libxl_device_model_info *dm_info,
     dm_info->apic = b_info->u.hvm.apic;
     dm_info->vcpus = b_info->max_vcpus;
     dm_info->vcpu_avail = b_info->cur_vcpus;
+    dm_info->gfx_passthru = b_info->gfx_passthru;
     dm_info->stdvga = 0;
     dm_info->vnc = 1;
@@ -900,6 +901,9 @@ static void parse_config_data(const char 
     xlu_cfg_replace_string (config, "kernel", &b_info->kernel.path);
+    if (!xlu_cfg_get_long (config, "gfx_passthru", &l))
+        b_info->gfx_passthru = l;
     if (c_info->hvm == 1) {
         if (!xlu_cfg_get_long (config, "pae", &l))
             b_info->u.hvm.pae = l;
Xen-devel mailing list