[PATCH 4/4] qemu: Use pvpanic by default on aarch64

Andrea Bolognani posted 4 patches 2 months, 4 weeks ago
[PATCH 4/4] qemu: Use pvpanic by default on aarch64
Posted by Andrea Bolognani 2 months, 4 weeks ago
pvpanic-pci is the only reasonable implementation of a panic
device for aarch64/virt guests. Right now we're asking users to
provide the model name manually, but we can be more helpful and
fill it in automatically instead.

With this change, the aarch64-panic-no-model test no longer
fails and so it's no longer useful to us. Instead, we can amend
the aarch64-virt-default-models test case to include panic
coverage, something that until now wasn't possible.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 src/qemu/qemu_domain.c                              |  3 +++
 .../aarch64-panic-no-model.aarch64-latest.err       |  1 -
 tests/qemuxmlconfdata/aarch64-panic-no-model.xml    | 13 -------------
 ...rt-default-models.aarch64-latest.abi-update.args |  1 +
 ...irt-default-models.aarch64-latest.abi-update.xml |  3 +++
 .../aarch64-virt-default-models.aarch64-latest.args |  1 +
 .../aarch64-virt-default-models.aarch64-latest.xml  |  3 +++
 .../qemuxmlconfdata/aarch64-virt-default-models.xml |  2 +-
 tests/qemuxmlconftest.c                             |  1 -
 9 files changed, 12 insertions(+), 16 deletions(-)
 delete mode 100644 tests/qemuxmlconfdata/aarch64-panic-no-model.aarch64-latest.err
 delete mode 100644 tests/qemuxmlconfdata/aarch64-panic-no-model.xml

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 0cc335eb30..4b3b5077e0 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4162,6 +4162,9 @@ qemuDomainDefaultPanicModel(const virDomainDef *def)
     if (ARCH_IS_X86(def->os.arch))
         return VIR_DOMAIN_PANIC_MODEL_ISA;
 
+    if (qemuDomainIsARMVirt(def))
+        return VIR_DOMAIN_PANIC_MODEL_PVPANIC;
+
     return VIR_DOMAIN_PANIC_MODEL_DEFAULT;
 }
 
diff --git a/tests/qemuxmlconfdata/aarch64-panic-no-model.aarch64-latest.err b/tests/qemuxmlconfdata/aarch64-panic-no-model.aarch64-latest.err
deleted file mode 100644
index 139249bbc5..0000000000
--- a/tests/qemuxmlconfdata/aarch64-panic-no-model.aarch64-latest.err
+++ /dev/null
@@ -1 +0,0 @@
-unsupported configuration: no panic model provided, and no default for the architecture and machine type
diff --git a/tests/qemuxmlconfdata/aarch64-panic-no-model.xml b/tests/qemuxmlconfdata/aarch64-panic-no-model.xml
deleted file mode 100644
index 5207e48bbd..0000000000
--- a/tests/qemuxmlconfdata/aarch64-panic-no-model.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<domain type='qemu'>
-  <name>guest</name>
-  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
-  <memory>4194304</memory>
-  <vcpu>4</vcpu>
-  <os>
-    <type arch='aarch64' machine='virt'>hvm</type>
-  </os>
-  <devices>
-    <emulator>/usr/bin/qemu-system-aarch64</emulator>
-    <panic/>
-  </devices>
-</domain>
diff --git a/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.abi-update.args b/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.abi-update.args
index a503f45d0c..96fb251d80 100644
--- a/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.abi-update.args
+++ b/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.abi-update.args
@@ -44,4 +44,5 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -device '{"driver":"virtio-gpu-pci","id":"video0","max_outputs":1,"bus":"pci.5","addr":"0x0"}' \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-device '{"driver":"pvpanic-pci","bus":"pcie.0","addr":"0x2"}' \
 -msg timestamp=on
diff --git a/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.abi-update.xml b/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.abi-update.xml
index bbe1dd931d..f27e7e1522 100644
--- a/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.abi-update.xml
+++ b/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.abi-update.xml
@@ -78,5 +78,8 @@
       <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
     </video>
     <memballoon model='none'/>
+    <panic model='pvpanic'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </panic>
   </devices>
 </domain>
diff --git a/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.args b/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.args
index a503f45d0c..96fb251d80 100644
--- a/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.args
+++ b/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.args
@@ -44,4 +44,5 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -device '{"driver":"virtio-gpu-pci","id":"video0","max_outputs":1,"bus":"pci.5","addr":"0x0"}' \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-device '{"driver":"pvpanic-pci","bus":"pcie.0","addr":"0x2"}' \
 -msg timestamp=on
diff --git a/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.xml b/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.xml
index bbe1dd931d..f27e7e1522 100644
--- a/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.xml
+++ b/tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.xml
@@ -78,5 +78,8 @@
       <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
     </video>
     <memballoon model='none'/>
+    <panic model='pvpanic'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </panic>
   </devices>
 </domain>
diff --git a/tests/qemuxmlconfdata/aarch64-virt-default-models.xml b/tests/qemuxmlconfdata/aarch64-virt-default-models.xml
index d9ad495e75..a8029d888d 100644
--- a/tests/qemuxmlconfdata/aarch64-virt-default-models.xml
+++ b/tests/qemuxmlconfdata/aarch64-virt-default-models.xml
@@ -19,6 +19,6 @@
     </tpm>
     <video/>
     <memballoon model='none'/>
-    <!-- No default model for <panic/> on aarch64 -->
+    <panic/>
   </devices>
 </domain>
diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c
index e97d0e7bdc..5497fb2ba1 100644
--- a/tests/qemuxmlconftest.c
+++ b/tests/qemuxmlconftest.c
@@ -2648,7 +2648,6 @@ mymain(void)
     DO_TEST_CAPS_LATEST("panic");
     DO_TEST_CAPS_LATEST("panic-double");
     DO_TEST_CAPS_LATEST("panic-no-address");
-    DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("aarch64-panic-no-model", "aarch64");
     DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("riscv64-panic-no-model", "riscv64");
 
     DO_TEST_CAPS_LATEST("pvpanic-pci-x86_64");
-- 
2.46.0