Accepting request 796123 from home:jfehlig:branches:Virtualization

- libxl: Add support for 'passthrough' and 'e820_host' settings
  b7d6648d-conf-add-e820-host.patch,
  5749395b-libxl-e820-host.patch,
  f3ef7daf-xenconfig-e820-host.patch,
  34077c1b-tests-check-e820-host.patch,
  fadbaa23-conf-add-passthrough.patch,
  9529e007-libxl-passthrough.patch,
  9cb8bc6f-xenconfig-refactor-features.patch,
  b523e225-xenconfig-passthrough.patch,
  bed32525-tests-check-passthrough.patch
  bsc#1167217

OBS-URL: https://build.opensuse.org/request/show/796123
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=823
This commit is contained in:
James Fehlig 2020-04-21 20:56:47 +00:00 committed by Git OBS Bridge
parent c93c63891d
commit 06eb24a4dd
17 changed files with 1185 additions and 12 deletions

View File

@ -213,7 +213,7 @@ Index: libvirt-6.2.0/src/libvirt_private.syms
===================================================================
--- libvirt-6.2.0.orig/src/libvirt_private.syms
+++ libvirt-6.2.0/src/libvirt_private.syms
@@ -725,6 +725,9 @@ virDomainConfNWFilterInstantiate;
@@ -727,6 +727,9 @@ virDomainConfNWFilterInstantiate;
virDomainConfNWFilterTeardown;
virDomainConfVMNWFilterTeardown;
@ -223,7 +223,7 @@ Index: libvirt-6.2.0/src/libvirt_private.syms
# conf/interface_conf.h
virInterfaceDefFormat;
@@ -1751,6 +1754,7 @@ virCgroupGetMemoryUsage;
@@ -1753,6 +1756,7 @@ virCgroupGetMemoryUsage;
virCgroupGetMemSwapHardLimit;
virCgroupGetMemSwapUsage;
virCgroupGetPercpuStats;

View File

@ -0,0 +1,81 @@
commit 34077c1b8b62bb61e76b908d0959216da0b3185f
Author: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Date: Tue Apr 14 04:37:07 2020 +0200
tests: check e820_host option handling
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Index: libvirt-6.2.0/tests/xlconfigdata/test-paravirt-e820_host.cfg
===================================================================
--- /dev/null
+++ libvirt-6.2.0/tests/xlconfigdata/test-paravirt-e820_host.cfg
@@ -0,0 +1,13 @@
+name = "XenGuest1"
+uuid = "45b60f51-88a9-47a8-a3b3-5e66d71b2283"
+maxmem = 512
+memory = 512
+vcpus = 4
+e820_host = 1
+localtime = 0
+on_poweroff = "preserve"
+on_reboot = "restart"
+on_crash = "preserve"
+vif = [ "mac=5a:36:0e:be:00:09" ]
+bootloader = "/usr/bin/pygrub"
+disk = [ "format=qcow2,vdev=xvda,access=rw,backendtype=qdisk,target=/var/lib/xen/images/debian/disk.qcow2" ]
Index: libvirt-6.2.0/tests/xlconfigdata/test-paravirt-e820_host.xml
===================================================================
--- /dev/null
+++ libvirt-6.2.0/tests/xlconfigdata/test-paravirt-e820_host.xml
@@ -0,0 +1,37 @@
+<domain type='xen'>
+ <name>XenGuest1</name>
+ <uuid>45b60f51-88a9-47a8-a3b3-5e66d71b2283</uuid>
+ <memory unit='KiB'>524288</memory>
+ <currentMemory unit='KiB'>524288</currentMemory>
+ <vcpu placement='static'>4</vcpu>
+ <bootloader>/usr/bin/pygrub</bootloader>
+ <os>
+ <type arch='x86_64' machine='xenpv'>linux</type>
+ </os>
+ <features>
+ <xen>
+ <e820_host state='on'/>
+ </xen>
+ </features>
+ <clock offset='utc' adjustment='reset'/>
+ <on_poweroff>preserve</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>preserve</on_crash>
+ <devices>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source file='/var/lib/xen/images/debian/disk.qcow2'/>
+ <target dev='xvda' bus='xen'/>
+ </disk>
+ <controller type='xenbus' index='0'/>
+ <interface type='ethernet'>
+ <mac address='5a:36:0e:be:00:09'/>
+ </interface>
+ <console type='pty'>
+ <target type='xen' port='0'/>
+ </console>
+ <input type='mouse' bus='xen'/>
+ <input type='keyboard' bus='xen'/>
+ <memballoon model='xen'/>
+ </devices>
+</domain>
Index: libvirt-6.2.0/tests/xlconfigtest.c
===================================================================
--- libvirt-6.2.0.orig/tests/xlconfigtest.c
+++ libvirt-6.2.0/tests/xlconfigtest.c
@@ -300,6 +300,7 @@ mymain(void)
DO_TEST("vif-multi-ip");
DO_TEST("usb");
DO_TEST("usbctrl");
+ DO_TEST("paravirt-e820_host");
testXLFreeDriver(driver);

View File

@ -0,0 +1,34 @@
commit 5749395bfd03fcdb55a8be6a69637a2acaaad2c9
Author: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Date: Tue Apr 14 04:37:05 2020 +0200
libxl: make use of e820_host feature
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Index: libvirt-6.2.0/src/libxl/libxl_conf.c
===================================================================
--- libvirt-6.2.0.orig/src/libxl/libxl_conf.c
+++ libvirt-6.2.0/src/libxl/libxl_conf.c
@@ -692,6 +692,20 @@ libxlMakeDomBuildInfo(virDomainDefPtr de
b_info->u.pv.kernel = g_strdup(def->os.kernel);
}
b_info->u.pv.ramdisk = g_strdup(def->os.initrd);
+
+ if (def->features[VIR_DOMAIN_FEATURE_XEN] == VIR_TRISTATE_SWITCH_ON) {
+ switch ((virTristateSwitch) def->xen_features[VIR_DOMAIN_XEN_E820_HOST]) {
+ case VIR_TRISTATE_SWITCH_ON:
+ libxl_defbool_set(&b_info->u.pv.e820_host, true);
+ break;
+ case VIR_TRISTATE_SWITCH_OFF:
+ libxl_defbool_set(&b_info->u.pv.e820_host, false);
+ break;
+ case VIR_TRISTATE_SWITCH_ABSENT:
+ case VIR_TRISTATE_SWITCH_LAST:
+ break;
+ }
+ }
}
/* only the 'xen' balloon device model is supported */

View File

