diff --git a/0001-Extract-stats-functions-from-the-qemu-driver.patch b/0001-Extract-stats-functions-from-the-qemu-driver.patch index e53fe1b..2ec9662 100644 --- a/0001-Extract-stats-functions-from-the-qemu-driver.patch +++ b/0001-Extract-stats-functions-from-the-qemu-driver.patch @@ -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; diff --git a/34077c1b-tests-check-e820-host.patch b/34077c1b-tests-check-e820-host.patch new file mode 100644 index 0000000..1792a0d --- /dev/null +++ b/34077c1b-tests-check-e820-host.patch @@ -0,0 +1,81 @@ +commit 34077c1b8b62bb61e76b908d0959216da0b3185f +Author: Marek Marczykowski-Górecki +Date: Tue Apr 14 04:37:07 2020 +0200 + + tests: check e820_host option handling + + Signed-off-by: Marek Marczykowski-Górecki + Reviewed-by: Jim Fehlig + +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 @@ ++ ++ XenGuest1 ++ 45b60f51-88a9-47a8-a3b3-5e66d71b2283 ++ 524288 ++ 524288 ++ 4 ++ /usr/bin/pygrub ++ ++ linux ++ ++ ++ ++ ++ ++ ++ ++ preserve ++ restart ++ preserve ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +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); + diff --git a/5749395b-libxl-e820-host.patch b/5749395b-libxl-e820-host.patch new file mode 100644 index 0000000..17e7b6f --- /dev/null +++ b/5749395b-libxl-e820-host.patch @@ -0,0 +1,34 @@ +commit 5749395bfd03fcdb55a8be6a69637a2acaaad2c9 +Author: Marek Marczykowski-Górecki +Date: Tue Apr 14 04:37:05 2020 +0200 + + libxl: make use of e820_host feature + + Signed-off-by: Marek Marczykowski-Górecki + Reviewed-by: Jim Fehlig + +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 */ diff --git a/93b15ba0-qemu-fix-hang-in-p2p-xbzrle-compression-parallel-mig.patch b/93b15ba0-qemu-fix-hang-in-p2p-xbzrle-compression-parallel-mig.patch new file mode 100644 index 0000000..fa9523a --- /dev/null +++ b/93b15ba0-qemu-fix-hang-in-p2p-xbzrle-compression-parallel-mig.patch @@ -0,0 +1,40 @@ +commit 93b15ba0f2eb7858f8d88a5fd7354bd48bb7fc8d +Author: Lin Ma +Date: Thu Apr 16 12:44:51 2020 +0800 + + qemu: fix hang in p2p + xbzrle compression + parallel migration + + When we do parallel migration, The multifd-channels migration parameter + needs to be set on the destination side as well before incoming migration + URI, unless we accept the default number of connections(2). + + Usually, This can be correctly handled by libvirtd. But in this case if + we use p2p + xbzrle compression without parameter '--comp-xbzrle-cache', + qemuMigrationParamsDump returns too early, The corresponding migration + parameter will not be set on the destination side, It results QEMU hangs. + + Reproducer: + virsh migrate --live --p2p --comp-methods xbzrle \ + --parallel --parallel-connections 3 GUEST qemu+ssh://dsthost/system + + or + + virsh migrate --live --p2p --compressed \ + --parallel --parallel-connections 3 GUEST qemu+ssh://dsthost/system + + Signed-off-by: Lin Ma + Message-Id: <20200416044451.21134-1-lma@suse.com> + Reviewed-by: Jiri Denemark + +Index: libvirt-6.0.0/src/qemu/qemu_migration_params.c +=================================================================== +--- libvirt-6.0.0.orig/src/qemu/qemu_migration_params.c ++++ libvirt-6.0.0/src/qemu/qemu_migration_params.c +@@ -630,7 +630,6 @@ qemuMigrationParamsDump(qemuMigrationPar + if (migParams->compMethods == 1ULL << QEMU_MIGRATION_COMPRESS_XBZRLE && + !migParams->params[QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE].set) { + *flags |= VIR_MIGRATE_COMPRESSED; +- return 0; + } + + for (i = 0; i < QEMU_MIGRATION_COMPRESS_LAST; ++i) { diff --git a/9529e007-libxl-passthrough.patch b/9529e007-libxl-passthrough.patch new file mode 100644 index 0000000..5fb9a2c --- /dev/null +++ b/9529e007-libxl-passthrough.patch @@ -0,0 +1,41 @@ +commit 9529e0077a3f9002d6bc7f5504ca4583e5d985f1 +Author: Jim Fehlig +Date: Wed Apr 15 17:18:25 2020 -0600 + + libxl: make use of passthrough hypervisor feature + + Signed-off-by: Jim Fehlig + Reviewed-by: Michal Privoznik + +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 && diff --git a/9cb8bc6f-xenconfig-refactor-features.patch b/9cb8bc6f-xenconfig-refactor-features.patch new file mode 100644 index 0000000..7947ebc --- /dev/null +++ b/9cb8bc6f-xenconfig-refactor-features.patch @@ -0,0 +1,112 @@ +commit 9cb8bc6ff1ad80aba4d3c68756166a22e830d481 +Author: Jim Fehlig +Date: Wed Apr 15 21:48:42 2020 -0600 + + libxl: refactor cpu and hypervisor feature parser/formatter + + Signed-off-by: Jim Fehlig + Reviewed-by: Michal Privoznik + +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) diff --git a/b523e225-xenconfig-passthrough.patch b/b523e225-xenconfig-passthrough.patch new file mode 100644 index 0000000..3aca323 --- /dev/null +++ b/b523e225-xenconfig-passthrough.patch @@ -0,0 +1,112 @@ +commit b523e22521afe733165869c9e1ae18e88536acd6 +Author: Jim Fehlig +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 + Reviewed-by: Michal Privoznik + +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: diff --git a/b7d6648d-conf-add-e820-host.patch b/b7d6648d-conf-add-e820-host.patch new file mode 100644 index 0000000..0dc94e4 --- /dev/null +++ b/b7d6648d-conf-add-e820-host.patch @@ -0,0 +1,292 @@ +commit b7d6648d436fe0a99d4faf0f99c88a27a7bfea33 +Author: Marek Marczykowski-Górecki +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. + + + + + + + + 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 + Reviewed-by: Jim Fehlig + +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 @@ + <hidden state='on'/> + <hint-dedicated state='on'/> + </kvm> ++ <xen> ++ <e820_host state='on'/> ++ </xen> + <pvspinlock state='on'/> + <gic version='2'/> + <ioapic driver='qemu'/> +@@ -2236,6 +2239,23 @@ + + + ++
xen
++
Various features to change the behavior of the Xen hypervisor. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++
FeatureDescriptionValueSince
e820_hostExpose the host e820 to the guest (PV only)on, off6.3.0
++
+
pmu
+
Depending on the state attribute (values on, + off, default on) 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 @@ + + + ++ ++ ++ + + + +@@ -6313,6 +6316,19 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + +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, "\n"); + break; + ++ case VIR_DOMAIN_FEATURE_XEN: ++ if (def->features[i] != VIR_TRISTATE_SWITCH_ON) ++ break; ++ ++ virBufferAddLit(&childBuf, "\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, "\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); diff --git a/bed32525-tests-check-passthrough.patch b/bed32525-tests-check-passthrough.patch new file mode 100644 index 0000000..fa4c887 --- /dev/null +++ b/bed32525-tests-check-passthrough.patch @@ -0,0 +1,137 @@ +commit bed325253681fa61537b01be821538479fa9df60 +Author: Jim Fehlig +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 + Reviewed-by: Michal Privoznik + +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 @@ ++ ++ XenGuest2 ++ c7a5fdb2-cdaf-9455-926a-d65c16db1809 ++ 592896 ++ 403456 ++ 1 ++ ++ hvm ++ /usr/lib/xen/boot/hvmloader ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ destroy ++ restart ++ restart ++ ++ /usr/lib/xen/bin/qemu-system-i386 ++ ++ ++ ++ ++
++ ++ ++ ++ ++ ++ ++