qemu: Add support for virtio device option page-per-vq

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1925363

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Han Han 2021-10-15 14:09:30 +08:00 committed by Michal Privoznik
parent 388cdd11f3
commit d139171d80
5 changed files with 29 additions and 26 deletions

View File

@ -1122,6 +1122,7 @@ qemuBuildVirtioDevProps(virDomainDeviceType devtype,
"T:iommu_platform", virtioOptions->iommu, "T:iommu_platform", virtioOptions->iommu,
"T:ats", virtioOptions->ats, "T:ats", virtioOptions->ats,
"T:packed", virtioOptions->packed, "T:packed", virtioOptions->packed,
"T:page-per-vq", virtioOptions->page_per_vq,
NULL) < 0) NULL) < 0)
return NULL; return NULL;
} }

View File

@ -3797,7 +3797,8 @@ qemuDomainChangeNet(virQEMUDriver *driver,
(olddev->virtio && newdev->virtio && (olddev->virtio && newdev->virtio &&
(olddev->virtio->iommu != newdev->virtio->iommu || (olddev->virtio->iommu != newdev->virtio->iommu ||
olddev->virtio->ats != newdev->virtio->ats || olddev->virtio->ats != newdev->virtio->ats ||
olddev->virtio->packed != newdev->virtio->packed))) { olddev->virtio->packed != newdev->virtio->packed ||
olddev->virtio->page_per_vq != newdev->virtio->page_per_vq))) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("cannot modify virtio network device driver options")); _("cannot modify virtio network device driver options"));
goto cleanup; goto cleanup;

View File

@ -1592,6 +1592,7 @@ qemuValidateDomainVirtioOptions(const virDomainVirtioOptions *virtio,
"QEMU binary")); "QEMU binary"));
return -1; return -1;
} }
return 0; return 0;
} }

View File

