From 34924a8987e6c1fe5dbefa79a41215a16ec37911 Mon Sep 17 00:00:00 2001 From: Hao Chen Date: Sun, 13 Nov 2022 22:04:26 -0500 Subject: [PATCH] examples/vdpa: enable vIOMMU 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 Reviewed-by: Maxime Coquelin --- .mailmap | 2 +- examples/vdpa/main.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.mailmap b/.mailmap index 9501257c17b..aeb5561ae81 100644 --- a/.mailmap +++ b/.mailmap @@ -456,7 +456,7 @@ Hamza Khan Hannes Frederic Sowa Hanoch Haim Hanumanth Pothula -Hao Chen +Hao Chen Hao Wu Hari Kumar Vemula Harini Ramakrishnan diff --git a/examples/vdpa/main.c b/examples/vdpa/main.c index 4c7e81d7b6a..4d3203f3a71 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",