render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
6d3351
From 2106b821cd1eef809853f7424edf8660732b1303 Mon Sep 17 00:00:00 2001
6d3351
Message-Id: <2106b821cd1eef809853f7424edf8660732b1303@dist-git>
6d3351
From: Andrea Bolognani <abologna@redhat.com>
6d3351
Date: Tue, 4 Apr 2017 14:59:30 +0200
6d3351
Subject: [PATCH] qemu: Advertise ACPI support for aarch64 guests
6d3351
6d3351
So far, libvirt has assumed that only x86 supports ACPI,
6d3351
but that's inaccurate since aarch64 supports it too.
6d3351
6d3351
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1429509
6d3351
6d3351
(cherry picked from commit 560335c35c830344329c16cb1f25f887344bdfd8)
6d3351
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6d3351
---
6d3351
 src/qemu/qemu_capabilities.c                       | 28 ++++++++++++++++------
6d3351
 .../caps_2.6.0-gicv2.aarch64.xml                   |  1 +
6d3351
 .../caps_2.6.0-gicv3.aarch64.xml                   |  1 +
6d3351
 .../qemuxml2argv-aarch64-gic-host.args             |  1 +
6d3351
 .../qemuxml2argv-aarch64-gic-v2.args               |  1 +
6d3351
 .../qemuxml2argv-aarch64-gic-v3.args               |  1 +
6d3351
 6 files changed, 26 insertions(+), 7 deletions(-)
6d3351
6d3351
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
6d3351
index 9d0a29732..a8125102c 100644
6d3351
--- a/src/qemu/qemu_capabilities.c
6d3351
+++ b/src/qemu/qemu_capabilities.c
6d3351
@@ -1043,13 +1043,17 @@ virQEMUCapsInitGuestFromBinary(virCapsPtr caps,
6d3351
 
6d3351
         machines = NULL;
6d3351
         nmachines = 0;
6d3351
+    }
6d3351
 
6d3351
+    if ((ARCH_IS_X86(guestarch) || guestarch == VIR_ARCH_AARCH64) &&
6d3351
+        virCapabilitiesAddGuestFeature(guest, "acpi", true, true) == NULL) {
6d3351
+        goto cleanup;
6d3351
     }
6d3351
 
6d3351
     if (ARCH_IS_X86(guestarch) &&
6d3351
-        (virCapabilitiesAddGuestFeature(guest, "acpi", true, true) == NULL ||
6d3351
-         virCapabilitiesAddGuestFeature(guest, "apic", true, false) == NULL))
6d3351
+        virCapabilitiesAddGuestFeature(guest, "apic", true, false) == NULL) {
6d3351
         goto cleanup;
6d3351
+    }
6d3351
 
