Subject: libxl: Add none to vga parameter
From: Fabio Fantoni fabio.fantoni@m2r.biz Thu Mar 13 15:25:47 2014 +0100
Date: Thu Mar 13 18:09:57 2014 +0000:
Git: 2e5738ff47b9d2e1948024100f87b1a25fcf004a

Usage:
  vga="none"

Make possible to not have an emulated vga on hvm domUs.

Signed-off-by: Fabio Fantoni <fabio.fantoni@m2r.biz>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Tested-by: Paul Durrant <paul.durrant@citrix.com>

Index: xen-4.4.3-testing/docs/man/xl.cfg.pod.5
===================================================================
--- xen-4.4.3-testing.orig/docs/man/xl.cfg.pod.5
+++ xen-4.4.3-testing/docs/man/xl.cfg.pod.5
@@ -1082,7 +1082,7 @@ This option is deprecated, use vga="stdv
 
 =item B<vga="STRING">
 
-Selects the emulated video card (stdvga|cirrus).
+Selects the emulated video card (none|stdvga|cirrus).
 The default is cirrus.
 
 =item B<vnc=BOOLEAN>
Index: xen-4.4.3-testing/tools/libxl/libxl_create.c
===================================================================
--- xen-4.4.3-testing.orig/tools/libxl/libxl_create.c
+++ xen-4.4.3-testing/tools/libxl/libxl_create.c
@@ -226,6 +226,10 @@ int libxl__domain_build_info_setdefault(
         switch (b_info->device_model_version) {
         case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
             switch (b_info->u.hvm.vga.kind) {
+            case LIBXL_VGA_INTERFACE_TYPE_NONE:
+                if (b_info->video_memkb == LIBXL_MEMKB_DEFAULT)
+                    b_info->video_memkb = 0;
+                break;
             case LIBXL_VGA_INTERFACE_TYPE_STD:
                 if (b_info->video_memkb == LIBXL_MEMKB_DEFAULT)
                     b_info->video_memkb = 8 * 1024;
@@ -246,6 +250,10 @@ int libxl__domain_build_info_setdefault(
         case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
         default:
             switch (b_info->u.hvm.vga.kind) {
+            case LIBXL_VGA_INTERFACE_TYPE_NONE:
+                if (b_info->video_memkb == LIBXL_MEMKB_DEFAULT)
+                    b_info->video_memkb = 0;
+                break;
             case LIBXL_VGA_INTERFACE_TYPE_STD:
                 if (b_info->video_memkb == LIBXL_MEMKB_DEFAULT)
                     b_info->video_memkb = 16 * 1024;
Index: xen-4.4.3-testing/tools/libxl/libxl_dm.c
===================================================================
--- xen-4.4.3-testing.orig/tools/libxl/libxl_dm.c
+++ xen-4.4.3-testing/tools/libxl/libxl_dm.c
@@ -226,6 +226,9 @@ static char ** libxl__build_device_model
             break;
         case LIBXL_VGA_INTERFACE_TYPE_CIRRUS:
             break;
+        case LIBXL_VGA_INTERFACE_TYPE_NONE:
+            flexarray_append_pair(dm_args, "-vga", "none");
+            break;
         }
 
         if (b_info->u.hvm.boot) {
@@ -534,6 +537,8 @@ static char ** libxl__build_device_model
                 GCSPRINTF("vga.vram_size_mb=%d",
                 libxl__sizekb_to_mb(b_info->video_memkb)));
             break;
+        case LIBXL_VGA_INTERFACE_TYPE_NONE:
+            break;
         }
 
         if (b_info->u.hvm.boot) {
Index: xen-4.4.3-testing/tools/libxl/libxl_types.idl
===================================================================
--- xen-4.4.3-testing.orig/tools/libxl/libxl_types.idl
+++ xen-4.4.3-testing/tools/libxl/libxl_types.idl
@@ -153,6 +153,7 @@ libxl_shutdown_reason = Enumeration("shu
 libxl_vga_interface_type = Enumeration("vga_interface_type", [
     (1, "CIRRUS"),
     (2, "STD"),
+    (3, "NONE"),
     ], init_val = 1)
 
 libxl_vendor_device = Enumeration("vendor_device", [
Index: xen-4.4.3-testing/tools/libxl/xl_cmdimpl.c
===================================================================
--- xen-4.4.3-testing.orig/tools/libxl/xl_cmdimpl.c
+++ xen-4.4.3-testing/tools/libxl/xl_cmdimpl.c
@@ -1667,6 +1667,8 @@ skip_vfb:
                 b_info->u.hvm.vga.kind = LIBXL_VGA_INTERFACE_TYPE_STD;
             } else if (!strcmp(buf, "cirrus")) {
                 b_info->u.hvm.vga.kind = LIBXL_VGA_INTERFACE_TYPE_CIRRUS;
+            } else if (!strcmp(buf, "none")) {
+                b_info->u.hvm.vga.kind = LIBXL_VGA_INTERFACE_TYPE_NONE;
             } else {
                 fprintf(stderr, "Unknown vga \"%s\" specified\n", buf);
                 exit(1);
