On 4/20/23 08:42, Martin Kletzander wrote: > On Wed, Apr 19, 2023 at 04:53:36PM +0200, Michal Prívozník wrote: >> On 4/19/23 16:07, Martin Kletzander wrote: >>> Most of them are platform devices and only i6300esb can be plugged >>> multiple times into different PCI slots. >>> >>> Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx> >>> --- >>> src/qemu/qemu_validate.c | 18 ++++++++++-------- >>> 1 file changed, 10 insertions(+), 8 deletions(-) >>> >>> diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c >>> index b2c3fd1785bc..2b205348f597 100644 >>> --- a/src/qemu/qemu_validate.c >>> +++ b/src/qemu/qemu_validate.c >>> @@ -1110,19 +1110,21 @@ qemuValidateDomainDefTPMs(const virDomainDef >>> *def) >>> static int >>> qemuValidateDomainDefWatchdogs(const virDomainDef *def) >>> { >>> - bool found_itco = false; >>> + bool watchdogs[VIR_DOMAIN_WATCHDOG_MODEL_LAST] = {0}; >> >> >> We usually us virBitmap for this... >> >>> size_t i = 0; >>> >>> for (i = 0; i < def->nwatchdogs; i++) { >>> + if (def->watchdogs[i]->model == >>> VIR_DOMAIN_WATCHDOG_MODEL_I6300ESB) >>> + continue; >>> >>> - 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; >>> + if (watchdogs[def->watchdogs[i]->model]) { >>> + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, >>> + _("domain can only have one watchdog with >>> model '%1$s'"), >>> + >>> virDomainWatchdogModelTypeToString(def->watchdogs[i]->model)); >>> + return -1; >>> } >>> + >>> + watchdogs[def->watchdogs[i]->model] = true; >>> } >>> >>> return 0; >> >> It should be fairly trivial to rewrite. >> > > Is the following patch OK to squash in? Perfect. Michal