1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-23 21:34:54 +03:00

qemu: Support input model=virtio-{non-}transitional

Add <input> model handling for virtio transitional devices. Ex:

  <input type='passthrough' bus='virtio' model='virtio-transitional'>
    ...
  </input>

* "virtio-transitional" maps to qemu "virtio-input-host-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-input-host-non-transitional"

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2019-01-17 12:52:42 -05:00
parent 2593a1bd1a
commit 90fd9bd989
7 changed files with 31 additions and 21 deletions

View File

@ -512,8 +512,14 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
has_ntmodel = device.data.vsock->model == VIR_DOMAIN_VSOCK_MODEL_VIRTIO_NON_TRANSITIONAL;
break;
case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_INPUT:
if (device.data.input->type != VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH)
return 0;
has_tmodel = device.data.input->model == VIR_DOMAIN_INPUT_MODEL_VIRTIO_TRANSITIONAL;
has_ntmodel = device.data.input->model == VIR_DOMAIN_INPUT_MODEL_VIRTIO_NON_TRANSITIONAL;
break;
case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_SOUND:
case VIR_DOMAIN_DEVICE_VIDEO:
case VIR_DOMAIN_DEVICE_WATCHDOG:

View File

@ -946,7 +946,18 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
case VIR_DOMAIN_DEVICE_INPUT:
switch ((virDomainInputBus) dev->data.input->bus) {
case VIR_DOMAIN_INPUT_BUS_VIRTIO:
return virtioFlags;
switch ((virDomainInputModel) dev->data.input->model) {
case VIR_DOMAIN_INPUT_MODEL_VIRTIO_TRANSITIONAL:
/* Transitional devices only work in conventional PCI slots */
return pciFlags;
case VIR_DOMAIN_INPUT_MODEL_VIRTIO:
case VIR_DOMAIN_INPUT_MODEL_VIRTIO_NON_TRANSITIONAL:
case VIR_DOMAIN_INPUT_MODEL_DEFAULT:
return virtioFlags;
case VIR_DOMAIN_INPUT_MODEL_LAST:
break;
}
return 0;
case VIR_DOMAIN_INPUT_BUS_PS2:
case VIR_DOMAIN_INPUT_BUS_USB:

View File

@ -42,8 +42,8 @@ fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.1,addr=0x0 \
-netdev user,id=hostnet0 \
-device virtio-net-pci,disable-legacy=on,disable-modern=off,netdev=hostnet0,\
id=net0,mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \
-device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.7,\
addr=0x0 \
-device virtio-input-host-pci,disable-legacy=on,disable-modern=off,id=input0,\
evdev=/dev/input/event1234,bus=pci.7,addr=0x0 \
-device vhost-scsi-pci,disable-legacy=on,disable-modern=off,\
wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,bus=pci.4,addr=0x0 \
-device virtio-balloon-pci,disable-legacy=on,disable-modern=off,id=balloon0,\

View File

@ -42,8 +42,8 @@ bus=pci.1,addr=0x0 \
-netdev user,id=hostnet0 \
-device virtio-net-pci-non-transitional,netdev=hostnet0,id=net0,\
mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \
-device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.7,\
addr=0x0 \
-device virtio-input-host-pci-non-transitional,id=input0,\
evdev=/dev/input/event1234,bus=pci.7,addr=0x0 \
-device vhost-scsi-pci-non-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\
id=hostdev0,bus=pci.4,addr=0x0 \
-device virtio-balloon-pci-non-transitional,id=balloon0,bus=pci.5,addr=0x0 \

View File

@ -27,7 +27,6 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
addr=0x1 \
-device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \
-device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \
-device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci,disable-legacy=off,disable-modern=off,scsi=off,\
bus=pci.2,addr=0x3,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
@ -37,8 +36,8 @@ fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.2,addr=0x1 \
-netdev user,id=hostnet0 \
-device virtio-net-pci,disable-legacy=off,disable-modern=off,netdev=hostnet0,\
id=net0,mac=00:11:22:33:44:55,bus=pci.2,addr=0x2 \
-device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.3,\
addr=0x0 \
-device virtio-input-host-pci,disable-legacy=off,disable-modern=off,id=input0,\
evdev=/dev/input/event1234,bus=pci.2,addr=0x7 \
-device vhost-scsi-pci,disable-legacy=off,disable-modern=off,\
wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,bus=pci.2,addr=0x4 \
-device virtio-balloon-pci,disable-legacy=off,disable-modern=off,id=balloon0,\
@ -49,5 +48,5 @@ id=rng0,bus=pci.2,addr=0x6 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-device vhost-vsock-pci,disable-legacy=off,disable-modern=off,id=vsock0,\
guest-cid=4,vhostfd=6789,bus=pci.2,addr=0x7 \
guest-cid=4,vhostfd=6789,bus=pci.2,addr=0x8 \
-msg timestamp=on

View File

@ -27,7 +27,6 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
addr=0x1 \
-device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \
-device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \
-device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x3,\
drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
@ -37,8 +36,8 @@ bus=pci.2,addr=0x1 \
-netdev user,id=hostnet0 \
-device virtio-net-pci-transitional,netdev=hostnet0,id=net0,\
mac=00:11:22:33:44:55,bus=pci.2,addr=0x2 \
-device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.3,\
addr=0x0 \
-device virtio-input-host-pci-transitional,id=input0,\
evdev=/dev/input/event1234,bus=pci.2,addr=0x7 \
-device vhost-scsi-pci-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\
id=hostdev0,bus=pci.2,addr=0x4 \
-device virtio-balloon-pci-transitional,id=balloon0,bus=pci.2,addr=0x5 \
@ -47,5 +46,5 @@ id=hostdev0,bus=pci.2,addr=0x4 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-device vhost-vsock-pci-transitional,id=vsock0,guest-cid=4,vhostfd=6789,\
bus=pci.2,addr=0x7 \
bus=pci.2,addr=0x8 \
-msg timestamp=on

View File

@ -39,11 +39,6 @@
<target chassis='3' port='0x9'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<controller type='pci' index='4' model='pcie-root-port'>
<model name='pcie-root-port'/>
<target chassis='4' port='0xa'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<filesystem type='mount' accessmode='passthrough' model='virtio-transitional'>
<source dir='/export/fs1'/>
<target dir='fs1'/>
@ -56,7 +51,7 @@
</interface>
<input type='passthrough' bus='virtio' model='virtio-transitional'>
<source evdev='/dev/input/event1234'/>
<address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
<address type='pci' domain='0x0000' bus='0x02' slot='0x07' function='0x0'/>
</input>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
@ -73,7 +68,7 @@
</rng>
<vsock model='virtio-transitional'>
<cid auto='no' address='4'/>
<address type='pci' domain='0x0000' bus='0x02' slot='0x07' function='0x0'/>
<address type='pci' domain='0x0000' bus='0x02' slot='0x08' function='0x0'/>
</vsock>
</devices>
</domain>