6d3351
     if ((guestarch == VIR_ARCH_I686) &&
6d3351
         (virCapabilitiesAddGuestFeature(guest, "pae", true, false) == NULL ||
6d3351
@@ -4181,10 +4185,15 @@ virQEMUCapsInitHelp(virQEMUCapsPtr qemuCaps, uid_t runUid, gid_t runGid, const c
6d3351
                                 qmperr) < 0)
6d3351
         goto cleanup;
6d3351
 
6d3351
-    /* -no-acpi is not supported on non-x86
6d3351
-     * even if qemu reports it in -help */
6d3351
-    if (!ARCH_IS_X86(qemuCaps->arch))
6d3351
+    /* Older QEMU versions reported -no-acpi in the output of -help even
6d3351
+     * though it was not supported by the architecture. The issue has since
6d3351
+     * been fixed, but to maintain compatibility with all release we still
6d3351
+     * need to filter out the capability for architectures that we know
6d3351
+     * don't support the feature, eg. anything but x86 and aarch64 */
6d3351
+    if (!ARCH_IS_X86(qemuCaps->arch) &&
6d3351
+        qemuCaps->arch != VIR_ARCH_AARCH64) {
6d3351
         virQEMUCapsClear(qemuCaps, QEMU_CAPS_NO_ACPI);
6d3351
+    }
6d3351
 
6d3351
     /* virQEMUCapsExtractDeviceStr will only set additional caps if qemu
6d3351
      * understands the 0.13.0+ notion of "-device driver,".  */
6d3351
@@ -4305,9 +4314,14 @@ virQEMUCapsInitQMPArch(virQEMUCapsPtr qemuCaps,
6d3351
 void
6d3351
 virQEMUCapsInitQMPBasicArch(virQEMUCapsPtr qemuCaps)
6d3351
 {
6d3351
-    /* ACPI/HPET/KVM PIT are x86 specific */
6d3351
-    if (ARCH_IS_X86(qemuCaps->arch)) {
6d3351
+    /* ACPI only works on x86 and aarch64 */
6d3351
+    if (ARCH_IS_X86(qemuCaps->arch) ||
6d3351
+        qemuCaps->arch == VIR_ARCH_AARCH64) {
6d3351
         virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_ACPI);
6d3351
+    }
6d3351
+
6d3351
+    /* HPET and KVM PIT are x86 specific */
6d3351
+    if (ARCH_IS_X86(qemuCaps->arch)) {
6d3351
         virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_HPET);
6d3351
         virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_KVM_PIT);
6d3351
     }
6d3351
diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml
6d3351
index c1e46794a..af3a8e7cb 100644
6d3351
--- a/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml
6d3351
+++ b/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml
6d3351
@@ -40,6 +40,7 @@
6d3351
   <flag name='no-shutdown'/>
6d3351
   <flag name='cache-unsafe'/>
6d3351
   <flag name='ich9-ahci'/>
6d3351
+  <flag name='no-acpi'/>
6d3351
   <flag name='fsdev-readonly'/>
6d3351
   <flag name='virtio-blk-pci.scsi'/>
6d3351
   <flag name='drive-copy-on-read'/>
6d3351
diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml
6d3351
index 20dfda216..4402ffa6f 100644
6d3351
--- a/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml
6d3351
+++ b/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml
6d3351
@@ -40,6 +40,7 @@
6d3351
   <flag name='no-shutdown'/>
6d3351
   <flag name='cache-unsafe'/>
6d3351
   <flag name='ich9-ahci'/>
6d3351
+  <flag name='no-acpi'/>
6d3351
   <flag name='fsdev-readonly'/>
6d3351
   <flag name='virtio-blk-pci.scsi'/>
6d3351
   <flag name='drive-copy-on-read'/>
6d3351
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-host.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-host.args
6d3351
index 5fdaa08ef..23276ad71 100644
6d3351
--- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-host.args
6d3351
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-host.args
6d3351
@@ -15,4 +15,5 @@ QEMU_AUDIO_DRV=none \
6d3351
 -nographic \
6d3351
 -nodefaults \
6d3351
 -monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \
6d3351
+-no-acpi \
6d3351
 -boot c
6d3351
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v2.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v2.args
6d3351
index 2caf1b92c..f79c1c60e 100644
6d3351
--- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v2.args
6d3351
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v2.args
6d3351
@@ -15,4 +15,5 @@ QEMU_AUDIO_DRV=none \
6d3351
 -nographic \
6d3351
 -nodefaults \
6d3351
 -monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \
6d3351
+-no-acpi \
6d3351
 -boot c
6d3351
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v3.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v3.args
6d3351
index 3ae8e5f86..fce9308b0 100644
6d3351
--- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v3.args
6d3351
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v3.args
6d3351
@@ -15,4 +15,5 @@ QEMU_AUDIO_DRV=none \
6d3351
 -nographic \
6d3351
 -nodefaults \
6d3351
 -monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \
6d3351
+-no-acpi \
6d3351
 -boot c
6d3351
-- 
6d3351
2.12.2
6d3351