From patchwork Thu Jul 13 11:29:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Coquelin X-Patchwork-Id: 129524 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4DE0C42E5F; Thu, 13 Jul 2023 13:29:23 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3BFD442B8E; Thu, 13 Jul 2023 13:29:20 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 5C87C42B8E for ; Thu, 13 Jul 2023 13:29:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689247757; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3Tur4zVJZTfR2trWISKC8yWy9AgpA4dz1YtlnKSlVAM=; b=c5scHs/qH6lfmddQg7YCD4cmEgs7kaQGBuqCJuPCu1GkgLvKFqjIbsNo7brA3/f0n8jDod tVcLLo0WG9iNJzP0Hj9ikWhercUiWGYitXSZ/j7AAPLenOuvOIZSsziXkr5rZEsbDuYmDp jCOcTu2hgpi1iTC+L8TPaQddxoCeL+Q= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-463-ez2BdJimP_aIAr_ojVOA6A-1; Thu, 13 Jul 2023 07:29:13 -0400 X-MC-Unique: ez2BdJimP_aIAr_ojVOA6A-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3E0C1104458D; Thu, 13 Jul 2023 11:29:13 +0000 (UTC) Received: from max-t490s.redhat.com (unknown [10.39.208.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id B74A2492C13; Thu, 13 Jul 2023 11:29:11 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, david.marchand@redhat.com, thomas@monjalon.net, chenbo.xia@intel.com, aconole@redhat.com, ktraynor@redhat.com Cc: Maxime Coquelin Subject: [PATCH v2 2/2] vhost: force vIOMMU enablement with VDUSE Date: Thu, 13 Jul 2023 13:29:05 +0200 Message-ID: <20230713112905.233306-3-maxime.coquelin@redhat.com> In-Reply-To: <20230713112905.233306-1-maxime.coquelin@redhat.com> References: <20230713112905.233306-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- lib/vhost/socket.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c index 57dfe3d2fe..79f2138f60 100644 --- a/lib/vhost/socket.c +++ b/lib/vhost/socket.c @@ -932,7 +932,10 @@ 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 | @@ -986,7 +989,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); }