When we run dpdk vdpa in the nested virtual machine vm-L1 and ping test in vm-L2, the ping is not good. The reason for troubleshooting is that the virtio net in vm-L2 sends control information to the vring, and the qemu back-end device in vm-L1 cannot obtain correct data from the vring. This problem is related to the opening of the vIOMMU.
This patch add flag RTE_VHOST_USER_IOMMU_SUPPORT to use vhost vIOMMU , VIRTIO_F_IOMMU_PLATFORM feature will be negotiated successfully if virtio iommu is used in a nested virtualization environment. The configuration is as follows: The host starts iommu, and the kernel parameter is added with 'intel_iommu=on iommu=pt'. VM-L1's xml add viommu and virtio device adds iommu='on' ats='on'. VM-L2's xml enables viommu, and adds parameters 'intel_iommu=on iommu=pt' to kernel. Then the ping test in vm-L2 is OK. Signed-off-by: Hao Chen <ch...@yusur.tech> --- v4: *Simplify the patch. Set the flags RTE_VHOST_USER_IOMMU_SUPPORT default. v3: *Modify mail title. v2: *fprintf all string including the eal one. *remove exit(1). examples/vdpa/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/vdpa/main.c b/examples/vdpa/main.c index 4c7e81d7b6..4d3203f3a7 100644 --- a/examples/vdpa/main.c +++ b/examples/vdpa/main.c @@ -214,6 +214,8 @@ start_vdpa(struct vdpa_port *vport) if (client_mode) vport->flags |= RTE_VHOST_USER_CLIENT; + vport->flags |= RTE_VHOST_USER_IOMMU_SUPPORT; + if (access(socket_path, F_OK) != -1 && !client_mode) { RTE_LOG(ERR, VDPA, "%s exists, please remove it or specify another file and try again.\n", -- 2.27.0