mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemu: add vdpa support
Enable <interface type='vdpa'> for qemu domains. This provides basic support and does not support hotplug or migration. Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
committed by
Laine Stump
parent
9825f71b53
commit
0b1a05ffb5
38
tests/qemuxml2argvdata/net-vdpa.x86_64-latest.args
Normal file
38
tests/qemuxml2argvdata/net-vdpa.x86_64-latest.args
Normal file
@@ -0,0 +1,38 @@
|
||||
LC_ALL=C \
|
||||
PATH=/bin \
|
||||
HOME=/tmp/lib/domain--1-QEMUGuest1 \
|
||||
USER=test \
|
||||
LOGNAME=test \
|
||||
XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
|
||||
XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
|
||||
XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
|
||||
QEMU_AUDIO_DRV=none \
|
||||
/usr/bin/qemu-system-i386 \
|
||||
-name guest=QEMUGuest1,debug-threads=on \
|
||||
-S \
|
||||
-object secret,id=masterKey0,format=raw,\
|
||||
file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
|
||||
-machine pc,accel=tcg,usb=off,dump-guest-core=off,memory-backend=pc.ram \
|
||||
-cpu qemu64 \
|
||||
-m 214 \
|
||||
-object memory-backend-ram,id=pc.ram,size=224395264 \
|
||||
-overcommit mem-lock=off \
|
||||
-smp 1,sockets=1,cores=1,threads=1 \
|
||||
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
||||
-display none \
|
||||
-no-user-config \
|
||||
-nodefaults \
|
||||
-chardev socket,id=charmonitor,fd=1729,server,nowait \
|
||||
-mon chardev=charmonitor,id=monitor,mode=control \
|
||||
-rtc base=utc \
|
||||
-no-shutdown \
|
||||
-no-acpi \
|
||||
-boot strict=on \
|
||||
-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
|
||||
-add-fd set=0,fd=1732,opaque=/dev/vhost-vdpa-0 \
|
||||
-netdev vhost-vdpa,vhostdev=/dev/fdset/0,id=hostnet0 \
|
||||
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:95:db:c0,bus=pci.0,\
|
||||
addr=0x2 \
|
||||
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
|
||||
resourcecontrol=deny \
|
||||
-msg timestamp=on
|
||||
28
tests/qemuxml2argvdata/net-vdpa.xml
Normal file
28
tests/qemuxml2argvdata/net-vdpa.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<domain type='qemu'>
|
||||
<name>QEMUGuest1</name>
|
||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
<memory unit='KiB'>219136</memory>
|
||||
<currentMemory unit='KiB'>219136</currentMemory>
|
||||
<vcpu placement='static'>1</vcpu>
|
||||
<os>
|
||||
<type arch='i686' machine='pc'>hvm</type>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu-system-i386</emulator>
|
||||
<controller type='usb' index='0'/>
|
||||
<controller type='ide' index='0'/>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<interface type='vdpa'>
|
||||
<mac address='52:54:00:95:db:c0'/>
|
||||
<source dev='/dev/vhost-vdpa-0'/>
|
||||
</interface>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<input type='keyboard' bus='ps2'/>
|
||||
<memballoon model='none'/>
|
||||
</devices>
|
||||
</domain>
|
||||
@@ -195,7 +195,7 @@ virHostGetDRMRenderNode(void)
|
||||
|
||||
static void (*real_virCommandPassFD)(virCommandPtr cmd, int fd, unsigned int flags);
|
||||
|
||||
static const int testCommandPassSafeFDs[] = { 1730, 1731 };
|
||||
static const int testCommandPassSafeFDs[] = { 1730, 1731, 1732 };
|
||||
|
||||
void
|
||||
virCommandPassFD(virCommandPtr cmd,
|
||||
@@ -281,3 +281,12 @@ virNetDevSetRootQDisc(const char *ifname G_GNUC_UNUSED,
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuInterfaceVDPAConnect(virDomainNetDefPtr net G_GNUC_UNUSED)
|
||||
{
|
||||
if (fcntl(1732, F_GETFD) != -1)
|
||||
abort();
|
||||
return 1732;
|
||||
}
|
||||
|
||||
@@ -1491,6 +1491,7 @@ mymain(void)
|
||||
QEMU_CAPS_DEVICE_VFIO_PCI);
|
||||
DO_TEST_FAILURE("net-hostdev-fail",
|
||||
QEMU_CAPS_DEVICE_VFIO_PCI);
|
||||
DO_TEST_CAPS_LATEST("net-vdpa");
|
||||
|
||||
DO_TEST("hostdev-pci-multifunction",
|
||||
QEMU_CAPS_KVM,
|
||||
|
||||
34
tests/qemuxml2xmloutdata/net-vdpa.xml
Normal file
34
tests/qemuxml2xmloutdata/net-vdpa.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<domain type='qemu'>
|
||||
<name>QEMUGuest1</name>
|
||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
<memory unit='KiB'>219136</memory>
|
||||
<currentMemory unit='KiB'>219136</currentMemory>
|
||||
<vcpu placement='static'>1</vcpu>
|
||||
<os>
|
||||
<type arch='i686' machine='pc'>hvm</type>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu-system-i386</emulator>
|
||||
<controller type='usb' index='0'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
||||
</controller>
|
||||
<controller type='ide' index='0'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
|
||||
</controller>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<interface type='vdpa'>
|
||||
<mac address='52:54:00:95:db:c0'/>
|
||||
<source dev='/dev/vhost-vdpa-0'/>
|
||||
<model type='virtio'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
|
||||
</interface>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<input type='keyboard' bus='ps2'/>
|
||||
<memballoon model='none'/>
|
||||
</devices>
|
||||
</domain>
|
||||
@@ -502,6 +502,7 @@ mymain(void)
|
||||
DO_TEST("net-mtu", QEMU_CAPS_VIRTIO_NET_HOST_MTU);
|
||||
DO_TEST("net-coalesce", NONE);
|
||||
DO_TEST("net-many-models", NONE);
|
||||
DO_TEST("net-vdpa", QEMU_CAPS_NETDEV_VHOST_VDPA);
|
||||
|
||||
DO_TEST("serial-tcp-tlsx509-chardev", NONE);
|
||||
DO_TEST("serial-tcp-tlsx509-chardev-notls", NONE);
|
||||
|
||||
Reference in New Issue
Block a user