[PATCH 4/7] qemu: Forbid ib700 watchdogs for non-i440fx machine types

Martin Kletzander mkletzan at redhat.com
Wed Apr 19 14:07:07 UTC 2023


We can launch qemu with it, but it will not work since it's not even
probed by the kernel at the mapped address with different machine types
since they are expected to be connected to ISA and not even its newer
LPC counterpart found on q35.  And it does not exist on non-x86
architectures.

Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---
 src/qemu/qemu_validate.c                                   | 7 +++++++
 .../watchdog-q35-multiple.x86_64-latest.args               | 4 ++--
 tests/qemuxml2argvdata/watchdog-q35-multiple.xml           | 2 +-
 .../watchdog-q35-multiple.x86_64-latest.xml                | 4 +++-
 4 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index b8d5e9bd74e9..6ebd2ba0101f 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -2320,6 +2320,13 @@ qemuValidateDomainWatchdogDef(const virDomainWatchdogDef *dev,
         break;
 
     case VIR_DOMAIN_WATCHDOG_MODEL_IB700:
+        if (!qemuDomainIsI440FX(def)) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           _("%1$s model of watchdog cannot be used with this machine type"),
+                           virDomainWatchdogModelTypeToString(dev->model));
+            return -1;
+        }
+
         if (dev->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("%1$s model of watchdog does not support configuring the address"),
diff --git a/tests/qemuxml2argvdata/watchdog-q35-multiple.x86_64-latest.args b/tests/qemuxml2argvdata/watchdog-q35-multiple.x86_64-latest.args
index 655d206421b6..4c14a9552088 100644
--- a/tests/qemuxml2argvdata/watchdog-q35-multiple.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/watchdog-q35-multiple.x86_64-latest.args
@@ -31,8 +31,8 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
 -device '{"driver":"pcie-root-port","port":9,"chassis":3,"id":"pci.3","bus":"pcie.0","addr":"0x1.0x1"}' \
 -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.2","addr":"0x1"}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
--device '{"driver":"ib700","id":"watchdog0"}' \
--device '{"driver":"i6300esb","id":"watchdog1","bus":"pci.2","addr":"0x2"}' \
+-device '{"driver":"i6300esb","id":"watchdog0","bus":"pci.2","addr":"0x2"}' \
+-device '{"driver":"i6300esb","id":"watchdog1","bus":"pci.2","addr":"0x3"}' \
 -global ICH9-LPC.noreboot=off \
 -watchdog-action poweroff \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
diff --git a/tests/qemuxml2argvdata/watchdog-q35-multiple.xml b/tests/qemuxml2argvdata/watchdog-q35-multiple.xml
index af0cb169f0d9..1ed3aff41482 100644
--- a/tests/qemuxml2argvdata/watchdog-q35-multiple.xml
+++ b/tests/qemuxml2argvdata/watchdog-q35-multiple.xml
@@ -18,7 +18,7 @@
     <controller type='usb' index='0'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <watchdog model='ib700' action='poweroff'/>
+    <watchdog model='i6300esb' action='poweroff'/>
     <watchdog model='i6300esb' action='poweroff'/>
     <memballoon model='none'/>
   </devices>
diff --git a/tests/qemuxml2xmloutdata/watchdog-q35-multiple.x86_64-latest.xml b/tests/qemuxml2xmloutdata/watchdog-q35-multiple.x86_64-latest.xml
index 7e60c6e6517d..1ea084854ee6 100644
--- a/tests/qemuxml2xmloutdata/watchdog-q35-multiple.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/watchdog-q35-multiple.x86_64-latest.xml
@@ -41,10 +41,12 @@
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <audio id='1' type='none'/>
-    <watchdog model='ib700' action='poweroff'/>
     <watchdog model='i6300esb' action='poweroff'>
       <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0'/>
     </watchdog>
+    <watchdog model='i6300esb' action='poweroff'>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x03' function='0x0'/>
+    </watchdog>
     <watchdog model='itco' action='poweroff'/>
     <memballoon model='none'/>
   </devices>
-- 
2.40.0



More information about the libvir-list mailing list