DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shubham Rohila <shubham.rohila@amd.com>
To: <nikhil.agarwal@amd.com>, <david.marchand@redhat.com>,
	<nipun.gupta@amd.com>, <dev@dpdk.org>
Cc: <thomas@monjalon.net>, <ferruh.yigit@amd.com>,
	<anatoly.burakov@intel.com>,
	Shubham Rohila <shubham.rohila@amd.com>
Subject: [PATCH v2 1/2] bus/cdx: add support for devices without MSI
Date: Fri, 3 Nov 2023 16:50:15 +0530	[thread overview]
Message-ID: <20231103112016.1945684-1-shubham.rohila@amd.com> (raw)
In-Reply-To: <20231027162212.3353973-1-ferruh.yigit@amd.com>

From: Nikhil Agarwal <nikhil.agarwal@amd.com>

Update the cleanup routine for cdx device to support
device without MSI. Also, set vfio_dev_fd for such devices
This fd can be used for BME reload operations.

Signed-off-by: Nikhil Agarwal <nikhil.agarwal@amd.com>
Signed-off-by: Shubham Rohila <shubham.rohila@amd.com>
---
 v2
 - New patch in the series
 drivers/bus/cdx/cdx.c      |  2 +-
 drivers/bus/cdx/cdx_vfio.c | 19 +++++++++----------
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c
index 541aae76c3..62b108e082 100644
--- a/drivers/bus/cdx/cdx.c
+++ b/drivers/bus/cdx/cdx.c
@@ -405,9 +405,9 @@ cdx_probe_one_driver(struct rte_cdx_driver *dr,
 	return ret;
 
 error_probe:
+	cdx_vfio_unmap_resource(dev);
 	rte_intr_instance_free(dev->intr_handle);
 	dev->intr_handle = NULL;
-	cdx_vfio_unmap_resource(dev);
 error_map_device:
 	return ret;
 }
diff --git a/drivers/bus/cdx/cdx_vfio.c b/drivers/bus/cdx/cdx_vfio.c
index 8a3ac0b995..8cac79782e 100644
--- a/drivers/bus/cdx/cdx_vfio.c
+++ b/drivers/bus/cdx/cdx_vfio.c
@@ -101,13 +101,12 @@ cdx_vfio_unmap_resource_primary(struct rte_cdx_device *dev)
 	struct mapped_cdx_res_list *vfio_res_list;
 	int ret, vfio_dev_fd;
 
-	if (rte_intr_fd_get(dev->intr_handle) < 0)
-		return -1;
-
-	if (close(rte_intr_fd_get(dev->intr_handle)) < 0) {
-		CDX_BUS_ERR("Error when closing eventfd file descriptor for %s",
-			dev->device.name);
-		return -1;
+	if (rte_intr_fd_get(dev->intr_handle) >= 0) {
+		if (close(rte_intr_fd_get(dev->intr_handle)) < 0) {
+			CDX_BUS_ERR("Error when closing eventfd file descriptor for %s",
+				dev->device.name);
+			return -1;
+		}
 	}
 
 	vfio_dev_fd = rte_intr_dev_fd_get(dev->intr_handle);
@@ -185,6 +184,9 @@ cdx_vfio_setup_interrupts(struct rte_cdx_device *dev, int vfio_dev_fd,
 {
 	int i, ret;
 
+	if (rte_intr_dev_fd_set(dev->intr_handle, vfio_dev_fd))
+		return -1;
+
 	if (num_irqs == 0)
 		return 0;
 
@@ -227,9 +229,6 @@ cdx_vfio_setup_interrupts(struct rte_cdx_device *dev, int vfio_dev_fd,
 		if (rte_intr_type_set(dev->intr_handle, RTE_INTR_HANDLE_VFIO_MSIX))
 			return -1;
 
-		if (rte_intr_dev_fd_set(dev->intr_handle, vfio_dev_fd))
-			return -1;
-
 		return 0;
 	}
 
-- 
2.25.1


  parent reply	other threads:[~2023-11-03 11:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-27 16:22 [PATCH] Add bus master enable/disable APIs for CDX devices Ferruh Yigit
2023-10-27 16:24 ` Ferruh Yigit
2023-11-03 11:20 ` Shubham Rohila [this message]
2023-11-03 11:20   ` [PATCH v2 2/2] bus/cdx: add bus master enable/disable APIs Shubham Rohila
2023-11-07 14:25     ` Gupta, Nipun
2023-11-12 13:36       ` Thomas Monjalon
2023-11-06 17:04   ` [PATCH v2 1/2] bus/cdx: add support for devices without MSI Gupta, Nipun
2023-11-06 17:54     ` Agarwal, Nikhil
2023-11-07 14:25   ` Gupta, Nipun
2024-10-03 22:16 ` [PATCH] Add bus master enable/disable APIs for CDX devices Stephen Hemminger
2024-10-03 22:48   ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231103112016.1945684-1-shubham.rohila@amd.com \
    --to=shubham.rohila@amd.com \
    --cc=anatoly.burakov@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=nikhil.agarwal@amd.com \
    --cc=nipun.gupta@amd.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).