[PATCH v1 4/4] qemu_domain.c: do not launch ppc64 guests with Hyperv settings

Daniel Henrique Barboza posted 4 patches 5 years, 10 months ago
[PATCH v1 4/4] qemu_domain.c: do not launch ppc64 guests with Hyperv settings
Posted by Daniel Henrique Barboza 5 years, 10 months ago
Hyperv features aren't supported in QEMU for ppc64. The <hyperv/>
declaration in the XML by itself is benign, but any of its 14 current
features will break QEMU with an error like this:

qemu-kvm: Expected key=value format, found hv_relaxed

This is a more extreme case than the one for apic eoi because we
would need an extra 'switch' statement, with all current Hyperv
features in the body of qemuDomainDefValidateFeatures(), to
check if the user attempted to activate any of them. It's easier to
simply fail to launch with any 'hyperv' declaration in the XML for
ppc64 guests.

A fair disclaimer about Windows and PowerPC: the last Windows version
that ran in the architecture is the hall of famer Windows NT 4.0,
launched in 1996 and with end of extended support for the Server
version in 2004 [1]. I am acknowledging that there might be Windows
NT 4.0 users running in PowerPC, but not enough people running it
under KVM/QEMU to justify Libvirt allowing 'hyperv' to exist in the
domain XML of ppc64 domains.

[1] https://en.wikipedia.org/wiki/Windows_NT_4.0

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
 src/qemu/qemu_domain.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 2e5f987a04..ba458bfde9 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5295,12 +5295,23 @@ qemuDomainDefValidateFeatures(const virDomainDef *def,
             }
             break;
 
+        case VIR_DOMAIN_FEATURE_HYPERV:
+            if (def->features[i] != VIR_TRISTATE_SWITCH_ABSENT &&
+                ARCH_IS_PPC64(def->os.arch)) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                               _("Hyperv features are not supported for "
+                                 "architecture '%s' or machine type '%s'"),
+                                 virArchToString(def->os.arch),
+                                 def->os.machine);
+                 return -1;
+            }
+            break;
+
         case VIR_DOMAIN_FEATURE_ACPI:
         case VIR_DOMAIN_FEATURE_PAE:
         case VIR_DOMAIN_FEATURE_HAP:
         case VIR_DOMAIN_FEATURE_VIRIDIAN:
         case VIR_DOMAIN_FEATURE_PRIVNET:
-        case VIR_DOMAIN_FEATURE_HYPERV:
         case VIR_DOMAIN_FEATURE_CAPABILITIES:
         case VIR_DOMAIN_FEATURE_MSRS:
         case VIR_DOMAIN_FEATURE_LAST:
-- 
2.25.1


Re: [PATCH v1 4/4] qemu_domain.c: do not launch ppc64 guests with Hyperv settings
Posted by Andrea Bolognani 5 years, 10 months ago
On Thu, 2020-03-19 at 18:44 -0300, Daniel Henrique Barboza wrote:
[...]
> +        case VIR_DOMAIN_FEATURE_HYPERV:
> +            if (def->features[i] != VIR_TRISTATE_SWITCH_ABSENT &&
> +                ARCH_IS_PPC64(def->os.arch)) {
> +                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> +                               _("Hyperv features are not supported for "
> +                                 "architecture '%s' or machine type '%s'"),
> +                                 virArchToString(def->os.arch),
> +                                 def->os.machine);
> +                 return -1;

Same as the previous patches, except Hyper-V is reasonable not only
on x86 but also on aarch64, so the architecture check should be
tweaked accordingly.

-- 
Andrea Bolognani / Red Hat / Virtualization