From: Chris Patterson <cjp256@gmail.com>
To: xen-devel@lists.xenproject.org
Cc: Wei Liu <wei.liu2@citrix.com>,
Chris Patterson <pattersonc@ainfosec.com>,
Ian Jackson <ian.jackson@eu.citrix.com>
Subject: [PATCH 1/2] libxl: Add virtio vga interface support for qemu
Date: Thu, 4 Apr 2019 15:36:50 -0400 [thread overview]
Message-ID: <1554406611-11262-1-git-send-email-cjp256@gmail.com> (raw)
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
next reply other threads:[~2019-04-04 19:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-04 19:36 Chris Patterson [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1554406611-11262-1-git-send-email-cjp256@gmail.com \
--to=cjp256@gmail.com \
--cc=ian.jackson@eu.citrix.com \
--cc=pattersonc@ainfosec.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).