[PATCH 0/2] qemu: Strip <acpi/> from configs on s390

See patch 1 for the rationale. Peter Krempa (2): qemu_domain: Strip <acpi/> from s390(x) definitions qemuxmlconftest: Add tests for the ACPI stripping hack on s390 src/qemu/qemu_domain.c | 94 +++++++++++++++++++ .../aarch64-nousb-acpi.aarch64-latest.err | 1 + tests/qemuxmlconfdata/aarch64-nousb-acpi.xml | 18 ++++ ...ngarch64-virt-acpi.loongarch64-latest.args | 31 ++++++ ...ongarch64-virt-acpi.loongarch64-latest.xml | 26 +++++ .../qemuxmlconfdata/loongarch64-virt-acpi.xml | 15 +++ .../misc-acpi.x86_64-latest.args | 34 ------- .../misc-acpi.x86_64-latest.xml | 41 -------- tests/qemuxmlconfdata/misc-acpi.xml | 33 ------- .../riscv64-virt-acpi.riscv64-latest.args | 33 +++++++ .../riscv64-virt-acpi.riscv64-latest.xml | 36 +++++++ tests/qemuxmlconfdata/riscv64-virt-acpi.xml | 15 +++ .../s390x-ccw-acpi.s390x-latest.args | 32 +++++++ .../s390x-ccw-acpi.s390x-latest.xml | 27 ++++++ tests/qemuxmlconfdata/s390x-ccw-acpi.xml | 15 +++ .../x86_64-q35-acpi.x86_64-latest.args | 38 ++++++++ .../x86_64-q35-acpi.x86_64-latest.xml | 53 +++++++++++ tests/qemuxmlconfdata/x86_64-q35-acpi.xml | 15 +++ tests/qemuxmlconftest.c | 13 ++- 19 files changed, 461 insertions(+), 109 deletions(-) create mode 100644 tests/qemuxmlconfdata/aarch64-nousb-acpi.aarch64-latest.err create mode 100644 tests/qemuxmlconfdata/aarch64-nousb-acpi.xml create mode 100644 tests/qemuxmlconfdata/loongarch64-virt-acpi.loongarch64-latest.args create mode 100644 tests/qemuxmlconfdata/loongarch64-virt-acpi.loongarch64-latest.xml create mode 100644 tests/qemuxmlconfdata/loongarch64-virt-acpi.xml delete mode 100644 tests/qemuxmlconfdata/misc-acpi.x86_64-latest.args delete mode 100644 tests/qemuxmlconfdata/misc-acpi.x86_64-latest.xml delete mode 100644 tests/qemuxmlconfdata/misc-acpi.xml create mode 100644 tests/qemuxmlconfdata/riscv64-virt-acpi.riscv64-latest.args create mode 100644 tests/qemuxmlconfdata/riscv64-virt-acpi.riscv64-latest.xml create mode 100644 tests/qemuxmlconfdata/riscv64-virt-acpi.xml create mode 100644 tests/qemuxmlconfdata/s390x-ccw-acpi.s390x-latest.args create mode 100644 tests/qemuxmlconfdata/s390x-ccw-acpi.s390x-latest.xml create mode 100644 tests/qemuxmlconfdata/s390x-ccw-acpi.xml create mode 100644 tests/qemuxmlconfdata/x86_64-q35-acpi.x86_64-latest.args create mode 100644 tests/qemuxmlconfdata/x86_64-q35-acpi.x86_64-latest.xml create mode 100644 tests/qemuxmlconfdata/x86_64-q35-acpi.xml -- 2.45.2

