From mboxrd@z Thu Jan 1 00:00:00 1970 From: Santosh Shukla Subject: [PATCH 01/10] bsdapp/eal_pci: get iommu class Date: Thu, 8 Jun 2017 16:35:04 +0530 Message-ID: <20170608110513.22548-2-santosh.shukla@caviumnetworks.com> References: <20170608110513.22548-1-santosh.shukla@caviumnetworks.com> Mime-Version: 1.0 Content-Type: text/plain Cc: jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com, shreyansh.jain@nxp.com, gaetan.rivet@6wind.com, Santosh Shukla To: thomas@monjalon.net, bruce.richardson@intel.com, dev@dpdk.org Return-path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0067.outbound.protection.outlook.com [104.47.38.67]) by dpdk.org (Postfix) with ESMTP id D58842BB9 for ; Thu, 8 Jun 2017 13:06:20 +0200 (CEST) In-Reply-To: <20170608110513.22548-1-santosh.shukla@caviumnetworks.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Introducing rte_pci_get_iommu_class API which helps to get iommu class of PCI device on the bus and returns preferred iova mapping mode for that bus. Bsdapp case returns default iova mode. Signed-off-by: Santosh Shukla Signed-off-by: Jerin Jacob --- lib/librte_eal/bsdapp/eal/eal_pci.c | 10 ++++++++++ lib/librte_eal/bsdapp/eal/rte_eal_version.map | 7 +++++++ lib/librte_eal/common/include/rte_bus.h | 10 ++++++++++ lib/librte_eal/common/include/rte_pci.h | 11 +++++++++++ 4 files changed, 38 insertions(+) diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c index e321461d8..9c6670964 100644 --- a/lib/librte_eal/bsdapp/eal/eal_pci.c +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c @@ -405,6 +405,16 @@ rte_pci_scan(void) return -1; } +/* + * Get iommu class of pci devices on the bus. + */ +enum rte_iova_mode +rte_pci_get_iommu_class(void) +{ + /* Has only one drv (RTE_KDRV_NIC_UIO) so ..*/ + return RTE_IOVA_PA; +} + int pci_update_device(const struct rte_pci_addr *addr) { diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map index 2e48a7366..a9cc3a67e 100644 --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map @@ -193,3 +193,10 @@ DPDK_17.05 { vfio_get_group_no; } DPDK_17.02; + +DPDK_17.08 { + global: + + rte_pci_get_iommu_class; + +} DPDK_17.05; diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h index 7c3696926..56eacd0c9 100644 --- a/lib/librte_eal/common/include/rte_bus.h +++ b/lib/librte_eal/common/include/rte_bus.h @@ -56,6 +56,16 @@ extern "C" { /** Double linked list of buses */ TAILQ_HEAD(rte_bus_list, rte_bus); + +/** + * IOVA mapping mode. + */ +enum rte_iova_mode { + RTE_IOVA_DC, /* _DC --> Don't Care mode */ + RTE_IOVA_PA, + RTE_IOVA_VA +}; + /** * Bus specific scan for devices attached on the bus. * For each bus object, the scan would be reponsible for finding devices and diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h index b82ab9e79..bc403123a 100644 --- a/lib/librte_eal/common/include/rte_pci.h +++ b/lib/librte_eal/common/include/rte_pci.h @@ -377,6 +377,16 @@ int rte_pci_probe(void); /** + * Get iommu class of PCI devices on the bus. + * And return their preferred iova mapping mode. + * + * @return + * - enum rte_iova_mode. + */ +enum rte_iova_mode +rte_pci_get_iommu_class(void); + +/** * Map the PCI device resources in user space virtual memory address * * Note that driver should not call this function when flag @@ -472,6 +482,7 @@ int rte_pci_detach(const struct rte_pci_addr *addr); */ void rte_pci_dump(FILE *f); + /** * Register a PCI driver. * -- 2.11.0