Generic vdpa

From QEMU

Normal vhost-vDPA

Before Qemu 8.0, if we want to use virtio device such as virtio-net with kernel vDPA framework, we need to add vhost-vDPA support for the virtio device. And the type of virtio device used must be explicitly specified in the qemu command line (such as virtio-net-pci).

qemu -netdev type=vhost-vdpa,vhostdev=/dev/vhost-vdpa-0,id=net0 \
-device virtio-net-pci,netdev=net0

Currently only the virtio-net device for vhost-vDPA has been fully supported in qemu, the supporting of other virtio devices has developed slowly.

Generic vDPA

With the rapid development of DPU technology, more and more virtio devices such as virtio-net, virito-blk, virtio-scsi, and virito-rdma have gradually achieved hardware offloading. The adaptation pace for other vDPA device types cannot keep up with the current DPU full offloading scenario.

Therefore Qemu 8.0 introduced a new device of 'vhost-vdpa-device-pci' that does not differentiate specific virtio devices, which called generic vDPA device. This generic vDPA device type is a framework that supports more or even all virtio devices, allowing for quick addition of support for other virtio devices in the future. The generic vDPA solution avoids the need for maintaining a large amount of device emulation code, reducing maintenance costs.

Similar to passthrough devices, qemu does not need to be concerned with the specific virtio device type or keep track of the virtio device's state. It only needs to present the device to the guest and integrate with the vhost-vDPA uAPI. The guest OS kernel can recognize the device type of virtio-pci and automatically load the corresponding virtio driver.

Usage of generic vDPA:

qemu -device vhost-vdpa-device-pci,vhostdev=/dev/vhost-vdpa-0

Generic vdpa with kernel vdpa framework.png