The s390(x) machines never supported ACPI. That didn't stop users enabling ACPI in their config. As of libvirt-9.2 (98c4e3d073) with new enough qemu we reject configs which require ACPI, but qemu can't satisfy it. This breaks migration of existing VMs with the old wrong configs to new libvirt installations. To address this introduce a post-parse fixup removing the ACPI flag specifically for s390 machines which do enable it in the definition. The advantage of doing it in post-parse, rather than simply relaxing the ABI stability check to allow users providing an fixed XML when migrating (allowing change of the ACPI flag for s390 in ABI stability check, as it doesn't impact ABI), is that only the destination installation needs to be patched in order to preserve migration. The disadvantage is that users will not be notified that they are using a broken configuration as it will be silently fixed. This is also the reason why only specifically s390(x) machines are being fixed up despite the problem also impacting other legacy architectures not supporting ACPI as well. Resolves: https://issues.redhat.com/browse/RHEL-49516 Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_domain.c | 94 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 298f4bfb9e..4f77817215 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5020,6 +5020,98 @@ qemuDomainDefPostParseBasic(virDomainDef *def, } +/** + * qemuDomainDefACPIPostParse: + * @def: domain definition + * @qemuCaps: qemu capabilities object + * + * Fixup the use of ACPI flag on certain architectures that never supported it + * and users for some reason used it, which would break migration to newer + * libvirt versions which check whether given machine type supports ACPI. + */ +static void +qemuDomainDefACPIPostParse(virDomainDef *def, + virQEMUCaps *qemuCaps) +{ + bool stripACPI = false; + + /* Only cases when ACPI is enabled need to be fixed up */ + if (def->features[VIR_DOMAIN_FEATURE_ACPI] != VIR_TRISTATE_SWITCH_ON) + return; + + switch (def->os.arch) { + /* x86(_64) and AARCH64 always supported ACPI */ + case VIR_ARCH_I686: + case VIR_ARCH_X86_64: + case VIR_ARCH_AARCH64: + stripACPI = false; + break; + + /* S390 never supported ACPI, but some users enabled it regardless in their + * configs for some reason. In order to fix incoming migration we'll strip + * ACPI from those definitions, so that user configs are fixed by updating + * only the destination libvirt installation */ + case VIR_ARCH_S390: + case VIR_ARCH_S390X: + stripACPI = true; + break; + + /* Any other historic architectures could undergo the above treatment but + * since there were no user reports of invalid usage we avoid stripping ACPI */ + case VIR_ARCH_ARMV6L: + case VIR_ARCH_ARMV7L: + case VIR_ARCH_ARMV7B: + case VIR_ARCH_PPC64: + case VIR_ARCH_PPC64LE: + case VIR_ARCH_ALPHA: + case VIR_ARCH_PPC: + case VIR_ARCH_PPCEMB: + case VIR_ARCH_SH4: + case VIR_ARCH_SH4EB: + case VIR_ARCH_RISCV32: + case VIR_ARCH_SPARC64: + case VIR_ARCH_MIPS: + case VIR_ARCH_MIPSEL: + case VIR_ARCH_MIPS64: + case VIR_ARCH_MIPS64EL: + case VIR_ARCH_CRIS: + case VIR_ARCH_ITANIUM: + case VIR_ARCH_LM32: + case VIR_ARCH_M68K: + case VIR_ARCH_MICROBLAZE: + case VIR_ARCH_MICROBLAZEEL: + case VIR_ARCH_OR32: + case VIR_ARCH_PARISC: + case VIR_ARCH_PARISC64: + case VIR_ARCH_PPCLE: + case VIR_ARCH_SPARC: + case VIR_ARCH_UNICORE32: + case VIR_ARCH_XTENSA: + case VIR_ARCH_XTENSAEB: + stripACPI = false; + break; + + /* Any modern architecture must obey what qemu reports */ + case VIR_ARCH_LOONGARCH64: + case VIR_ARCH_RISCV64: + stripACPI = false; + break; + + case VIR_ARCH_NONE: + case VIR_ARCH_LAST: + default: + break; + } + + /* To be sure, we only strip ACPI if given machine type doesn't support it + * or if the support state is unknown (which effectively means that it's + * unsupported, as we don't fixup x86(_64) and AARCH64) */ + if (stripACPI && + virQEMUCapsMachineSupportsACPI(qemuCaps, def->virtType, def->os.machine) != VIR_TRISTATE_BOOL_YES) + def->features[VIR_DOMAIN_FEATURE_ACPI] = VIR_TRISTATE_SWITCH_ABSENT; +} + + static int qemuDomainDefPostParse(virDomainDef *def, unsigned int parseFlags, @@ -5040,6 +5132,8 @@ qemuDomainDefPostParse(virDomainDef *def, if (qemuDomainDefMachinePostParse(def, qemuCaps) < 0) return -1; + qemuDomainDefACPIPostParse(def, qemuCaps); + if (qemuDomainDefBootPostParse(def, driver, parseFlags) < 0) return -1; -- 2.45.2

Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com> On 7/31/24 1:02 PM, Peter Krempa wrote:
The s390(x) machines never supported ACPI. That didn't stop users enabling ACPI in their config. As of libvirt-9.2 (98c4e3d073) with new enough qemu we reject configs which require ACPI, but qemu can't satisfy it.
This breaks migration of existing VMs with the old wrong configs to new libvirt installations.
To address this introduce a post-parse fixup removing the ACPI flag specifically for s390 machines which do enable it in the definition.
The advantage of doing it in post-parse, rather than simply relaxing the ABI stability check to allow users providing an fixed XML when migrating (allowing change of the ACPI flag for s390 in ABI stability check, as it doesn't impact ABI), is that only the destination installation needs to be patched in order to preserve migration.
The disadvantage is that users will not be notified that they are using a broken configuration as it will be silently fixed. This is also the reason why only specifically s390(x) machines are being fixed up despite the problem also impacting other legacy architectures not supporting ACPI as well.
Resolves: https://issues.redhat.com/browse/RHEL-49516 Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_domain.c | 94 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 298f4bfb9e..4f77817215 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5020,6 +5020,98 @@ qemuDomainDefPostParseBasic(virDomainDef *def, }
+/** + * qemuDomainDefACPIPostParse: + * @def: domain definition + * @qemuCaps: qemu capabilities object + * + * Fixup the use of ACPI flag on certain architectures that never supported it + * and users for some reason used it, which would break migration to newer + * libvirt versions which check whether given machine type supports ACPI. + */ +static void +qemuDomainDefACPIPostParse(virDomainDef *def, + virQEMUCaps *qemuCaps) +{ + bool stripACPI = false; + + /* Only cases when ACPI is enabled need to be fixed up */ + if (def->features[VIR_DOMAIN_FEATURE_ACPI] != VIR_TRISTATE_SWITCH_ON) + return; + + switch (def->os.arch) { + /* x86(_64) and AARCH64 always supported ACPI */ + case VIR_ARCH_I686: + case VIR_ARCH_X86_64: + case VIR_ARCH_AARCH64: + stripACPI = false; + break; + + /* S390 never supported ACPI, but some users enabled it regardless in their + * configs for some reason. In order to fix incoming migration we'll strip + * ACPI from those definitions, so that user configs are fixed by updating + * only the destination libvirt installation */ + case VIR_ARCH_S390: + case VIR_ARCH_S390X: + stripACPI = true; + break; + + /* Any other historic architectures could undergo the above treatment but + * since there were no user reports of invalid usage we avoid stripping ACPI */ + case VIR_ARCH_ARMV6L: + case VIR_ARCH_ARMV7L: + case VIR_ARCH_ARMV7B: + case VIR_ARCH_PPC64: + case VIR_ARCH_PPC64LE: + case VIR_ARCH_ALPHA: + case VIR_ARCH_PPC: + case VIR_ARCH_PPCEMB: + case VIR_ARCH_SH4: + case VIR_ARCH_SH4EB: + case VIR_ARCH_RISCV32: + case VIR_ARCH_SPARC64: + case VIR_ARCH_MIPS: + case VIR_ARCH_MIPSEL: + case VIR_ARCH_MIPS64: + case VIR_ARCH_MIPS64EL: + case VIR_ARCH_CRIS: + case VIR_ARCH_ITANIUM: + case VIR_ARCH_LM32: + case VIR_ARCH_M68K: + case VIR_ARCH_MICROBLAZE: + case VIR_ARCH_MICROBLAZEEL: + case VIR_ARCH_OR32: + case VIR_ARCH_PARISC: + case VIR_ARCH_PARISC64: + case VIR_ARCH_PPCLE: + case VIR_ARCH_SPARC: + case VIR_ARCH_UNICORE32: + case VIR_ARCH_XTENSA: + case VIR_ARCH_XTENSAEB: + stripACPI = false; + break; + + /* Any modern architecture must obey what qemu reports */ + case VIR_ARCH_LOONGARCH64: + case VIR_ARCH_RISCV64: + stripACPI = false; + break; + + case VIR_ARCH_NONE: + case VIR_ARCH_LAST: + default: + break; + } + + /* To be sure, we only strip ACPI if given machine type doesn't support it + * or if the support state is unknown (which effectively means that it's + * unsupported, as we don't fixup x86(_64) and AARCH64) */ + if (stripACPI && + virQEMUCapsMachineSupportsACPI(qemuCaps, def->virtType, def->os.machine) != VIR_TRISTATE_BOOL_YES) + def->features[VIR_DOMAIN_FEATURE_ACPI] = VIR_TRISTATE_SWITCH_ABSENT; +} + + static int qemuDomainDefPostParse(virDomainDef *def, unsigned int parseFlags, @@ -5040,6 +5132,8 @@ qemuDomainDefPostParse(virDomainDef *def, if (qemuDomainDefMachinePostParse(def, qemuCaps) < 0) return -1;
+ qemuDomainDefACPIPostParse(def, qemuCaps); + if (qemuDomainDefBootPostParse(def, driver, parseFlags) < 0) return -1;
-- Mit freundlichen Grüßen/Kind regards Boris Fiuczynski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Wolfgang Wendt Geschäftsführung: David Faller Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294

On Wed, Jul 31, 2024 at 01:02:26PM GMT, Peter Krempa wrote:
The s390(x) machines never supported ACPI. That didn't stop users enabling ACPI in their config. As of libvirt-9.2 (98c4e3d073) with new enough qemu we reject configs which require ACPI, but qemu can't satisfy it.
This breaks migration of existing VMs with the old wrong configs to new libvirt installations.
To address this introduce a post-parse fixup removing the ACPI flag specifically for s390 machines which do enable it in the definition.
The advantage of doing it in post-parse, rather than simply relaxing the ABI stability check to allow users providing an fixed XML when migrating (allowing change of the ACPI flag for s390 in ABI stability check, as it doesn't impact ABI), is that only the destination installation needs to be patched in order to preserve migration.
The disadvantage is that users will not be notified that they are using a broken configuration as it will be silently fixed.
+/** + * qemuDomainDefACPIPostParse: + * @def: domain definition + * @qemuCaps: qemu capabilities object + * + * Fixup the use of ACPI flag on certain architectures that never supported it + * and users for some reason used it, which would break migration to newer + * libvirt versions which check whether given machine type supports ACPI. + */ +static void +qemuDomainDefACPIPostParse(virDomainDef *def, + virQEMUCaps *qemuCaps) +{ + bool stripACPI = false; + + /* Only cases when ACPI is enabled need to be fixed up */ + if (def->features[VIR_DOMAIN_FEATURE_ACPI] != VIR_TRISTATE_SWITCH_ON) + return; + + switch (def->os.arch) { + /* x86(_64) and AARCH64 always supported ACPI */ + case VIR_ARCH_I686: + case VIR_ARCH_X86_64: + case VIR_ARCH_AARCH64: + stripACPI = false; + break; + + /* S390 never supported ACPI, but some users enabled it regardless in their + * configs for some reason. In order to fix incoming migration we'll strip + * ACPI from those definitions, so that user configs are fixed by updating + * only the destination libvirt installation */ + case VIR_ARCH_S390: + case VIR_ARCH_S390X: + stripACPI = true; + break; + + /* Any other historic architectures could undergo the above treatment but + * since there were no user reports of invalid usage we avoid stripping ACPI */ + case VIR_ARCH_ARMV6L: + case VIR_ARCH_ARMV7L: + case VIR_ARCH_ARMV7B: + case VIR_ARCH_PPC64: + case VIR_ARCH_PPC64LE: + case VIR_ARCH_ALPHA: + case VIR_ARCH_PPC: + case VIR_ARCH_PPCEMB: + case VIR_ARCH_SH4: + case VIR_ARCH_SH4EB: + case VIR_ARCH_RISCV32: + case VIR_ARCH_SPARC64: + case VIR_ARCH_MIPS: + case VIR_ARCH_MIPSEL: + case VIR_ARCH_MIPS64: + case VIR_ARCH_MIPS64EL: + case VIR_ARCH_CRIS: + case VIR_ARCH_ITANIUM: + case VIR_ARCH_LM32: + case VIR_ARCH_M68K: + case VIR_ARCH_MICROBLAZE: + case VIR_ARCH_MICROBLAZEEL: + case VIR_ARCH_OR32: + case VIR_ARCH_PARISC: + case VIR_ARCH_PARISC64: + case VIR_ARCH_PPCLE: + case VIR_ARCH_SPARC: + case VIR_ARCH_UNICORE32: + case VIR_ARCH_XTENSA: + case VIR_ARCH_XTENSAEB: + stripACPI = false; + break; + + /* Any modern architecture must obey what qemu reports */ + case VIR_ARCH_LOONGARCH64: + case VIR_ARCH_RISCV64: + stripACPI = false; + break; + + case VIR_ARCH_NONE: + case VIR_ARCH_LAST: + default: + break; + }
This looks unnecessarily verbose. I kinda get the idea, but considering that we're unlikely to go back and do anything about most of the architectures that we're currently leaving alone, does it really make sense to have all this code instead of just bool stripACPI = false; /* S390 never supported ACPI, but some users enabled it regardless in their * configs for some reason. In order to fix incoming migration we'll strip * ACPI from those definitions, so that user configs are fixed by updating * only the destination libvirt installation */ if (def->os.arch == VIR_ARCH_S390 || def->os.arch == VIR_ARCH_S390X) stripACPI = true; ? Maybe there's some motivation that I'm not seeing.
+ /* To be sure, we only strip ACPI if given machine type doesn't support it + * or if the support state is unknown (which effectively means that it's + * unsupported, as we don't fixup x86(_64) and AARCH64) */ + if (stripACPI && + virQEMUCapsMachineSupportsACPI(qemuCaps, def->virtType, def->os.machine) != VIR_TRISTATE_BOOL_YES) + def->features[VIR_DOMAIN_FEATURE_ACPI] = VIR_TRISTATE_SWITCH_ABSENT;
Clever safety measure. Regarding the disadvantage you mention in the commit message, how about we implement a middle-ground solution instead? If we only actually strip the feature when !(parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE) then we still silently fix migration, but we also prevent new s390x domains with ACPI (supposedly) enabled from being defined, and generally limit the scope of the workaround as much as possible. -- Andrea Bolognani / Red Hat / Virtualization

On Thu, Aug 01, 2024 at 02:35:59 -0700, Andrea Bolognani wrote:
On Wed, Jul 31, 2024 at 01:02:26PM GMT, Peter Krempa wrote:
The s390(x) machines never supported ACPI. That didn't stop users enabling ACPI in their config. As of libvirt-9.2 (98c4e3d073) with new enough qemu we reject configs which require ACPI, but qemu can't satisfy it.
This breaks migration of existing VMs with the old wrong configs to new libvirt installations.
To address this introduce a post-parse fixup removing the ACPI flag specifically for s390 machines which do enable it in the definition.
The advantage of doing it in post-parse, rather than simply relaxing the ABI stability check to allow users providing an fixed XML when migrating (allowing change of the ACPI flag for s390 in ABI stability check, as it doesn't impact ABI), is that only the destination installation needs to be patched in order to preserve migration.
The disadvantage is that users will not be notified that they are using a broken configuration as it will be silently fixed.
+/** + * qemuDomainDefACPIPostParse: + * @def: domain definition + * @qemuCaps: qemu capabilities object + * + * Fixup the use of ACPI flag on certain architectures that never supported it + * and users for some reason used it, which would break migration to newer + * libvirt versions which check whether given machine type supports ACPI. + */ +static void +qemuDomainDefACPIPostParse(virDomainDef *def, + virQEMUCaps *qemuCaps) +{ + bool stripACPI = false; + + /* Only cases when ACPI is enabled need to be fixed up */ + if (def->features[VIR_DOMAIN_FEATURE_ACPI] != VIR_TRISTATE_SWITCH_ON) + return; + + switch (def->os.arch) { + /* x86(_64) and AARCH64 always supported ACPI */ + case VIR_ARCH_I686: + case VIR_ARCH_X86_64: + case VIR_ARCH_AARCH64: + stripACPI = false; + break; + + /* S390 never supported ACPI, but some users enabled it regardless in their + * configs for some reason. In order to fix incoming migration we'll strip + * ACPI from those definitions, so that user configs are fixed by updating + * only the destination libvirt installation */ + case VIR_ARCH_S390: + case VIR_ARCH_S390X: + stripACPI = true; + break; + + /* Any other historic architectures could undergo the above treatment but + * since there were no user reports of invalid usage we avoid stripping ACPI */ + case VIR_ARCH_ARMV6L: + case VIR_ARCH_ARMV7L: + case VIR_ARCH_ARMV7B: + case VIR_ARCH_PPC64: + case VIR_ARCH_PPC64LE: + case VIR_ARCH_ALPHA: + case VIR_ARCH_PPC: + case VIR_ARCH_PPCEMB: + case VIR_ARCH_SH4: + case VIR_ARCH_SH4EB: + case VIR_ARCH_RISCV32: + case VIR_ARCH_SPARC64: + case VIR_ARCH_MIPS: + case VIR_ARCH_MIPSEL: + case VIR_ARCH_MIPS64: + case VIR_ARCH_MIPS64EL: + case VIR_ARCH_CRIS: + case VIR_ARCH_ITANIUM: + case VIR_ARCH_LM32: + case VIR_ARCH_M68K: + case VIR_ARCH_MICROBLAZE: + case VIR_ARCH_MICROBLAZEEL: + case VIR_ARCH_OR32: + case VIR_ARCH_PARISC: + case VIR_ARCH_PARISC64: + case VIR_ARCH_PPCLE: + case VIR_ARCH_SPARC: + case VIR_ARCH_UNICORE32: + case VIR_ARCH_XTENSA: + case VIR_ARCH_XTENSAEB: + stripACPI = false; + break; + + /* Any modern architecture must obey what qemu reports */ + case VIR_ARCH_LOONGARCH64: + case VIR_ARCH_RISCV64: + stripACPI = false; + break; + + case VIR_ARCH_NONE: + case VIR_ARCH_LAST: + default: + break; + }
This looks unnecessarily verbose. I kinda get the idea, but considering that we're unlikely to go back and do anything about most of the architectures that we're currently leaving alone, does it really make sense to have all this code instead of just
bool stripACPI = false;
/* S390 never supported ACPI, but some users enabled it regardless in their * configs for some reason. In order to fix incoming migration we'll strip * ACPI from those definitions, so that user configs are fixed by updating * only the destination libvirt installation */ if (def->os.arch == VIR_ARCH_S390 || def->os.arch == VIR_ARCH_S390X) stripACPI = true;
? Maybe there's some motivation that I'm not seeing.
Well, I tend to prefer the switch statement because it forces you to consider every code path when adding another member into the enum. In this case though, you're right that we won't ever want to add anything to the case when stripping is allowed. On the other hand it clearly differentiates the legacy arches where theoretically the same bug could be considered to be fixed and the modern arches where that stuff must never be done. Also note that yes this is more lines, but I'd consider the "verbosity" to be at the same level, because you then don't have to consider what other options are around when reading the code. And yes, all of that could be replaced by a comment.
+ /* To be sure, we only strip ACPI if given machine type doesn't support it + * or if the support state is unknown (which effectively means that it's + * unsupported, as we don't fixup x86(_64) and AARCH64) */ + if (stripACPI && + virQEMUCapsMachineSupportsACPI(qemuCaps, def->virtType, def->os.machine) != VIR_TRISTATE_BOOL_YES) + def->features[VIR_DOMAIN_FEATURE_ACPI] = VIR_TRISTATE_SWITCH_ABSENT;
Clever safety measure.
Regarding the disadvantage you mention in the commit message, how about we implement a middle-ground solution instead? If we only actually strip the feature when
!(parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE)
then we still silently fix migration, but we also prevent new s390x domains with ACPI (supposedly) enabled from being defined, and generally limit the scope of the workaround as much as possible.
I've considered this, but in case when you migrate the persistent XML along with the migration or use offline migration, you won't be able to start the VM. Yes it will force you to fix the config but it feels wrong to allow migration but then have a definition which no longer works. If the s390 folks consider this important for their usage and want to forgo the fact that we'll be stripping <acpi/> instead of them fixing the configs in the first place, we should do that always to prevent having weird intermediate states. If we want to go the route of not allowing 'defining' a new config with acpi enabled, we'll need another VIR_DOMAIN_DEF_PARSE_ flag asserted on all migration related XML parsing where the modification will be performed and on none of the normal code paths, but none of the existing flags allow that granularity.

On Thu, Aug 01, 2024 at 12:03:52PM GMT, Peter Krempa wrote:
On Thu, Aug 01, 2024 at 02:35:59 -0700, Andrea Bolognani wrote:
This looks unnecessarily verbose. I kinda get the idea, but considering that we're unlikely to go back and do anything about most of the architectures that we're currently leaving alone, does it really make sense to have all this code instead of just
bool stripACPI = false;
/* S390 never supported ACPI, but some users enabled it regardless in their * configs for some reason. In order to fix incoming migration we'll strip * ACPI from those definitions, so that user configs are fixed by updating * only the destination libvirt installation */ if (def->os.arch == VIR_ARCH_S390 || def->os.arch == VIR_ARCH_S390X) stripACPI = true;
? Maybe there's some motivation that I'm not seeing.
Well, I tend to prefer the switch statement because it forces you to consider every code path when adding another member into the enum. In this case though, you're right that we won't ever want to add anything to the case when stripping is allowed.
On the other hand it clearly differentiates the legacy arches where theoretically the same bug could be considered to be fixed and the modern arches where that stuff must never be done.
Also note that yes this is more lines, but I'd consider the "verbosity" to be at the same level, because you then don't have to consider what other options are around when reading the code. And yes, all of that could be replaced by a comment.
I generally prefer the switch approach as well, it just seems overkill in this specific case. But it's perfectly valid, so feel free to just ignore this bit of feedback.
Regarding the disadvantage you mention in the commit message, how about we implement a middle-ground solution instead? If we only actually strip the feature when
!(parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE)
then we still silently fix migration, but we also prevent new s390x domains with ACPI (supposedly) enabled from being defined, and generally limit the scope of the workaround as much as possible.
I've considered this, but in case when you migrate the persistent XML along with the migration or use offline migration, you won't be able to start the VM. Yes it will force you to fix the config but it feels wrong to allow migration but then have a definition which no longer works.
If the s390 folks consider this important for their usage and want to forgo the fact that we'll be stripping <acpi/> instead of them fixing the configs in the first place, we should do that always to prevent having weird intermediate states.
If we want to go the route of not allowing 'defining' a new config with acpi enabled, we'll need another VIR_DOMAIN_DEF_PARSE_ flag asserted on all migration related XML parsing where the modification will be performed and on none of the normal code paths, but none of the existing flags allow that granularity.
So offline migration sets ABI_UPDATE? I guess that makes sense to some extent, as live migration obviously has the strictest possible requirements, but still it feels weird that the same domain migrated between the same two hosts could end up with slightly different ABI depending on whether or not it's migrated while it's running. I can tell you for certain that the presence of ABI_UPDATE is (mis)interpreted as a witness for "this is a newly-defined domain" in several places. I've introduced a few myself. Having a separate flag that actually carries that meaning would probably be a very good idea. -- Andrea Bolognani / Red Hat / Virtualization

On Thu, Aug 01, 2024 at 06:04:59 -0700, Andrea Bolognani wrote:
On Thu, Aug 01, 2024 at 12:03:52PM GMT, Peter Krempa wrote:
On Thu, Aug 01, 2024 at 02:35:59 -0700, Andrea Bolognani wrote:
This looks unnecessarily verbose. I kinda get the idea, but considering that we're unlikely to go back and do anything about most of the architectures that we're currently leaving alone, does it really make sense to have all this code instead of just
bool stripACPI = false;
/* S390 never supported ACPI, but some users enabled it regardless in their * configs for some reason. In order to fix incoming migration we'll strip * ACPI from those definitions, so that user configs are fixed by updating * only the destination libvirt installation */ if (def->os.arch == VIR_ARCH_S390 || def->os.arch == VIR_ARCH_S390X) stripACPI = true;
? Maybe there's some motivation that I'm not seeing.
Well, I tend to prefer the switch statement because it forces you to consider every code path when adding another member into the enum. In this case though, you're right that we won't ever want to add anything to the case when stripping is allowed.
On the other hand it clearly differentiates the legacy arches where theoretically the same bug could be considered to be fixed and the modern arches where that stuff must never be done.
Also note that yes this is more lines, but I'd consider the "verbosity" to be at the same level, because you then don't have to consider what other options are around when reading the code. And yes, all of that could be replaced by a comment.
I generally prefer the switch approach as well, it just seems overkill in this specific case. But it's perfectly valid, so feel free to just ignore this bit of feedback.
Regarding the disadvantage you mention in the commit message, how about we implement a middle-ground solution instead? If we only actually strip the feature when
!(parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE)
then we still silently fix migration, but we also prevent new s390x domains with ACPI (supposedly) enabled from being defined, and generally limit the scope of the workaround as much as possible.
I've considered this, but in case when you migrate the persistent XML along with the migration or use offline migration, you won't be able to start the VM. Yes it will force you to fix the config but it feels wrong to allow migration but then have a definition which no longer works.
If the s390 folks consider this important for their usage and want to forgo the fact that we'll be stripping <acpi/> instead of them fixing the configs in the first place, we should do that always to prevent having weird intermediate states.
If we want to go the route of not allowing 'defining' a new config with acpi enabled, we'll need another VIR_DOMAIN_DEF_PARSE_ flag asserted on all migration related XML parsing where the modification will be performed and on none of the normal code paths, but none of the existing flags allow that granularity.
So offline migration sets ABI_UPDATE? I guess that makes sense to some extent, as live migration obviously has the strictest possible requirements, but still it feels weird that the same domain migrated between the same two hosts could end up with slightly different ABI depending on whether or not it's migrated while it's running.
Well, I thought it did but it doesn't seem to be the case: src/qemu/qemu_driver.c=static virDomainPtr qemuDomainCreateXML(virConnectPtr conn, src/qemu/qemu_driver.c: VIR_DOMAIN_DEF_PARSE_ABI_UPDATE; src/qemu/qemu_driver.c=static char *qemuConnectDomainXMLToNative(virConnectPtr conn, src/qemu/qemu_driver.c: VIR_DOMAIN_DEF_PARSE_ABI_UPDATE))) src/qemu/qemu_driver.c=qemuDomainDefineXMLFlags(virConnectPtr conn, src/qemu/qemu_driver.c: VIR_DOMAIN_DEF_PARSE_ABI_UPDATE; src/qemu/qemu_driver.c=qemuDomainAttachDeviceLiveAndConfig(virDomainObj *vm, src/qemu/qemu_driver.c: VIR_DOMAIN_DEF_PARSE_ABI_UPDATE; Which are the only relevant code paths asserting it.
I can tell you for certain that the presence of ABI_UPDATE is (mis)interpreted as a witness for "this is a newly-defined domain" in several places. I've introduced a few myself. Having a separate flag that actually carries that meaning would probably be a very good idea.
Well, I thought this flag would be asserted in more code paths, as of the 4 above, 1 is irrelevant and 3 are safe I guess we can do this thing as well.

Replace the 'misc-acpi' case by testing a bunch of architectures for how ACPI is handled including a test for the s390 ACPI strip hack added in previous commit. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- .../aarch64-nousb-acpi.aarch64-latest.err | 1 + tests/qemuxmlconfdata/aarch64-nousb-acpi.xml | 18 +++++++ ...ngarch64-virt-acpi.loongarch64-latest.args | 31 +++++++++++ ...ongarch64-virt-acpi.loongarch64-latest.xml | 26 +++++++++ .../qemuxmlconfdata/loongarch64-virt-acpi.xml | 15 ++++++ .../misc-acpi.x86_64-latest.args | 34 ------------ .../misc-acpi.x86_64-latest.xml | 41 -------------- tests/qemuxmlconfdata/misc-acpi.xml | 33 ------------ .../riscv64-virt-acpi.riscv64-latest.args | 33 ++++++++++++ .../riscv64-virt-acpi.riscv64-latest.xml | 36 +++++++++++++ tests/qemuxmlconfdata/riscv64-virt-acpi.xml | 15 ++++++ .../s390x-ccw-acpi.s390x-latest.args | 32 +++++++++++ .../s390x-ccw-acpi.s390x-latest.xml | 27 ++++++++++ tests/qemuxmlconfdata/s390x-ccw-acpi.xml | 15 ++++++ .../x86_64-q35-acpi.x86_64-latest.args | 38 +++++++++++++ .../x86_64-q35-acpi.x86_64-latest.xml | 53 +++++++++++++++++++ tests/qemuxmlconfdata/x86_64-q35-acpi.xml | 15 ++++++ tests/qemuxmlconftest.c | 13 ++++- 18 files changed, 367 insertions(+), 109 deletions(-) create mode 100644 tests/qemuxmlconfdata/aarch64-nousb-acpi.aarch64-latest.err create mode 100644 tests/qemuxmlconfdata/aarch64-nousb-acpi.xml create mode 100644 tests/qemuxmlconfdata/loongarch64-virt-acpi.loongarch64-latest.args create mode 100644 tests/qemuxmlconfdata/loongarch64-virt-acpi.loongarch64-latest.xml create mode 100644 tests/qemuxmlconfdata/loongarch64-virt-acpi.xml delete mode 100644 tests/qemuxmlconfdata/misc-acpi.x86_64-latest.args delete mode 100644 tests/qemuxmlconfdata/misc-acpi.x86_64-latest.xml delete mode 100644 tests/qemuxmlconfdata/misc-acpi.xml create mode 100644 tests/qemuxmlconfdata/riscv64-virt-acpi.riscv64-latest.args create mode 100644 tests/qemuxmlconfdata/riscv64-virt-acpi.riscv64-latest.xml create mode 100644 tests/qemuxmlconfdata/riscv64-virt-acpi.xml create mode 100644 tests/qemuxmlconfdata/s390x-ccw-acpi.s390x-latest.args create mode 100644 tests/qemuxmlconfdata/s390x-ccw-acpi.s390x-latest.xml create mode 100644 tests/qemuxmlconfdata/s390x-ccw-acpi.xml create mode 100644 tests/qemuxmlconfdata/x86_64-q35-acpi.x86_64-latest.args create mode 100644 tests/qemuxmlconfdata/x86_64-q35-acpi.x86_64-latest.xml create mode 100644 tests/qemuxmlconfdata/x86_64-q35-acpi.xml diff --git a/tests/qemuxmlconfdata/aarch64-nousb-acpi.aarch64-latest.err b/tests/qemuxmlconfdata/aarch64-nousb-acpi.aarch64-latest.err new file mode 100644 index 0000000000..5f379d56ce --- /dev/null +++ b/tests/qemuxmlconfdata/aarch64-nousb-acpi.aarch64-latest.err @@ -0,0 +1 @@ +unsupported configuration: machine type 'borzoi' does not support ACPI diff --git a/tests/qemuxmlconfdata/aarch64-nousb-acpi.xml b/tests/qemuxmlconfdata/aarch64-nousb-acpi.xml new file mode 100644 index 0000000000..0930b3a862 --- /dev/null +++ b/tests/qemuxmlconfdata/aarch64-nousb-acpi.xml @@ -0,0 +1,18 @@ +<domain type='kvm'> + <name>aarch64test</name> + <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid> + <memory unit='KiB'>1048576</memory> + <vcpu placement='static'>1</vcpu> + <os> + <!-- machine type doesn't matter as long as it has no implicit USB --> + <type arch='aarch64' machine='borzoi'>hvm</type> + </os> + <features> + <acpi/> + </features> + <cpu mode='host-passthrough'/> + <devices> + <emulator>/usr/bin/qemu-system-aarch64</emulator> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxmlconfdata/loongarch64-virt-acpi.loongarch64-latest.args b/tests/qemuxmlconfdata/loongarch64-virt-acpi.loongarch64-latest.args new file mode 100644 index 0000000000..e59d833ca9 --- /dev/null +++ b/tests/qemuxmlconfdata/loongarch64-virt-acpi.loongarch64-latest.args @@ -0,0 +1,31 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/var/lib/libvirt/qemu/domain--1-guest \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-guest/.local/share \ +XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-guest/.cache \ +XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \ +/usr/bin/qemu-system-loongarch64 \ +-name guest=guest,debug-threads=on \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \ +-machine virt,usb=off,dump-guest-core=off,memory-backend=loongarch.ram,acpi=on \ +-accel tcg \ +-cpu la464 \ +-m size=4194304k \ +-object '{"qom-type":"memory-backend-ram","id":"loongarch.ram","size":4294967296}' \ +-overcommit mem-lock=off \ +-smp 4,sockets=4,cores=1,threads=1 \ +-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-boot strict=on \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxmlconfdata/loongarch64-virt-acpi.loongarch64-latest.xml b/tests/qemuxmlconfdata/loongarch64-virt-acpi.loongarch64-latest.xml new file mode 100644 index 0000000000..d3ce68c3a3 --- /dev/null +++ b/tests/qemuxmlconfdata/loongarch64-virt-acpi.loongarch64-latest.xml @@ -0,0 +1,26 @@ +<domain type='qemu'> + <name>guest</name> + <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> + <memory unit='KiB'>4194304</memory> + <currentMemory unit='KiB'>4194304</currentMemory> + <vcpu placement='static'>4</vcpu> + <os> + <type arch='loongarch64' machine='virt'>hvm</type> + <boot dev='hd'/> + </os> + <features> + <acpi/> + </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>la464</model> + </cpu> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-loongarch64</emulator> + <controller type='pci' index='0' model='pcie-root'/> + <audio id='1' type='none'/> + </devices> +</domain> diff --git a/tests/qemuxmlconfdata/loongarch64-virt-acpi.xml b/tests/qemuxmlconfdata/loongarch64-virt-acpi.xml new file mode 100644 index 0000000000..1d83f93d88 --- /dev/null +++ b/tests/qemuxmlconfdata/loongarch64-virt-acpi.xml @@ -0,0 +1,15 @@ +<domain type='qemu'> + <name>guest</name> + <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> + <memory>4194304</memory> + <vcpu>4</vcpu> + <features> + <acpi/> + </features> + <os> + <type arch='loongarch64' machine='virt'>hvm</type> + </os> + <devices> + <emulator>/usr/bin/qemu-system-loongarch64</emulator> + </devices> +</domain> diff --git a/tests/qemuxmlconfdata/misc-acpi.x86_64-latest.args b/tests/qemuxmlconfdata/misc-acpi.x86_64-latest.args deleted file mode 100644 index c4e09c0af2..0000000000 --- a/tests/qemuxmlconfdata/misc-acpi.x86_64-latest.args +++ /dev/null @@ -1,34 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \ -USER=test \ -LOGNAME=test \ -XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \ -XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \ -XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -/usr/bin/qemu-system-x86_64 \ --name guest=QEMUGuest1,debug-threads=on \ --S \ --object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \ --machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=on \ --accel tcg \ --cpu qemu64 \ --m size=219136k \ --object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \ --overcommit mem-lock=off \ --smp 1,sockets=1,cores=1,threads=1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ --mon chardev=charmonitor,id=monitor,mode=control \ --rtc base=utc \ --no-shutdown \ --boot strict=on \ --device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ --blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","read-only":false}' \ --device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-storage","id":"ide0-0-0","bootindex":1}' \ --audiodev '{"id":"audio1","driver":"none"}' \ --sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ --msg timestamp=on diff --git a/tests/qemuxmlconfdata/misc-acpi.x86_64-latest.xml b/tests/qemuxmlconfdata/misc-acpi.x86_64-latest.xml deleted file mode 100644 index 176926bb60..0000000000 --- a/tests/qemuxmlconfdata/misc-acpi.x86_64-latest.xml +++ /dev/null @@ -1,41 +0,0 @@ -<domain type='qemu'> - <name>QEMUGuest1</name> - <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> - <memory unit='KiB'>219136</memory> - <currentMemory unit='KiB'>219136</currentMemory> - <vcpu placement='static'>1</vcpu> - <os> - <type arch='x86_64' machine='pc'>hvm</type> - <boot dev='hd'/> - </os> - <features> - <acpi/> - </features> - <cpu mode='custom' match='exact' check='none'> - <model fallback='forbid'>qemu64</model> - </cpu> - <clock offset='utc'/> - <on_poweroff>destroy</on_poweroff> - <on_reboot>restart</on_reboot> - <on_crash>destroy</on_crash> - <devices> - <emulator>/usr/bin/qemu-system-x86_64</emulator> - <disk type='block' device='disk'> - <driver name='qemu' type='raw'/> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='hda' bus='ide'/> - <address type='drive' controller='0' bus='0' target='0' unit='0'/> - </disk> - <controller type='usb' index='0' model='piix3-uhci'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> - </controller> - <controller type='ide' index='0'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> - </controller> - <controller type='pci' index='0' model='pci-root'/> - <input type='mouse' bus='ps2'/> - <input type='keyboard' bus='ps2'/> - <audio id='1' type='none'/> - <memballoon model='none'/> - </devices> -</domain> diff --git a/tests/qemuxmlconfdata/misc-acpi.xml b/tests/qemuxmlconfdata/misc-acpi.xml deleted file mode 100644 index 59fbe471ff..0000000000 --- a/tests/qemuxmlconfdata/misc-acpi.xml +++ /dev/null @@ -1,33 +0,0 @@ -<domain type='qemu'> - <name>QEMUGuest1</name> - <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> - <memory unit='KiB'>219136</memory> - <currentMemory unit='KiB'>219136</currentMemory> - <vcpu placement='static'>1</vcpu> - <os> - <type arch='x86_64' machine='pc'>hvm</type> - <boot dev='hd'/> - </os> - <features> - <acpi/> - </features> - <clock offset='utc'/> - <on_poweroff>destroy</on_poweroff> - <on_reboot>restart</on_reboot> - <on_crash>destroy</on_crash> - <devices> - <emulator>/usr/bin/qemu-system-x86_64</emulator> - <disk type='block' device='disk'> - <driver name='qemu' type='raw'/> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='hda' bus='ide'/> - <address type='drive' controller='0' bus='0' target='0' unit='0'/> - </disk> - <controller type='usb' index='0'/> - <controller type='ide' index='0'/> - <controller type='pci' index='0' model='pci-root'/> - <input type='mouse' bus='ps2'/> - <input type='keyboard' bus='ps2'/> - <memballoon model='none'/> - </devices> -</domain> diff --git a/tests/qemuxmlconfdata/riscv64-virt-acpi.riscv64-latest.args b/tests/qemuxmlconfdata/riscv64-virt-acpi.riscv64-latest.args new file mode 100644 index 0000000000..fcb80b009e --- /dev/null +++ b/tests/qemuxmlconfdata/riscv64-virt-acpi.riscv64-latest.args @@ -0,0 +1,33 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/var/lib/libvirt/qemu/domain--1-guest \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-guest/.local/share \ +XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-guest/.cache \ +XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \ +/usr/bin/qemu-system-riscv64 \ +-name guest=guest,debug-threads=on \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \ +-machine virt,usb=off,dump-guest-core=off,memory-backend=riscv_virt_board.ram \ +-accel tcg \ +-m size=4194304k \ +-object '{"qom-type":"memory-backend-ram","id":"riscv_virt_board.ram","size":4294967296}' \ +-overcommit mem-lock=off \ +-smp 4,sockets=4,cores=1,threads=1 \ +-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-boot strict=on \ +-device '{"driver":"pcie-root-port","port":8,"chassis":1,"id":"pci.1","bus":"pcie.0","multifunction":true,"addr":"0x1"}' \ +-device '{"driver":"pcie-root-port","port":9,"chassis":2,"id":"pci.2","bus":"pcie.0","addr":"0x1.0x1"}' \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.1","addr":"0x0"}' \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxmlconfdata/riscv64-virt-acpi.riscv64-latest.xml b/tests/qemuxmlconfdata/riscv64-virt-acpi.riscv64-latest.xml new file mode 100644 index 0000000000..075708df9c --- /dev/null +++ b/tests/qemuxmlconfdata/riscv64-virt-acpi.riscv64-latest.xml @@ -0,0 +1,36 @@ +<domain type='qemu'> + <name>guest</name> + <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> + <memory unit='KiB'>4194304</memory> + <currentMemory unit='KiB'>4194304</currentMemory> + <vcpu placement='static'>4</vcpu> + <os> + <type arch='riscv64' machine='virt'>hvm</type> + <boot dev='hd'/> + </os> + <features> + <acpi/> + </features> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-riscv64</emulator> + <controller type='pci' index='0' model='pcie-root'/> + <controller type='pci' index='1' model='pcie-root-port'> + <model name='pcie-root-port'/> + <target chassis='1' port='0x8'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/> + </controller> + <controller type='pci' index='2' model='pcie-root-port'> + <model name='pcie-root-port'/> + <target chassis='2' port='0x9'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> + <audio id='1' type='none'/> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxmlconfdata/riscv64-virt-acpi.xml b/tests/qemuxmlconfdata/riscv64-virt-acpi.xml new file mode 100644 index 0000000000..1e2dff1b17 --- /dev/null +++ b/tests/qemuxmlconfdata/riscv64-virt-acpi.xml @@ -0,0 +1,15 @@ +<domain type='qemu'> + <name>guest</name> + <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> + <memory>4194304</memory> + <vcpu>4</vcpu> + <features> + <acpi/> + </features> + <os> + <type arch='riscv64' machine='virt'>hvm</type> + </os> + <devices> + <emulator>/usr/bin/qemu-system-riscv64</emulator> + </devices> +</domain> diff --git a/tests/qemuxmlconfdata/s390x-ccw-acpi.s390x-latest.args b/tests/qemuxmlconfdata/s390x-ccw-acpi.s390x-latest.args new file mode 100644 index 0000000000..84098e580e --- /dev/null +++ b/tests/qemuxmlconfdata/s390x-ccw-acpi.s390x-latest.args @@ -0,0 +1,32 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/var/lib/libvirt/qemu/domain--1-guest \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-guest/.local/share \ +XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-guest/.cache \ +XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \ +/usr/bin/qemu-system-s390x \ +-name guest=guest,debug-threads=on \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \ +-machine s390-ccw-virtio,usb=off,dump-guest-core=off,memory-backend=s390.ram \ +-accel tcg \ +-cpu qemu \ +-m size=4194304k \ +-object '{"qom-type":"memory-backend-ram","id":"s390.ram","size":4294967296}' \ +-overcommit mem-lock=off \ +-smp 4,sockets=4,cores=1,threads=1 \ +-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-boot strict=on \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-device '{"driver":"virtio-balloon-ccw","id":"balloon0","devno":"fe.0.0000"}' \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxmlconfdata/s390x-ccw-acpi.s390x-latest.xml b/tests/qemuxmlconfdata/s390x-ccw-acpi.s390x-latest.xml new file mode 100644 index 0000000000..df8e578212 --- /dev/null +++ b/tests/qemuxmlconfdata/s390x-ccw-acpi.s390x-latest.xml @@ -0,0 +1,27 @@ +<domain type='qemu'> + <name>guest</name> + <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> + <memory unit='KiB'>4194304</memory> + <currentMemory unit='KiB'>4194304</currentMemory> + <vcpu placement='static'>4</vcpu> + <os> + <type arch='s390x' machine='s390-ccw-virtio'>hvm</type> + <boot dev='hd'/> + </os> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu</model> + </cpu> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-s390x</emulator> + <controller type='pci' index='0' model='pci-root'/> + <audio id='1' type='none'/> + <memballoon model='virtio'> + <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/> + </memballoon> + <panic model='s390'/> + </devices> +</domain> diff --git a/tests/qemuxmlconfdata/s390x-ccw-acpi.xml b/tests/qemuxmlconfdata/s390x-ccw-acpi.xml new file mode 100644 index 0000000000..b7be060c66 --- /dev/null +++ b/tests/qemuxmlconfdata/s390x-ccw-acpi.xml @@ -0,0 +1,15 @@ +<domain type='qemu'> + <name>guest</name> + <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> + <memory>4194304</memory> + <vcpu>4</vcpu> + <features> + <acpi/> + </features> + <os> + <type arch='s390x' machine='s390-ccw-virtio'>hvm</type> + </os> + <devices> + <emulator>/usr/bin/qemu-system-s390x</emulator> + </devices> +</domain> diff --git a/tests/qemuxmlconfdata/x86_64-q35-acpi.x86_64-latest.args b/tests/qemuxmlconfdata/x86_64-q35-acpi.x86_64-latest.args new file mode 100644 index 0000000000..bced7b2530 --- /dev/null +++ b/tests/qemuxmlconfdata/x86_64-q35-acpi.x86_64-latest.args @@ -0,0 +1,38 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/var/lib/libvirt/qemu/domain--1-guest \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-guest/.local/share \ +XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-guest/.cache \ +XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \ +/usr/bin/qemu-system-x86_64 \ +-name guest=guest,debug-threads=on \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \ +-machine q35,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=on \ +-accel tcg \ +-cpu qemu64 \ +-m size=4194304k \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":4294967296}' \ +-overcommit mem-lock=off \ +-smp 4,sockets=4,cores=1,threads=1 \ +-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-boot strict=on \ +-device '{"driver":"pcie-root-port","port":8,"chassis":1,"id":"pci.1","bus":"pcie.0","multifunction":true,"addr":"0x1"}' \ +-device '{"driver":"pcie-root-port","port":9,"chassis":2,"id":"pci.2","bus":"pcie.0","addr":"0x1.0x1"}' \ +-device '{"driver":"pcie-root-port","port":10,"chassis":3,"id":"pci.3","bus":"pcie.0","addr":"0x1.0x2"}' \ +-device '{"driver":"qemu-xhci","id":"usb","bus":"pci.1","addr":"0x0"}' \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-global ICH9-LPC.noreboot=off \ +-watchdog-action reset \ +-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.2","addr":"0x0"}' \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxmlconfdata/x86_64-q35-acpi.x86_64-latest.xml b/tests/qemuxmlconfdata/x86_64-q35-acpi.x86_64-latest.xml new file mode 100644 index 0000000000..95ca4b6e42 --- /dev/null +++ b/tests/qemuxmlconfdata/x86_64-q35-acpi.x86_64-latest.xml @@ -0,0 +1,53 @@ +<domain type='qemu'> + <name>guest</name> + <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> + <memory unit='KiB'>4194304</memory> + <currentMemory unit='KiB'>4194304</currentMemory> + <vcpu placement='static'>4</vcpu> + <os> + <type arch='x86_64' machine='q35'>hvm</type> + <boot dev='hd'/> + </os> + <features> + <acpi/> + </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='usb' index='0' model='qemu-xhci'> + <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/> + </controller> + <controller type='sata' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/> + </controller> + <controller type='pci' index='0' model='pcie-root'/> + <controller type='pci' index='1' model='pcie-root-port'> + <model name='pcie-root-port'/> + <target chassis='1' port='0x8'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/> + </controller> + <controller type='pci' index='2' model='pcie-root-port'> + <model name='pcie-root-port'/> + <target chassis='2' port='0x9'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> + <controller type='pci' index='3' model='pcie-root-port'> + <model name='pcie-root-port'/> + <target chassis='3' port='0xa'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <audio id='1' type='none'/> + <watchdog model='itco' action='reset'/> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxmlconfdata/x86_64-q35-acpi.xml b/tests/qemuxmlconfdata/x86_64-q35-acpi.xml new file mode 100644 index 0000000000..2ad8a843cc --- /dev/null +++ b/tests/qemuxmlconfdata/x86_64-q35-acpi.xml @@ -0,0 +1,15 @@ +<domain type='qemu'> + <name>guest</name> + <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> + <memory>4194304</memory> + <vcpu>4</vcpu> + <os> + <type arch='x86_64' machine='q35'>hvm</type> + </os> + <features> + <acpi/> + </features> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + </devices> +</domain> diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c index 4fccc06fcd..ea37a2244a 100644 --- a/tests/qemuxmlconftest.c +++ b/tests/qemuxmlconftest.c @@ -1732,7 +1732,18 @@ mymain(void) DO_TEST_CAPS_LATEST("input-usbmouse"); DO_TEST_CAPS_LATEST("input-usbtablet"); - DO_TEST_CAPS_LATEST("misc-acpi"); + + /* tests for ACPI support handling: + * - x86(_64) and aarch attempt + * - other architectures base the decision based on how qemu reports + * the support for ACPI + * - s390x has hack to strip ACPI to preserve migration of old configs */ + DO_TEST_CAPS_LATEST("x86_64-q35-acpi"); + DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("aarch64-nousb-acpi", "aarch64"); + DO_TEST_CAPS_ARCH_LATEST("loongarch64-virt-acpi", "loongarch64"); + DO_TEST_CAPS_ARCH_LATEST("riscv64-virt-acpi", "riscv64"); + DO_TEST_CAPS_ARCH_LATEST("s390x-ccw-acpi", "s390x"); + DO_TEST_CAPS_LATEST("misc-disable-s3"); DO_TEST_CAPS_LATEST("misc-disable-suspends"); DO_TEST_CAPS_LATEST("misc-enable-s4"); -- 2.45.2

Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com> On 7/31/24 1:02 PM, Peter Krempa wrote:
Replace the 'misc-acpi' case by testing a bunch of architectures for how ACPI is handled including a test for the s390 ACPI strip hack added in previous commit.
Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- .../aarch64-nousb-acpi.aarch64-latest.err | 1 + tests/qemuxmlconfdata/aarch64-nousb-acpi.xml | 18 +++++++ ...ngarch64-virt-acpi.loongarch64-latest.args | 31 +++++++++++ ...ongarch64-virt-acpi.loongarch64-latest.xml | 26 +++++++++ .../qemuxmlconfdata/loongarch64-virt-acpi.xml | 15 ++++++ .../misc-acpi.x86_64-latest.args | 34 ------------ .../misc-acpi.x86_64-latest.xml | 41 -------------- tests/qemuxmlconfdata/misc-acpi.xml | 33 ------------ .../riscv64-virt-acpi.riscv64-latest.args | 33 ++++++++++++ .../riscv64-virt-acpi.riscv64-latest.xml | 36 +++++++++++++ tests/qemuxmlconfdata/riscv64-virt-acpi.xml | 15 ++++++ .../s390x-ccw-acpi.s390x-latest.args | 32 +++++++++++ .../s390x-ccw-acpi.s390x-latest.xml | 27 ++++++++++ tests/qemuxmlconfdata/s390x-ccw-acpi.xml | 15 ++++++ .../x86_64-q35-acpi.x86_64-latest.args | 38 +++++++++++++ .../x86_64-q35-acpi.x86_64-latest.xml | 53 +++++++++++++++++++ tests/qemuxmlconfdata/x86_64-q35-acpi.xml | 15 ++++++ tests/qemuxmlconftest.c | 13 ++++- 18 files changed, 367 insertions(+), 109 deletions(-) create mode 100644 tests/qemuxmlconfdata/aarch64-nousb-acpi.aarch64-latest.err create mode 100644 tests/qemuxmlconfdata/aarch64-nousb-acpi.xml create mode 100644 tests/qemuxmlconfdata/loongarch64-virt-acpi.loongarch64-latest.args create mode 100644 tests/qemuxmlconfdata/loongarch64-virt-acpi.loongarch64-latest.xml create mode 100644 tests/qemuxmlconfdata/loongarch64-virt-acpi.xml delete mode 100644 tests/qemuxmlconfdata/misc-acpi.x86_64-latest.args delete mode 100644 tests/qemuxmlconfdata/misc-acpi.x86_64-latest.xml delete mode 100644 tests/qemuxmlconfdata/misc-acpi.xml create mode 100644 tests/qemuxmlconfdata/riscv64-virt-acpi.riscv64-latest.args create mode 100644 tests/qemuxmlconfdata/riscv64-virt-acpi.riscv64-latest.xml create mode 100644 tests/qemuxmlconfdata/riscv64-virt-acpi.xml create mode 100644 tests/qemuxmlconfdata/s390x-ccw-acpi.s390x-latest.args create mode 100644 tests/qemuxmlconfdata/s390x-ccw-acpi.s390x-latest.xml create mode 100644 tests/qemuxmlconfdata/s390x-ccw-acpi.xml create mode 100644 tests/qemuxmlconfdata/x86_64-q35-acpi.x86_64-latest.args create mode 100644 tests/qemuxmlconfdata/x86_64-q35-acpi.x86_64-latest.xml create mode 100644 tests/qemuxmlconfdata/x86_64-q35-acpi.xml
diff --git a/tests/qemuxmlconfdata/aarch64-nousb-acpi.aarch64-latest.err b/tests/qemuxmlconfdata/aarch64-nousb-acpi.aarch64-latest.err new file mode 100644 index 0000000000..5f379d56ce --- /dev/null +++ b/tests/qemuxmlconfdata/aarch64-nousb-acpi.aarch64-latest.err @@ -0,0 +1 @@ +unsupported configuration: machine type 'borzoi' does not support ACPI diff --git a/tests/qemuxmlconfdata/aarch64-nousb-acpi.xml b/tests/qemuxmlconfdata/aarch64-nousb-acpi.xml new file mode 100644 index 0000000000..0930b3a862 --- /dev/null +++ b/tests/qemuxmlconfdata/aarch64-nousb-acpi.xml @@ -0,0 +1,18 @@ +<domain type='kvm'> + <name>aarch64test</name> + <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid> + <memory unit='KiB'>1048576</memory> + <vcpu placement='static'>1</vcpu> + <os> + <!-- machine type doesn't matter as long as it has no implicit USB --> + <type arch='aarch64' machine='borzoi'>hvm</type> + </os> + <features> + <acpi/> + </features> + <cpu mode='host-passthrough'/> + <devices> + <emulator>/usr/bin/qemu-system-aarch64</emulator> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxmlconfdata/loongarch64-virt-acpi.loongarch64-latest.args b/tests/qemuxmlconfdata/loongarch64-virt-acpi.loongarch64-latest.args new file mode 100644 index 0000000000..e59d833ca9 --- /dev/null +++ b/tests/qemuxmlconfdata/loongarch64-virt-acpi.loongarch64-latest.args @@ -0,0 +1,31 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/var/lib/libvirt/qemu/domain--1-guest \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-guest/.local/share \ +XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-guest/.cache \ +XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \ +/usr/bin/qemu-system-loongarch64 \ +-name guest=guest,debug-threads=on \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \ +-machine virt,usb=off,dump-guest-core=off,memory-backend=loongarch.ram,acpi=on \ +-accel tcg \ +-cpu la464 \ +-m size=4194304k \ +-object '{"qom-type":"memory-backend-ram","id":"loongarch.ram","size":4294967296}' \ +-overcommit mem-lock=off \ +-smp 4,sockets=4,cores=1,threads=1 \ +-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-boot strict=on \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxmlconfdata/loongarch64-virt-acpi.loongarch64-latest.xml b/tests/qemuxmlconfdata/loongarch64-virt-acpi.loongarch64-latest.xml new file mode 100644 index 0000000000..d3ce68c3a3 --- /dev/null +++ b/tests/qemuxmlconfdata/loongarch64-virt-acpi.loongarch64-latest.xml @@ -0,0 +1,26 @@ +<domain type='qemu'> + <name>guest</name> + <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> + <memory unit='KiB'>4194304</memory> + <currentMemory unit='KiB'>4194304</currentMemory> + <vcpu placement='static'>4</vcpu> + <os> + <type arch='loongarch64' machine='virt'>hvm</type> + <boot dev='hd'/> + </os> + <features> + <acpi/> + </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>la464</model> + </cpu> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-loongarch64</emulator> + <controller type='pci' index='0' model='pcie-root'/> + <audio id='1' type='none'/> + </devices> +</domain> diff --git a/tests/qemuxmlconfdata/loongarch64-virt-acpi.xml b/tests/qemuxmlconfdata/loongarch64-virt-acpi.xml new file mode 100644 index 0000000000..1d83f93d88 --- /dev/null +++ b/tests/qemuxmlconfdata/loongarch64-virt-acpi.xml @@ -0,0 +1,15 @@ +<domain type='qemu'> + <name>guest</name> + <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> + <memory>4194304</memory> + <vcpu>4</vcpu> + <features> + <acpi/> + </features> + <os> + <type arch='loongarch64' machine='virt'>hvm</type> + </os> + <devices> + <emulator>/usr/bin/qemu-system-loongarch64</emulator> + </devices> +</domain> diff --git a/tests/qemuxmlconfdata/misc-acpi.x86_64-latest.args b/tests/qemuxmlconfdata/misc-acpi.x86_64-latest.args deleted file mode 100644 index c4e09c0af2..0000000000 --- a/tests/qemuxmlconfdata/misc-acpi.x86_64-latest.args +++ /dev/null @@ -1,34 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \ -USER=test \ -LOGNAME=test \ -XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \ -XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \ -XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -/usr/bin/qemu-system-x86_64 \ --name guest=QEMUGuest1,debug-threads=on \ --S \ --object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \ --machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=on \ --accel tcg \ --cpu qemu64 \ --m size=219136k \ --object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \ --overcommit mem-lock=off \ --smp 1,sockets=1,cores=1,threads=1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ --mon chardev=charmonitor,id=monitor,mode=control \ --rtc base=utc \ --no-shutdown \ --boot strict=on \ --device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ --blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","read-only":false}' \ --device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-storage","id":"ide0-0-0","bootindex":1}' \ --audiodev '{"id":"audio1","driver":"none"}' \ --sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ --msg timestamp=on diff --git a/tests/qemuxmlconfdata/misc-acpi.x86_64-latest.xml b/tests/qemuxmlconfdata/misc-acpi.x86_64-latest.xml deleted file mode 100644 index 176926bb60..0000000000 --- a/tests/qemuxmlconfdata/misc-acpi.x86_64-latest.xml +++ /dev/null @@ -1,41 +0,0 @@ -<domain type='qemu'> - <name>QEMUGuest1</name> - <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> - <memory unit='KiB'>219136</memory> - <currentMemory unit='KiB'>219136</currentMemory> - <vcpu placement='static'>1</vcpu> - <os> - <type arch='x86_64' machine='pc'>hvm</type> - <boot dev='hd'/> - </os> - <features> - <acpi/> - </features> - <cpu mode='custom' match='exact' check='none'> - <model fallback='forbid'>qemu64</model> - </cpu> - <clock offset='utc'/> - <on_poweroff>destroy</on_poweroff> - <on_reboot>restart</on_reboot> - <on_crash>destroy</on_crash> - <devices> - <emulator>/usr/bin/qemu-system-x86_64</emulator> - <disk type='block' device='disk'> - <driver name='qemu' type='raw'/> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='hda' bus='ide'/> - <address type='drive' controller='0' bus='0' target='0' unit='0'/> - </disk> - <controller type='usb' index='0' model='piix3-uhci'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> - </controller> - <controller type='ide' index='0'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> - </controller> - <controller type='pci' index='0' model='pci-root'/> - <input type='mouse' bus='ps2'/> - <input type='keyboard' bus='ps2'/> - <audio id='1' type='none'/> - <memballoon model='none'/> - </devices> -</domain> diff --git a/tests/qemuxmlconfdata/misc-acpi.xml b/tests/qemuxmlconfdata/misc-acpi.xml deleted file mode 100644 index 59fbe471ff..0000000000 --- a/tests/qemuxmlconfdata/misc-acpi.xml +++ /dev/null @@ -1,33 +0,0 @@ -<domain type='qemu'> - <name>QEMUGuest1</name> - <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> - <memory unit='KiB'>219136</memory> - <currentMemory unit='KiB'>219136</currentMemory> - <vcpu placement='static'>1</vcpu> - <os> - <type arch='x86_64' machine='pc'>hvm</type> - <boot dev='hd'/> - </os> - <features> - <acpi/> - </features> - <clock offset='utc'/> - <on_poweroff>destroy</on_poweroff> - <on_reboot>restart</on_reboot> - <on_crash>destroy</on_crash> - <devices> - <emulator>/usr/bin/qemu-system-x86_64</emulator> - <disk type='block' device='disk'> - <driver name='qemu' type='raw'/> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='hda' bus='ide'/> - <address type='drive' controller='0' bus='0' target='0' unit='0'/> - </disk> - <controller type='usb' index='0'/> - <controller type='ide' index='0'/> - <controller type='pci' index='0' model='pci-root'/> - <input type='mouse' bus='ps2'/> - <input type='keyboard' bus='ps2'/> - <memballoon model='none'/> - </devices> -</domain> diff --git a/tests/qemuxmlconfdata/riscv64-virt-acpi.riscv64-latest.args b/tests/qemuxmlconfdata/riscv64-virt-acpi.riscv64-latest.args new file mode 100644 index 0000000000..fcb80b009e --- /dev/null +++ b/tests/qemuxmlconfdata/riscv64-virt-acpi.riscv64-latest.args @@ -0,0 +1,33 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/var/lib/libvirt/qemu/domain--1-guest \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-guest/.local/share \ +XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-guest/.cache \ +XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \ +/usr/bin/qemu-system-riscv64 \ +-name guest=guest,debug-threads=on \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \ +-machine virt,usb=off,dump-guest-core=off,memory-backend=riscv_virt_board.ram \ +-accel tcg \ +-m size=4194304k \ +-object '{"qom-type":"memory-backend-ram","id":"riscv_virt_board.ram","size":4294967296}' \ +-overcommit mem-lock=off \ +-smp 4,sockets=4,cores=1,threads=1 \ +-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-boot strict=on \ +-device '{"driver":"pcie-root-port","port":8,"chassis":1,"id":"pci.1","bus":"pcie.0","multifunction":true,"addr":"0x1"}' \ +-device '{"driver":"pcie-root-port","port":9,"chassis":2,"id":"pci.2","bus":"pcie.0","addr":"0x1.0x1"}' \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.1","addr":"0x0"}' \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxmlconfdata/riscv64-virt-acpi.riscv64-latest.xml b/tests/qemuxmlconfdata/riscv64-virt-acpi.riscv64-latest.xml new file mode 100644 index 0000000000..075708df9c --- /dev/null +++ b/tests/qemuxmlconfdata/riscv64-virt-acpi.riscv64-latest.xml @@ -0,0 +1,36 @@ +<domain type='qemu'> + <name>guest</name> + <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> + <memory unit='KiB'>4194304</memory> + <currentMemory unit='KiB'>4194304</currentMemory> + <vcpu placement='static'>4</vcpu> + <os> + <type arch='riscv64' machine='virt'>hvm</type> + <boot dev='hd'/> + </os> + <features> + <acpi/> + </features> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-riscv64</emulator> + <controller type='pci' index='0' model='pcie-root'/> + <controller type='pci' index='1' model='pcie-root-port'> + <model name='pcie-root-port'/> + <target chassis='1' port='0x8'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/> + </controller> + <controller type='pci' index='2' model='pcie-root-port'> + <model name='pcie-root-port'/> + <target chassis='2' port='0x9'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> + <audio id='1' type='none'/> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxmlconfdata/riscv64-virt-acpi.xml b/tests/qemuxmlconfdata/riscv64-virt-acpi.xml new file mode 100644 index 0000000000..1e2dff1b17 --- /dev/null +++ b/tests/qemuxmlconfdata/riscv64-virt-acpi.xml @@ -0,0 +1,15 @@ +<domain type='qemu'> + <name>guest</name> + <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> + <memory>4194304</memory> + <vcpu>4</vcpu> + <features> + <acpi/> + </features> + <os> + <type arch='riscv64' machine='virt'>hvm</type> + </os> + <devices> + <emulator>/usr/bin/qemu-system-riscv64</emulator> + </devices> +</domain> diff --git a/tests/qemuxmlconfdata/s390x-ccw-acpi.s390x-latest.args b/tests/qemuxmlconfdata/s390x-ccw-acpi.s390x-latest.args new file mode 100644 index 0000000000..84098e580e --- /dev/null +++ b/tests/qemuxmlconfdata/s390x-ccw-acpi.s390x-latest.args @@ -0,0 +1,32 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/var/lib/libvirt/qemu/domain--1-guest \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-guest/.local/share \ +XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-guest/.cache \ +XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \ +/usr/bin/qemu-system-s390x \ +-name guest=guest,debug-threads=on \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \ +-machine s390-ccw-virtio,usb=off,dump-guest-core=off,memory-backend=s390.ram \ +-accel tcg \ +-cpu qemu \ +-m size=4194304k \ +-object '{"qom-type":"memory-backend-ram","id":"s390.ram","size":4294967296}' \ +-overcommit mem-lock=off \ +-smp 4,sockets=4,cores=1,threads=1 \ +-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-boot strict=on \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-device '{"driver":"virtio-balloon-ccw","id":"balloon0","devno":"fe.0.0000"}' \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxmlconfdata/s390x-ccw-acpi.s390x-latest.xml b/tests/qemuxmlconfdata/s390x-ccw-acpi.s390x-latest.xml new file mode 100644 index 0000000000..df8e578212 --- /dev/null +++ b/tests/qemuxmlconfdata/s390x-ccw-acpi.s390x-latest.xml @@ -0,0 +1,27 @@ +<domain type='qemu'> + <name>guest</name> + <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> + <memory unit='KiB'>4194304</memory> + <currentMemory unit='KiB'>4194304</currentMemory> + <vcpu placement='static'>4</vcpu> + <os> + <type arch='s390x' machine='s390-ccw-virtio'>hvm</type> + <boot dev='hd'/> + </os> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu</model> + </cpu> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-s390x</emulator> + <controller type='pci' index='0' model='pci-root'/> + <audio id='1' type='none'/> + <memballoon model='virtio'> + <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/> + </memballoon> + <panic model='s390'/> + </devices> +</domain> diff --git a/tests/qemuxmlconfdata/s390x-ccw-acpi.xml b/tests/qemuxmlconfdata/s390x-ccw-acpi.xml new file mode 100644 index 0000000000..b7be060c66 --- /dev/null +++ b/tests/qemuxmlconfdata/s390x-ccw-acpi.xml @@ -0,0 +1,15 @@ +<domain type='qemu'> + <name>guest</name> + <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> + <memory>4194304</memory> + <vcpu>4</vcpu> + <features> + <acpi/> + </features> + <os> + <type arch='s390x' machine='s390-ccw-virtio'>hvm</type> + </os> + <devices> + <emulator>/usr/bin/qemu-system-s390x</emulator> + </devices> +</domain> diff --git a/tests/qemuxmlconfdata/x86_64-q35-acpi.x86_64-latest.args b/tests/qemuxmlconfdata/x86_64-q35-acpi.x86_64-latest.args new file mode 100644 index 0000000000..bced7b2530 --- /dev/null +++ b/tests/qemuxmlconfdata/x86_64-q35-acpi.x86_64-latest.args @@ -0,0 +1,38 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/var/lib/libvirt/qemu/domain--1-guest \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-guest/.local/share \ +XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-guest/.cache \ +XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \ +/usr/bin/qemu-system-x86_64 \ +-name guest=guest,debug-threads=on \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \ +-machine q35,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=on \ +-accel tcg \ +-cpu qemu64 \ +-m size=4194304k \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":4294967296}' \ +-overcommit mem-lock=off \ +-smp 4,sockets=4,cores=1,threads=1 \ +-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-boot strict=on \ +-device '{"driver":"pcie-root-port","port":8,"chassis":1,"id":"pci.1","bus":"pcie.0","multifunction":true,"addr":"0x1"}' \ +-device '{"driver":"pcie-root-port","port":9,"chassis":2,"id":"pci.2","bus":"pcie.0","addr":"0x1.0x1"}' \ +-device '{"driver":"pcie-root-port","port":10,"chassis":3,"id":"pci.3","bus":"pcie.0","addr":"0x1.0x2"}' \ +-device '{"driver":"qemu-xhci","id":"usb","bus":"pci.1","addr":"0x0"}' \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-global ICH9-LPC.noreboot=off \ +-watchdog-action reset \ +-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.2","addr":"0x0"}' \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxmlconfdata/x86_64-q35-acpi.x86_64-latest.xml b/tests/qemuxmlconfdata/x86_64-q35-acpi.x86_64-latest.xml new file mode 100644 index 0000000000..95ca4b6e42 --- /dev/null +++ b/tests/qemuxmlconfdata/x86_64-q35-acpi.x86_64-latest.xml @@ -0,0 +1,53 @@ +<domain type='qemu'> + <name>guest</name> + <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> + <memory unit='KiB'>4194304</memory> + <currentMemory unit='KiB'>4194304</currentMemory> + <vcpu placement='static'>4</vcpu> + <os> + <type arch='x86_64' machine='q35'>hvm</type> + <boot dev='hd'/> + </os> + <features> + <acpi/> + </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='usb' index='0' model='qemu-xhci'> + <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/> + </controller> + <controller type='sata' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/> + </controller> + <controller type='pci' index='0' model='pcie-root'/> + <controller type='pci' index='1' model='pcie-root-port'> + <model name='pcie-root-port'/> + <target chassis='1' port='0x8'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/> + </controller> + <controller type='pci' index='2' model='pcie-root-port'> + <model name='pcie-root-port'/> + <target chassis='2' port='0x9'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> + <controller type='pci' index='3' model='pcie-root-port'> + <model name='pcie-root-port'/> + <target chassis='3' port='0xa'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <audio id='1' type='none'/> + <watchdog model='itco' action='reset'/> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxmlconfdata/x86_64-q35-acpi.xml b/tests/qemuxmlconfdata/x86_64-q35-acpi.xml new file mode 100644 index 0000000000..2ad8a843cc --- /dev/null +++ b/tests/qemuxmlconfdata/x86_64-q35-acpi.xml @@ -0,0 +1,15 @@ +<domain type='qemu'> + <name>guest</name> + <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> + <memory>4194304</memory> + <vcpu>4</vcpu> + <os> + <type arch='x86_64' machine='q35'>hvm</type> + </os> + <features> + <acpi/> + </features> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + </devices> +</domain> diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c index 4fccc06fcd..ea37a2244a 100644 --- a/tests/qemuxmlconftest.c +++ b/tests/qemuxmlconftest.c @@ -1732,7 +1732,18 @@ mymain(void)
DO_TEST_CAPS_LATEST("input-usbmouse"); DO_TEST_CAPS_LATEST("input-usbtablet"); - DO_TEST_CAPS_LATEST("misc-acpi"); + + /* tests for ACPI support handling: + * - x86(_64) and aarch attempt + * - other architectures base the decision based on how qemu reports + * the support for ACPI + * - s390x has hack to strip ACPI to preserve migration of old configs */ + DO_TEST_CAPS_LATEST("x86_64-q35-acpi"); + DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("aarch64-nousb-acpi", "aarch64"); + DO_TEST_CAPS_ARCH_LATEST("loongarch64-virt-acpi", "loongarch64"); + DO_TEST_CAPS_ARCH_LATEST("riscv64-virt-acpi", "riscv64"); + DO_TEST_CAPS_ARCH_LATEST("s390x-ccw-acpi", "s390x"); + DO_TEST_CAPS_LATEST("misc-disable-s3"); DO_TEST_CAPS_LATEST("misc-disable-suspends"); DO_TEST_CAPS_LATEST("misc-enable-s4");
-- Mit freundlichen Grüßen/Kind regards Boris Fiuczynski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Wolfgang Wendt Geschäftsführung: David Faller Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294

On Wed, Jul 31, 2024 at 01:02:27PM GMT, Peter Krempa wrote:
+++ b/tests/qemuxmlconfdata/aarch64-nousb-acpi.xml @@ -0,0 +1,18 @@ +<domain type='kvm'> + <name>aarch64test</name> + <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid> + <memory unit='KiB'>1048576</memory> + <vcpu placement='static'>1</vcpu> + <os> + <!-- machine type doesn't matter as long as it has no implicit USB --> + <type arch='aarch64' machine='borzoi'>hvm</type> + </os>
The relationship between having implicit USB and being able to use ACPI is not explained. I could probably figure it out by looking at the code, but I think it would be better if the comment was expanded to include this information.
+++ b/tests/qemuxmlconfdata/riscv64-virt-acpi.xml @@ -0,0 +1,15 @@ +<domain type='qemu'> + <name>guest</name> + <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> + <memory>4194304</memory> + <vcpu>4</vcpu> + <features> + <acpi/> + </features> + <os> + <type arch='riscv64' machine='virt'>hvm</type> + </os> + <devices> + <emulator>/usr/bin/qemu-system-riscv64</emulator> + </devices> +</domain>
Here and in a few other input files you've put the <features> element before the <os> element, which of course our parser is perfectly capable of handling but it just looks... Off to the human eye :) For this input file in particular, you could add <memballoon model='none'/> which would make for slighly smaller output files. I'd personally just include that (as well as the USB equivalent) in every file, just to ensure minimal hardware while making it easier to compare them.
+++ b/tests/qemuxmlconftest.c @@ -1732,7 +1732,18 @@ mymain(void)
DO_TEST_CAPS_LATEST("input-usbmouse"); DO_TEST_CAPS_LATEST("input-usbtablet"); - DO_TEST_CAPS_LATEST("misc-acpi"); + + /* tests for ACPI support handling: + * - x86(_64) and aarch attempt
Incomplete sentence? Also it's aarch64.
+ * - other architectures base the decision based on how qemu reports + * the support for ACPI + * - s390x has hack to strip ACPI to preserve migration of old configs */ + DO_TEST_CAPS_LATEST("x86_64-q35-acpi"); + DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("aarch64-nousb-acpi", "aarch64");
We should have a positive test for aarch64 which uses the virt machine type and has ACPI enabled. -- Andrea Bolognani / Red Hat / Virtualization

On Thu, Aug 01, 2024 at 02:46:34 -0700, Andrea Bolognani wrote:
On Wed, Jul 31, 2024 at 01:02:27PM GMT, Peter Krempa wrote:
+++ b/tests/qemuxmlconfdata/aarch64-nousb-acpi.xml @@ -0,0 +1,18 @@ +<domain type='kvm'> + <name>aarch64test</name> + <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid> + <memory unit='KiB'>1048576</memory> + <vcpu placement='static'>1</vcpu> + <os> + <!-- machine type doesn't matter as long as it has no implicit USB --> + <type arch='aarch64' machine='borzoi'>hvm</type> + </os>
The relationship between having implicit USB and being able to use ACPI is not explained. I could probably figure it out by looking at the code, but I think it would be better if the comment was expanded to include this information.
The comment is a leftover from copying aarch64-nousb-minimal. I should have removed the nousb part and went with a specific machine type name.
+++ b/tests/qemuxmlconfdata/riscv64-virt-acpi.xml @@ -0,0 +1,15 @@ +<domain type='qemu'> + <name>guest</name> + <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> + <memory>4194304</memory> + <vcpu>4</vcpu> + <features> + <acpi/> + </features> + <os> + <type arch='riscv64' machine='virt'>hvm</type> + </os> + <devices> + <emulator>/usr/bin/qemu-system-riscv64</emulator> + </devices> +</domain>
Here and in a few other input files you've put the <features> element before the <os> element, which of course our parser is perfectly capable of handling but it just looks... Off to the human eye :)
Welp. I've added it manually. I can move it or we can say it is testing the XML parser.
For this input file in particular, you could add
<memballoon model='none'/>
Once again, I've copied riscv64-virt-minimal. Seems like it's missing there in the first place.
which would make for slighly smaller output files. I'd personally just include that (as well as the USB equivalent) in every file, just to ensure minimal hardware while making it easier to compare them.
+++ b/tests/qemuxmlconftest.c @@ -1732,7 +1732,18 @@ mymain(void)
DO_TEST_CAPS_LATEST("input-usbmouse"); DO_TEST_CAPS_LATEST("input-usbtablet"); - DO_TEST_CAPS_LATEST("misc-acpi"); + + /* tests for ACPI support handling: + * - x86(_64) and aarch attempt
Incomplete sentence? Also it's aarch64.
eh, right
+ * - other architectures base the decision based on how qemu reports + * the support for ACPI + * - s390x has hack to strip ACPI to preserve migration of old configs */ + DO_TEST_CAPS_LATEST("x86_64-q35-acpi"); + DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("aarch64-nousb-acpi", "aarch64");
We should have a positive test for aarch64 which uses the virt machine type and has ACPI enabled.
We do have that already in the code which is testing also the appripriate UEFI firmware selection for it, which is the exact reason I didn't duplicate it here. I can add a comment if you feel like that.

On Thu, Aug 01, 2024 at 12:06:57PM GMT, Peter Krempa wrote:
On Thu, Aug 01, 2024 at 02:46:34 -0700, Andrea Bolognani wrote:
On Wed, Jul 31, 2024 at 01:02:27PM GMT, Peter Krempa wrote:
+ <!-- machine type doesn't matter as long as it has no implicit USB --> + <type arch='aarch64' machine='borzoi'>hvm</type>
The relationship between having implicit USB and being able to use ACPI is not explained. I could probably figure it out by looking at the code, but I think it would be better if the comment was expanded to include this information.
The comment is a leftover from copying aarch64-nousb-minimal. I should have removed the nousb part and went with a specific machine type name.
That explains it.
+ <features> + <acpi/> + </features> + <os> + <type arch='riscv64' machine='virt'>hvm</type> + </os>
Here and in a few other input files you've put the <features> element before the <os> element, which of course our parser is perfectly capable of handling but it just looks... Off to the human eye :)
Welp. I've added it manually. I can move it or we can say it is testing the XML parser.
I have a mild preference for the former. Keep in mind that there's a very real chance that, in a while, I will forget this conversation, re-discover the out-of-order elements, and post a patch shuffling them around :D
For this input file in particular, you could add
<memballoon model='none'/>
Once again, I've copied riscv64-virt-minimal. Seems like it's missing there in the first place.
In that case it's very intentional: the *-minimal test cases are supposed to show what kind of controllers and devices libvirt will automatically add when presented with an XML that doesn't contain any. The fact that some of the output files have memballoon and some don't is exactly the point.
+ DO_TEST_CAPS_LATEST("x86_64-q35-acpi"); + DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("aarch64-nousb-acpi", "aarch64");
We should have a positive test for aarch64 which uses the virt machine type and has ACPI enabled.
We do have that already in the code which is testing also the appripriate UEFI firmware selection for it, which is the exact reason I didn't duplicate it here. I can add a comment if you feel like that.
Makes sense. A small comment would be appreciated. -- Andrea Bolognani / Red Hat / Virtualization
participants (3)
-
Andrea Bolognani
-
Boris Fiuczynski
-
Peter Krempa