We will soon need to use it in a context where we don't have a virDomainDef handy. Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx> --- src/qemu/qemu_capabilities.c | 11 ++++++----- src/qemu/qemu_capabilities.h | 3 ++- src/qemu/qemu_validate.c | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 2d53e87ff3..bde28ad083 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -6032,15 +6032,16 @@ virQEMUCapsSupportsI8042(virQEMUCaps *qemuCaps, bool virQEMUCapsSupportsI8042Toggle(virQEMUCaps *qemuCaps, - const virDomainDef *def) + const char *machine, + const virArch arch) { if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_I8042_OPT)) return false; - return qemuDomainIsI440FX(def) || - qemuDomainIsQ35(def) || - qemuDomainIsXenFV(def) || - STREQ(def->os.machine, "isapc"); + return qemuDomainMachineIsI440FX(machine, arch) || + qemuDomainMachineIsQ35(machine, arch) || + qemuDomainMachineIsXenFV(machine, arch) || + STREQ(machine, "isapc"); } diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 9c577c1505..5036d49aab 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -723,7 +723,8 @@ bool virQEMUCapsSupportsI8042(virQEMUCaps *qemuCaps, const virDomainDef *def); bool virQEMUCapsSupportsI8042Toggle(virQEMUCaps *qemuCaps, - const virDomainDef *def); + const char *machine, + const virArch arch); const char *virQEMUCapsGetBinary(virQEMUCaps *qemuCaps); virArch virQEMUCapsGetArch(virQEMUCaps *qemuCaps); diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index f74c538efe..3c40f76c12 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -258,7 +258,7 @@ qemuValidateDomainDefFeatures(const virDomainDef *def, } if (def->features[i] != VIR_TRISTATE_SWITCH_ABSENT && - !virQEMUCapsSupportsI8042Toggle(qemuCaps, def)) { + !virQEMUCapsSupportsI8042Toggle(qemuCaps, def->os.machine, def->os.arch)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("ps2 feature state cannot be controlled with this QEMU binary")); return -1; -- 2.46.0