[PATCH v1 1/4] qemu_domain.c: do not launch ppc64 guests with APIC-EOI setting

Daniel Henrique Barboza danielhb413 at gmail.com
Thu Mar 19 21:44:04 UTC 2020


The "<apic/>" feature, although it's not available for pseries,
can be declared in the domain XML of ppc64 guests without errors.
But setting its 'eoi' attribute will break QEMU. For "<apic eoi='on'/>":

qemu-kvm: Expected key=value format, found +kvm_pv_eoi

A similar error happens with eoi='off'.

One can argue that it's better to simply forbid launching ppc64
guests with "<apic/>" declared in the ppc64 XML - it is a feature that
the architecture doesn't support and this would make it clearer
about it. This is sensible, but there are ppc64 guests that are running
with "<apic/>" declared in the domain (and A LOT of guests running with
"<acpi/>" for that matter, probably reminiscent of x86 templates that
were reused for ppc64) that will stop working if we go this route.

A more subtle approach is to detect if the 'eoi' element is being set
for ppc64 guests, and warn the user about it with a better error
message than the one QEMU provides. This is the new error message
when any value is set for the 'eoi' element:

error: unsupported configuration: The 'eoi' attribute of the 'apic'
feature is not supported for architecture 'ppc64' or machine type
'pseries'.

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

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index edc8ba2ddb..381b62b96a 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5262,8 +5262,26 @@ qemuDomainDefValidateFeatures(const virDomainDef *def,
             }
             break;
 
-        case VIR_DOMAIN_FEATURE_ACPI:
         case VIR_DOMAIN_FEATURE_APIC:
+            /* the <apic/> declaration is harmless for ppc64, but
+             * its 'eoi' attribute isn't. To detect if 'eoi' was
+             * present in the XML we can check the tristate switch
+             * of def->apic_eoi */
+            if (def->features[i] != VIR_TRISTATE_SWITCH_ABSENT &&
+                def->apic_eoi != VIR_TRISTATE_SWITCH_ABSENT &&
+                ARCH_IS_PPC64(def->os.arch)) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                               _("The 'eoi' attribute of the '%s' feature "
+                                 "is not supported for architecture '%s' or "
+                                 "machine type '%s'"),
+                                 featureName,
+                                 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:
-- 
2.25.1





More information about the libvir-list mailing list