@ -27,26 +27,26 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
-no-acpi \ -no-acpi \
-boot strict=on \ -boot strict=on \
-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
-device virtio-scsi-pci,iommu_platform=on,ats=on,packed=on,id=scsi0,bus=pci.0,addr=0x8 \ -device virtio-scsi-pci,iommu_platform=on,ats=on,packed=on,page-per-vq=on,id=scsi0,bus=pci.0,addr=0x8 \
-device virtio-serial-pci,iommu_platform=on,ats=on,packed=on,id=virtio-serial0,bus=pci.0,addr=0x9 \ -device virtio-serial-pci,iommu_platform=on,ats=on,packed=on,page-per-vq=on,id=virtio-serial0,bus=pci.0,addr=0x9 \
-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/img1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/img1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
-device virtio-blk-pci,iommu_platform=on,ats=on,packed=on,bus=pci.0,addr=0xa,drive=libvirt-1-format,id=virtio-disk0,bootindex=1 \ -device virtio-blk-pci,iommu_platform=on,ats=on,packed=on,page-per-vq=on,bus=pci.0,addr=0xa,drive=libvirt-1-format,id=virtio-disk0,bootindex=1 \
-fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \ -fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \
-device virtio-9p-pci,iommu_platform=on,ats=on,packed=on,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.0,addr=0x3 \ -device virtio-9p-pci,iommu_platform=on,ats=on,packed=on,page-per-vq=on,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.0,addr=0x3 \
-fsdev local,security_model=mapped,writeout=immediate,id=fsdev-fs1,path=/export/fs2 \ -fsdev local,security_model=mapped,writeout=immediate,id=fsdev-fs1,path=/export/fs2 \
-device virtio-9p-pci,iommu_platform=on,ats=on,packed=on,id=fs1,fsdev=fsdev-fs1,mount_tag=fs2,bus=pci.0,addr=0x4 \ -device virtio-9p-pci,iommu_platform=on,ats=on,packed=on,page-per-vq=on,id=fs1,fsdev=fsdev-fs1,mount_tag=fs2,bus=pci.0,addr=0x4 \
-netdev user,id=hostnet0 \ -netdev user,id=hostnet0 \
-device virtio-net-pci,iommu_platform=on,ats=on,packed=on,netdev=hostnet0,id=net0,mac=52:54:56:58:5a:5c,bus=pci.0,addr=0x6 \ -device virtio-net-pci,iommu_platform=on,ats=on,packed=on,page-per-vq=on,netdev=hostnet0,id=net0,mac=52:54:56:58:5a:5c,bus=pci.0,addr=0x6 \
-device virtio-mouse-pci,iommu_platform=on,ats=on,packed=on,id=input0,bus=pci.0,addr=0xe \ -device virtio-mouse-pci,iommu_platform=on,ats=on,packed=on,page-per-vq=on,id=input0,bus=pci.0,addr=0xe \
-device virtio-keyboard-pci,iommu_platform=on,ats=on,packed=on,id=input1,bus=pci.0,addr=0x10 \ -device virtio-keyboard-pci,iommu_platform=on,ats=on,packed=on,page-per-vq=on,id=input1,bus=pci.0,addr=0x10 \
-device virtio-tablet-pci,iommu_platform=on,ats=on,packed=on,id=input2,bus=pci.0,addr=0x11 \ -device virtio-tablet-pci,iommu_platform=on,ats=on,packed=on,page-per-vq=on,id=input2,bus=pci.0,addr=0x11 \
-device virtio-input-host-pci,iommu_platform=on,ats=on,packed=on,id=input3,evdev=/dev/input/event1234,bus=pci.0,addr=0x12 \ -device virtio-input-host-pci,iommu_platform=on,ats=on,packed=on,page-per-vq=on,id=input3,evdev=/dev/input/event1234,bus=pci.0,addr=0x12 \
-audiodev id=audio1,driver=none \ -audiodev id=audio1,driver=none \
-chardev socket,id=chr-vu-video0,fd=1729 \ -chardev socket,id=chr-vu-video0,fd=1729 \
-device vhost-user-vga,id=video0,max_outputs=1,chardev=chr-vu-video0,bus=pci.0,addr=0x2 \ -device vhost-user-vga,id=video0,max_outputs=1,chardev=chr-vu-video0,bus=pci.0,addr=0x2 \
-device virtio-balloon-pci,iommu_platform=on,ats=on,packed=on,id=balloon0,bus=pci.0,addr=0xc \ -device virtio-balloon-pci,iommu_platform=on,ats=on,packed=on,page-per-vq=on,id=balloon0,bus=pci.0,addr=0xc \
-object '{"qom-type":"rng-random","id":"objrng0","filename":"/dev/random"}' \ -object '{"qom-type":"rng-random","id":"objrng0","filename":"/dev/random"}' \
-device virtio-rng-pci,iommu_platform=on,ats=on,packed=on,rng=objrng0,id=rng0,bus=pci.0,addr=0xd \ -device virtio-rng-pci,iommu_platform=on,ats=on,packed=on,page-per-vq=on,rng=objrng0,id=rng0,bus=pci.0,addr=0xd \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
-msg timestamp=on -msg timestamp=on

View File

