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

[Xen-devel] [PATCH 1/2] libxl: Add virtio vga interface support for qemu



From: Chris Patterson <pattersonc@xxxxxxxxxxxx>

To enable it, set vga="virtio".

Default videoram for virtio-vga is set to match current
QEMU default with 256MB.

Signed-off-by: Chris Patterson <pattersonc@xxxxxxxxxxxx>
---
 docs/man/xl.cfg.5.pod.in    |  4 +++-
 tools/libxl/libxl.h         | 10 ++++++++++
 tools/libxl/libxl_create.c  |  9 +++++++++
 tools/libxl/libxl_dm.c      |  7 +++++++
 tools/libxl/libxl_types.idl |  1 +
 tools/xl/xl_parse.c         |  2 ++
 6 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index ad81af1..0d4fd49 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -2232,6 +2232,8 @@ device-model, the default and minimum is 8 MB.
 For QXL vga, both the default and minimal are 128MB.
 If B<videoram> is set less than 128MB, an error will be triggered.
 
+For VirtIO vga, the default is 256MB.
+
 =item B<stdvga=BOOLEAN>
 
 Speficies a standard VGA card with VBE (VESA BIOS Extensions) as the
@@ -2245,7 +2247,7 @@ B<This option is deprecated, use vga="stdvga" instead>.
 =item B<vga="STRING">
 
 Selects the emulated video card.
-Options are: B<none>, B<stdvga>, B<cirrus> and B<qxl>.
+Options are: B<none>, B<stdvga>, B<cirrus>, B<qxl>, and B<virtio>.
 The default is B<cirrus>.
 
 In general, QXL should work with the Spice remote display protocol
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index a38e5cd..b818e1a 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -747,6 +747,16 @@ typedef struct libxl__ctx libxl_ctx;
 #define LIBXL_HAVE_QXL 1
 
 /*
+ * LIBXL_HAVE_VIRTIO_VGA
+ *
+ * If defined, then the libxl_vga_interface_type will contain another value:
+ * "VIRTIO". This value define if virtio vga is supported.
+ *
+ * If this is not defined, the virtio vga support is missed.
+ */
+#define LIBXL_HAVE_VIRTIO_VGA 1
+
+/*
  * LIBXL_HAVE_SPICE_VDAGENT
  *
  * If defined, then the libxl_spice_info structure will contain a boolean type:
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 89fe80f..d6c2b91 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -245,6 +245,10 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
                 LOG(ERROR,"qemu upstream required for qxl vga");
                 return ERROR_INVAL;
                 break;
+            case LIBXL_VGA_INTERFACE_TYPE_VIRTIO:
+                LOG(ERROR,"qemu upstream required for virtio vga");
+                return ERROR_INVAL;
+                break;
             case LIBXL_VGA_INTERFACE_TYPE_STD:
                 if (b_info->video_memkb == LIBXL_MEMKB_DEFAULT)
                     b_info->video_memkb = 8 * 1024;
@@ -278,6 +282,11 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
                     return ERROR_INVAL;
                 }
                 break;
+            case LIBXL_VGA_INTERFACE_TYPE_VIRTIO:
+                if (b_info->video_memkb == LIBXL_MEMKB_DEFAULT) {
+                    b_info->video_memkb = (256 * 1024);
+                }
+                break;
             case LIBXL_VGA_INTERFACE_TYPE_STD:
                 if (b_info->video_memkb == LIBXL_MEMKB_DEFAULT)
                     b_info->video_memkb = 16 * 1024;
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 2f19786..2aaa359 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -790,6 +790,8 @@ static int libxl__build_device_model_args_old(libxl__gc *gc,
             break;
         case LIBXL_VGA_INTERFACE_TYPE_QXL:
             break;
+        case LIBXL_VGA_INTERFACE_TYPE_VIRTIO:
+            break;
         default:
             LOGD(ERROR, domid, "Invalid emulated video card specified");
             return ERROR_INVAL;
@@ -1401,6 +1403,11 @@ static int libxl__build_device_model_args_new(libxl__gc 
*gc,
                 GCSPRINTF("qxl-vga,vram_size_mb=%"PRIu64",ram_size_mb=%"PRIu64,
                 (b_info->video_memkb/2/1024), (b_info->video_memkb/2/1024) ) );
             break;
+        case LIBXL_VGA_INTERFACE_TYPE_VIRTIO:
+            flexarray_append_pair(dm_args, "-device",
+                GCSPRINTF("virtio-vga,max_hostmem=%"PRIu64,
+                (b_info->video_memkb*1024)));
+            break;
         default:
             LOGD(ERROR, guest_domid, "Invalid emulated video card specified");
             return ERROR_INVAL;
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index b685ac4..19ab799 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -220,6 +220,7 @@ libxl_vga_interface_type = 
Enumeration("vga_interface_type", [
     (2, "STD"),
     (3, "NONE"),
     (4, "QXL"),
+    (5, "VIRTIO"),
     ], init_val = "LIBXL_VGA_INTERFACE_TYPE_UNKNOWN")
 
 libxl_vendor_device = Enumeration("vendor_device", [
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index 352cd21..33153bd 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -2560,6 +2560,8 @@ skip_usbdev:
                 b_info->u.hvm.vga.kind = LIBXL_VGA_INTERFACE_TYPE_NONE;
             } else if (!strcmp(buf, "qxl")) {
                 b_info->u.hvm.vga.kind = LIBXL_VGA_INTERFACE_TYPE_QXL;
+            } else if (!strcmp(buf, "virtio")) {
+                b_info->u.hvm.vga.kind = LIBXL_VGA_INTERFACE_TYPE_VIRTIO;
             } else {
                 fprintf(stderr, "Unknown vga \"%s\" specified\n", buf);
                 exit(1);
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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