Skip to content

Commit

Permalink
examples/vdpa: enable vIOMMU
Browse files Browse the repository at this point in the history
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 <chenh@yusur.tech>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
  • Loading branch information
Hao Chen authored and mcoquelin committed Feb 9, 2023
1 parent cc75968 commit 34924a8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ Hamza Khan <hamza.khan@intel.com>
Hannes Frederic Sowa <hannes@stressinduktion.org>
Hanoch Haim <hhaim@cisco.com>
Hanumanth Pothula <hpothula@marvell.com>
Hao Chen <chenhao164@huawei.com>
Hao Chen <chenh@yusur.tech> <chenhao164@huawei.com>
Hao Wu <hao.wu@intel.com>
Hari Kumar Vemula <hari.kumarx.vemula@intel.com>
Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
Expand Down
2 changes: 2 additions & 0 deletions examples/vdpa/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 34924a8

Please sign in to comment.