libvirt/0002-qemu-Use-GICv2-for-aarch64-virt-TCG-guests.patch
Cole Robinson 262bbf08f2 Fix aarch64 gic default for non-kvm VMs (bz #1449837)
Don't run libvirtd in live environment, to avoid network collision (bz #1146232)
2017-05-30 18:57:48 -04:00

86 lines
3.6 KiB
Diff

From: Andrea Bolognani <abologna@redhat.com>
Date: Fri, 12 May 2017 13:29:57 +0200
Subject: [PATCH] qemu: Use GICv2 for aarch64/virt TCG guests
There are currently some limitations in the emulated GICv3
that make it unsuitable as a default. Use GICv2 instead.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1450433
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
(cherry picked from commit bc07101a7c2cd2ce07ad1ca28c47e0a7cde5625d)
---
src/qemu/qemu_domain.c | 23 +++++++++++++++++++++-
.../qemuxml2argv-aarch64-gic-none-tcg.args | 2 +-
.../qemuxml2xmlout-aarch64-gic-none-tcg.xml | 2 +-
3 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 589eb18..891f825 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2527,6 +2527,24 @@ qemuDomainDefEnableDefaultFeatures(virDomainDefPtr def,
for (version = VIR_GIC_VERSION_LAST - 1;
version > VIR_GIC_VERSION_NONE;
version--) {
+
+ /* We want to use the highest available GIC version for guests;
+ * however, the emulated GICv3 is currently lacking a MSI controller,
+ * making it unsuitable for the pure PCIe topology we aim for.
+ *
+ * For that reason, we skip this step entirely for TCG guests,
+ * and rely on the code below to pick the default version, GICv2,
+ * which supports all the features we need.
+ *
+ * We'll want to revisit this once MSI support for GICv3 has been
+ * implemented in QEMU.
+ *
+ * See https://bugzilla.redhat.com/show_bug.cgi?id=1414081 */
+ if (version == VIR_GIC_VERSION_3 &&
+ def->virtType == VIR_DOMAIN_VIRT_QEMU) {
+ continue;
+ }
+
if (virQEMUCapsSupportsGICVersion(qemuCaps,
def->virtType,
version)) {
@@ -2544,8 +2562,11 @@ qemuDomainDefEnableDefaultFeatures(virDomainDefPtr def,
/* Use the default GIC version if no version was specified */
if (def->features[VIR_DOMAIN_FEATURE_GIC] == VIR_TRISTATE_SWITCH_ON &&
- def->gic_version == VIR_GIC_VERSION_NONE)
+ def->gic_version == VIR_GIC_VERSION_NONE) {
+ VIR_DEBUG("Using GIC version %s (default)",
+ virGICVersionTypeToString(VIR_GIC_VERSION_DEFAULT));
def->gic_version = VIR_GIC_VERSION_DEFAULT;
+ }
}
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-tcg.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-tcg.args
index 975a014..52b6996 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-tcg.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-tcg.args
@@ -7,7 +7,7 @@ QEMU_AUDIO_DRV=none \
/usr/bin/qemu-system-aarch64 \
-name guest \
-S \
--machine virt,accel=tcg,gic-version=3 \
+-machine virt,accel=tcg \
-cpu cortex-a57 \
-m 1024 \
-smp 1,sockets=1,cores=1,threads=1 \
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gic-none-tcg.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gic-none-tcg.xml
index 69510e2..a0cd0b7 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gic-none-tcg.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gic-none-tcg.xml
@@ -9,7 +9,7 @@
<boot dev='hd'/>
</os>
<features>
- <gic version='3'/>
+ <gic version='2'/>
</features>
<cpu mode='custom' match='exact' check='none'>
<model fallback='allow'>cortex-a57</model>