Add vendor_device parameter for HVM guests
PATCH v3 1/1 Add vendor_device parameter for HVM guests
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).
---
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(+)
docs/man/xl.cfg.pod.5 +23 -0
@@ -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
tools/libxl/libxl.h +8 -0
@@ -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
tools/libxl/libxl_dm.c +9 -0
@@ -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);
tools/libxl/libxl_types.idl +5 -0
@@ -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),
tools/libxl/xl_cmdimpl.c +14 -0
@@ -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);
Signature · 1 line
1.7.10.4
Quoted 10 lines · Paul Durrant
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 - seedocs/misc/pci-device-reservations.txt).Signed-off-by Paul Durrant <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Ian Campbell <[email protected]>Cc Ian Jackson <[email protected]>
Acked & applied with one small change:
Quoted 7 lines
/*
+ *LIBXL_HAVE_BUILD_INFO_HVM_VENDOR_DEVICEindicates that the
+ *libxl_vendor_devicefield is present in the hvm sections of
+ *libxl_domain_build_info. This field tells libxl which
+ * flavour of xen-pvdevice to enable in QEMU.
+ */
+#defineLIBXL_HAVE_BUILD_INFO_HVM_VENDOR_DEVICE1
For better or worse the existing example like this is BUILDINFO not BUILD_INFO so I dropped the "_".
Quoted 30 lines · Paul Durrant
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 - seedocs/misc/pci-device-reservations.txt).docs/man/xl.cfg.pod.5 +16
-0@@ -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. +
docs/man/xl.cfg.pod.5 documentation. · line 1204
Quoted 10 lines
docs/man/xl.cfg.pod.5 +7
-0+=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
This change causes an error:
man/xl.cfg.pod.5 around line 1179: '=item' outside of any '=over' POD document had syntax errors at /usr/bin/pod2text line 84. make[2]: *** [txt/man/xl.cfg.5.txt] Error 255
Olaf