DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chaitanya Babu Talluri <tallurix.chaitanya.babu@intel.com>
To: dev@dpdk.org
Cc: reshma.pattan@intel.com, jananeex.m.parthasarathy@intel.com,
	anatoly.burakov@intel.com,
	Chaitanya Babu Talluri <tallurix.chaitanya.babu@intel.com>
Subject: [dpdk-dev] [PATCH v4 3/4] lib/eal: add API to check iommu type is set
Date: Wed,  4 Sep 2019 13:04:41 +0100	[thread overview]
Message-ID: <1567598682-2225-4-git-send-email-tallurix.chaitanya.babu@intel.com> (raw)
In-Reply-To: <1566907031-2105-1-git-send-email-tallurix.chaitanya.babu@intel.com>

Add rte_vfio_iommu_type_is_set() to check IOMMU
type for default container.

Signed-off-by: Chaitanya Babu Talluri <tallurix.chaitanya.babu@intel.com>
---
 lib/librte_eal/common/include/rte_vfio.h | 11 +++++++++++
 lib/librte_eal/linux/eal/eal_vfio.c      | 16 ++++++++++++++++
 lib/librte_eal/rte_eal_version.map       |  3 +++
 3 files changed, 30 insertions(+)

diff --git a/lib/librte_eal/common/include/rte_vfio.h b/lib/librte_eal/common/include/rte_vfio.h
index b360485fa..e3f80f772 100644
--- a/lib/librte_eal/common/include/rte_vfio.h
+++ b/lib/librte_eal/common/include/rte_vfio.h
@@ -397,6 +397,17 @@ int
 rte_vfio_container_dma_unmap(int container_fd, uint64_t vaddr,
 		uint64_t iova, uint64_t len);
 
+/**
+ * Check VFIO IOMMU Type is set for default container.
+ *
+ * @return
+ *    0 if successful
+ *   <0 if failed
+ */
+__rte_experimental
+int
+rte_vfio_iommu_type_is_set(void);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/librte_eal/linux/eal/eal_vfio.c b/lib/librte_eal/linux/eal/eal_vfio.c
index 04c284cb2..a5bb1cff4 100644
--- a/lib/librte_eal/linux/eal/eal_vfio.c
+++ b/lib/librte_eal/linux/eal/eal_vfio.c
@@ -2071,6 +2071,17 @@ rte_vfio_container_dma_unmap(int container_fd, uint64_t vaddr, uint64_t iova,
 	return container_dma_unmap(vfio_cfg, vaddr, iova, len);
 }
 
+int
+rte_vfio_iommu_type_is_set(void)
+{
+	if (vfio_get_iommu_type() < 0) {
+		RTE_LOG(ERR, EAL, "VFIO IOMMU Type is not set\n");
+		return -1;
+	}
+
+	return 0;
+}
+
 #else
 
 int
@@ -2191,4 +2202,9 @@ rte_vfio_container_dma_unmap(__rte_unused int container_fd,
 	return -1;
 }
 
+int
+rte_vfio_iommu_type_is_set(void)
+{
+	return -1;
+}
 #endif /* VFIO_PRESENT */
diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
index 7cbf82d37..5b1ba6fbd 100644
--- a/lib/librte_eal/rte_eal_version.map
+++ b/lib/librte_eal/rte_eal_version.map
@@ -419,4 +419,7 @@ EXPERIMENTAL {
 	rte_mcfg_timer_lock;
 	rte_mcfg_timer_unlock;
 	rte_rand_max;
+
+	# added in 19.11
+	rte_vfio_iommu_type_is_set;
 };
-- 
2.17.2


  parent reply	other threads:[~2019-09-04 12:06 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-21 13:02 [dpdk-dev] [PATCH 0/3] add unit tests for eal vfio library Chaitanya Babu Talluri
2019-08-21 13:02 ` [dpdk-dev] [PATCH 1/3] lib/eal: fix vfio unmap that fails unexpectedly Chaitanya Babu Talluri
2019-08-21 13:20   ` Burakov, Anatoly
2019-08-21 13:02 ` [dpdk-dev] [PATCH 2/3] lib/eal: fix vfio unmap that succeeds unexpectedly Chaitanya Babu Talluri
2019-08-21 13:24   ` Burakov, Anatoly
2019-08-21 13:02 ` [dpdk-dev] [PATCH 3/3] app/test: add unit tests for eal vfio Chaitanya Babu Talluri
2019-08-21 15:44   ` Aaron Conole
2019-08-22  7:18     ` Chaitanya Babu, TalluriX
2019-08-22 10:57       ` Burakov, Anatoly
2019-08-22 14:40         ` Aaron Conole
2019-08-22 11:53 ` [dpdk-dev] [PATCH v2 0/3] add unit tests for eal vfio library Chaitanya Babu Talluri
2019-08-27 11:57   ` [dpdk-dev] [PATCH v3 0/4] " Chaitanya Babu Talluri
2019-09-04 12:04     ` [dpdk-dev] [PATCH v4 " Chaitanya Babu Talluri
2019-09-23 15:56       ` Burakov, Anatoly
2023-06-14 19:37       ` Stephen Hemminger
2019-09-04 12:04     ` [dpdk-dev] [PATCH v4 1/4] lib/eal: fix vfio unmap that fails unexpectedly Chaitanya Babu Talluri
2019-09-04 12:04     ` [dpdk-dev] [PATCH v4 2/4] lib/eal: fix vfio unmap that succeeds unexpectedly Chaitanya Babu Talluri
2019-09-04 12:04     ` Chaitanya Babu Talluri [this message]
2019-09-04 12:04     ` [dpdk-dev] [PATCH v4 4/4] app/test: add unit tests for eal vfio Chaitanya Babu Talluri
2019-08-27 11:57   ` [dpdk-dev] [PATCH v3 1/4] lib/eal: fix vfio unmap that fails unexpectedly Chaitanya Babu Talluri
2019-08-27 11:57   ` [dpdk-dev] [PATCH v3 2/4] lib/eal: fix vfio unmap that succeeds unexpectedly Chaitanya Babu Talluri
2019-08-27 11:57   ` [dpdk-dev] [PATCH v3 3/4] lib/eal: add API to check iommu type is set Chaitanya Babu Talluri
2019-08-27 11:57   ` [dpdk-dev] [PATCH v3 4/4] app/test: add unit tests for eal vfio Chaitanya Babu Talluri
2019-08-22 11:53 ` [dpdk-dev] [PATCH v2 1/3] lib/eal: fix vfio unmap that fails unexpectedly Chaitanya Babu Talluri
2019-08-22 11:53 ` [dpdk-dev] [PATCH v2 2/3] lib/eal: fix vfio unmap that succeeds unexpectedly Chaitanya Babu Talluri
2019-08-22 11:53 ` [dpdk-dev] [PATCH v2 3/3] app/test: add unit tests for eal vfio Chaitanya Babu Talluri
2019-08-22 12:15   ` Burakov, Anatoly
2019-08-23  7:57     ` Chaitanya Babu, TalluriX
2019-08-23  9:12       ` Burakov, Anatoly

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=1567598682-2225-4-git-send-email-tallurix.chaitanya.babu@intel.com \
    --to=tallurix.chaitanya.babu@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=jananeex.m.parthasarathy@intel.com \
    --cc=reshma.pattan@intel.com \
    /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).