All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] libxl: Add virtio vga interface support for qemu
@ 2019-04-04 19:36 Chris Patterson
  2019-04-04 19:36 ` [PATCH 2/2] libxl_dm: honor opengl flag for SDL Chris Patterson
  2019-04-11  0:02   ` [Xen-devel] " Chris Patterson
  0 siblings, 2 replies; 6+ messages in thread
From: Chris Patterson @ 2019-04-04 19:36 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, Chris Patterson, Ian Jackson

From: Chris Patterson <pattersonc@ainfosec.com>

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@ainfosec.com>
---
 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@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] libxl_dm: honor opengl flag for SDL
  2019-04-04 19:36 [PATCH 1/2] libxl: Add virtio vga interface support for qemu Chris Patterson
@ 2019-04-04 19:36 ` Chris Patterson
  2019-04-11  0:02   ` [Xen-devel] " Chris Patterson
  1 sibling, 0 replies; 6+ messages in thread
From: Chris Patterson @ 2019-04-04 19:36 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, Chris Patterson, Ian Jackson

From: Chris Patterson <pattersonc@ainfosec.com>

It was honored in libxl__build_device_model_args_old(), but did not
transition to libxl__build_device_model_args_new().

The opengl flag is useful for SDL to toggle virgl when using virtio-vga.

To accomplish this, we also switch from the short-hand "-sdl" notation to
"-display sdl", which should be fine compatibility-wise as "-display sdl"
is used as far back as qemu 0.15 [1].

"-display sdl,gl=on" is supported as far back as qemu 2.7 [2].

[1] https://github.com/qemu/qemu/blob/stable-0.15/qemu-options.hx#L617
[2] https://github.com/qemu/qemu/blob/stable-2.7/qemu-options.hx#L929

Signed-off-by: Chris Patterson <pattersonc@ainfosec.com>
---
 docs/man/xl.cfg.5.pod.in | 3 +--
 tools/libxl/libxl_dm.c   | 5 ++++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index 0d4fd49..a2d3988 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -2297,8 +2297,7 @@ Simple DirectMedia Layer). The default is (0) not enabled.
 
 =item B<opengl=BOOLEAN>
 
-Enable OpenGL acceleration of the SDL display. Only effects machines
-using B<device_model_version="qemu-xen-traditional"> and only if the
+Enable OpenGL acceleration of the SDL display.  Only works if the
 device-model was compiled with OpenGL support. Default is (0) false.
 
 =item B<nographic=BOOLEAN>
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 2aaa359..5928214 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -1307,7 +1307,10 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
     flexarray_append_pair(dm_args, "-display", "none");
 
     if (sdl) {
-        flexarray_append(dm_args, "-sdl");
+        flexarray_append_pair(dm_args, "-display", GCSPRINTF("sdl%s",
+                              libxl_defbool_val(sdl->opengl) ?
+                              ",gl=on" : ""));
+
         if (sdl->display)
             flexarray_append_pair(dm_envs, "DISPLAY", sdl->display);
         if (sdl->xauthority)
-- 
2.1.4


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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] libxl: Add virtio vga interface support for qemu
@ 2019-04-11  0:02   ` Chris Patterson
  0 siblings, 0 replies; 6+ messages in thread
From: Chris Patterson @ 2019-04-11  0:02 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, Chris Patterson, Ian Jackson

For anyone looking at this... while I have tested and verified that
both virtio-gpu and VirGL work, it's not without some hiccup.

I have been running Ubuntu 19.04 with this config for a few days and I
have had a couple VM freezes. 'xl dmesg' is spamming the following
repeatedly:
(XEN) irq.c:2479: dom3: pirq 143 or emuirq -3 already mapped

Seems to be related to MSI-X for the device, but I haven't yet had a
chance to dig into it.  Maybe someone knows if this is to be expected
given the state of things? :)

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Xen-devel] [PATCH 1/2] libxl: Add virtio vga interface support for qemu
@ 2019-04-11  0:02   ` Chris Patterson
  0 siblings, 0 replies; 6+ messages in thread
From: Chris Patterson @ 2019-04-11  0:02 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, Chris Patterson, Ian Jackson

For anyone looking at this... while I have tested and verified that
both virtio-gpu and VirGL work, it's not without some hiccup.

I have been running Ubuntu 19.04 with this config for a few days and I
have had a couple VM freezes. 'xl dmesg' is spamming the following
repeatedly:
(XEN) irq.c:2479: dom3: pirq 143 or emuirq -3 already mapped

Seems to be related to MSI-X for the device, but I haven't yet had a
chance to dig into it.  Maybe someone knows if this is to be expected
given the state of things? :)

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] libxl: Add virtio vga interface support for qemu
@ 2019-04-17 17:55     ` Rich Persaud
  0 siblings, 0 replies; 6+ messages in thread
From: Rich Persaud @ 2019-04-17 17:55 UTC (permalink / raw)
  To: Chris Patterson
  Cc: xen-devel, Chris Patterson, Wei Liu, Ian Jackson, Paul Durrant

> On Apr 10, 2019, at 20:02, Chris Patterson <cjp256@gmail.com> wrote:
> 
> For anyone looking at this... while I have tested and verified that
> both virtio-gpu and VirGL work, it's not without some hiccup.
> 
> I have been running Ubuntu 19.04 with this config for a few days and I
> have had a couple VM freezes. 'xl dmesg' is spamming the following
> repeatedly:
> (XEN) irq.c:2479: dom3: pirq 143 or emuirq -3 already mapped
> 
> Seems to be related to MSI-X for the device, but I haven't yet had a
> chance to dig into it.  Maybe someone knows if this is to be expected
> given the state of things? :)

Adding Paul Durrant (vGPU/graphics) to the thread.

Rich

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Xen-devel] [PATCH 1/2] libxl: Add virtio vga interface support for qemu
@ 2019-04-17 17:55     ` Rich Persaud
  0 siblings, 0 replies; 6+ messages in thread
From: Rich Persaud @ 2019-04-17 17:55 UTC (permalink / raw)
  To: Chris Patterson
  Cc: xen-devel, Chris Patterson, Wei Liu, Ian Jackson, Paul Durrant

> On Apr 10, 2019, at 20:02, Chris Patterson <cjp256@gmail.com> wrote:
> 
> For anyone looking at this... while I have tested and verified that
> both virtio-gpu and VirGL work, it's not without some hiccup.
> 
> I have been running Ubuntu 19.04 with this config for a few days and I
> have had a couple VM freezes. 'xl dmesg' is spamming the following
> repeatedly:
> (XEN) irq.c:2479: dom3: pirq 143 or emuirq -3 already mapped
> 
> Seems to be related to MSI-X for the device, but I haven't yet had a
> chance to dig into it.  Maybe someone knows if this is to be expected
> given the state of things? :)

Adding Paul Durrant (vGPU/graphics) to the thread.

Rich

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-04-17 17:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-04 19:36 [PATCH 1/2] libxl: Add virtio vga interface support for qemu Chris Patterson
2019-04-04 19:36 ` [PATCH 2/2] libxl_dm: honor opengl flag for SDL Chris Patterson
2019-04-11  0:02 ` [PATCH 1/2] libxl: Add virtio vga interface support for qemu Chris Patterson
2019-04-11  0:02   ` [Xen-devel] " Chris Patterson
2019-04-17 17:55   ` Rich Persaud
2019-04-17 17:55     ` [Xen-devel] " Rich Persaud

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.