@ -0,0 +1,41 @@
commit 9529e0077a3f9002d6bc7f5504ca4583e5d985f1
Author: Jim Fehlig <jfehlig@suse.com>
Date: Wed Apr 15 17:18:25 2020 -0600
libxl: make use of passthrough hypervisor feature
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Index: libvirt-6.2.0/src/libxl/libxl_conf.c
===================================================================
--- libvirt-6.2.0.orig/src/libxl/libxl_conf.c
+++ libvirt-6.2.0/src/libxl/libxl_conf.c
@@ -158,6 +158,27 @@ libxlMakeDomCreateInfo(libxl_ctx *ctx,
c_info->type = LIBXL_DOMAIN_TYPE_PV;
}
+#ifdef LIBXL_HAVE_CREATEINFO_PASSTHROUGH
+ if (def->features[VIR_DOMAIN_FEATURE_XEN] == VIR_TRISTATE_SWITCH_ON) {
+ switch ((virTristateSwitch) def->xen_features[VIR_DOMAIN_XEN_PASSTHROUGH]) {
+ case VIR_TRISTATE_SWITCH_ON:
+ if (def->xen_passthrough_mode == VIR_DOMAIN_XEN_PASSTHROUGH_MODE_SYNC_PT)
+ c_info->passthrough = LIBXL_PASSTHROUGH_SYNC_PT;
+ else if (def->xen_passthrough_mode == VIR_DOMAIN_XEN_PASSTHROUGH_MODE_SHARE_PT)
+ c_info->passthrough = LIBXL_PASSTHROUGH_SHARE_PT;
+ else
+ c_info->passthrough = LIBXL_PASSTHROUGH_ENABLED;
+ break;
+ case VIR_TRISTATE_SWITCH_OFF:
+ c_info->passthrough = LIBXL_PASSTHROUGH_DISABLED;
+ break;
+ case VIR_TRISTATE_SWITCH_ABSENT:
+ case VIR_TRISTATE_SWITCH_LAST:
+ break;
+ }
+ }
+#endif
+
c_info->name = g_strdup(def->name);
if (def->nseclabels &&

View File

@ -0,0 +1,112 @@
commit 9cb8bc6ff1ad80aba4d3c68756166a22e830d481
Author: Jim Fehlig <jfehlig@suse.com>
Date: Wed Apr 15 21:48:42 2020 -0600
libxl: refactor cpu and hypervisor feature parser/formatter
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Index: libvirt-6.2.0/src/libxl/xen_common.c
===================================================================
--- libvirt-6.2.0.orig/src/libxl/xen_common.c
+++ libvirt-6.2.0/src/libxl/xen_common.c
@@ -493,15 +493,12 @@ xenParsePCIList(virConfPtr conf, virDoma
static int
-xenParseCPUFeatures(virConfPtr conf,
- virDomainDefPtr def,
- virDomainXMLOptionPtr xmlopt)
+xenParseCPU(virConfPtr conf,
+ virDomainDefPtr def,
+ virDomainXMLOptionPtr xmlopt)
{
unsigned long count = 0;
g_autofree char *cpus = NULL;
- g_autofree char *tsc_mode = NULL;
- int val = 0;
- virDomainTimerDefPtr timer;
if (xenConfigGetULong(conf, "vcpus", &count, 1) < 0)
return -1;
@@ -526,6 +523,17 @@ xenParseCPUFeatures(virConfPtr conf,
if (cpus && (virBitmapParse(cpus, &def->cpumask, 4096) < 0))
return -1;
+ return 0;
+}
+
+
+static int
+xenParseHypervisorFeatures(virConfPtr conf, virDomainDefPtr def)
+{
+ g_autofree char *tsc_mode = NULL;
+ virDomainTimerDefPtr timer;
+ int val = 0;
+
if (xenConfigGetString(conf, "tsc_mode", &tsc_mode, NULL) < 0)
return -1;
@@ -552,27 +560,26 @@ xenParseCPUFeatures(virConfPtr conf,
if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
if (xenConfigGetBool(conf, "pae", &val, 1) < 0)
return -1;
-
else if (val)
def->features[VIR_DOMAIN_FEATURE_PAE] = VIR_TRISTATE_SWITCH_ON;
+
if (xenConfigGetBool(conf, "acpi", &val, 1) < 0)
return -1;
-
else if (val)
def->features[VIR_DOMAIN_FEATURE_ACPI] = VIR_TRISTATE_SWITCH_ON;
+
if (xenConfigGetBool(conf, "apic", &val, 1) < 0)
return -1;
-
else if (val)
def->features[VIR_DOMAIN_FEATURE_APIC] = VIR_TRISTATE_SWITCH_ON;
+
if (xenConfigGetBool(conf, "hap", &val, 1) < 0)
return -1;
-
else if (!val)
def->features[VIR_DOMAIN_FEATURE_HAP] = VIR_TRISTATE_SWITCH_OFF;
+
if (xenConfigGetBool(conf, "viridian", &val, 0) < 0)
return -1;
-
else if (val)
def->features[VIR_DOMAIN_FEATURE_VIRIDIAN] = VIR_TRISTATE_SWITCH_ON;
@@ -1483,7 +1490,10 @@ xenParseConfigCommon(virConfPtr conf,
if (xenParseEventsActions(conf, def) < 0)
return -1;
- if (xenParseCPUFeatures(conf, def, xmlopt) < 0)
+ if (xenParseCPU(conf, def, xmlopt) < 0)
+ return -1;
+
+ if (xenParseHypervisorFeatures(conf, def) < 0)
return -1;
if (xenParseTimeOffset(conf, def) < 0)
@@ -2115,7 +2125,7 @@ xenFormatCPUAllocation(virConfPtr conf,
static int
-xenFormatCPUFeatures(virConfPtr conf, virDomainDefPtr def)
+xenFormatHypervisorFeatures(virConfPtr conf, virDomainDefPtr def)
{
size_t i;
bool hvm = !!(def->os.type == VIR_DOMAIN_OSTYPE_HVM);
@@ -2423,7 +2433,7 @@ xenFormatConfigCommon(virConfPtr conf,
if (xenFormatCPUAllocation(conf, def) < 0)
return -1;
- if (xenFormatCPUFeatures(conf, def) < 0)
+ if (xenFormatHypervisorFeatures(conf, def) < 0)
return -1;
if (xenFormatTimeOffset(conf, def) < 0)

View File

@ -0,0 +1,112 @@
commit b523e22521afe733165869c9e1ae18e88536acd6
Author: Jim Fehlig <jfehlig@suse.com>
Date: Thu Apr 16 08:31:48 2020 -0600
xenconfig: Add support for 'passthrough' hypervisor feature
Add support for xl.cfg(5) 'passthrough' option in the domXML-to-xenconfig
configuration converter.
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Index: libvirt-6.2.0/src/libvirt_private.syms
===================================================================
--- libvirt-6.2.0.orig/src/libvirt_private.syms
+++ libvirt-6.2.0/src/libvirt_private.syms
@@ -650,6 +650,8 @@ virDomainWatchdogActionTypeToString;
virDomainWatchdogDefFree;
virDomainWatchdogModelTypeFromString;
virDomainWatchdogModelTypeToString;
+virDomainXenPassthroughModeTypeFromString;
+virDomainXenPassthroughModeTypeToString;
virDomainXMLOptionGetNamespace;
virDomainXMLOptionGetSaveCookie;
virDomainXMLOptionNew;
Index: libvirt-6.2.0/src/libxl/xen_common.c
===================================================================
--- libvirt-6.2.0.orig/src/libxl/xen_common.c
+++ libvirt-6.2.0/src/libxl/xen_common.c
@@ -530,14 +530,14 @@ xenParseCPU(virConfPtr conf,
static int
xenParseHypervisorFeatures(virConfPtr conf, virDomainDefPtr def)
{
- g_autofree char *tsc_mode = NULL;
+ g_autofree char *strval = NULL;
virDomainTimerDefPtr timer;
int val = 0;
- if (xenConfigGetString(conf, "tsc_mode", &tsc_mode, NULL) < 0)
+ if (xenConfigGetString(conf, "tsc_mode", &strval, NULL) < 0)
return -1;
- if (tsc_mode) {
+ if (strval) {
if (VIR_EXPAND_N(def->clock.timers, def->clock.ntimers, 1) < 0 ||
VIR_ALLOC(timer) < 0)
return -1;
@@ -547,16 +547,40 @@ xenParseHypervisorFeatures(virConfPtr co
timer->tickpolicy = -1;
timer->mode = VIR_DOMAIN_TIMER_MODE_AUTO;
timer->track = -1;
- if (STREQ_NULLABLE(tsc_mode, "always_emulate"))
+ if (STREQ_NULLABLE(strval, "always_emulate"))
timer->mode = VIR_DOMAIN_TIMER_MODE_EMULATE;
- else if (STREQ_NULLABLE(tsc_mode, "native"))
+ else if (STREQ_NULLABLE(strval, "native"))
timer->mode = VIR_DOMAIN_TIMER_MODE_NATIVE;
- else if (STREQ_NULLABLE(tsc_mode, "native_paravirt"))
+ else if (STREQ_NULLABLE(strval, "native_paravirt"))
timer->mode = VIR_DOMAIN_TIMER_MODE_PARAVIRT;
def->clock.timers[def->clock.ntimers - 1] = timer;
}
+ if (xenConfigGetString(conf, "passthrough", &strval, NULL) < 0)
+ return -1;
+
+ if (strval) {
+ if (STREQ(strval, "disabled")) {
+ def->features[VIR_DOMAIN_FEATURE_XEN] = VIR_TRISTATE_SWITCH_OFF;
+ def->xen_features[VIR_DOMAIN_XEN_PASSTHROUGH] = VIR_TRISTATE_SWITCH_OFF;
+ } else if (STREQ(strval, "enabled")) {
+ def->features[VIR_DOMAIN_FEATURE_XEN] = VIR_TRISTATE_SWITCH_ON;
+ def->xen_features[VIR_DOMAIN_XEN_PASSTHROUGH] = VIR_TRISTATE_SWITCH_ON;
+ } else if (STREQ(strval, "sync_pt")) {
+ def->features[VIR_DOMAIN_FEATURE_XEN] = VIR_TRISTATE_SWITCH_ON;
+ def->xen_features[VIR_DOMAIN_XEN_PASSTHROUGH] = VIR_TRISTATE_SWITCH_ON;
+ def->xen_passthrough_mode = VIR_DOMAIN_XEN_PASSTHROUGH_MODE_SYNC_PT;
+ } else if (STREQ(strval, "share_pt")) {
+ def->features[VIR_DOMAIN_FEATURE_XEN] = VIR_TRISTATE_SWITCH_ON;
+ def->xen_features[VIR_DOMAIN_XEN_PASSTHROUGH] = VIR_TRISTATE_SWITCH_ON;
+ def->xen_passthrough_mode = VIR_DOMAIN_XEN_PASSTHROUGH_MODE_SHARE_PT;
+ } else {
+ virReportError(VIR_ERR_CONF_SYNTAX,
+ _("Invalid passthrough mode %s"), strval);
+ }
+ }
+
if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
if (xenConfigGetBool(conf, "pae", &val, 1) < 0)
return -1;
@@ -2163,6 +2187,20 @@ xenFormatHypervisorFeatures(virConfPtr c
}
}
+ if (def->features[VIR_DOMAIN_FEATURE_XEN] == VIR_TRISTATE_SWITCH_ON) {
+ if (def->xen_features[VIR_DOMAIN_XEN_PASSTHROUGH] == VIR_TRISTATE_SWITCH_ON) {
+ if (def->xen_passthrough_mode == VIR_DOMAIN_XEN_PASSTHROUGH_MODE_SYNC_PT ||
+ def->xen_passthrough_mode == VIR_DOMAIN_XEN_PASSTHROUGH_MODE_SHARE_PT) {
+ if (xenConfigSetString(conf, "passthrough",
+ virDomainXenPassthroughModeTypeToString(def->xen_passthrough_mode)) < 0)
+ return -1;
+ } else {
+ if (xenConfigSetString(conf, "passthrough", "enabled") < 0)
+ return -1;
+ }
+ }
+ }
+
for (i = 0; i < def->clock.ntimers; i++) {
switch ((virDomainTimerNameType)def->clock.timers[i]->name) {
case VIR_DOMAIN_TIMER_NAME_TSC:

View File

@ -0,0 +1,292 @@
commit b7d6648d436fe0a99d4faf0f99c88a27a7bfea33
Author: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Date: Tue Apr 14 04:37:04 2020 +0200
conf: add xen specific feature: e820_host
e820_host is a Xen-specific option, only available for PV domains, that
provides the domain a virtual e820 memory map based on the host one. It
is enabled with a new Xen hypervisor feature, e.g.
<features>
<xen>
<e820_host state='on'/>
</xen>
</features>
e820_host is required when using PCI passthrough and is generally
considered safe for any PV kernel. e820_host is silently ignored if set
in HVM domain configuration. See xl.cfg(5) man page in the Xen
documentation for more details.
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Index: libvirt-6.2.0/docs/formatdomain.html.in
===================================================================
--- libvirt-6.2.0.orig/docs/formatdomain.html.in
+++ libvirt-6.2.0/docs/formatdomain.html.in
@@ -2055,6 +2055,9 @@
&lt;hidden state='on'/&gt;
&lt;hint-dedicated state='on'/&gt;
&lt;/kvm&gt;
+ &lt;xen&gt;
+ &lt;e820_host state='on'/&gt;
+ &lt;/xen&gt;
&lt;pvspinlock state='on'/&gt;
&lt;gic version='2'/&gt;
&lt;ioapic driver='qemu'/&gt;
@@ -2236,6 +2239,23 @@
</tr>
</table>
</dd>
+ <dt><code>xen</code></dt>
+ <dd>Various features to change the behavior of the Xen hypervisor.
+ <table class="top_table">
+ <tr>
+ <th>Feature</th>
+ <th>Description</th>
+ <th>Value</th>
+ <th>Since</th>
+ </tr>
+ <tr>
+ <td>e820_host</td>
+ <td>Expose the host e820 to the guest (PV only)</td>
+ <td>on, off</td>
+ <td><span class="since">6.3.0</span></td>
+ </tr>
+ </table>
+ </dd>
<dt><code>pmu</code></dt>
<dd>Depending on the <code>state</code> attribute (values <code>on</code>,
<code>off</code>, default <code>on</code>) enable or disable the
Index: libvirt-6.2.0/docs/schemas/domaincommon.rng
===================================================================
--- libvirt-6.2.0.orig/docs/schemas/domaincommon.rng
+++ libvirt-6.2.0/docs/schemas/domaincommon.rng
@@ -5334,6 +5334,9 @@
<ref name="kvm"/>
</optional>
<optional>
+ <ref name="xen"/>
+ </optional>
+ <optional>
<element name="privnet">
<empty/>
</element>
@@ -6313,6 +6316,19 @@
<ref name="featurestate"/>
</element>
</optional>
+ </interleave>
+ </element>
+ </define>
+
+ <!-- Optional Xen features -->
+ <define name="xen">
+ <element name="xen">
+ <interleave>
+ <optional>
+ <element name="e820_host">
+ <ref name="featurestate"/>
+ </element>
+ </optional>
</interleave>
</element>
</define>
Index: libvirt-6.2.0/src/conf/domain_conf.c
===================================================================
--- libvirt-6.2.0.orig/src/conf/domain_conf.c
+++ libvirt-6.2.0/src/conf/domain_conf.c
@@ -174,6 +174,7 @@ VIR_ENUM_IMPL(virDomainFeature,
"nested-hv",
"msrs",
"ccf-assist",
+ "xen",
);
VIR_ENUM_IMPL(virDomainCapabilitiesPolicy,
@@ -207,6 +208,11 @@ VIR_ENUM_IMPL(virDomainKVM,
"hint-dedicated",
);
+VIR_ENUM_IMPL(virDomainXen,
+ VIR_DOMAIN_XEN_LAST,
+ "e820_host"
+);
+
VIR_ENUM_IMPL(virDomainMsrsUnknown,
VIR_DOMAIN_MSRS_UNKNOWN_LAST,
"ignore",
@@ -20810,6 +20816,7 @@ virDomainDefParseXML(xmlDocPtr xml,
case VIR_DOMAIN_FEATURE_HYPERV:
case VIR_DOMAIN_FEATURE_KVM:
case VIR_DOMAIN_FEATURE_MSRS:
+ case VIR_DOMAIN_FEATURE_XEN:
def->features[val] = VIR_TRISTATE_SWITCH_ON;
break;
@@ -21120,6 +21127,51 @@ virDomainDefParseXML(xmlDocPtr xml,
VIR_FREE(nodes);
}
+ if (def->features[VIR_DOMAIN_FEATURE_XEN] == VIR_TRISTATE_SWITCH_ON) {
+ int feature;
+ int value;
+ if ((n = virXPathNodeSet("./features/xen/*", ctxt, &nodes)) < 0)
+ goto error;
+
+ for (i = 0; i < n; i++) {
+ feature = virDomainXenTypeFromString((const char *)nodes[i]->name);
+ if (feature < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unsupported Xen feature: %s"),
+ nodes[i]->name);
+ goto error;
+ }
+
+ switch ((virDomainXen) feature) {
+ case VIR_DOMAIN_XEN_E820_HOST:
+ if (!(tmp = virXMLPropString(nodes[i], "state"))) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("missing 'state' attribute for "
+ "Xen feature '%s'"),
+ nodes[i]->name);
+ goto error;
+ }
+
+ if ((value = virTristateSwitchTypeFromString(tmp)) < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("invalid value of state argument "
+ "for Xen feature '%s'"),
+ nodes[i]->name);
+ goto error;
+ }
+
+ VIR_FREE(tmp);
+ def->xen_features[feature] = value;
+ break;
+
+ /* coverity[dead_error_begin] */
+ case VIR_DOMAIN_XEN_LAST:
+ break;
+ }
+ }
+ VIR_FREE(nodes);
+ }
+
if (def->features[VIR_DOMAIN_FEATURE_SMM] == VIR_TRISTATE_SWITCH_ON) {
int rv = virDomainParseScaledValue("string(./features/smm/tseg)",
"string(./features/smm/tseg/@unit)",
@@ -23113,6 +23165,7 @@ virDomainDefFeaturesCheckABIStability(vi
case VIR_DOMAIN_FEATURE_PRIVNET:
case VIR_DOMAIN_FEATURE_HYPERV:
case VIR_DOMAIN_FEATURE_KVM:
+ case VIR_DOMAIN_FEATURE_XEN:
case VIR_DOMAIN_FEATURE_PVSPINLOCK:
case VIR_DOMAIN_FEATURE_PMU:
case VIR_DOMAIN_FEATURE_VMPORT:
@@ -23284,6 +23337,30 @@ virDomainDefFeaturesCheckABIStability(vi
}
}
+ /* xen */
+ if (src->features[VIR_DOMAIN_FEATURE_XEN] == VIR_TRISTATE_SWITCH_ON) {
+ for (i = 0; i < VIR_DOMAIN_XEN_LAST; i++) {
+ switch ((virDomainXen) i) {
+ case VIR_DOMAIN_XEN_E820_HOST:
+ if (src->xen_features[i] != dst->xen_features[i]) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("State of Xen feature '%s' differs: "
+ "source: '%s', destination: '%s'"),
+ virDomainXenTypeToString(i),
+ virTristateSwitchTypeToString(src->xen_features[i]),
+ virTristateSwitchTypeToString(dst->xen_features[i]));
+ return false;
+ }
+
+ break;
+
+ /* coverity[dead_error_begin] */
+ case VIR_DOMAIN_XEN_LAST:
+ break;
+ }
+ }
+ }
+
/* kvm */
if (src->features[VIR_DOMAIN_FEATURE_KVM] == VIR_TRISTATE_SWITCH_ON) {
for (i = 0; i < VIR_DOMAIN_KVM_LAST; i++) {
@@ -28885,6 +28962,31 @@ virDomainDefFormatFeatures(virBufferPtr
virBufferAddLit(&childBuf, "</kvm>\n");
break;
+ case VIR_DOMAIN_FEATURE_XEN:
+ if (def->features[i] != VIR_TRISTATE_SWITCH_ON)
+ break;
+
+ virBufferAddLit(&childBuf, "<xen>\n");
+ virBufferAdjustIndent(&childBuf, 2);
+ for (j = 0; j < VIR_DOMAIN_XEN_LAST; j++) {
+ switch ((virDomainXen) j) {
+ case VIR_DOMAIN_XEN_E820_HOST:
+ if (def->xen_features[j])
+ virBufferAsprintf(&childBuf, "<%s state='%s'/>\n",
+ virDomainXenTypeToString(j),
+ virTristateSwitchTypeToString(
+ def->xen_features[j]));
+ break;
+
+ /* coverity[dead_error_begin] */
+ case VIR_DOMAIN_XEN_LAST:
+ break;
+ }
+ }
+ virBufferAdjustIndent(&childBuf, -2);
+ virBufferAddLit(&childBuf, "</xen>\n");
+ break;
+
case VIR_DOMAIN_FEATURE_CAPABILITIES:
for (j = 0; j < VIR_DOMAIN_PROCES_CAPS_FEATURE_LAST; j++) {
if (def->caps_features[j] != VIR_TRISTATE_SWITCH_ABSENT)
Index: libvirt-6.2.0/src/conf/domain_conf.h
===================================================================
--- libvirt-6.2.0.orig/src/conf/domain_conf.h
+++ libvirt-6.2.0/src/conf/domain_conf.h
@@ -1800,6 +1800,7 @@ typedef enum {
VIR_DOMAIN_FEATURE_NESTED_HV,
VIR_DOMAIN_FEATURE_MSRS,
VIR_DOMAIN_FEATURE_CCF_ASSIST,
+ VIR_DOMAIN_FEATURE_XEN,
VIR_DOMAIN_FEATURE_LAST
} virDomainFeature;
@@ -1846,6 +1847,12 @@ typedef enum {
} virDomainMsrsUnknown;
typedef enum {
+ VIR_DOMAIN_XEN_E820_HOST = 0,
+
+ VIR_DOMAIN_XEN_LAST
+} virDomainXen;
+
+typedef enum {
VIR_DOMAIN_CAPABILITIES_POLICY_DEFAULT = 0,
VIR_DOMAIN_CAPABILITIES_POLICY_ALLOW,
VIR_DOMAIN_CAPABILITIES_POLICY_DENY,
@@ -2469,6 +2476,7 @@ struct _virDomainDef {
int hyperv_features[VIR_DOMAIN_HYPERV_LAST];
int kvm_features[VIR_DOMAIN_KVM_LAST];
int msrs_features[VIR_DOMAIN_MSRS_LAST];
+ int xen_features[VIR_DOMAIN_XEN_LAST];
unsigned int hyperv_spinlocks;
int hyperv_stimer_direct;
virGICVersion gic_version;
@@ -3514,6 +3522,7 @@ VIR_ENUM_DECL(virDomainGraphicsSpiceMous
VIR_ENUM_DECL(virDomainGraphicsVNCSharePolicy);
VIR_ENUM_DECL(virDomainHyperv);
VIR_ENUM_DECL(virDomainKVM);
+VIR_ENUM_DECL(virDomainXen);
VIR_ENUM_DECL(virDomainMsrsUnknown);
VIR_ENUM_DECL(virDomainRNGModel);
VIR_ENUM_DECL(virDomainRNGBackend);

View File

@ -0,0 +1,137 @@
commit bed325253681fa61537b01be821538479fa9df60
Author: Jim Fehlig <jfehlig@suse.com>
Date: Fri Apr 17 14:19:16 2020 -0600
tests: check conversion of passthrough hypervisor feature
Add a new test to check the 'mode' attribute of the passthrough element
and augment an existing, related test to check enablement of the
passthrough element only.
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Index: libvirt-6.2.0/tests/xlconfigdata/test-fullvirt-hypervisor-features.cfg
===================================================================
--- /dev/null
+++ libvirt-6.2.0/tests/xlconfigdata/test-fullvirt-hypervisor-features.cfg
@@ -0,0 +1,26 @@
+name = "XenGuest2"
+uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809"
+maxmem = 579
+memory = 394
+vcpus = 1
+pae = 1
+acpi = 1
+apic = 1
+viridian = 0
+passthrough = "share_pt"
+rtc_timeoffset = 0
+localtime = 0
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+device_model = "/usr/lib/xen/bin/qemu-system-i386"
+sdl = 0
+vnc = 1
+vncunused = 1
+vnclisten = "127.0.0.1"
+vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000" ]
+parallel = "none"
+serial = "none"
+builder = "hvm"
+boot = "c"
+disk = [ "format=raw,vdev=hda,access=rw,backendtype=phy,target=/dev/HostVG/XenGuest2" ]
Index: libvirt-6.2.0/tests/xlconfigdata/test-fullvirt-hypervisor-features.xml
===================================================================
--- /dev/null
+++ libvirt-6.2.0/tests/xlconfigdata/test-fullvirt-hypervisor-features.xml
@@ -0,0 +1,50 @@
+<domain type='xen'>
+ <name>XenGuest2</name>
+ <uuid>c7a5fdb2-cdaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>592896</memory>
+ <currentMemory unit='KiB'>403456</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='xenfv'>hvm</type>
+ <loader type='rom'>/usr/lib/xen/boot/hvmloader</loader>
+ <boot dev='hd'/>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ <pae/>
+ <xen>
+ <passthrough state='on' mode='share_pt'/>
+ </xen>
+ </features>
+ <clock offset='variable' adjustment='0' basis='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <emulator>/usr/lib/xen/bin/qemu-system-i386</emulator>
+ <disk type='block' device='disk'>
+ <driver name='phy' type='raw'/>
+ <source dev='/dev/HostVG/XenGuest2'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='xenbus' index='0'/>
+ <controller type='ide' index='0'/>
+ <interface type='bridge'>
+ <mac address='00:16:3e:66:92:9c'/>
+ <source bridge='xenbr1'/>
+ <script path='vif-bridge'/>
+ <model type='e1000'/>
+ </interface>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'>
+ <listen type='address' address='127.0.0.1'/>
+ </graphics>
+ <video>
+ <model type='cirrus' vram='8192' heads='1' primary='yes'/>
+ </video>
+ <memballoon model='xen'/>
+ </devices>
+</domain>
Index: libvirt-6.2.0/tests/xlconfigdata/test-paravirt-e820_host.cfg
===================================================================
--- libvirt-6.2.0.orig/tests/xlconfigdata/test-paravirt-e820_host.cfg
+++ libvirt-6.2.0/tests/xlconfigdata/test-paravirt-e820_host.cfg
@@ -4,6 +4,7 @@ maxmem = 512
memory = 512
vcpus = 4
e820_host = 1
+passthrough = "enabled"
localtime = 0
on_poweroff = "preserve"
on_reboot = "restart"
Index: libvirt-6.2.0/tests/xlconfigdata/test-paravirt-e820_host.xml
===================================================================
--- libvirt-6.2.0.orig/tests/xlconfigdata/test-paravirt-e820_host.xml
+++ libvirt-6.2.0/tests/xlconfigdata/test-paravirt-e820_host.xml
@@ -11,6 +11,7 @@
<features>
<xen>
<e820_host state='on'/>
+ <passthrough state='on'/>
</xen>
</features>
<clock offset='utc' adjustment='reset'/>
Index: libvirt-6.2.0/tests/xlconfigtest.c
===================================================================
--- libvirt-6.2.0.orig/tests/xlconfigtest.c
+++ libvirt-6.2.0/tests/xlconfigtest.c
@@ -301,6 +301,9 @@ mymain(void)
DO_TEST("usb");
DO_TEST("usbctrl");
DO_TEST("paravirt-e820_host");
+#ifdef LIBXL_HAVE_CREATEINFO_PASSTHROUGH
+ DO_TEST("fullvirt-hypervisor-features");
+#endif
testXLFreeDriver(driver);

View File

@ -0,0 +1,40 @@
commit f3ef7dafc8a60e6e21ac31cbbc019aa76a34e523
Author: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Date: Tue Apr 14 04:37:06 2020 +0200
xenconfig: parse e820_host option
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Index: libvirt-6.2.0/src/libxl/xen_common.c
===================================================================
--- libvirt-6.2.0.orig/src/libxl/xen_common.c
+++ libvirt-6.2.0/src/libxl/xen_common.c
@@ -592,6 +592,13 @@ xenParseCPUFeatures(virConfPtr conf,
def->clock.timers[def->clock.ntimers - 1] = timer;
}
+ } else {
+ if (xenConfigGetBool(conf, "e820_host", &val, 0) < 0) {
+ return -1;
+ } else if (val) {
+ def->features[VIR_DOMAIN_FEATURE_XEN] = VIR_TRISTATE_SWITCH_ON;
+ def->xen_features[VIR_DOMAIN_XEN_E820_HOST] = VIR_TRISTATE_SWITCH_ON;
+ }
}
return 0;
@@ -2138,6 +2145,12 @@ xenFormatCPUFeatures(virConfPtr conf, vi
(def->features[VIR_DOMAIN_FEATURE_VIRIDIAN] ==
VIR_TRISTATE_SWITCH_ON) ? 1 : 0) < 0)
return -1;
+ } else {
+ if (def->features[VIR_DOMAIN_FEATURE_XEN] == VIR_TRISTATE_SWITCH_ON) {
+ if (def->xen_features[VIR_DOMAIN_XEN_E820_HOST] == VIR_TRISTATE_SWITCH_ON)
+ if (xenConfigSetInt(conf, "e820_host", 1) < 0)
+ return -1;
+ }
}
for (i = 0; i < def->clock.ntimers; i++) {

View File

@ -0,0 +1,291 @@
commit fadbaa23757ff9dca329bdb8d3447c27599f6884
Author: Jim Fehlig <jfehlig@suse.com>
Date: Wed Apr 15 16:34:54 2020 -0600
conf: add xen hypervisor feature 'passthrough'
'passthrough' is Xen-Specific guest configuration option new to Xen 4.13
that enables IOMMU mappings for a guest and hence whether it supports PCI
passthrough. The default is disabled. See the xl.cfg(5) man page and
xen.git commit babde47a3fe for more details.
The default state of disabled prevents hotlugging PCI devices. However,
if the guest configuration contains a PCI passthrough device at time of
creation, libxl will automatically enable 'passthrough' and subsequent
hotplugging of PCI devices will also be possible. It is not possible to
unconditionally enable 'passthrough' since it would introduce a migration
incompatibility due to guest ABI change. Instead, introduce another Xen
hypervisor feature that can be used to enable guest PCI passthrough
<features>
<xen>
<passthrough state='on'/>
</xen>
</features>
To allow finer control over how IOMMU maps to guest P2M table, the
passthrough element also supports a 'mode' attribute with values
restricted to snyc_pt and share_pt, similar to xl.cfg(5) 'passthrough'
setting .
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Index: libvirt-6.2.0/docs/formatdomain.html.in
===================================================================
--- libvirt-6.2.0.orig/docs/formatdomain.html.in
+++ libvirt-6.2.0/docs/formatdomain.html.in
@@ -2057,6 +2057,7 @@
&lt;/kvm&gt;
&lt;xen&gt;
&lt;e820_host state='on'/&gt;
+ &lt;passthrough state='on' mode='share_pt'/&gt;
&lt;/xen&gt;
&lt;pvspinlock state='on'/&gt;
&lt;gic version='2'/&gt;
@@ -2254,6 +2255,12 @@
<td>on, off</td>
<td><span class="since">6.3.0</span></td>
</tr>
+ <tr>
+ <td>passthrough</td>
+ <td>Enable IOMMU mappings allowing PCI passthrough)</td>
+ <td>on, off; mode - optional string sync_pt or share_pt</td>
+ <td><span class="since">6.3.0</span></td>
+ </tr>
</table>
</dd>
<dt><code>pmu</code></dt>
Index: libvirt-6.2.0/docs/schemas/domaincommon.rng
===================================================================
--- libvirt-6.2.0.orig/docs/schemas/domaincommon.rng
+++ libvirt-6.2.0/docs/schemas/domaincommon.rng
@@ -6329,6 +6329,18 @@
<ref name="featurestate"/>
</element>
</optional>
+ <optional>
+ <element name="passthrough">
+ <ref name="featurestate"/>
+ <optional>
+ <attribute name="mode">
+ <data type="string">
+ <param name='pattern'>(sync_pt|share_pt)</param>
+ </data>
+ </attribute>
+ </optional>
+ </element>
+ </optional>
</interleave>
</element>
</define>
Index: libvirt-6.2.0/src/conf/domain_conf.c
===================================================================
--- libvirt-6.2.0.orig/src/conf/domain_conf.c
+++ libvirt-6.2.0/src/conf/domain_conf.c
@@ -210,7 +210,15 @@ VIR_ENUM_IMPL(virDomainKVM,
VIR_ENUM_IMPL(virDomainXen,
VIR_DOMAIN_XEN_LAST,
- "e820_host"
+ "e820_host",
+ "passthrough",
+);
+
+VIR_ENUM_IMPL(virDomainXenPassthroughMode,
+ VIR_DOMAIN_XEN_PASSTHROUGH_MODE_LAST,
+ "default",
+ "sync_pt",
+ "share_pt",
);
VIR_ENUM_IMPL(virDomainMsrsUnknown,
@@ -21130,6 +21138,8 @@ virDomainDefParseXML(xmlDocPtr xml,
if (def->features[VIR_DOMAIN_FEATURE_XEN] == VIR_TRISTATE_SWITCH_ON) {
int feature;
int value;
+ g_autofree char *ptval = NULL;
+
if ((n = virXPathNodeSet("./features/xen/*", ctxt, &nodes)) < 0)
goto error;
@@ -21142,27 +21152,53 @@ virDomainDefParseXML(xmlDocPtr xml,
goto error;
}
+ if (!(tmp = virXMLPropString(nodes[i], "state"))) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("missing 'state' attribute for "
+ "Xen feature '%s'"),
+ nodes[i]->name);
+ goto error;
+ }
+
+ if ((value = virTristateSwitchTypeFromString(tmp)) < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("invalid value of state argument "
+ "for Xen feature '%s'"),
+ nodes[i]->name);
+ goto error;
+ }
+
+ VIR_FREE(tmp);
+ def->xen_features[feature] = value;
+
switch ((virDomainXen) feature) {
case VIR_DOMAIN_XEN_E820_HOST:
- if (!(tmp = virXMLPropString(nodes[i], "state"))) {
- virReportError(VIR_ERR_XML_ERROR,
- _("missing 'state' attribute for "
- "Xen feature '%s'"),
- nodes[i]->name);
- goto error;
- }
+ break;
- if ((value = virTristateSwitchTypeFromString(tmp)) < 0) {
+ case VIR_DOMAIN_XEN_PASSTHROUGH:
+ if (value != VIR_TRISTATE_SWITCH_ON)
+ break;
+
+ if ((ptval = virXMLPropString(nodes[i], "mode"))) {
+ int mode = virDomainXenPassthroughModeTypeFromString(ptval);
+
+ if (mode < 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("invalid value of state argument "
- "for Xen feature '%s'"),
- nodes[i]->name);
+ _("unsupported mode '%s' for Xen passthrough feature"),
+ ptval);
goto error;
}
- VIR_FREE(tmp);
- def->xen_features[feature] = value;
- break;
+ if (mode != VIR_DOMAIN_XEN_PASSTHROUGH_MODE_SYNC_PT &&
+ mode != VIR_DOMAIN_XEN_PASSTHROUGH_MODE_SHARE_PT) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("'mode' attribute for Xen feature "
+ "'passthrough' must be 'sync_pt' or 'share_pt'"));
+ goto error;
+ }
+ def->xen_passthrough_mode = mode;
+ }
+ break;
/* coverity[dead_error_begin] */
case VIR_DOMAIN_XEN_LAST:
@@ -23340,18 +23376,28 @@ virDomainDefFeaturesCheckABIStability(vi
/* xen */
if (src->features[VIR_DOMAIN_FEATURE_XEN] == VIR_TRISTATE_SWITCH_ON) {
for (i = 0; i < VIR_DOMAIN_XEN_LAST; i++) {
+ if (src->xen_features[i] != dst->xen_features[i]) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("State of Xen feature '%s' differs: "
+ "source: '%s', destination: '%s'"),
+ virDomainXenTypeToString(i),
+ virTristateSwitchTypeToString(src->xen_features[i]),
+ virTristateSwitchTypeToString(dst->xen_features[i]));
+ return false;
+ }
switch ((virDomainXen) i) {
case VIR_DOMAIN_XEN_E820_HOST:
- if (src->xen_features[i] != dst->xen_features[i]) {
+ break;
+
+ case VIR_DOMAIN_XEN_PASSTHROUGH:
+ if (src->xen_passthrough_mode != dst->xen_passthrough_mode) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("State of Xen feature '%s' differs: "
+ _("'mode' of Xen passthrough feature differs: "
"source: '%s', destination: '%s'"),
- virDomainXenTypeToString(i),
- virTristateSwitchTypeToString(src->xen_features[i]),
- virTristateSwitchTypeToString(dst->xen_features[i]));
+ virDomainXenPassthroughModeTypeToString(src->xen_passthrough_mode),
+ virDomainXenPassthroughModeTypeToString(dst->xen_passthrough_mode));
return false;
}
-
break;
/* coverity[dead_error_begin] */
@@ -28969,13 +29015,30 @@ virDomainDefFormatFeatures(virBufferPtr
virBufferAddLit(&childBuf, "<xen>\n");
virBufferAdjustIndent(&childBuf, 2);
for (j = 0; j < VIR_DOMAIN_XEN_LAST; j++) {
+ if (def->xen_features[j] == VIR_TRISTATE_SWITCH_ABSENT)
+ continue;
+
+ virBufferAsprintf(&childBuf, "<%s state='%s'",
+ virDomainXenTypeToString(j),
+ virTristateSwitchTypeToString(
+ def->xen_features[j]));
+
switch ((virDomainXen) j) {
case VIR_DOMAIN_XEN_E820_HOST:
- if (def->xen_features[j])
- virBufferAsprintf(&childBuf, "<%s state='%s'/>\n",
- virDomainXenTypeToString(j),
- virTristateSwitchTypeToString(
- def->xen_features[j]));
+ virBufferAddLit(&childBuf, "/>\n");
+ break;
+ case VIR_DOMAIN_XEN_PASSTHROUGH:
+ if (def->xen_features[j] != VIR_TRISTATE_SWITCH_ON) {
+ virBufferAddLit(&childBuf, "/>\n");
+ break;
+ }
+ if (def->xen_passthrough_mode == VIR_DOMAIN_XEN_PASSTHROUGH_MODE_SYNC_PT ||
+ def->xen_passthrough_mode == VIR_DOMAIN_XEN_PASSTHROUGH_MODE_SHARE_PT) {
+ virBufferEscapeString(&childBuf, " mode='%s'/>\n",
+ virDomainXenPassthroughModeTypeToString(def->xen_passthrough_mode));
+ } else {
+ virBufferAddLit(&childBuf, "/>\n");
+ }
break;
/* coverity[dead_error_begin] */
Index: libvirt-6.2.0/src/conf/domain_conf.h
===================================================================
--- libvirt-6.2.0.orig/src/conf/domain_conf.h
+++ libvirt-6.2.0/src/conf/domain_conf.h
@@ -1848,11 +1848,20 @@ typedef enum {
typedef enum {
VIR_DOMAIN_XEN_E820_HOST = 0,
+ VIR_DOMAIN_XEN_PASSTHROUGH,
VIR_DOMAIN_XEN_LAST
} virDomainXen;
typedef enum {
+ VIR_DOMAIN_XEN_PASSTHROUGH_MODE_DEFAULT = 0,
+ VIR_DOMAIN_XEN_PASSTHROUGH_MODE_SYNC_PT,
+ VIR_DOMAIN_XEN_PASSTHROUGH_MODE_SHARE_PT,
+
+ VIR_DOMAIN_XEN_PASSTHROUGH_MODE_LAST
+} virDomainXenPassthroughMode;
+
+typedef enum {
VIR_DOMAIN_CAPABILITIES_POLICY_DEFAULT = 0,
VIR_DOMAIN_CAPABILITIES_POLICY_ALLOW,
VIR_DOMAIN_CAPABILITIES_POLICY_DENY,
@@ -2477,6 +2486,7 @@ struct _virDomainDef {
int kvm_features[VIR_DOMAIN_KVM_LAST];
int msrs_features[VIR_DOMAIN_MSRS_LAST];
int xen_features[VIR_DOMAIN_XEN_LAST];
+ int xen_passthrough_mode;
unsigned int hyperv_spinlocks;
int hyperv_stimer_direct;
virGICVersion gic_version;
@@ -3523,6 +3533,7 @@ VIR_ENUM_DECL(virDomainGraphicsVNCShareP
VIR_ENUM_DECL(virDomainHyperv);
VIR_ENUM_DECL(virDomainKVM);
VIR_ENUM_DECL(virDomainXen);
+VIR_ENUM_DECL(virDomainXenPassthroughMode);
VIR_ENUM_DECL(virDomainMsrsUnknown);
VIR_ENUM_DECL(virDomainRNGModel);
VIR_ENUM_DECL(virDomainRNGBackend);

View File

@ -1,3 +1,18 @@
-------------------------------------------------------------------
Tue Apr 21 17:45:36 UTC 2020 - James Fehlig <jfehlig@suse.com>
- libxl: Add support for 'passthrough' and 'e820_host' settings
b7d6648d-conf-add-e820-host.patch,
5749395b-libxl-e820-host.patch,
f3ef7daf-xenconfig-e820-host.patch,
34077c1b-tests-check-e820-host.patch,
fadbaa23-conf-add-passthrough.patch,
9529e007-libxl-passthrough.patch,
9cb8bc6f-xenconfig-refactor-features.patch,
b523e225-xenconfig-passthrough.patch,
bed32525-tests-check-passthrough.patch
bsc#1167217
-------------------------------------------------------------------
Fri Apr 17 05:19:57 UTC 2020 - Lin Ma <lma@suse.com>

View File

@ -343,6 +343,15 @@ Patch1: 8e669b38-conf-add-event-channels.patch
Patch2: a93f55c5-libxl-add-event-channels.patch
Patch3: 967f4eeb-xenconfig-event-channels.patch
Patch4: 93b15ba0-qemu-fix-hang-in-p2p-xbzrle-compression-parallel-mig.patch
Patch5: b7d6648d-conf-add-e820-host.patch
Patch6: 5749395b-libxl-e820-host.patch
Patch7: f3ef7daf-xenconfig-e820-host.patch
Patch8: 34077c1b-tests-check-e820-host.patch
Patch9: fadbaa23-conf-add-passthrough.patch
Patch10: 9529e007-libxl-passthrough.patch
Patch11: 9cb8bc6f-xenconfig-refactor-features.patch
Patch12: b523e225-xenconfig-passthrough.patch
Patch13: bed32525-tests-check-passthrough.patch
# Patches pending upstream review
Patch100: libxl-dom-reset.patch
Patch101: network-don-t-use-dhcp-authoritative-on-static-netwo.patch
@ -883,6 +892,15 @@ libvirt plugin for NSS for translating domain names into IP addresses.
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch100 -p1
%patch101 -p1
%patch150 -p1

View File

@ -7,7 +7,7 @@ Index: libvirt-6.2.0/src/libxl/libxl_conf.c
===================================================================
--- libvirt-6.2.0.orig/src/libxl/libxl_conf.c
+++ libvirt-6.2.0/src/libxl/libxl_conf.c
@@ -870,6 +870,30 @@ libxlDiskSetDiscard(libxl_device_disk *x
@@ -905,6 +905,30 @@ libxlDiskSetDiscard(libxl_device_disk *x
#endif
}
@ -38,7 +38,7 @@ Index: libvirt-6.2.0/src/libxl/libxl_conf.c
static char *
libxlMakeNetworkDiskSrcStr(virStorageSourcePtr src,
const char *username,
@@ -1111,6 +1135,7 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk
@@ -1146,6 +1170,7 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk
x_disk->is_cdrom = l_disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM ? 1 : 0;
if (libxlDiskSetDiscard(x_disk, l_disk->discard) < 0)
return -1;

View File

@ -11,7 +11,7 @@ Index: libvirt-6.2.0/src/libxl/libxl_conf.c
===================================================================
--- libvirt-6.2.0.orig/src/libxl/libxl_conf.c
+++ libvirt-6.2.0/src/libxl/libxl_conf.c
@@ -870,6 +870,22 @@ libxlDiskSetDiscard(libxl_device_disk *x
@@ -905,6 +905,22 @@ libxlDiskSetDiscard(libxl_device_disk *x
#endif
}
@ -34,7 +34,7 @@ Index: libvirt-6.2.0/src/libxl/libxl_conf.c
static void
libxlDiskSetCacheMode(libxl_device_disk *x_disk, int cachemode)
{
@@ -1010,6 +1026,7 @@ libxlMakeNetworkDiskSrc(virStorageSource
@@ -1045,6 +1061,7 @@ libxlMakeNetworkDiskSrc(virStorageSource
int
libxlMakeDisk(virDomainDiskDefPtr l_disk, libxl_device_disk *x_disk)
{
@ -42,7 +42,7 @@ Index: libvirt-6.2.0/src/libxl/libxl_conf.c
const char *driver = virDomainDiskGetDriver(l_disk);
int format = virDomainDiskGetFormat(l_disk);
int actual_type = virStorageSourceGetActualType(l_disk->src);
@@ -1025,7 +1042,7 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk
@@ -1060,7 +1077,7 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk
if (libxlMakeNetworkDiskSrc(l_disk->src, &x_disk->pdev_path) < 0)
return -1;
} else {
@ -51,7 +51,7 @@ Index: libvirt-6.2.0/src/libxl/libxl_conf.c
}
x_disk->vdev = g_strdup(l_disk->dst);
@@ -1136,6 +1153,9 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk
@@ -1171,6 +1188,9 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk
if (libxlDiskSetDiscard(x_disk, l_disk->discard) < 0)
return -1;
libxlDiskSetCacheMode(x_disk, l_disk->cachemode);

View File

@ -31,7 +31,7 @@ Index: libvirt-6.2.0/src/libxl/libxl_conf.c
===================================================================
--- libvirt-6.2.0.orig/src/libxl/libxl_conf.c
+++ libvirt-6.2.0/src/libxl/libxl_conf.c
@@ -1788,7 +1788,7 @@ libxlDriverConfigNew(void)
@@ -1823,7 +1823,7 @@ libxlDriverConfigNew(void)
int
libxlDriverConfigInit(libxlDriverConfigPtr cfg)
{

View File

@ -31,7 +31,7 @@ Index: libvirt-6.2.0/src/libxl/libxl_conf.c
===================================================================
--- libvirt-6.2.0.orig/src/libxl/libxl_conf.c
+++ libvirt-6.2.0/src/libxl/libxl_conf.c
@@ -1702,15 +1702,12 @@ libxlMakeBuildInfoVfb(virPortAllocatorRa
@@ -1737,15 +1737,12 @@ libxlMakeBuildInfoVfb(virPortAllocatorRa
/*
* Get domain0 autoballoon configuration. Honor user-specified
* setting in libxl.conf first. If not specified, autoballooning
@ -48,7 +48,7 @@ Index: libvirt-6.2.0/src/libxl/libxl_conf.c
int res;
res = virConfGetValueBool(conf, "autoballoon", &cfg->autoballoon);
@@ -1719,15 +1716,8 @@ libxlGetAutoballoonConf(libxlDriverConfi
@@ -1754,15 +1751,8 @@ libxlGetAutoballoonConf(libxlDriverConfi
else if (res == 1)
return 0;

View File

@ -9,7 +9,7 @@ Index: libvirt-6.2.0/src/libxl/libxl_conf.c
===================================================================
--- libvirt-6.2.0.orig/src/libxl/libxl_conf.c
+++ libvirt-6.2.0/src/libxl/libxl_conf.c
@@ -1742,6 +1742,15 @@ libxlDriverConfigNew(void)
@@ -1777,6 +1777,15 @@ libxlDriverConfigNew(void)
cfg->autoDumpDir = g_strdup(LIBXL_DUMP_DIR);
cfg->channelDir = g_strdup(LIBXL_CHANNEL_DIR);