From mboxrd@z Thu Jan 1 00:00:00 1970 From: Santosh Shukla Subject: [PATCH v3 00/11] Infrastructure to detect iova mapping on the bus Date: Tue, 11 Jul 2017 06:16:20 +0000 Message-ID: <20170711061631.5018-1-santosh.shukla@caviumnetworks.com> References: <20170710114235.18970-1-santosh.shukla@caviumnetworks.com> Mime-Version: 1.0 Content-Type: text/plain Cc: bruce.richardson@intel.com, jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com, shreyansh.jain@nxp.com, gaetan.rivet@6wind.com, sergio.gonzalez.monroy@intel.com, anatoly.burakov@intel.com, stephen@networkplumber.org, maxime.coquelin@redhat.com, olivier.matz@6wind.com, Santosh Shukla To: thomas@monjalon.net, dev@dpdk.org Return-path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0067.outbound.protection.outlook.com [104.47.37.67]) by dpdk.org (Postfix) with ESMTP id A45A1532D for ; Tue, 11 Jul 2017 08:17:27 +0200 (CEST) In-Reply-To: <20170710114235.18970-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" v3: Removed virt2phy translation for mempool (suggested by Olivier [4]). Patch series rebased on 'a6e3149d0c0fac39a6fc970bdadfae14f875c9c6'. v2: Based on the discussion on the thread [3]. Introducing RTE_PCI_DRV_NEED_IOVA_VA flag for autodetection of iova va mapping. If a PCI driver demand for IOVA as VA scheme then the driver can add it in the PCI driver registration function. Algorithm to select IOVA as VA for PCI bus case: 0. Look for device attached to vfio kdrv and has .drv_flag set to RTE_PCI_DRV_NEED_IOVA_VA. 1. Look for any device attached to UIO class of driver. 2. Check for vfio-noiommu mode enabled. If 1) & 2) is false and 0) is true then select mapping scheme as iova=va. Otherwise use default mapping scheme (iova_pa). That way, Bus can truly autodetect the iova mapping mode for a device Or a set of the device. v1 --> v2: - Removed override eal option i.e. (--iova-mode=<>) Because we have means to truly autodetect the iova mode. - Introduced RTE_PCI_DRV_NEED_IOVA_VA drv_flag (Suggested by Maxime). - Using NEED_IOVA_VA drv_flag in autodetection logic. - Removed Linux version check macro in vfio code, As per Maxime feedback. - Moved rte_pci_match API from local to global. v2 --> v3: - Removed rte_mempool_virt2phy (suggested by Olivier) Patch Summary: 0) 1st: Introducing a new flag in rte_pci_drv 1) 2nd: declare rte_pci_match api in pci header. Required for autodetection in follow up patches. 2) 3nd - 4th: autodetection mapping infrastructure for Linux/bsdapp. 3) 5th: Introduces global bus API named rte_bus_get_iommu_class. 4) 6th: iova mode helper API. 5) 7th - 8th: Calls rte_bus_get_iommu_class API for Linux/bsdapp and returns their iova mode. 6) 9th: Check iova mode and accordingly map vfio.dma_map to _pa or _va. 7) 10th - 11th: Check for IOVA_VA mode in below APIs - rte_mem_virt2phy - rte_malloc_virt2phy Test History: - Tested for x86/XL710 40G NIC card for both modes (iova_va/pa). - Tested for arm64/thunderx vNIC Integrated NIC for both modes - Tested for arm64/Octeontx integrated NICs for only Iova_va mode(It supports only one mode.) - Ran standalone tests like mempool_autotest, mbuf_autotest. - Verified for Doxygen. Work History: For v1, Refer [1]. For v2, Refer [2]. Checkpatch result: - No error/warning noticed. [1] https://www.mail-archive.com/dev@dpdk.org/msg67438.html [2] https://www.mail-archive.com/dev@dpdk.org/msg70674.html [3] https://www.mail-archive.com/dev@dpdk.org/msg70279.html [4] https://www.mail-archive.com/dev@dpdk.org/msg70692.html Santosh Shukla (11): eal/pci: introduce PCI driver iova as va flag eal/pci: export match function bsdapp/eal_pci: get iommu class linuxapp/eal_pci: get iommu class bus: get iommu class eal: introduce iova mode helper api linuxapp/eal: auto detect iova mode bsdapp/eal: auto detect iova mapping mode linuxapp/eal_vfio: honor iova mode before mapping linuxapp/eal_memory: honor iova mode in virt2phy eal/rte_malloc: honor iova mode in virt2phy lib/librte_eal/bsdapp/eal/eal.c | 22 ++++++--- lib/librte_eal/bsdapp/eal/eal_pci.c | 10 ++++ lib/librte_eal/bsdapp/eal/rte_eal_version.map | 4 ++ lib/librte_eal/common/eal_common_bus.c | 23 +++++++++ lib/librte_eal/common/eal_common_pci.c | 11 +---- lib/librte_eal/common/include/rte_bus.h | 31 ++++++++++++ lib/librte_eal/common/include/rte_eal.h | 12 +++++ lib/librte_eal/common/include/rte_pci.h | 28 +++++++++++ lib/librte_eal/common/rte_malloc.c | 9 +++- lib/librte_eal/linuxapp/eal/eal.c | 22 ++++++--- lib/librte_eal/linuxapp/eal/eal_memory.c | 3 ++ lib/librte_eal/linuxapp/eal/eal_pci.c | 66 +++++++++++++++++++++++++ lib/librte_eal/linuxapp/eal/eal_vfio.c | 29 ++++++++++- lib/librte_eal/linuxapp/eal/eal_vfio.h | 4 ++ lib/librte_eal/linuxapp/eal/rte_eal_version.map | 4 ++ 15 files changed, 254 insertions(+), 24 deletions(-) -- 2.13.0