[v3,2/2] vhost: force vIOMMU enablement with VDUSE
Checks
Commit Message
Unlike Vhost-user, VDUSE requires vIOMMU support.
This patch ignores whether RTE_VHOST_USER_IOMMU_SUPPORT
flag is passed at register time to avoid having application
to pass it for having working VDUSE device creation.
Fixes: 0adb8eccc6a6 ("vhost: add VDUSE device creation and destruction")
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
lib/vhost/socket.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
Comments
On 13/07/2023 14:52, Maxime Coquelin wrote:
> Unlike Vhost-user, VDUSE requires vIOMMU support.
> This patch ignores whether RTE_VHOST_USER_IOMMU_SUPPORT
> flag is passed at register time to avoid having application
> to pass it for having working VDUSE device creation.
>
> Fixes: 0adb8eccc6a6 ("vhost: add VDUSE device creation and destruction")
>
> Signed-off-by: Maxime Coquelin<maxime.coquelin@redhat.com>
> ---
> lib/vhost/socket.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
lgtm
Acked-by: Kevin Traynor <ktraynor@redhat.com>
@@ -932,11 +932,13 @@ rte_vhost_driver_register(const char *path, uint64_t flags)
vsocket->async_copy = flags & RTE_VHOST_USER_ASYNC_COPY;
vsocket->net_compliant_ol_flags = flags & RTE_VHOST_USER_NET_COMPLIANT_OL_FLAGS;
vsocket->stats_enabled = flags & RTE_VHOST_USER_NET_STATS_ENABLE;
- vsocket->iommu_support = flags & RTE_VHOST_USER_IOMMU_SUPPORT;
+ if (vsocket->is_vduse)
+ vsocket->iommu_support = true;
+ else
+ vsocket->iommu_support = flags & RTE_VHOST_USER_IOMMU_SUPPORT;
- if (vsocket->async_copy &&
- (flags & (RTE_VHOST_USER_IOMMU_SUPPORT |
- RTE_VHOST_USER_POSTCOPY_SUPPORT))) {
+ if (vsocket->async_copy && (vsocket->iommu_support ||
+ (flags & RTE_VHOST_USER_POSTCOPY_SUPPORT))) {
VHOST_LOG_CONFIG(path, ERR, "async copy with IOMMU or post-copy not supported\n");
goto out_mutex;
}
@@ -986,7 +988,7 @@ rte_vhost_driver_register(const char *path, uint64_t flags)
vsocket->features &= ~seg_offload_features;
}
- if (!(flags & RTE_VHOST_USER_IOMMU_SUPPORT)) {
+ if (!vsocket->iommu_support) {
vsocket->supported_features &= ~(1ULL << VIRTIO_F_IOMMU_PLATFORM);
vsocket->features &= ~(1ULL << VIRTIO_F_IOMMU_PLATFORM);
}