From: Paul Durrant <paul.durrant@citrix.com>
To: xen-devel@lists.xen.org
Cc: Ian Jackson <ian.jackson@citrix.com>,
Paul Durrant <paul.durrant@citrix.com>,
Stefano Stabellini <stefano.stabellini@citrix.com>,
Ian Campbell <ian.campbell@citrix.com>
Subject: [PATCH v3] Add vendor_device parameter for HVM guests
Date: Fri, 2 Aug 2013 17:45:31 +0100 [thread overview]
Message-ID: <1375461931-25525-1-git-send-email-paul.durrant@citrix.com> (raw)
The parameter determines which, if any, xen-pvdevice is specified on the
QEMU command line. The default value is 'none' which means no argument will
be passed. A value of 'xenserver' specifies a xen-pvdevice with device-id
0xc000 (the initial value in the xenserver namespace - see
docs/misc/pci-device-reservations.txt).
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@citrix.com>
---
v3:
- Changed names from using 'pvdevice' to 'vendor_device'
- Dropped 'device_model' prefix in xl.cfg parameter
- Adhere to general format of LIBXL_HAVE_ definitions
v2:
- Added LIBXL_HAVE_PVDEVICE to libxl.h
- Added more text to xl.cfg manpage to call out the device-id of
the xenserver pvdevice and point readers at
docs/misc/pci-device-reservations.txt
docs/man/xl.cfg.pod.5 | 23 +++++++++++++++++++++++
tools/libxl/libxl.h | 8 ++++++++
tools/libxl/libxl_dm.c | 9 +++++++++
tools/libxl/libxl_types.idl | 5 +++++
tools/libxl/xl_cmdimpl.c | 14 ++++++++++++++
5 files changed, 59 insertions(+)
diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5
index 069b73f..08d6cc4 100644
--- a/docs/man/xl.cfg.pod.5
+++ b/docs/man/xl.cfg.pod.5
@@ -1176,6 +1176,29 @@ documentation.
=back
+=item B<vendor_device="VENDOR_DEVICE">
+
+Selects which variant of the QEMU xen-pvdevice should be used for this
+guest. Valid values are:
+
+=over 4
+
+=item B<none>
+
+The xen-pvdevice should be omitted. This is the default.
+
+=item B<xenserver>
+
+The xenserver variant of the xen-pvdevice (device-id=C000) will be
+specified, enabling the use of XenServer PV drivers in the guest.
+
+=back
+
+This parameter only takes effect when device_model_version=qemu-xen.
+See F<docs/misc/pci-device-reservations.txt> for more information.
+
+=back
+
=head2 Device-Model Options
The following options control the selection of the device-model. This
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index 37e4d82..b9af2b1 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -82,6 +82,14 @@
#define LIBXL_HAVE_DOMAIN_NODEAFFINITY 1
/*
+ * LIBXL_HAVE_BUILD_INFO_HVM_VENDOR_DEVICE indicates that the
+ * libxl_vendor_device field is present in the hvm sections of
+ * libxl_domain_build_info. This field tells libxl which
+ * flavour of xen-pvdevice to enable in QEMU.
+ */
+#define LIBXL_HAVE_BUILD_INFO_HVM_VENDOR_DEVICE 1
+
+/*
* libxl ABI compatibility
*
* The only guarantee which libxl makes regarding ABI compatibility
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 7e54c02..615dcf3 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -647,6 +647,15 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
flexarray_append(dm_args, "-drive");
flexarray_append(dm_args, drive);
}
+
+ switch (b_info->u.hvm.vendor_device) {
+ case LIBXL_VENDOR_DEVICE_XENSERVER:
+ flexarray_append(dm_args, "-device");
+ flexarray_append(dm_args, "xen-pvdevice,device-id=0xc000");
+ break;
+ default:
+ break;
+ }
}
flexarray_append(dm_args, NULL);
return (char **) flexarray_contents(dm_args);
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index d218a2d..85341a0 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -132,6 +132,10 @@ libxl_vga_interface_type = Enumeration("vga_interface_type", [
(2, "STD"),
], init_val = 0)
+libxl_vendor_device = Enumeration("vendor_device", [
+ (0, "NONE"),
+ (1, "XENSERVER"),
+ ])
#
# Complex libxl types
#
@@ -332,6 +336,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
("soundhw", string),
("xen_platform_pci", libxl_defbool),
("usbdevice_list", libxl_string_list),
+ ("vendor_device", libxl_vendor_device),
])),
("pv", Struct(None, [("kernel", string),
("slack_memkb", MemKB),
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 5bef969..b583942 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -1532,6 +1532,20 @@ skip_vfb:
exit (1);
}
+
+ if (!xlu_cfg_get_string (config, "vendor_device", &buf, 0)) {
+ libxl_vendor_device d;
+
+ e = libxl_vendor_device_from_string(buf, &d);
+ if (e) {
+ fprintf(stderr,
+ "xl: unknown vendor_device '%s'\n",
+ buf);
+ exit(-ERROR_FAIL);
+ }
+
+ b_info->u.hvm.vendor_device = d;
+ }
}
xlu_cfg_destroy(config);
--
1.7.10.4
next reply other threads:[~2013-08-02 16:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-02 16:45 Paul Durrant [this message]
2013-08-05 10:54 ` [PATCH v3] Add vendor_device parameter for HVM guests Ian Campbell
2013-09-04 15:53 ` Olaf Hering
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=1375461931-25525-1-git-send-email-paul.durrant@citrix.com \
--to=paul.durrant@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@citrix.com \
--cc=stefano.stabellini@citrix.com \
--cc=xen-devel@lists.xen.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).