Add iTCO watchdog support

Supported only with q35 machine types.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Martin Kletzander 2023-01-20 10:26:21 +01:00
parent 1c61bd718a
commit 5b80e93e42
5 changed files with 29 additions and 0 deletions

View File

@ -838,6 +838,7 @@ VIR_ENUM_IMPL(virDomainWatchdogModel,
"i6300esb",
"ib700",
"diag288",
"itco",
);
VIR_ENUM_IMPL(virDomainWatchdogAction,

View 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;

View File

@ -5345,6 +5345,7 @@
<value>i6300esb</value>
<value>ib700</value>
<value>diag288</value>
<value>itco</value>
</choice>
</attribute>
<optional>

View 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;
}

View 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);