@ -18,7 +18,7 @@
<devices> <devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator> <emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type='file' device='disk'> <disk type='file' device='disk'>
<driver name='qemu' type='raw' iommu='on' ats='on' packed='on'/> <driver name='qemu' type='raw' iommu='on' ats='on' packed='on' page_per_vq='on'/>
<source file='/var/lib/libvirt/images/img1'/> <source file='/var/lib/libvirt/images/img1'/>
<target dev='vda' bus='virtio'/> <target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
@ -30,22 +30,22 @@
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller> </controller>
<controller type='scsi' index='0' model='virtio-scsi'> <controller type='scsi' index='0' model='virtio-scsi'>
<driver iommu='on' ats='on' packed='on'/> <driver iommu='on' ats='on' packed='on' page_per_vq='on'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
</controller> </controller>
<controller type='pci' index='0' model='pci-root'/> <controller type='pci' index='0' model='pci-root'/>
<controller type='virtio-serial' index='0'> <controller type='virtio-serial' index='0'>
<driver iommu='on' ats='on' packed='on'/> <driver iommu='on' ats='on' packed='on' page_per_vq='on'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
</controller> </controller>
<filesystem type='mount' accessmode='passthrough'> <filesystem type='mount' accessmode='passthrough'>
<driver iommu='on' ats='on' packed='on'/> <driver iommu='on' ats='on' packed='on' page_per_vq='on'/>
<source dir='/export/fs1'/> <source dir='/export/fs1'/>
<target dir='fs1'/> <target dir='fs1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</filesystem> </filesystem>
<filesystem type='mount' accessmode='mapped'> <filesystem type='mount' accessmode='mapped'>
<driver type='path' wrpolicy='immediate' iommu='on' ats='on' packed='on'/> <driver type='path' wrpolicy='immediate' iommu='on' ats='on' packed='on' page_per_vq='on'/>
<source dir='/export/fs2'/> <source dir='/export/fs2'/>
<target dir='fs2'/> <target dir='fs2'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
@ -53,23 +53,23 @@
<interface type='user'> <interface type='user'>
<mac address='52:54:56:58:5a:5c'/> <mac address='52:54:56:58:5a:5c'/>
<model type='virtio'/> <model type='virtio'/>
<driver iommu='on' ats='on' packed='on'/> <driver iommu='on' ats='on' packed='on' page_per_vq='on'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</interface> </interface>
<input type='mouse' bus='virtio'> <input type='mouse' bus='virtio'>
<driver iommu='on' ats='on' packed='on'/> <driver iommu='on' ats='on' packed='on' page_per_vq='on'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0e' function='0x0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x0e' function='0x0'/>
</input> </input>
<input type='keyboard' bus='virtio'> <input type='keyboard' bus='virtio'>
<driver iommu='on' ats='on' packed='on'/> <driver iommu='on' ats='on' packed='on' page_per_vq='on'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x10' function='0x0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x10' function='0x0'/>
</input> </input>
<input type='tablet' bus='virtio'> <input type='tablet' bus='virtio'>
<driver iommu='on' ats='on' packed='on'/> <driver iommu='on' ats='on' packed='on' page_per_vq='on'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x11' function='0x0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x11' function='0x0'/>
</input> </input>
<input type='passthrough' bus='virtio'> <input type='passthrough' bus='virtio'>
<driver iommu='on' ats='on' packed='on'/> <driver iommu='on' ats='on' packed='on' page_per_vq='on'/>
<source evdev='/dev/input/event1234'/> <source evdev='/dev/input/event1234'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x12' function='0x0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x12' function='0x0'/>
</input> </input>
@ -77,7 +77,7 @@
<input type='keyboard' bus='ps2'/> <input type='keyboard' bus='ps2'/>
<audio id='1' type='none'/> <audio id='1' type='none'/>
<video> <video>
<driver iommu='on' ats='on' packed='on' name='vhostuser'/> <driver iommu='on' ats='on' packed='on' page_per_vq='on' name='vhostuser'/>
<model type='virtio' heads='1' primary='yes'> <model type='virtio' heads='1' primary='yes'>
<acceleration accel3d='yes' rendernode='/dev/dri/test'/> <acceleration accel3d='yes' rendernode='/dev/dri/test'/>
</model> </model>
@ -85,11 +85,11 @@
</video> </video>
<memballoon model='virtio'> <memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/>
<driver iommu='on' ats='on' packed='on'/> <driver iommu='on' ats='on' packed='on' page_per_vq='on'/>
</memballoon> </memballoon>
<rng model='virtio'> <rng model='virtio'>
<backend model='random'>/dev/random</backend> <backend model='random'>/dev/random</backend>
<driver iommu='on' ats='on' packed='on'/> <driver iommu='on' ats='on' packed='on' page_per_vq='on'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0d' function='0x0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x0d' function='0x0'/>
</rng> </rng>
</devices> </devices>