M Michael S. Tsirkin #
Message details and related content
On Fri, Sep 10, 2021 at 10:28:18AM +0800, Wu Zongyong wrote:
On Thu, Sep 09, 2021 at 09:57:50AM -0400, Michael S. Tsirkin wrote:quoted
On Wed, Sep 08, 2021 at 08:20:37PM +0800, Wu Zongyong wrote:quoted
This patch implements a vdpa driver for legacy virtio-pci device. And this has been tested with the ENI(Elastic Network Interface) which is a hardware virtio network device in Alibaba ECS baremetal instance. Note that legacy device doesn't support to change the virtqueue size, so users should use get_vq_num_unchangeable callback to check if the virqueue size can be changed.Hmm isn't this implicit in this being a legacy device?Yes, but there is no way to report the backend device is legacy for users. So I add a new callback get_vq_num_unchangeable to indicate it.
Legacy is actually easy. It does not have VIRTIO_F_VERSION_1. Transitional devices with two interfaces are trickier. These really need an ioctl so userspace can tell vdpa whether it's being used through a legacy or modern interface.
quoted
quoted
If not, users should get the virqueue size first by the get_vq_num_max callback first then allocate same size memory for the virtqueue otherwise the device won't work correctly. Signed-off-by: Wu Zongyong <redacted> --- drivers/vdpa/Kconfig | 7 + drivers/vdpa/virtio_pci/Makefile | 1 + drivers/vdpa/virtio_pci/vp_vdpa_common.c | 5 + drivers/vdpa/virtio_pci/vp_vdpa_common.h | 11 + drivers/vdpa/virtio_pci/vp_vdpa_legacy.c | 346 +++++++++++++++++++++++ 5 files changed, 370 insertions(+) create mode 100644 drivers/vdpa/virtio_pci/vp_vdpa_legacy.cdiff --git a/drivers/vdpa/Kconfig b/drivers/vdpa/Kconfig index a503c1b2bfd9..ccb4fdb11f0f 100644 --- a/drivers/vdpa/Kconfig +++ b/drivers/vdpa/Kconfig@@ -67,4 +67,11 @@ config VP_VDPA help This kernel module bridges virtio PCI device to vDPA bus. +config VP_VDPA_LEGACY + bool "Support legacy virtio pci device" + depends on VP_VDPA + select VIRTIO_PCI_LIB_LEGACY + help + This option enables bridges legacy virito PCI device to vDPA bus. + endif # VDPAdiff --git a/drivers/vdpa/virtio_pci/Makefile b/drivers/vdpa/virtio_pci/Makefile index a772d86952b1..77c52dfb8b56 100644 --- a/drivers/vdpa/virtio_pci/Makefile +++ b/drivers/vdpa/virtio_pci/Makefile@@ -1,4 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 vp_vdpa-y += vp_vdpa_common.o vp_vdpa_modern.o +vp_vdpa-$(CONFIG_VP_VDPA_LEGACY) += vp_vdpa_legacy.o obj-$(CONFIG_VP_VDPA) += vp_vdpa.o
_______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization