On 03/09/2017 12:37 PM, Andrea Bolognani wrote: > Depending on the architecture, requirements for ACPI and UEFI can > be different; more specifically, while on x86 UEFI requires ACPI, > on aarch64 it's the other way around. > > Enforce these requirements when building the QEMU command line, > and make the error message more accurate by mentioning that the > requirements are not necessarily applicable to all architectures. > > Several aarch64 test cases had to be tweaked because they didn't > respect the requirements. > --- > src/qemu/qemu_command.c | 20 +++++++++++++++++++- > .../qemuxml2argv-aarch64-aavmf-virtio-mmio.args | 1 + > .../qemuxml2argv-aarch64-aavmf-virtio-mmio.xml | 1 - > .../qemuxml2argv-aarch64-cpu-passthrough.args | 1 + > .../qemuxml2argv-aarch64-cpu-passthrough.xml | 1 - > .../qemuxml2argv-aarch64-video-virtio-gpu-pci.args | 1 + > .../qemuxml2argv-aarch64-video-virtio-gpu-pci.xml | 3 --- > ...xml2argv-aarch64-virt-2.6-virtio-pci-default.args | 1 + > ...uxml2argv-aarch64-virt-2.6-virtio-pci-default.xml | 1 - > .../qemuxml2argv-aarch64-virt-default-nic.args | 1 + > .../qemuxml2argv-aarch64-virt-default-nic.xml | 3 --- > .../qemuxml2argv-aarch64-virt-virtio.args | 1 + > .../qemuxml2argv-aarch64-virt-virtio.xml | 1 - > .../qemuxml2argv-aarch64-virtio-pci-default.args | 1 + > .../qemuxml2argv-aarch64-virtio-pci-default.xml | 1 - > ...xml2argv-aarch64-virtio-pci-manual-addresses.args | 1 + > ...uxml2argv-aarch64-virtio-pci-manual-addresses.xml | 1 - > .../qemuxml2argv-balloon-mmio-deflate.args | 1 + > .../qemuxml2argv-balloon-mmio-deflate.xml | 1 - > .../qemuxml2xmlout-aarch64-aavmf-virtio-mmio.xml | 1 - > .../qemuxml2xmlout-aarch64-video-virtio-gpu-pci.xml | 1 - > .../qemuxml2xmlout-aarch64-virtio-pci-default.xml | 1 - > ...ml2xmlout-aarch64-virtio-pci-manual-addresses.xml | 1 - > 23 files changed, 28 insertions(+), 18 deletions(-) > > diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c > index 6545a93..282ffaa 100644 > --- a/src/qemu/qemu_command.c > +++ b/src/qemu/qemu_command.c > @@ -6252,9 +6252,23 @@ qemuBuildPMCommandLine(virCommandPtr cmd, > virCommandAddArg(cmd, "-no-shutdown"); > } > > + /* Architectures that support ACPI also support -no-acpi as a way > + * of turning it off, and vice versa */ > if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_ACPI)) { > + > + /* ACPI is off unless explicitly turned on */ > if (def->features[VIR_DOMAIN_FEATURE_ACPI] != VIR_TRISTATE_SWITCH_ON) > virCommandAddArg(cmd, "-no-acpi"); > + > + /* aarch64 requires UEFI to be in use for ACPI to work */ > + if (def->features[VIR_DOMAIN_FEATURE_ACPI] == VIR_TRISTATE_SWITCH_ON && > + def->os.arch == VIR_ARCH_AARCH64 && > + (!def->os.loader || > + def->os.loader->type != VIR_DOMAIN_LOADER_TYPE_PFLASH)) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", > + _("ACPI requires UEFI on this architecture")); > + return -1; > + } Why isn't this check in qemuDomainDefPostParse? Avoids errors in command line building which IIRC was something where there was an "effort" to avoid in favor of "earlier" checking. Beyond that - mixing a is there a no-acpi cap flag set and the aarch64 ACPI requirement check feels like we could miss something... > } > > /* We fall back to PIIX4_PM even for q35, since it's what we did > @@ -9099,10 +9113,14 @@ qemuBuildDomainLoaderCommandLine(virCommandPtr cmd, > break; > > case VIR_DOMAIN_LOADER_TYPE_PFLASH: > + > + /* On x86, ACPI is a requirement for UEFI; other architectures, > + * such as aarch64, might have different requirements */ > if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_ACPI) && > + ARCH_IS_X86(def->os.arch) && > def->features[VIR_DOMAIN_FEATURE_ACPI] != VIR_TRISTATE_SWITCH_ON) { > virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", > - _("ACPI must be enabled in order to use UEFI")); > + _("UEFI requires ACPI on this architecture")); > goto cleanup; > } This is another one where I think something could be checked in qemuDomainDefPostParse... If we have a loader of type flash on an X86 system, then ACPI had better be on - regardless of the -no-acpi cap check. John > > diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.args > index bf4b2f7..68fb61b 100644 > --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.args > +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.args > @@ -16,6 +16,7 @@ QEMU_AUDIO_DRV=none \ > -nodefconfig \ > -nodefaults \ > -monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \ > +-no-acpi \ > -boot c \ > -kernel /aarch64.kernel \ > -initrd /aarch64.initrd \ > diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.xml > index 8c7428c..5d72173 100644 > --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.xml > +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.xml > @@ -13,7 +13,6 @@ > <boot dev='hd'/> > </os> > <features> > - <acpi/> > <apic/> > <pae/> > <gic version='2'/> > diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-passthrough.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-passthrough.args > index 52d2112..9c8c001 100644 > --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-passthrough.args > +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-passthrough.args > @@ -16,6 +16,7 @@ QEMU_AUDIO_DRV=none \ > -nodefconfig \ > -nodefaults \ > -monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \ > +-no-acpi \ > -boot c \ > -drive file=/aarch64.raw,format=raw,if=none,id=drive-virtio-disk0 \ > -device virtio-blk-device,drive=drive-virtio-disk0,id=virtio-disk0 > diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-passthrough.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-passthrough.xml > index 4cdf387..0dda095 100644 > --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-passthrough.xml > +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-passthrough.xml > @@ -8,7 +8,6 @@ > <type arch="aarch64" machine="virt">hvm</type> > </os> > <features> > - <acpi/> > <apic/> > <pae/> > </features> > diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-video-virtio-gpu-pci.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-video-virtio-gpu-pci.args > index 76ee977..2f8c516 100644 > --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-video-virtio-gpu-pci.args > +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-video-virtio-gpu-pci.args > @@ -16,6 +16,7 @@ QEMU_AUDIO_DRV=none \ > -nodefconfig \ > -nodefaults \ > -monitor unix:/tmp/lib/domain--1-aarch64-vgpu/monitor.sock,server,nowait \ > +-no-acpi \ > -device ioh3420,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\ > addr=0x1 \ > -device ioh3420,port=0x9,chassis=2,id=pci.2,bus=pcie.0,multifunction=on,\ > diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-video-virtio-gpu-pci.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-video-virtio-gpu-pci.xml > index 4b52a73..d9a0128 100644 > --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-video-virtio-gpu-pci.xml > +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-video-virtio-gpu-pci.xml > @@ -7,9 +7,6 @@ > <os> > <type arch='aarch64' machine='virt'>hvm</type> > </os> > - <features> > - <acpi/> > - </features> > <cpu mode='custom' match='exact'> > <model fallback='allow'>cortex-a57</model> > </cpu> > diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.args > index df03c6e..e99d412 100644 > --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.args > +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.args > @@ -16,6 +16,7 @@ QEMU_AUDIO_DRV=none \ > -nodefconfig \ > -nodefaults \ > -monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \ > +-no-acpi \ > -boot c \ > -kernel /aarch64.kernel \ > -initrd /aarch64.initrd \ > diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.xml > index e745101..43bc008 100644 > --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.xml > +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.xml > @@ -12,7 +12,6 @@ > <cmdline>earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait</cmdline> > </os> > <features> > - <acpi/> > <apic/> > <pae/> > </features> > diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args > index 29f65f6..47d7761 100644 > --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args > +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args > @@ -17,6 +17,7 @@ QEMU_AUDIO_DRV=none \ > -nodefaults \ > -monitor unix:/tmp/lib/domain--1-aarch64-virt-default/monitor.sock,server,\ > nowait \ > +-no-acpi \ > -boot c \ > -kernel /aarch64.kernel \ > -initrd /aarch64.initrd \ > diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.xml > index 3a6f098..17ddc90 100644 > --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.xml > +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.xml > @@ -4,9 +4,6 @@ > <memory>1048576</memory> > <currentMemory>1048576</currentMemory> > <vcpu>1</vcpu> > - <features> > - <acpi/> > - </features> > <cpu match='exact'> > <model>cortex-a53</model> > </cpu> > diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args > index b5b010c..5fef3b4 100644 > --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args > +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args > @@ -16,6 +16,7 @@ QEMU_AUDIO_DRV=none \ > -nodefconfig \ > -nodefaults \ > -monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \ > +-no-acpi \ > -boot c \ > -kernel /aarch64.kernel \ > -initrd /aarch64.initrd \ > diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.xml > index ad34615..2692e61 100644 > --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.xml > +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.xml > @@ -12,7 +12,6 @@ > <cmdline>earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait</cmdline> > </os> > <features> > - <acpi/> > <apic/> > <pae/> > </features> > diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.args > index 46ac51d..23a5fff 100644 > --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.args > +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.args > @@ -16,6 +16,7 @@ QEMU_AUDIO_DRV=none \ > -nodefconfig \ > -nodefaults \ > -monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \ > +-no-acpi \ > -boot c \ > -kernel /aarch64.kernel \ > -initrd /aarch64.initrd \ > diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.xml > index 2a84a96..72bf0c9 100644 > --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.xml > +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.xml > @@ -12,7 +12,6 @@ > <cmdline>earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait</cmdline> > </os> > <features> > - <acpi/> > <apic/> > <pae/> > </features> > diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.args > index 0640399..54244fd 100644 > --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.args > +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.args > @@ -16,6 +16,7 @@ QEMU_AUDIO_DRV=none \ > -nodefconfig \ > -nodefaults \ > -monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \ > +-no-acpi \ > -boot c \ > -kernel /aarch64.kernel \ > -initrd /aarch64.initrd \ > diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.xml > index 5e1b494..fee3258 100644 > --- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.xml > +++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.xml > @@ -13,7 +13,6 @@ > <boot dev='hd'/> > </os> > <features> > - <acpi/> > <apic/> > <pae/> > </features> > diff --git a/tests/qemuxml2argvdata/qemuxml2argv-balloon-mmio-deflate.args b/tests/qemuxml2argvdata/qemuxml2argv-balloon-mmio-deflate.args > index 10d1362..e568e3c 100644 > --- a/tests/qemuxml2argvdata/qemuxml2argv-balloon-mmio-deflate.args > +++ b/tests/qemuxml2argvdata/qemuxml2argv-balloon-mmio-deflate.args > @@ -16,6 +16,7 @@ QEMU_AUDIO_DRV=none \ > -nodefconfig \ > -nodefaults \ > -monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \ > +-no-acpi \ > -boot c \ > -kernel /aarch64.kernel \ > -initrd /aarch64.initrd \ > diff --git a/tests/qemuxml2argvdata/qemuxml2argv-balloon-mmio-deflate.xml b/tests/qemuxml2argvdata/qemuxml2argv-balloon-mmio-deflate.xml > index 1b5b48c..49b7d2c 100644 > --- a/tests/qemuxml2argvdata/qemuxml2argv-balloon-mmio-deflate.xml > +++ b/tests/qemuxml2argvdata/qemuxml2argv-balloon-mmio-deflate.xml > @@ -12,7 +12,6 @@ > <cmdline>earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait</cmdline> > </os> > <features> > - <acpi/> > <apic/> > <pae/> > </features> > diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-aavmf-virtio-mmio.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-aavmf-virtio-mmio.xml > index 2f1f8dd..6eac9db 100644 > --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-aavmf-virtio-mmio.xml > +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-aavmf-virtio-mmio.xml > @@ -13,7 +13,6 @@ > <boot dev='hd'/> > </os> > <features> > - <acpi/> > <apic/> > <pae/> > <gic version='2'/> > diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-video-virtio-gpu-pci.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-video-virtio-gpu-pci.xml > index 26f6a51..4a3c747 100644 > --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-video-virtio-gpu-pci.xml > +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-video-virtio-gpu-pci.xml > @@ -8,7 +8,6 @@ > <type arch='aarch64' machine='virt'>hvm</type> > </os> > <features> > - <acpi/> > <gic version='2'/> > </features> > <cpu mode='custom' match='exact'> > diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-default.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-default.xml > index f7fbdc7..7bd1d7b 100644 > --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-default.xml > +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-default.xml > @@ -13,7 +13,6 @@ > <boot dev='hd'/> > </os> > <features> > - <acpi/> > <apic/> > <pae/> > <gic version='2'/> > diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-manual-addresses.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-manual-addresses.xml > index 1b50f75..8a3a1f5 100644 > --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-manual-addresses.xml > +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-manual-addresses.xml > @@ -13,7 +13,6 @@ > <boot dev='hd'/> > </os> > <features> > - <acpi/> > <apic/> > <pae/> > <gic version='2'/> > -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list