commit libvirt for openSUSE:Leap:15.2
Hello community, here is the log from the commit of package libvirt for openSUSE:Leap:15.2 checked in at 2020-04-30 18:51:23 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Leap:15.2/libvirt (Old) and /work/SRC/openSUSE:Leap:15.2/.libvirt.new.2738 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "libvirt" Thu Apr 30 18:51:23 2020 rev:115 rq:799258 version:6.0.0 Changes: -------- --- /work/SRC/openSUSE:Leap:15.2/libvirt/libvirt.changes 2020-04-20 12:55:28.716727535 +0200 +++ /work/SRC/openSUSE:Leap:15.2/.libvirt.new.2738/libvirt.changes 2020-04-30 18:51:29.684605088 +0200 @@ -1,0 +2,23 @@ +Wed Apr 29 17:03:01 UTC 2020 - James Fehlig <jfehlig@suse.com> + +- qemu: Fix memory leak in qemuDomainGetStatsIOThread + CVE-2020-12430 + 9bf9e0ae-CVE-2020-12430.patch + bsc#1170765 + +------------------------------------------------------------------- +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 + +------------------------------------------------------------------- New: ---- 34077c1b-tests-check-e820-host.patch 5749395b-libxl-e820-host.patch 9529e007-libxl-passthrough.patch 9bf9e0ae-CVE-2020-12430.patch 9cb8bc6f-xenconfig-refactor-features.patch b523e225-xenconfig-passthrough.patch b7d6648d-conf-add-e820-host.patch bed32525-tests-check-passthrough.patch f3ef7daf-xenconfig-e820-host.patch fadbaa23-conf-add-passthrough.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libvirt.spec ++++++ --- /var/tmp/diff_new_pack.b9zLHq/_old 2020-04-30 18:51:30.876607628 +0200 +++ /var/tmp/diff_new_pack.b9zLHq/_new 2020-04-30 18:51:30.876607628 +0200 @@ -350,6 +350,16 @@ Patch9: 967f4eeb-xenconfig-event-channels.patch Patch10: 4cc90c2e-CVE-2020-10701.patch Patch11: 93b15ba0-qemu-fix-hang-in-p2p-xbzrle-compression-parallel-mig.patch +Patch12: b7d6648d-conf-add-e820-host.patch +Patch13: 5749395b-libxl-e820-host.patch +Patch14: f3ef7daf-xenconfig-e820-host.patch +Patch15: 34077c1b-tests-check-e820-host.patch +Patch16: fadbaa23-conf-add-passthrough.patch +Patch17: 9529e007-libxl-passthrough.patch +Patch18: 9cb8bc6f-xenconfig-refactor-features.patch +Patch19: b523e225-xenconfig-passthrough.patch +Patch20: bed32525-tests-check-passthrough.patch +Patch21: 9bf9e0ae-CVE-2020-12430.patch # Patches pending upstream review Patch100: libxl-dom-reset.patch Patch101: network-don-t-use-dhcp-authoritative-on-static-netwo.patch @@ -896,6 +906,16 @@ %patch9 -p1 %patch10 -p1 %patch11 -p1 +%patch12 -p1 +%patch13 -p1 +%patch14 -p1 +%patch15 -p1 +%patch16 -p1 +%patch17 -p1 +%patch18 -p1 +%patch19 -p1 +%patch20 -p1 +%patch21 -p1 %patch100 -p1 %patch101 -p1 %patch150 -p1 ++++++ 0001-Extract-stats-functions-from-the-qemu-driver.patch ++++++ --- /var/tmp/diff_new_pack.b9zLHq/_old 2020-04-30 18:51:30.920607722 +0200 +++ /var/tmp/diff_new_pack.b9zLHq/_new 2020-04-30 18:51:30.920607722 +0200 @@ -213,7 +213,7 @@ =================================================================== --- libvirt-6.0.0.orig/src/libvirt_private.syms +++ libvirt-6.0.0/src/libvirt_private.syms -@@ -714,6 +714,9 @@ virDomainConfNWFilterInstantiate; +@@ -716,6 +716,9 @@ virDomainConfNWFilterInstantiate; virDomainConfNWFilterTeardown; virDomainConfVMNWFilterTeardown; @@ -223,7 +223,7 @@ # conf/interface_conf.h virInterfaceDefFormat; -@@ -1691,6 +1694,7 @@ virCgroupGetMemoryUsage; +@@ -1693,6 +1696,7 @@ virCgroupGetMemoryUsage; virCgroupGetMemSwapHardLimit; virCgroupGetMemSwapUsage; virCgroupGetPercpuStats; ++++++ 34077c1b-tests-check-e820-host.patch ++++++ 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.0.0/tests/xlconfigdata/test-paravirt-e820_host.cfg =================================================================== --- /dev/null +++ libvirt-6.0.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.0.0/tests/xlconfigdata/test-paravirt-e820_host.xml =================================================================== --- /dev/null +++ libvirt-6.0.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.0.0/tests/xlconfigtest.c =================================================================== --- libvirt-6.0.0.orig/tests/xlconfigtest.c +++ libvirt-6.0.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); ++++++ 5749395b-libxl-e820-host.patch ++++++ 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.0.0/src/libxl/libxl_conf.c =================================================================== --- libvirt-6.0.0.orig/src/libxl/libxl_conf.c +++ libvirt-6.0.0/src/libxl/libxl_conf.c @@ -693,6 +693,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 */ ++++++ 9529e007-libxl-passthrough.patch ++++++ 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.0.0/src/libxl/libxl_conf.c =================================================================== --- libvirt-6.0.0.orig/src/libxl/libxl_conf.c +++ libvirt-6.0.0/src/libxl/libxl_conf.c @@ -160,6 +160,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 && ++++++ 9bf9e0ae-CVE-2020-12430.patch ++++++ commit 9bf9e0ae6af38c806f4672ca7b12a6b38d5a9581 Author: Peter Krempa <pkrempa@redhat.com> Date: Wed Feb 19 08:40:59 2020 +0100 qemuDomainGetStatsIOThread: Don't leak array with 0 iothreads qemuMonitorGetIOThreads returns a NULL-terminated list even when 0 iothreads are present. The caller didn't perform cleanup if there were 0 iothreads leaking the array. https://bugzilla.redhat.com/show_bug.cgi?id=1804548 Fixes: d1eac92784573559b6fd56836e33b215c89308e3 Reported-by: Jing Yan <jiyan@redhat.com> Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Index: libvirt-6.0.0/src/qemu/qemu_driver.c =================================================================== --- libvirt-6.0.0.orig/src/qemu/qemu_driver.c +++ libvirt-6.0.0/src/qemu/qemu_driver.c @@ -21511,8 +21511,12 @@ qemuDomainGetStatsIOThread(virQEMUDriver if ((niothreads = qemuDomainGetIOThreadsMon(driver, dom, &iothreads)) < 0) return -1; - if (niothreads == 0) - return 0; + /* qemuDomainGetIOThreadsMon returns a NULL-terminated list, so we must free + * it even if it returns 0 */ + if (niothreads == 0) { + ret = 0; + goto cleanup; + } if (virTypedParamListAddUInt(params, niothreads, "iothread.count") < 0) goto cleanup; ++++++ 9cb8bc6f-xenconfig-refactor-features.patch ++++++ 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.0.0/src/libxl/xen_common.c =================================================================== --- libvirt-6.0.0.orig/src/libxl/xen_common.c +++ libvirt-6.0.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); @@ -2422,7 +2432,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) ++++++ b523e225-xenconfig-passthrough.patch ++++++ 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.0.0/src/libvirt_private.syms =================================================================== --- libvirt-6.0.0.orig/src/libvirt_private.syms +++ libvirt-6.0.0/src/libvirt_private.syms @@ -642,6 +642,8 @@ virDomainWatchdogActionTypeToString; virDomainWatchdogDefFree; virDomainWatchdogModelTypeFromString; virDomainWatchdogModelTypeToString; +virDomainXenPassthroughModeTypeFromString; +virDomainXenPassthroughModeTypeToString; virDomainXMLOptionGetNamespace; virDomainXMLOptionGetSaveCookie; virDomainXMLOptionNew; Index: libvirt-6.0.0/src/libxl/xen_common.c =================================================================== --- libvirt-6.0.0.orig/src/libxl/xen_common.c +++ libvirt-6.0.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: ++++++ b7d6648d-conf-add-e820-host.patch ++++++ 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.0.0/docs/formatdomain.html.in =================================================================== --- libvirt-6.0.0.orig/docs/formatdomain.html.in +++ libvirt-6.0.0/docs/formatdomain.html.in @@ -2053,6 +2053,9 @@ <hidden state='on'/> <hint-dedicated state='on'/> </kvm> + <xen> + <e820_host state='on'/> + </xen> <pvspinlock state='on'/> <gic version='2'/> <ioapic driver='qemu'/> @@ -2234,6 +2237,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.0.0/docs/schemas/domaincommon.rng =================================================================== --- libvirt-6.0.0.orig/docs/schemas/domaincommon.rng +++ libvirt-6.0.0/docs/schemas/domaincommon.rng @@ -5106,6 +5106,9 @@ <ref name="kvm"/> </optional> <optional> + <ref name="xen"/> + </optional> + <optional> <element name="privnet"> <empty/> </element> @@ -6074,6 +6077,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.0.0/src/conf/domain_conf.c =================================================================== --- libvirt-6.0.0.orig/src/conf/domain_conf.c +++ libvirt-6.0.0/src/conf/domain_conf.c @@ -172,6 +172,7 @@ VIR_ENUM_IMPL(virDomainFeature, "nested-hv", "msrs", "ccf-assist", + "xen", ); VIR_ENUM_IMPL(virDomainCapabilitiesPolicy, @@ -205,6 +206,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", @@ -20349,6 +20355,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; @@ -20659,6 +20666,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)", @@ -22651,6 +22703,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: @@ -22822,6 +22875,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++) { @@ -28304,6 +28381,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.0.0/src/conf/domain_conf.h =================================================================== --- libvirt-6.0.0.orig/src/conf/domain_conf.h +++ libvirt-6.0.0/src/conf/domain_conf.h @@ -1765,6 +1765,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; @@ -1811,6 +1812,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, @@ -2429,6 +2436,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; @@ -3467,6 +3475,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); ++++++ bed32525-tests-check-passthrough.patch ++++++ 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.0.0/tests/xlconfigdata/test-fullvirt-hypervisor-features.cfg =================================================================== --- /dev/null +++ libvirt-6.0.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.0.0/tests/xlconfigdata/test-fullvirt-hypervisor-features.xml =================================================================== --- /dev/null +++ libvirt-6.0.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.0.0/tests/xlconfigdata/test-paravirt-e820_host.cfg =================================================================== --- libvirt-6.0.0.orig/tests/xlconfigdata/test-paravirt-e820_host.cfg +++ libvirt-6.0.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.0.0/tests/xlconfigdata/test-paravirt-e820_host.xml =================================================================== --- libvirt-6.0.0.orig/tests/xlconfigdata/test-paravirt-e820_host.xml +++ libvirt-6.0.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.0.0/tests/xlconfigtest.c =================================================================== --- libvirt-6.0.0.orig/tests/xlconfigtest.c +++ libvirt-6.0.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); ++++++ f3ef7daf-xenconfig-e820-host.patch ++++++ 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.0.0/src/libxl/xen_common.c =================================================================== --- libvirt-6.0.0.orig/src/libxl/xen_common.c +++ libvirt-6.0.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++) { ++++++ fadbaa23-conf-add-passthrough.patch ++++++ 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.0.0/docs/formatdomain.html.in =================================================================== --- libvirt-6.0.0.orig/docs/formatdomain.html.in +++ libvirt-6.0.0/docs/formatdomain.html.in @@ -2055,6 +2055,7 @@ </kvm> <xen> <e820_host state='on'/> + <passthrough state='on' mode='share_pt'/> </xen> <pvspinlock state='on'/> <gic version='2'/> @@ -2252,6 +2253,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.0.0/docs/schemas/domaincommon.rng =================================================================== --- libvirt-6.0.0.orig/docs/schemas/domaincommon.rng +++ libvirt-6.0.0/docs/schemas/domaincommon.rng @@ -6090,6 +6090,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.0.0/src/conf/domain_conf.c =================================================================== --- libvirt-6.0.0.orig/src/conf/domain_conf.c +++ libvirt-6.0.0/src/conf/domain_conf.c @@ -208,7 +208,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, @@ -20669,6 +20677,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; @@ -20681,27 +20691,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: @@ -22878,18 +22914,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] */ @@ -28388,13 +28434,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.0.0/src/conf/domain_conf.h =================================================================== --- libvirt-6.0.0.orig/src/conf/domain_conf.h +++ libvirt-6.0.0/src/conf/domain_conf.h @@ -1813,11 +1813,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, @@ -2437,6 +2446,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; @@ -3476,6 +3486,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); ++++++ libxl-set-cach-mode.patch ++++++ --- /var/tmp/diff_new_pack.b9zLHq/_old 2020-04-30 18:51:31.108608122 +0200 +++ /var/tmp/diff_new_pack.b9zLHq/_new 2020-04-30 18:51:31.108608122 +0200 @@ -7,7 +7,7 @@ =================================================================== --- libvirt-6.0.0.orig/src/libxl/libxl_conf.c +++ libvirt-6.0.0/src/libxl/libxl_conf.c -@@ -871,6 +871,30 @@ libxlDiskSetDiscard(libxl_device_disk *x +@@ -906,6 +906,30 @@ libxlDiskSetDiscard(libxl_device_disk *x #endif } @@ -38,7 +38,7 @@ static char * libxlMakeNetworkDiskSrcStr(virStorageSourcePtr src, const char *username, -@@ -1112,6 +1136,7 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk +@@ -1147,6 +1171,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; ++++++ libxl-support-block-script.patch ++++++ --- /var/tmp/diff_new_pack.b9zLHq/_old 2020-04-30 18:51:31.120608148 +0200 +++ /var/tmp/diff_new_pack.b9zLHq/_new 2020-04-30 18:51:31.124608156 +0200 @@ -11,7 +11,7 @@ =================================================================== --- libvirt-6.0.0.orig/src/libxl/libxl_conf.c +++ libvirt-6.0.0/src/libxl/libxl_conf.c -@@ -871,6 +871,22 @@ libxlDiskSetDiscard(libxl_device_disk *x +@@ -906,6 +906,22 @@ libxlDiskSetDiscard(libxl_device_disk *x #endif } @@ -34,7 +34,7 @@ static void libxlDiskSetCacheMode(libxl_device_disk *x_disk, int cachemode) { -@@ -1011,6 +1027,7 @@ libxlMakeNetworkDiskSrc(virStorageSource +@@ -1046,6 +1062,7 @@ libxlMakeNetworkDiskSrc(virStorageSource int libxlMakeDisk(virDomainDiskDefPtr l_disk, libxl_device_disk *x_disk) { @@ -42,7 +42,7 @@ const char *driver = virDomainDiskGetDriver(l_disk); int format = virDomainDiskGetFormat(l_disk); int actual_type = virStorageSourceGetActualType(l_disk->src); -@@ -1026,7 +1043,7 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk +@@ -1061,7 +1078,7 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk if (libxlMakeNetworkDiskSrc(l_disk->src, &x_disk->pdev_path) < 0) return -1; } else { @@ -51,7 +51,7 @@ } x_disk->vdev = g_strdup(l_disk->dst); -@@ -1137,6 +1154,9 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk +@@ -1172,6 +1189,9 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk if (libxlDiskSetDiscard(x_disk, l_disk->discard) < 0) return -1; libxlDiskSetCacheMode(x_disk, l_disk->cachemode); ++++++ suse-bump-xen-version.patch ++++++ --- /var/tmp/diff_new_pack.b9zLHq/_old 2020-04-30 18:51:31.144608199 +0200 +++ /var/tmp/diff_new_pack.b9zLHq/_new 2020-04-30 18:51:31.144608199 +0200 @@ -31,7 +31,7 @@ =================================================================== --- libvirt-6.0.0.orig/src/libxl/libxl_conf.c +++ libvirt-6.0.0/src/libxl/libxl_conf.c -@@ -1727,7 +1727,7 @@ libxlDriverConfigNew(void) +@@ -1762,7 +1762,7 @@ libxlDriverConfigNew(void) { libxlDriverConfigPtr cfg; char ebuf[1024]; ++++++ suse-libxl-disable-autoballoon.patch ++++++ --- /var/tmp/diff_new_pack.b9zLHq/_old 2020-04-30 18:51:31.160608233 +0200 +++ /var/tmp/diff_new_pack.b9zLHq/_new 2020-04-30 18:51:31.160608233 +0200 @@ -31,7 +31,7 @@ =================================================================== --- libvirt-6.0.0.orig/src/libxl/libxl_conf.c +++ libvirt-6.0.0/src/libxl/libxl_conf.c -@@ -1703,15 +1703,12 @@ libxlMakeBuildInfoVfb(virPortAllocatorRa +@@ -1738,15 +1738,12 @@ libxlMakeBuildInfoVfb(virPortAllocatorRa /* * Get domain0 autoballoon configuration. Honor user-specified * setting in libxl.conf first. If not specified, autoballooning @@ -48,7 +48,7 @@ int res; res = virConfGetValueBool(conf, "autoballoon", &cfg->autoballoon); -@@ -1720,15 +1717,8 @@ libxlGetAutoballoonConf(libxlDriverConfi +@@ -1755,15 +1752,8 @@ libxlGetAutoballoonConf(libxlDriverConfi else if (res == 1) return 0; ++++++ suse-xen-ovmf-loaders.patch ++++++ --- /var/tmp/diff_new_pack.b9zLHq/_old 2020-04-30 18:51:31.184608284 +0200 +++ /var/tmp/diff_new_pack.b9zLHq/_new 2020-04-30 18:51:31.184608284 +0200 @@ -9,7 +9,7 @@ =================================================================== --- libvirt-6.0.0.orig/src/libxl/libxl_conf.c +++ libvirt-6.0.0/src/libxl/libxl_conf.c -@@ -1780,6 +1780,15 @@ libxlDriverConfigNew(void) +@@ -1815,6 +1815,15 @@ libxlDriverConfigNew(void) goto error; }
participants (1)
-
root