mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
qemu: Format gic-version=2 on the command line
Up until now we have only formatted non-default GIC versions on the command line, in order to maintain compatibility with older QEMU versions that didn't implement the gic-version option to begin with; however, doing so is entirely unnecessary for newer QEMU versions, where the option is available. Moreover, having the GIC version formatted on the command line at all times ensures that QEMU changing its own defaults doesn't affect the ABI of libvirt guests. A few test cases are removed to avoid extra churn. It doesn't matter for coverage, as those scenarios are already covered by other parts of the test suite. This patch is better viewed with 'git show -w'. Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
4d7384eb9d
commit
550950e5b3
@ -7295,12 +7295,25 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
|
||||
goto cleanup;
|
||||
|
||||
if (def->features[VIR_DOMAIN_FEATURE_GIC] == VIR_TRISTATE_SWITCH_ON) {
|
||||
if (def->gic_version != VIR_GIC_VERSION_NONE) {
|
||||
/* The default GIC version (GICv2) should not be specified on
|
||||
* the QEMU commandline for backwards compatibility reasons */
|
||||
if (def->gic_version != VIR_GIC_VERSION_2) {
|
||||
if (!virQEMUCapsGet(qemuCaps,
|
||||
QEMU_CAPS_MACH_VIRT_GIC_VERSION)) {
|
||||
bool hasGICVersionOption = virQEMUCapsGet(qemuCaps,
|
||||
QEMU_CAPS_MACH_VIRT_GIC_VERSION);
|
||||
|
||||
switch ((virGICVersion) def->gic_version) {
|
||||
case VIR_GIC_VERSION_2:
|
||||
if (!hasGICVersionOption) {
|
||||
/* If the gic-version option is not available, we can't
|
||||
* configure the GIC; however, we know that before the
|
||||
* option was introduced the guests would always get a
|
||||
* GICv2, so in order to maintain compatibility with
|
||||
* those old QEMU versions all we need to do is stop
|
||||
* early instead of erroring out */
|
||||
break;
|
||||
}
|
||||
ATTRIBUTE_FALLTHROUGH;
|
||||
|
||||
case VIR_GIC_VERSION_3:
|
||||
case VIR_GIC_VERSION_HOST:
|
||||
if (!hasGICVersionOption) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("gic-version option is not available "
|
||||
"with this QEMU binary"));
|
||||
@ -7309,7 +7322,12 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
|
||||
|
||||
virBufferAsprintf(&buf, ",gic-version=%s",
|
||||
virGICVersionTypeToString(def->gic_version));
|
||||
}
|
||||
break;
|
||||
|
||||
case VIR_GIC_VERSION_NONE:
|
||||
case VIR_GIC_VERSION_LAST:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ QEMU_AUDIO_DRV=none \
|
||||
/usr/bin/qemu-system-aarch64 \
|
||||
-name guest \
|
||||
-S \
|
||||
-machine virt,accel=tcg \
|
||||
-machine virt,accel=tcg,gic-version=2 \
|
||||
-cpu cortex-a57 \
|
||||
-m 1024 \
|
||||
-smp 1,sockets=1,cores=1,threads=1 \
|
||||
|
@ -7,7 +7,7 @@ QEMU_AUDIO_DRV=none \
|
||||
/usr/bin/qemu-system-aarch64 \
|
||||
-name aarch64test \
|
||||
-S \
|
||||
-machine virt,accel=kvm \
|
||||
-machine virt,accel=kvm,gic-version=2 \
|
||||
-cpu host \
|
||||
-m 1024 \
|
||||
-smp 1,sockets=1,cores=1,threads=1 \
|
||||
|
@ -2652,8 +2652,6 @@ mymain(void)
|
||||
DO_TEST("aarch64-cpu-passthrough",
|
||||
QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
|
||||
QEMU_CAPS_KVM);
|
||||
DO_TEST_GIC("aarch64-gic-none", GIC_NONE,
|
||||
QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT);
|
||||
DO_TEST_GIC("aarch64-gic-none", GIC_NONE,
|
||||
QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT,
|
||||
QEMU_CAPS_MACH_VIRT_GIC_VERSION);
|
||||
@ -2669,8 +2667,6 @@ mymain(void)
|
||||
DO_TEST_GIC("aarch64-gic-none-tcg", GIC_BOTH,
|
||||
QEMU_CAPS_MACHINE_OPT,
|
||||
QEMU_CAPS_MACH_VIRT_GIC_VERSION);
|
||||
DO_TEST_GIC("aarch64-gic-default", GIC_NONE,
|
||||
QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT);
|
||||
DO_TEST_GIC("aarch64-gic-default", GIC_NONE,
|
||||
QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT,
|
||||
QEMU_CAPS_MACH_VIRT_GIC_VERSION);
|
||||
@ -2683,8 +2679,6 @@ mymain(void)
|
||||
DO_TEST_GIC("aarch64-gic-default-both", GIC_BOTH,
|
||||
QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT,
|
||||
QEMU_CAPS_MACH_VIRT_GIC_VERSION);
|
||||
DO_TEST_GIC("aarch64-gic-v2", GIC_NONE,
|
||||
QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT);
|
||||
DO_TEST_GIC("aarch64-gic-v2", GIC_NONE,
|
||||
QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT,
|
||||
QEMU_CAPS_MACH_VIRT_GIC_VERSION);
|
||||
|
Loading…
x
Reference in New Issue
Block a user