From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7BFBBA0545 for ; Mon, 20 Jun 2022 11:48:06 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 77B6740150; Mon, 20 Jun 2022 11:48:06 +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 11A6C40150 for ; Mon, 20 Jun 2022 11:48:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655718484; 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=pYJnGOdq0iQHUJykwHKnCth7hzKlx6v91Bazthmw7u4=; b=I51L6pMMIRMCR47lWaZdMNjsWDYcq77M1tdqYP7dto+QdOE0Cj1ZafQdSKjJ/tgAeRHoUW /6pWI5L+z9EqAfrNeRyHYt8cDhpZOSS5oFyUi1Inmzf2/D1G25k6WVhOpA1E0Wd/SyBc7n /NwHtiM12XF7EH6zXe2vzFR66/DnxOc= 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-629-1Wdv_UZpOVq7H0NRBag-xg-1; Mon, 20 Jun 2022 05:48:01 -0400 X-MC-Unique: 1Wdv_UZpOVq7H0NRBag-xg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 373E1101E988; Mon, 20 Jun 2022 09:48:01 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.194.217]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6341B400F3FF; Mon, 20 Jun 2022 09:48:00 +0000 (UTC) From: Kevin Traynor To: Romain Delhomel Cc: Hemant Agrawal , dpdk stable Subject: patch 'bus/fslmc: fix VFIO setup' has been queued to stable release 21.11.2 Date: Mon, 20 Jun 2022 10:47:36 +0100 Message-Id: <20220620094752.1027299-3-ktraynor@redhat.com> In-Reply-To: <20220620094752.1027299-1-ktraynor@redhat.com> References: <20220620094752.1027299-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/23/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/7133eadc9ccca643a3c507c4505726eaf706ef5b Thanks. Kevin --- >From 7133eadc9ccca643a3c507c4505726eaf706ef5b Mon Sep 17 00:00:00 2001 From: Romain Delhomel Date: Fri, 3 Jun 2022 17:18:30 +0200 Subject: [PATCH] bus/fslmc: fix VFIO setup [ upstream commit 36c3c4df136f6d79c0ffaddec00696f5eddaef16 ] At device probe, the fslmc bus driver calls rte_vfio_get_group_fd() to get a fd associated to a vfio group. This function first checks if the group is already opened, else it opens /dev/vfio/%u, and increases the number of active groups in default_vfio_cfg (which references the default vfio container). When adding the first group to a vfio_cfg, the caller is supposed to pick an IOMMU type and set up DMA mappings for container, as it's done by pci bus, but it is not done here. Instead, a new container is created and used. This prevents the pci bus driver, which uses the default_vfio_cfg container, to configure the container because default_vfio_cfg->active_group > 1. This patch fixes the issue by always creating a new container (and its associated vfio_cfg) and binding the group to it. Fixes: a69f79300262 ("bus/fslmc: support multi VFIO group") Signed-off-by: Romain Delhomel Acked-by: Hemant Agrawal --- drivers/bus/fslmc/fslmc_vfio.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c index b4704eeae4..abe1cab2ee 100644 --- a/drivers/bus/fslmc/fslmc_vfio.c +++ b/drivers/bus/fslmc/fslmc_vfio.c @@ -980,4 +980,5 @@ fslmc_vfio_setup_group(void) int groupid; int ret; + int vfio_container_fd; struct vfio_group_status status = { .argsz = sizeof(status) }; @@ -998,6 +999,13 @@ fslmc_vfio_setup_group(void) } + ret = rte_vfio_container_create(); + if (ret < 0) { + DPAA2_BUS_ERR("Failed to open VFIO container"); + return ret; + } + vfio_container_fd = ret; + /* Get the actual group fd */ - ret = rte_vfio_get_group_fd(groupid); + ret = rte_vfio_container_group_bind(vfio_container_fd, groupid); if (ret < 0) return ret; -- 2.34.3 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-06-20 10:46:27.858802137 +0100 +++ 0003-bus-fslmc-fix-VFIO-setup.patch 2022-06-20 10:46:27.765146795 +0100 @@ -1 +1 @@ -From 36c3c4df136f6d79c0ffaddec00696f5eddaef16 Mon Sep 17 00:00:00 2001 +From 7133eadc9ccca643a3c507c4505726eaf706ef5b Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 36c3c4df136f6d79c0ffaddec00696f5eddaef16 ] + @@ -25 +26,0 @@ -Cc: stable@dpdk.org @@ -34 +35 @@ -index 1b89a56bbc..3d4e71a80a 100644 +index b4704eeae4..abe1cab2ee 100644 @@ -37 +38 @@ -@@ -996,4 +996,5 @@ fslmc_vfio_setup_group(void) +@@ -980,4 +980,5 @@ fslmc_vfio_setup_group(void) @@ -43 +44 @@ -@@ -1014,6 +1015,13 @@ fslmc_vfio_setup_group(void) +@@ -998,6 +999,13 @@ fslmc_vfio_setup_group(void)