]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Add iTCO watchdog support
authorMartin Kletzander <mkletzan@redhat.com>
Fri, 20 Jan 2023 09:26:21 +0000 (10:26 +0100)
committerMartin Kletzander <mkletzan@redhat.com>
Thu, 26 Jan 2023 15:40:30 +0000 (16:40 +0100)
Supported only with q35 machine types.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/conf/domain_conf.c
src/conf/domain_conf.h
src/conf/schemas/domaincommon.rng
src/qemu/qemu_domain_address.c
src/qemu/qemu_validate.c

index 00a42abd30d34139c50304f2cb512ba489689700..0cd6020ea3a9aa7b80cb890ad88241640bea3137 100644 (file)
@@ -838,6 +838,7 @@ VIR_ENUM_IMPL(virDomainWatchdogModel,
               "i6300esb",
               "ib700",
               "diag288",
+              "itco",
 );
 
 VIR_ENUM_IMPL(virDomainWatchdogAction,
index 2b04e0c3e0208bca8dc48e5d9285f7d8da0646ce..631cef03fd98e98abe0340dcda1d7bf589f2105b 100644 (file)
@@ -1747,6 +1747,7 @@ typedef enum {
     VIR_DOMAIN_WATCHDOG_MODEL_I6300ESB,
     VIR_DOMAIN_WATCHDOG_MODEL_IB700,
     VIR_DOMAIN_WATCHDOG_MODEL_DIAG288,
+    VIR_DOMAIN_WATCHDOG_MODEL_ITCO,
 
     VIR_DOMAIN_WATCHDOG_MODEL_LAST
 } virDomainWatchdogModel;
index 524d57884ca85ab3372c0462ab068d6a9f1f5c9b..b4731f0d8d43d0d4f6da1faa13f8d8a1cc3df9d7 100644 (file)
             <value>i6300esb</value>
             <value>ib700</value>
             <value>diag288</value>
+            <value>itco</value>
           </choice>
         </attribute>
         <optional>
index e26ce9c0e6456ddab92e5972b78f21f223e9036a..20b648354b6918dada1316a724039663b61d741d 100644 (file)
@@ -932,6 +932,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDef *dev,
 
         case VIR_DOMAIN_WATCHDOG_MODEL_IB700:
         case VIR_DOMAIN_WATCHDOG_MODEL_DIAG288:
+        case VIR_DOMAIN_WATCHDOG_MODEL_ITCO:
         case VIR_DOMAIN_WATCHDOG_MODEL_LAST:
             return 0;
         }
index 134ab0437c42565b672bb6e62c4b9c6b38f371f2..c8c289ebb44aadf441c8ca85cdc4f55509e4d7e0 100644 (file)
@@ -1191,6 +1191,7 @@ qemuValidateDomainDefTPMs(const virDomainDef *def)
 static int
 qemuValidateDomainDefWatchdogs(const virDomainDef *def)
 {
+    bool found_itco = false;
     ssize_t i = 0;
 
     for (i = 1; i < def->nwatchdogs; i++) {
@@ -1204,6 +1205,15 @@ qemuValidateDomainDefWatchdogs(const virDomainDef *def)
                              "with this QEMU binary"));
             return -1;
         }
+
+        if (def->watchdogs[i]->model == VIR_DOMAIN_WATCHDOG_MODEL_ITCO) {
+            if (found_itco) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                               _("Multiple iTCO watchdogs are not supported"));
+                return -1;
+            }
+            found_itco = true;
+        }
     }
 
     return 0;
@@ -2410,6 +2420,21 @@ qemuValidateDomainWatchdogDef(const virDomainWatchdogDef *dev,
         }
         break;
 
+    case VIR_DOMAIN_WATCHDOG_MODEL_ITCO:
+        if (dev->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           _("%s model of watchdog is part of the machine and cannot have any address set."),
+                           virDomainWatchdogModelTypeToString(dev->model));
+            return -1;
+        }
+        if (!qemuDomainIsQ35(def)) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           _("%s model of watchdog is only part of q35 machine"),
+                           virDomainWatchdogModelTypeToString(dev->model));
+            return -1;
+        }
+        break;
+
     case VIR_DOMAIN_WATCHDOG_MODEL_LAST:
     default:
         virReportEnumRangeError(virDomainWatchdogModel, dev->model);