mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
qemu: Refuse to use "ps2" on machines that do not have this bus
The "ps2" bus is only available on certain machines like x86. On machines like s390x, we should refuse to add a device to this bus instead of silently ignoring it. Looking at the QEMU sources, PS/2 is only available if the QEMU binary has the "i8042" device, so let's check for that and only allow "ps2" devices if this QEMU device is available, or if we're on x86 anyway (so we don't have to fake the QEMU_CAPS_DEVICE_I8042 capability in all the tests that use <input ... bus='ps2'/> in their xml data). Reported-by: Sebastian Mitterle <smitterl@redhat.com> Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1763191 Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
4494b9b9d0
commit
e7a65484ba
@ -554,6 +554,9 @@ VIR_ENUM_IMPL(virQEMUCaps,
|
||||
"savevm-monitor-nodes",
|
||||
"drive-nvme",
|
||||
"smp-dies",
|
||||
|
||||
/* 350 */
|
||||
"i8042",
|
||||
);
|
||||
|
||||
|
||||
@ -1245,6 +1248,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
|
||||
{ "vhost-user-vga", QEMU_CAPS_DEVICE_VHOST_USER_VGA },
|
||||
{ "ramfb", QEMU_CAPS_DEVICE_RAMFB },
|
||||
{ "max-arm-cpu", QEMU_CAPS_ARM_MAX_CPU },
|
||||
{ "i8042", QEMU_CAPS_DEVICE_I8042 },
|
||||
};
|
||||
|
||||
static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBalloon[] = {
|
||||
|
@ -536,6 +536,9 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
|
||||
QEMU_CAPS_DRIVE_NVME, /* -drive file.driver=nvme */
|
||||
QEMU_CAPS_SMP_DIES, /* -smp dies= */
|
||||
|
||||
/* 350 */
|
||||
QEMU_CAPS_DEVICE_I8042, /* PS/2 controller */
|
||||
|
||||
QEMU_CAPS_LAST /* this must always be the last item */
|
||||
} virQEMUCapsFlags;
|
||||
|
||||
|
@ -8039,13 +8039,21 @@ qemuDomainDeviceDefValidateGraphics(const virDomainGraphicsDef *graphics,
|
||||
|
||||
static int
|
||||
qemuDomainDeviceDefValidateInput(const virDomainInputDef *input,
|
||||
const virDomainDef *def G_GNUC_UNUSED,
|
||||
const virDomainDef *def,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
const char *baseName;
|
||||
int cap;
|
||||
int ccwCap;
|
||||
|
||||
if (input->bus == VIR_DOMAIN_INPUT_BUS_PS2 && !ARCH_IS_X86(def->os.arch) &&
|
||||
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_I8042)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("%s is not supported by this QEMU binary"),
|
||||
virDomainInputBusTypeToString(input->bus));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (input->bus != VIR_DOMAIN_INPUT_BUS_VIRTIO)
|
||||
return 0;
|
||||
|
||||
|
@ -84,6 +84,7 @@
|
||||
<flag name='isa-serial'/>
|
||||
<flag name='hda-output'/>
|
||||
<flag name='mch'/>
|
||||
<flag name='i8042'/>
|
||||
<version>1005003</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>43100245</microcodeVersion>
|
||||
|
@ -89,6 +89,7 @@
|
||||
<flag name='isa-serial'/>
|
||||
<flag name='hda-output'/>
|
||||
<flag name='mch'/>
|
||||
<flag name='i8042'/>
|
||||
<version>1006000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>43100243</microcodeVersion>
|
||||
|
@ -91,6 +91,7 @@
|
||||
<flag name='isa-serial'/>
|
||||
<flag name='hda-output'/>
|
||||
<flag name='mch'/>
|
||||
<flag name='i8042'/>
|
||||
<version>1007000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>43100244</microcodeVersion>
|
||||
|
@ -107,6 +107,7 @@
|
||||
<flag name='isa-serial'/>
|
||||
<flag name='hda-output'/>
|
||||
<flag name='mch'/>
|
||||
<flag name='i8042'/>
|
||||
<version>2001001</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>43100240</microcodeVersion>
|
||||
|
@ -139,6 +139,7 @@
|
||||
<flag name='vhost-vsock'/>
|
||||
<flag name='egl-headless'/>
|
||||
<flag name='iothread.poll-max-ns'/>
|
||||
<flag name='i8042'/>
|
||||
<version>2010000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>42900287</microcodeVersion>
|
||||
|
@ -182,6 +182,7 @@
|
||||
<flag name='egl-headless'/>
|
||||
<flag name='iothread.poll-max-ns'/>
|
||||
<flag name='x86-max-cpu'/>
|
||||
<flag name='i8042'/>
|
||||
<version>2010000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>43100287</microcodeVersion>
|
||||
|
@ -188,6 +188,7 @@
|
||||
<flag name='egl-headless'/>
|
||||
<flag name='iothread.poll-max-ns'/>
|
||||
<flag name='x86-max-cpu'/>
|
||||
<flag name='i8042'/>
|
||||
<version>2011000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>43100288</microcodeVersion>
|
||||
|
@ -153,6 +153,7 @@
|
||||
<flag name='iothread.poll-max-ns'/>
|
||||
<flag name='memory-backend-file.align'/>
|
||||
<flag name='drive-nvme'/>
|
||||
<flag name='i8042'/>
|
||||
<version>2011090</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>42900289</microcodeVersion>
|
||||
|
@ -197,6 +197,7 @@
|
||||
<flag name='memory-backend-file.align'/>
|
||||
<flag name='x86-max-cpu'/>
|
||||
<flag name='drive-nvme'/>
|
||||
<flag name='i8042'/>
|
||||
<version>2011090</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>43100289</microcodeVersion>
|
||||
|
@ -133,6 +133,7 @@
|
||||
<flag name='sdl-gl'/>
|
||||
<flag name='hda-output'/>
|
||||
<flag name='mch'/>
|
||||
<flag name='i8042'/>
|
||||
<version>2004000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>43100242</microcodeVersion>
|
||||
|
@ -139,6 +139,7 @@
|
||||
<flag name='sdl-gl'/>
|
||||
<flag name='hda-output'/>
|
||||
<flag name='mch'/>
|
||||
<flag name='i8042'/>
|
||||
<version>2005000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>43100243</microcodeVersion>
|
||||
|
@ -118,6 +118,7 @@
|
||||
<flag name='nbd-tls'/>
|
||||
<flag name='sdl-gl'/>
|
||||
<flag name='hda-output'/>
|
||||
<flag name='i8042'/>
|
||||
<version>2006000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>42900244</microcodeVersion>
|
||||
|
@ -151,6 +151,7 @@
|
||||
<flag name='sdl-gl'/>
|
||||
<flag name='hda-output'/>
|
||||
<flag name='mch'/>
|
||||
<flag name='i8042'/>
|
||||
<version>2006000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>43100244</microcodeVersion>
|
||||
|
@ -156,6 +156,7 @@
|
||||
<flag name='sdl-gl'/>
|
||||
<flag name='hda-output'/>
|
||||
<flag name='mch'/>
|
||||
<flag name='i8042'/>
|
||||
<version>2007000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>43100245</microcodeVersion>
|
||||
|
@ -159,6 +159,7 @@
|
||||
<flag name='hda-output'/>
|
||||
<flag name='vhost-vsock'/>
|
||||
<flag name='mch'/>
|
||||
<flag name='i8042'/>
|
||||
<version>2008000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>43100246</microcodeVersion>
|
||||
|
@ -131,6 +131,7 @@
|
||||
<flag name='blockdev-del'/>
|
||||
<flag name='vhost-vsock'/>
|
||||
<flag name='iothread.poll-max-ns'/>
|
||||
<flag name='i8042'/>
|
||||
<version>2009000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>42900247</microcodeVersion>
|
||||
|
@ -176,6 +176,7 @@
|
||||
<flag name='mch'/>
|
||||
<flag name='iothread.poll-max-ns'/>
|
||||
<flag name='x86-max-cpu'/>
|
||||
<flag name='i8042'/>
|
||||
<version>2009000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>43100247</microcodeVersion>
|
||||
|
@ -155,6 +155,7 @@
|
||||
<flag name='bochs-display'/>
|
||||
<flag name='ramfb'/>
|
||||
<flag name='drive-nvme'/>
|
||||
<flag name='i8042'/>
|
||||
<version>2012050</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>42900239</microcodeVersion>
|
||||
|
@ -202,6 +202,7 @@
|
||||
<flag name='bochs-display'/>
|
||||
<flag name='ramfb'/>
|
||||
<flag name='drive-nvme'/>
|
||||
<flag name='i8042'/>
|
||||
<version>3000000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>43100239</microcodeVersion>
|
||||
|
@ -159,6 +159,7 @@
|
||||
<flag name='overcommit'/>
|
||||
<flag name='bochs-display'/>
|
||||
<flag name='drive-nvme'/>
|
||||
<flag name='i8042'/>
|
||||
<version>3000091</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>42900240</microcodeVersion>
|
||||
|
@ -205,6 +205,7 @@
|
||||
<flag name='bochs-display'/>
|
||||
<flag name='ramfb'/>
|
||||
<flag name='drive-nvme'/>
|
||||
<flag name='i8042'/>
|
||||
<version>3000092</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>43100240</microcodeVersion>
|
||||
|
@ -173,6 +173,7 @@
|
||||
<flag name='migration-file-drop-cache'/>
|
||||
<flag name='machine.pseries.cap-ccf-assist'/>
|
||||
<flag name='drive-nvme'/>
|
||||
<flag name='i8042'/>
|
||||
<version>4000000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>42900240</microcodeVersion>
|
||||
|
@ -210,6 +210,7 @@
|
||||
<flag name='migration-file-drop-cache'/>
|
||||
<flag name='ramfb'/>
|
||||
<flag name='drive-nvme'/>
|
||||
<flag name='i8042'/>
|
||||
<version>4000000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>43100240</microcodeVersion>
|
||||
|
@ -216,6 +216,7 @@
|
||||
<flag name='blockdev-file-dynamic-auto-read-only'/>
|
||||
<flag name='drive-nvme'/>
|
||||
<flag name='smp-dies'/>
|
||||
<flag name='i8042'/>
|
||||
<version>4001000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>43100241</microcodeVersion>
|
||||
|
@ -177,6 +177,7 @@
|
||||
<flag name='blockdev-file-dynamic-auto-read-only'/>
|
||||
<flag name='drive-nvme'/>
|
||||
<flag name='smp-dies'/>
|
||||
<flag name='i8042'/>
|
||||
<version>4001050</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>42900242</microcodeVersion>
|
||||
|
@ -219,6 +219,7 @@
|
||||
<flag name='savevm-monitor-nodes'/>
|
||||
<flag name='drive-nvme'/>
|
||||
<flag name='smp-dies'/>
|
||||
<flag name='i8042'/>
|
||||
<version>4002000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>43100242</microcodeVersion>
|
||||
|
@ -44,12 +44,6 @@
|
||||
<alias name='virtio-serial0'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
||||
</controller>
|
||||
<input type='mouse' bus='ps2'>
|
||||
<alias name='input0'/>
|
||||
</input>
|
||||
<input type='keyboard' bus='ps2'>
|
||||
<alias name='input1'/>
|
||||
</input>
|
||||
<memballoon model='none'/>
|
||||
<panic model='s390'/>
|
||||
</devices>
|
||||
|
@ -54,12 +54,6 @@
|
||||
<alias name='virtio-serial0'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
||||
</controller>
|
||||
<input type='mouse' bus='ps2'>
|
||||
<alias name='input0'/>
|
||||
</input>
|
||||
<input type='keyboard' bus='ps2'>
|
||||
<alias name='input1'/>
|
||||
</input>
|
||||
<memballoon model='none'>
|
||||
<alias name='balloon0'/>
|
||||
</memballoon>
|
||||
|
@ -54,12 +54,6 @@
|
||||
<alias name='virtio-serial0'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
||||
</controller>
|
||||
<input type='mouse' bus='ps2'>
|
||||
<alias name='input0'/>
|
||||
</input>
|
||||
<input type='keyboard' bus='ps2'>
|
||||
<alias name='input1'/>
|
||||
</input>
|
||||
<memballoon model='none'/>
|
||||
<panic model='s390'/>
|
||||
</devices>
|
||||
|
@ -44,12 +44,6 @@
|
||||
<alias name='virtio-serial0'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
||||
</controller>
|
||||
<input type='mouse' bus='ps2'>
|
||||
<alias name='input0'/>
|
||||
</input>
|
||||
<input type='keyboard' bus='ps2'>
|
||||
<alias name='input1'/>
|
||||
</input>
|
||||
<memballoon model='none'/>
|
||||
<panic model='s390'/>
|
||||
</devices>
|
||||
|
@ -53,12 +53,6 @@
|
||||
<alias name='virtio-serial0'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
||||
</controller>
|
||||
<input type='mouse' bus='ps2'>
|
||||
<alias name='input0'/>
|
||||
</input>
|
||||
<input type='keyboard' bus='ps2'>
|
||||
<alias name='input1'/>
|
||||
</input>
|
||||
<memballoon model='none'/>
|
||||
<panic model='s390'/>
|
||||
</devices>
|
||||
|
@ -53,12 +53,6 @@
|
||||
<alias name='virtio-serial0'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
||||
</controller>
|
||||
<input type='mouse' bus='ps2'>
|
||||
<alias name='input0'/>
|
||||
</input>
|
||||
<input type='keyboard' bus='ps2'>
|
||||
<alias name='input1'/>
|
||||
</input>
|
||||
<memballoon model='none'/>
|
||||
<panic model='s390'/>
|
||||
</devices>
|
||||
|
@ -43,12 +43,6 @@
|
||||
<alias name='virtio-serial0'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
||||
</controller>
|
||||
<input type='mouse' bus='ps2'>
|
||||
<alias name='input0'/>
|
||||
</input>
|
||||
<input type='keyboard' bus='ps2'>
|
||||
<alias name='input1'/>
|
||||
</input>
|
||||
<memballoon model='none'/>
|
||||
<panic model='s390'/>
|
||||
</devices>
|
||||
|
@ -34,12 +34,6 @@
|
||||
<alias name='virtio-serial0'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
||||
</controller>
|
||||
<input type='mouse' bus='ps2'>
|
||||
<alias name='input0'/>
|
||||
</input>
|
||||
<input type='keyboard' bus='ps2'>
|
||||
<alias name='input1'/>
|
||||
</input>
|
||||
<memballoon model='none'/>
|
||||
<panic model='s390'/>
|
||||
</devices>
|
||||
|
Loading…
Reference in New Issue
Block a user