From patchwork Thu Jul 18 06:45:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerin Jacob Kollanukkaran X-Patchwork-Id: 56699 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1CDEE4C90; Thu, 18 Jul 2019 08:45:50 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 541342BA8 for ; Thu, 18 Jul 2019 08:45:45 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x6I6jiip030902; Wed, 17 Jul 2019 23:45:44 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=sY/iaAuAJP7jAkGBIrPNM2XsxVCYInyfr3RXJkkX6rI=; b=zFs8DymQXeO6KVUnBb56UMl6fJfxxD/7A7jaCVlhlru7qA3SO0TyOShWTumoh2bw8QHF d/Wcc4V5fIWdv4P+XJRKGWQBRKNmemU281jjyc9i3fr7pq1XYqdrAvxWLTtY0bSrb8e3 zJUCMpEAFzKEY4FnjIzCxcK/TXVwSeXoAF5GsqAwbz1mlRSbJ5fN/gxia2MpZndXa3e/ HzhKvcByW/5ciaTHUscudAqIxX1dvaEnLEr/LjAFSiM3xdiKX5pfRVwlMQjL1FFrM5yK /Rblh6h/nbfOI42Oz9VD0Cqphr1pfhBztx0imLRv6Qv9kayWKmgKl1j6PUSehku0p/H5 2g== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 2ts0a2aw9n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 17 Jul 2019 23:45:44 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 17 Jul 2019 23:45:43 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Wed, 17 Jul 2019 23:45:43 -0700 Received: from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14]) by maili.marvell.com (Postfix) with ESMTP id 7D8A53F703F; Wed, 17 Jul 2019 23:45:41 -0700 (PDT) From: To: CC: , , , Jerin Jacob Date: Thu, 18 Jul 2019 12:15:39 +0530 Message-ID: <20190718064543.33383-2-jerinj@marvell.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190718064543.33383-1-jerinj@marvell.com> References: <20190716134609.40930-1-jerinj@marvell.com> <20190718064543.33383-1-jerinj@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:5.22.84,1.0.8 definitions=2019-07-18_02:2019-07-18,2019-07-18 signatures=0 Subject: [dpdk-dev] [PATCH v3 1/4] Revert "bus/pci: add Mellanox kernel driver type" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: David Marchand This reverts commit 0cb86518db57d35e0abc14d6703fad561a0310e2. The pci bus now reports DC when faced with a device bound to an unknown driver and, in such a case, the IOVA mode is selected against physical address availability. As a consequence, there is no reason for this special case for Mellanox drivers. Fixes: 703458e19c16 ("bus/pci: consider only usable devices for IOVA mode") Signed-off-by: David Marchand Reviewed-by: Jerin Jacob --- drivers/bus/pci/linux/pci.c | 8 -------- lib/librte_eal/common/include/rte_dev.h | 1 - 2 files changed, 9 deletions(-) diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c index 33c8ea7e9..b12f10af5 100644 --- a/drivers/bus/pci/linux/pci.c +++ b/drivers/bus/pci/linux/pci.c @@ -329,9 +329,6 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr) dev->kdrv = RTE_KDRV_IGB_UIO; else if (!strcmp(driver, "uio_pci_generic")) dev->kdrv = RTE_KDRV_UIO_GENERIC; - else if (!strcmp(driver, "mlx4_core") || - !strcmp(driver, "mlx5_core")) - dev->kdrv = RTE_KDRV_NIC_MLX; else dev->kdrv = RTE_KDRV_UNKNOWN; } else @@ -591,11 +588,6 @@ pci_device_iova_mode(const struct rte_pci_driver *pdrv, break; } - case RTE_KDRV_NIC_MLX: - if ((pdrv->drv_flags & RTE_PCI_DRV_IOVA_AS_VA) == 0) - iova_mode = RTE_IOVA_PA; - break; - case RTE_KDRV_IGB_UIO: case RTE_KDRV_UIO_GENERIC: iova_mode = RTE_IOVA_PA; diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h index 94829f6e4..c25e09e3d 100644 --- a/lib/librte_eal/common/include/rte_dev.h +++ b/lib/librte_eal/common/include/rte_dev.h @@ -63,7 +63,6 @@ enum rte_kernel_driver { RTE_KDRV_VFIO, RTE_KDRV_UIO_GENERIC, RTE_KDRV_NIC_UIO, - RTE_KDRV_NIC_MLX, RTE_KDRV_NONE, }; From patchwork Thu Jul 18 06:45:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerin Jacob Kollanukkaran X-Patchwork-Id: 56700 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 24EBA5905; Thu, 18 Jul 2019 08:46:05 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 1B24758C6 for ; Thu, 18 Jul 2019 08:46:04 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x6I6jlbl032764; Wed, 17 Jul 2019 23:46:01 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=RanEazceHNwkKYDLG7RaGbGZliHVMGj2gK9f6e6Vp8g=; b=aCtNa0mXCrI+b3+uhG7gS7kjqXs3OBHYV0QhvlR6xFPuCrtgMSXRyFbQ+sLvFcFQA2O/ wug76cDRUV4NWnbPV2yDgaMTunvd9FhTQs2TNedl/Vl2EcdiF1ZMLz8lTLX/46fsTYfk 86cP2A+F24HLf3EvyxiOJUK8R6oIiwqVZXVIAtl0KWdeRln5DfDdVEhFTGjFtOu/ZV2T 7SoNwpZWf2UsKxpZyscnovdSXkMMFEWuZbufs/bS43HgqfuknK3vTV+mtNv8+1kvAGRK 6j14H9TRMGw9LwHZyPyUoq6uJyvUaCggk31w1MyD8MqxX7Qwo8MHT01Pgk7D5AwPYyiD Og== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2ts0a2away-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 17 Jul 2019 23:46:01 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 17 Jul 2019 23:45:59 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Wed, 17 Jul 2019 23:45:59 -0700 Received: from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14]) by maili.marvell.com (Postfix) with ESMTP id 782083F703F; Wed, 17 Jul 2019 23:45:51 -0700 (PDT) From: To: , Anatoly Burakov , John McNamara , Marko Kovacevic , "Igor Russkikh" , Pavel Belous , Ajit Khaparde , Somnath Kotur , Wenzhuo Lu , John Daley , Hyong Youb Kim , Qi Zhang , Xiao Wang , Beilei Xing , Jingjing Wu , Qiming Yang , "Konstantin Ananyev" , Matan Azrad , Shahaf Shuler , Yongseok Koh , Viacheslav Ovsiienko , Alejandro Lucero , Jerin Jacob , "Nithin Dabilpuram" , Kiran Kumar K , Rasesh Mody , Shahed Shaikh , Bruce Richardson CC: , Date: Thu, 18 Jul 2019 12:15:40 +0530 Message-ID: <20190718064543.33383-3-jerinj@marvell.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190718064543.33383-1-jerinj@marvell.com> References: <20190716134609.40930-1-jerinj@marvell.com> <20190718064543.33383-1-jerinj@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:5.22.84,1.0.8 definitions=2019-07-18_02:2019-07-18,2019-07-18 signatures=0 Subject: [dpdk-dev] [PATCH v3 2/4] eal: fix IOVA mode selection as VA for pci drivers X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: David Marchand The incriminated commit broke the use of RTE_PCI_DRV_IOVA_AS_VA which was intended to mean "driver only supports VA" but had been understood as "driver supports both PA and VA" by most net drivers and used to let dpdk processes to run as non root (which do not have access to physical addresses on recent kernels). The check on physical addresses actually closed the gap for those drivers. We don't need to mark them with RTE_PCI_DRV_IOVA_AS_VA and this flag can retain its intended meaning. Document explicitly its meaning. We can check that a driver requirement wrt to IOVA mode is fulfilled before trying to probe a device. Finally, document the heuristic used to select the IOVA mode and hope that we won't break it again. Fixes: 703458e19c16 ("bus/pci: consider only usable devices for IOVA mode") Signed-off-by: David Marchand Reviewed-by: Jerin Jacob Tested-by: Jerin Jacob Acked-by: Anatoly Burakov --- .../prog_guide/env_abstraction_layer.rst | 31 +++++++++++++++++++ drivers/bus/pci/linux/pci.c | 16 ++++------ drivers/bus/pci/pci_common.c | 30 ++++++++++++++---- drivers/bus/pci/rte_bus_pci.h | 4 +-- drivers/net/atlantic/atl_ethdev.c | 3 +- drivers/net/bnxt/bnxt_ethdev.c | 3 +- drivers/net/e1000/em_ethdev.c | 3 +- drivers/net/e1000/igb_ethdev.c | 5 ++- drivers/net/enic/enic_ethdev.c | 3 +- drivers/net/fm10k/fm10k_ethdev.c | 3 +- drivers/net/i40e/i40e_ethdev.c | 3 +- drivers/net/i40e/i40e_ethdev_vf.c | 2 +- drivers/net/iavf/iavf_ethdev.c | 3 +- drivers/net/ice/ice_ethdev.c | 3 +- drivers/net/ixgbe/ixgbe_ethdev.c | 5 ++- drivers/net/mlx4/mlx4.c | 3 +- drivers/net/mlx5/mlx5.c | 2 +- drivers/net/nfp/nfp_net.c | 6 ++-- drivers/net/octeontx2/otx2_ethdev.c | 5 --- drivers/net/qede/qede_ethdev.c | 6 ++-- drivers/raw/ioat/ioat_rawdev.c | 3 +- lib/librte_eal/common/eal_common_bus.c | 30 ++++++++++++++++-- 22 files changed, 110 insertions(+), 62 deletions(-) diff --git a/doc/guides/prog_guide/env_abstraction_layer.rst b/doc/guides/prog_guide/env_abstraction_layer.rst index f15bcd976..77307e3a6 100644 --- a/doc/guides/prog_guide/env_abstraction_layer.rst +++ b/doc/guides/prog_guide/env_abstraction_layer.rst @@ -419,6 +419,37 @@ Misc Functions Locks and atomic operations are per-architecture (i686 and x86_64). +IOVA Mode Detection +~~~~~~~~~~~~~~~~~~~ + +IOVA Mode is selected by considering what the current usable Devices on the +system requires and/or supports. + +Below is the 2-step heuristic for this choice. + +For the first step, EAL asks each bus its requirement in terms of IOVA mode +and decides on a preferred IOVA mode. + +- if all buses report RTE_IOVA_PA, then the preferred IOVA mode is RTE_IOVA_PA, +- if all buses report RTE_IOVA_VA, then the preferred IOVA mode is RTE_IOVA_VA, +- if all buses report RTE_IOVA_DC, no bus expressed a preferrence, then the + preferred mode is RTE_IOVA_DC, +- if the buses disagree (at least one wants RTE_IOVA_PA and at least one wants + RTE_IOVA_VA), then the preferred IOVA mode is RTE_IOVA_DC (see below with the + check on Physical Addresses availability), + +The second step is checking if the preferred mode complies with the Physical +Addresses availability since those are only available to root user in recent +kernels. + +- if the preferred mode is RTE_IOVA_PA but there is no access to Physical + Addresses, then EAL init will fail early, since later probing of the devices + would fail anyway, +- if the preferred mode is RTE_IOVA_DC then based on the Physical Addresses + availability, the preferred mode is adjusted to RTE_IOVA_PA or RTE_IOVA_VA. + In the case when the buses had disagreed on the IOVA Mode at the first step, + part of the buses won't work because of this decision. + IOVA Mode Configuration ~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c index b12f10af5..1a2f99b32 100644 --- a/drivers/bus/pci/linux/pci.c +++ b/drivers/bus/pci/linux/pci.c @@ -578,12 +578,10 @@ pci_device_iova_mode(const struct rte_pci_driver *pdrv, else is_vfio_noiommu_enabled = 0; } - if ((pdrv->drv_flags & RTE_PCI_DRV_IOVA_AS_VA) == 0) { + if (is_vfio_noiommu_enabled != 0) iova_mode = RTE_IOVA_PA; - } else if (is_vfio_noiommu_enabled != 0) { - RTE_LOG(DEBUG, EAL, "Forcing to 'PA', vfio-noiommu mode configured\n"); - iova_mode = RTE_IOVA_PA; - } + else if ((pdrv->drv_flags & RTE_PCI_DRV_IOVA_AS_VA) != 0) + iova_mode = RTE_IOVA_VA; #endif break; } @@ -594,8 +592,8 @@ pci_device_iova_mode(const struct rte_pci_driver *pdrv, break; default: - RTE_LOG(DEBUG, EAL, "Unsupported kernel driver? Defaulting to IOVA as 'PA'\n"); - iova_mode = RTE_IOVA_PA; + if ((pdrv->drv_flags & RTE_PCI_DRV_IOVA_AS_VA) != 0) + iova_mode = RTE_IOVA_VA; break; } @@ -607,10 +605,8 @@ pci_device_iova_mode(const struct rte_pci_driver *pdrv, if (iommu_no_va == -1) iommu_no_va = pci_one_device_iommu_support_va(pdev) ? 0 : 1; - if (iommu_no_va != 0) { - RTE_LOG(DEBUG, EAL, "Forcing to 'PA', IOMMU does not support IOVA as 'VA'\n"); + if (iommu_no_va != 0) iova_mode = RTE_IOVA_PA; - } } return iova_mode; } diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c index d2af472ef..9794552fd 100644 --- a/drivers/bus/pci/pci_common.c +++ b/drivers/bus/pci/pci_common.c @@ -169,8 +169,22 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr, * This needs to be before rte_pci_map_device(), as it enables to use * driver flags for adjusting configuration. */ - if (!already_probed) + if (!already_probed) { + enum rte_iova_mode dev_iova_mode; + enum rte_iova_mode iova_mode; + + dev_iova_mode = pci_device_iova_mode(dr, dev); + iova_mode = rte_eal_iova_mode(); + if (dev_iova_mode != RTE_IOVA_DC && + dev_iova_mode != iova_mode) { + RTE_LOG(ERR, EAL, " Expecting '%s' IOVA mode but current mode is '%s', not initializing\n", + dev_iova_mode == RTE_IOVA_PA ? "PA" : "VA", + iova_mode == RTE_IOVA_PA ? "PA" : "VA"); + return -EINVAL; + } + dev->driver = dr; + } if (!already_probed && (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING)) { /* map resources for devices that use igb_uio */ @@ -629,12 +643,16 @@ rte_pci_get_iommu_class(void) devices_want_va = true; } } - if (devices_want_pa) { - iova_mode = RTE_IOVA_PA; - if (devices_want_va) - RTE_LOG(WARNING, EAL, "Some devices want 'VA' but forcing 'PA' because other devices want it\n"); - } else if (devices_want_va) { + if (devices_want_va && !devices_want_pa) { iova_mode = RTE_IOVA_VA; + } else if (devices_want_pa && !devices_want_va) { + iova_mode = RTE_IOVA_PA; + } else { + iova_mode = RTE_IOVA_DC; + if (devices_want_va) { + RTE_LOG(WARNING, EAL, "Some devices want 'VA' but forcing 'DC' because other devices want 'PA'.\n"); + RTE_LOG(WARNING, EAL, "Depending on the final decision by the EAL, not all devices may be able to initialize.\n"); + } } return iova_mode; } diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h index 06e004cd3..0f2177564 100644 --- a/drivers/bus/pci/rte_bus_pci.h +++ b/drivers/bus/pci/rte_bus_pci.h @@ -187,8 +187,8 @@ struct rte_pci_bus { #define RTE_PCI_DRV_INTR_RMV 0x0010 /** Device driver needs to keep mapped resources if unsupported dev detected */ #define RTE_PCI_DRV_KEEP_MAPPED_RES 0x0020 -/** Device driver supports IOVA as VA */ -#define RTE_PCI_DRV_IOVA_AS_VA 0X0040 +/** Device driver only supports IOVA as VA and cannot work with IOVA as PA */ +#define RTE_PCI_DRV_IOVA_AS_VA 0x0040 /** * Map the PCI device resources in user space virtual memory address diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c index fdc0a7f2d..fa89ae755 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -157,8 +157,7 @@ static const struct rte_pci_id pci_id_atl_map[] = { static struct rte_pci_driver rte_atl_pmd = { .id_table = pci_id_atl_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | - RTE_PCI_DRV_IOVA_AS_VA, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, .probe = eth_atl_pci_probe, .remove = eth_atl_pci_remove, }; diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 8fc510351..9306d5655 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -4028,8 +4028,7 @@ static int bnxt_pci_remove(struct rte_pci_device *pci_dev) static struct rte_pci_driver bnxt_rte_pmd = { .id_table = bnxt_pci_id_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | - RTE_PCI_DRV_INTR_LSC | RTE_PCI_DRV_IOVA_AS_VA, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, .probe = bnxt_pci_probe, .remove = bnxt_pci_remove, }; diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index dc886613a..0c859e52b 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -352,8 +352,7 @@ static int eth_em_pci_remove(struct rte_pci_device *pci_dev) static struct rte_pci_driver rte_em_pmd = { .id_table = pci_id_em_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | - RTE_PCI_DRV_IOVA_AS_VA, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, .probe = eth_em_pci_probe, .remove = eth_em_pci_remove, }; diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index 3ee28cfbc..e784eeb73 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -1116,8 +1116,7 @@ static int eth_igb_pci_remove(struct rte_pci_device *pci_dev) static struct rte_pci_driver rte_igb_pmd = { .id_table = pci_id_igb_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | - RTE_PCI_DRV_IOVA_AS_VA, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, .probe = eth_igb_pci_probe, .remove = eth_igb_pci_remove, }; @@ -1140,7 +1139,7 @@ static int eth_igbvf_pci_remove(struct rte_pci_device *pci_dev) */ static struct rte_pci_driver rte_igbvf_pmd = { .id_table = pci_id_igbvf_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_IOVA_AS_VA, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING, .probe = eth_igbvf_pci_probe, .remove = eth_igbvf_pci_remove, }; diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 5cfbd31a2..e9c6f83ce 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -1247,8 +1247,7 @@ static int eth_enic_pci_remove(struct rte_pci_device *pci_dev) static struct rte_pci_driver rte_enic_pmd = { .id_table = pci_id_enic_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | - RTE_PCI_DRV_IOVA_AS_VA, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, .probe = eth_enic_pci_probe, .remove = eth_enic_pci_remove, }; diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index a1e3836cb..2d3c47763 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -3268,8 +3268,7 @@ static const struct rte_pci_id pci_id_fm10k_map[] = { static struct rte_pci_driver rte_pmd_fm10k = { .id_table = pci_id_fm10k_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | - RTE_PCI_DRV_IOVA_AS_VA, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, .probe = eth_fm10k_pci_probe, .remove = eth_fm10k_pci_remove, }; diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 2b9fc4572..dd46d4d9d 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -696,8 +696,7 @@ static int eth_i40e_pci_remove(struct rte_pci_device *pci_dev) static struct rte_pci_driver rte_i40e_pmd = { .id_table = pci_id_i40e_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | - RTE_PCI_DRV_IOVA_AS_VA, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, .probe = eth_i40e_pci_probe, .remove = eth_i40e_pci_remove, }; diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 5be32b069..3ff2f6097 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1557,7 +1557,7 @@ static int eth_i40evf_pci_remove(struct rte_pci_device *pci_dev) */ static struct rte_pci_driver rte_i40evf_pmd = { .id_table = pci_id_i40evf_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_IOVA_AS_VA, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING, .probe = eth_i40evf_pci_probe, .remove = eth_i40evf_pci_remove, }; diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 53dc05c78..a97cd76fd 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -1402,8 +1402,7 @@ static int eth_iavf_pci_remove(struct rte_pci_device *pci_dev) /* Adaptive virtual function driver struct */ static struct rte_pci_driver rte_iavf_pmd = { .id_table = pci_id_iavf_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | - RTE_PCI_DRV_IOVA_AS_VA, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, .probe = eth_iavf_pci_probe, .remove = eth_iavf_pci_remove, }; diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 9ce730cd4..f05b48c01 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -3737,8 +3737,7 @@ ice_pci_remove(struct rte_pci_device *pci_dev) static struct rte_pci_driver rte_ice_pmd = { .id_table = pci_id_ice_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | - RTE_PCI_DRV_IOVA_AS_VA, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, .probe = ice_pci_probe, .remove = ice_pci_remove, }; diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 22c5b2c5c..4a6e5c32e 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1869,8 +1869,7 @@ static int eth_ixgbe_pci_remove(struct rte_pci_device *pci_dev) static struct rte_pci_driver rte_ixgbe_pmd = { .id_table = pci_id_ixgbe_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | - RTE_PCI_DRV_IOVA_AS_VA, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, .probe = eth_ixgbe_pci_probe, .remove = eth_ixgbe_pci_remove, }; @@ -1892,7 +1891,7 @@ static int eth_ixgbevf_pci_remove(struct rte_pci_device *pci_dev) */ static struct rte_pci_driver rte_ixgbevf_pmd = { .id_table = pci_id_ixgbevf_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_IOVA_AS_VA, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING, .probe = eth_ixgbevf_pci_probe, .remove = eth_ixgbevf_pci_remove, }; diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 2e169b088..d6e5753bf 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -1142,8 +1142,7 @@ static struct rte_pci_driver mlx4_driver = { }, .id_table = mlx4_pci_id_map, .probe = mlx4_pci_probe, - .drv_flags = RTE_PCI_DRV_INTR_LSC | RTE_PCI_DRV_INTR_RMV | - RTE_PCI_DRV_IOVA_AS_VA, + .drv_flags = RTE_PCI_DRV_INTR_LSC | RTE_PCI_DRV_INTR_RMV, }; #ifdef RTE_IBVERBS_LINK_DLOPEN diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index d93f92db5..0f05853f9 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -2087,7 +2087,7 @@ static struct rte_pci_driver mlx5_driver = { .dma_map = mlx5_dma_map, .dma_unmap = mlx5_dma_unmap, .drv_flags = RTE_PCI_DRV_INTR_LSC | RTE_PCI_DRV_INTR_RMV | - RTE_PCI_DRV_PROBE_AGAIN | RTE_PCI_DRV_IOVA_AS_VA, + RTE_PCI_DRV_PROBE_AGAIN, }; #ifdef RTE_IBVERBS_LINK_DLOPEN diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index 1a7aa17ee..f5d33efcf 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -3760,16 +3760,14 @@ static int eth_nfp_pci_remove(struct rte_pci_device *pci_dev) static struct rte_pci_driver rte_nfp_net_pf_pmd = { .id_table = pci_id_nfp_pf_net_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | - RTE_PCI_DRV_IOVA_AS_VA, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, .probe = nfp_pf_pci_probe, .remove = eth_nfp_pci_remove, }; static struct rte_pci_driver rte_nfp_net_vf_pmd = { .id_table = pci_id_nfp_vf_net_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | - RTE_PCI_DRV_IOVA_AS_VA, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, .probe = eth_nfp_pci_probe, .remove = eth_nfp_pci_remove, }; diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c index fcb1869d5..5ec55511b 100644 --- a/drivers/net/octeontx2/otx2_ethdev.c +++ b/drivers/net/octeontx2/otx2_ethdev.c @@ -1188,11 +1188,6 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev) goto fail; } - if (rte_eal_iova_mode() != RTE_IOVA_VA) { - otx2_err("iova mode should be va"); - goto fail; - } - if (conf->link_speeds & ETH_LINK_SPEED_FIXED) { otx2_err("Setting link speed/duplex not supported"); goto fail; diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 82363e6eb..0b3046a8a 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -2737,8 +2737,7 @@ static int qedevf_eth_dev_pci_remove(struct rte_pci_device *pci_dev) static struct rte_pci_driver rte_qedevf_pmd = { .id_table = pci_id_qedevf_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | - RTE_PCI_DRV_IOVA_AS_VA, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, .probe = qedevf_eth_dev_pci_probe, .remove = qedevf_eth_dev_pci_remove, }; @@ -2757,8 +2756,7 @@ static int qede_eth_dev_pci_remove(struct rte_pci_device *pci_dev) static struct rte_pci_driver rte_qede_pmd = { .id_table = pci_id_qede_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | - RTE_PCI_DRV_IOVA_AS_VA, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, .probe = qede_eth_dev_pci_probe, .remove = qede_eth_dev_pci_remove, }; diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c index d509b6606..7270ad7aa 100644 --- a/drivers/raw/ioat/ioat_rawdev.c +++ b/drivers/raw/ioat/ioat_rawdev.c @@ -338,8 +338,7 @@ static const struct rte_pci_id pci_id_ioat_map[] = { static struct rte_pci_driver ioat_pmd_drv = { .id_table = pci_id_ioat_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | - RTE_PCI_DRV_IOVA_AS_VA, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, .probe = ioat_rawdev_probe, .remove = ioat_rawdev_remove, }; diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c index 77f1be1b4..04590485b 100644 --- a/lib/librte_eal/common/eal_common_bus.c +++ b/lib/librte_eal/common/eal_common_bus.c @@ -228,13 +228,37 @@ rte_bus_find_by_device_name(const char *str) enum rte_iova_mode rte_bus_get_iommu_class(void) { - int mode = RTE_IOVA_DC; + enum rte_iova_mode mode = RTE_IOVA_DC; + bool buses_want_va = false; + bool buses_want_pa = false; struct rte_bus *bus; TAILQ_FOREACH(bus, &rte_bus_list, next) { + enum rte_iova_mode bus_iova_mode; - if (bus->get_iommu_class) - mode |= bus->get_iommu_class(); + if (bus->get_iommu_class == NULL) + continue; + + bus_iova_mode = bus->get_iommu_class(); + RTE_LOG(DEBUG, EAL, "Bus %s wants IOVA as '%s'\n", + bus->name, + bus_iova_mode == RTE_IOVA_DC ? "DC" : + (bus_iova_mode == RTE_IOVA_PA ? "PA" : "VA")); + if (bus_iova_mode == RTE_IOVA_PA) + buses_want_pa = true; + else if (bus_iova_mode == RTE_IOVA_VA) + buses_want_va = true; + } + if (buses_want_va && !buses_want_pa) { + mode = RTE_IOVA_VA; + } else if (buses_want_pa && !buses_want_va) { + mode = RTE_IOVA_PA; + } else { + mode = RTE_IOVA_DC; + if (buses_want_va) { + RTE_LOG(WARNING, EAL, "Some buses want 'VA' but forcing 'DC' because other buses want 'PA'.\n"); + RTE_LOG(WARNING, EAL, "Depending on the final decision by the EAL, not all buses may be able to initialize.\n"); + } } return mode; From patchwork Thu Jul 18 06:45:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerin Jacob Kollanukkaran X-Patchwork-Id: 56701 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 75A092BC7; Thu, 18 Jul 2019 08:46:08 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id AED681B464 for ; Thu, 18 Jul 2019 08:46:06 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x6I6jaXE013341; Wed, 17 Jul 2019 23:46:05 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=syYrnvBxVqhuNC+1TzDpG5TWOI53wlIfRQQ67DkaRSI=; b=pSpz3y63DQCr0tx8igealWngdL7BHz1OCv2yLFqD64myVh97DWEDuHa1RpEUuJyJOnx+ NesMA21HH6fsrrjl3GheVb2fuccGYtexbvdoVr8nK0C13xiBz23TTJNbKBoFhQiv8GIc fqFf0qCJqB/K4YlE/IGsTUYUPg4bJybke9cYpSoDQCrCd2yh6KsxP/h3QFpJrPRBqH9O Wo40FCW44hDJ7lXg8G/XjvhFsRWTsv+YhtVC8ZSVOU2LjNloqARCFjBnjeZg5bOvPf6n YUt14Qs89zqGJBlvFwf0C2JYzsau5gF9UEFxMLoNZEy6LdoUzsFUVxXHssibd+N15eAA nQ== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2ts07vkk9f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 17 Jul 2019 23:46:05 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 17 Jul 2019 23:46:04 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Wed, 17 Jul 2019 23:46:04 -0700 Received: from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14]) by maili.marvell.com (Postfix) with ESMTP id 96E5E3F7041; Wed, 17 Jul 2019 23:46:01 -0700 (PDT) From: To: , Pavan Nikhilesh , Jerin Jacob , Nithin Dabilpuram , "Vamsi Attunuru" , Kiran Kumar K , Satha Rao CC: , , Date: Thu, 18 Jul 2019 12:15:41 +0530 Message-ID: <20190718064543.33383-4-jerinj@marvell.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190718064543.33383-1-jerinj@marvell.com> References: <20190716134609.40930-1-jerinj@marvell.com> <20190718064543.33383-1-jerinj@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:5.22.84,1.0.8 definitions=2019-07-18_02:2019-07-18,2019-07-18 signatures=0 Subject: [dpdk-dev] [PATCH v3 3/4] eal: change RTE_PCI_DRV_IOVA_AS_VA flag name X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Jerin Jacob In order to align name with other PCI driver flag such as RTE_PCI_DRV_NEED_MAPPING and to reflect its purpose, Change RTE_PCI_DRV_IOVA_AS_VA flag name as RTE_PCI_DRV_NEED_IOVA_AS_VA. Signed-off-by: Jerin Jacob --- drivers/bus/pci/linux/pci.c | 4 ++-- drivers/bus/pci/rte_bus_pci.h | 4 ++-- drivers/event/octeontx/timvf_probe.c | 2 +- drivers/event/octeontx2/otx2_evdev.c | 2 +- drivers/mempool/octeontx/octeontx_fpavf.c | 2 +- drivers/mempool/octeontx2/otx2_mempool.c | 2 +- drivers/net/octeontx2/otx2_ethdev.c | 2 +- drivers/raw/octeontx2_dma/otx2_dpi_rawdev.c | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c index 1a2f99b32..1d8d20d93 100644 --- a/drivers/bus/pci/linux/pci.c +++ b/drivers/bus/pci/linux/pci.c @@ -580,7 +580,7 @@ pci_device_iova_mode(const struct rte_pci_driver *pdrv, } if (is_vfio_noiommu_enabled != 0) iova_mode = RTE_IOVA_PA; - else if ((pdrv->drv_flags & RTE_PCI_DRV_IOVA_AS_VA) != 0) + else if ((pdrv->drv_flags & RTE_PCI_DRV_NEED_IOVA_AS_VA) != 0) iova_mode = RTE_IOVA_VA; #endif break; @@ -592,7 +592,7 @@ pci_device_iova_mode(const struct rte_pci_driver *pdrv, break; default: - if ((pdrv->drv_flags & RTE_PCI_DRV_IOVA_AS_VA) != 0) + if ((pdrv->drv_flags & RTE_PCI_DRV_NEED_IOVA_AS_VA) != 0) iova_mode = RTE_IOVA_VA; break; } diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h index 0f2177564..29bea6d70 100644 --- a/drivers/bus/pci/rte_bus_pci.h +++ b/drivers/bus/pci/rte_bus_pci.h @@ -187,8 +187,8 @@ struct rte_pci_bus { #define RTE_PCI_DRV_INTR_RMV 0x0010 /** Device driver needs to keep mapped resources if unsupported dev detected */ #define RTE_PCI_DRV_KEEP_MAPPED_RES 0x0020 -/** Device driver only supports IOVA as VA and cannot work with IOVA as PA */ -#define RTE_PCI_DRV_IOVA_AS_VA 0x0040 +/** Device driver needs IOVA as VA and cannot work with IOVA as PA */ +#define RTE_PCI_DRV_NEED_IOVA_AS_VA 0x0040 /** * Map the PCI device resources in user space virtual memory address diff --git a/drivers/event/octeontx/timvf_probe.c b/drivers/event/octeontx/timvf_probe.c index 08dbd2be9..af87625fd 100644 --- a/drivers/event/octeontx/timvf_probe.c +++ b/drivers/event/octeontx/timvf_probe.c @@ -140,7 +140,7 @@ static const struct rte_pci_id pci_timvf_map[] = { static struct rte_pci_driver pci_timvf = { .id_table = pci_timvf_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_IOVA_AS_VA, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_NEED_IOVA_AS_VA, .probe = timvf_probe, .remove = NULL, }; diff --git a/drivers/event/octeontx2/otx2_evdev.c b/drivers/event/octeontx2/otx2_evdev.c index 56716c2ac..e6379e3b4 100644 --- a/drivers/event/octeontx2/otx2_evdev.c +++ b/drivers/event/octeontx2/otx2_evdev.c @@ -1630,7 +1630,7 @@ static const struct rte_pci_id pci_sso_map[] = { static struct rte_pci_driver pci_sso = { .id_table = pci_sso_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_IOVA_AS_VA, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_NEED_IOVA_AS_VA, .probe = otx2_sso_probe, .remove = otx2_sso_remove, }; diff --git a/drivers/mempool/octeontx/octeontx_fpavf.c b/drivers/mempool/octeontx/octeontx_fpavf.c index 4cf387e8f..baabc0152 100644 --- a/drivers/mempool/octeontx/octeontx_fpavf.c +++ b/drivers/mempool/octeontx/octeontx_fpavf.c @@ -799,7 +799,7 @@ static const struct rte_pci_id pci_fpavf_map[] = { static struct rte_pci_driver pci_fpavf = { .id_table = pci_fpavf_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_IOVA_AS_VA, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_NEED_IOVA_AS_VA, .probe = fpavf_probe, }; diff --git a/drivers/mempool/octeontx2/otx2_mempool.c b/drivers/mempool/octeontx2/otx2_mempool.c index 9a5f11cf4..3a4a9425f 100644 --- a/drivers/mempool/octeontx2/otx2_mempool.c +++ b/drivers/mempool/octeontx2/otx2_mempool.c @@ -443,7 +443,7 @@ static const struct rte_pci_id pci_npa_map[] = { static struct rte_pci_driver pci_npa = { .id_table = pci_npa_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_IOVA_AS_VA, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_NEED_IOVA_AS_VA, .probe = npa_probe, .remove = npa_remove, }; diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c index 5ec55511b..7b91f6b31 100644 --- a/drivers/net/octeontx2/otx2_ethdev.c +++ b/drivers/net/octeontx2/otx2_ethdev.c @@ -2001,7 +2001,7 @@ static const struct rte_pci_id pci_nix_map[] = { static struct rte_pci_driver pci_nix = { .id_table = pci_nix_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_IOVA_AS_VA | + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_NEED_IOVA_AS_VA | RTE_PCI_DRV_INTR_LSC, .probe = nix_probe, .remove = nix_remove, diff --git a/drivers/raw/octeontx2_dma/otx2_dpi_rawdev.c b/drivers/raw/octeontx2_dma/otx2_dpi_rawdev.c index 6a1b43678..e398abb75 100644 --- a/drivers/raw/octeontx2_dma/otx2_dpi_rawdev.c +++ b/drivers/raw/octeontx2_dma/otx2_dpi_rawdev.c @@ -427,7 +427,7 @@ otx2_dpi_rawdev_remove(struct rte_pci_device *pci_dev) static struct rte_pci_driver rte_dpi_rawdev_pmd = { .id_table = pci_dma_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_IOVA_AS_VA, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_NEED_IOVA_AS_VA, .probe = otx2_dpi_rawdev_probe, .remove = otx2_dpi_rawdev_remove, }; From patchwork Thu Jul 18 06:45:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerin Jacob Kollanukkaran X-Patchwork-Id: 56702 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DD4261B951; Thu, 18 Jul 2019 08:46:11 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id F14721B94E for ; Thu, 18 Jul 2019 08:46:09 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x6I6jVEU022133; Wed, 17 Jul 2019 23:46:09 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=hpT3oAyk4ItPaGrZU1DplorVT+LcnLqlYstjwDDej3Q=; b=Er92ZWud7eGshKq6D+qv5fUcRQ5+rdmID/zJAmjhWkcBXrPq3oVoybBPAuPkxgIykJdN fACfkvJhC6J/Rhq6wENWQuES5CZnXuAiY24BhtuJOjePJOCn2b8IX3lTG2YAXqfCf1iR 2lSSdoLq6bWtbzUcr9gcsAOovKxWDMWgatlukq6odBBoaUXSbOp3n+AlHeUbPa50Up4+ 8NmTMjC91PgzxPnohv9OlgL5wKv0N5lmiPDZgtq+AFE7CCuYVJ9dyfEWWAt9F9jinK0/ P+KQrTMajstIhbWSAHiYWSIu4CSWsUntUU4uZj3NM+BpskR0pLZLE5KyMQ616i7oXt2d 0g== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 2ts0a2awbb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 17 Jul 2019 23:46:09 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 17 Jul 2019 23:46:07 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Wed, 17 Jul 2019 23:46:07 -0700 Received: from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14]) by maili.marvell.com (Postfix) with ESMTP id A87A93F7041; Wed, 17 Jul 2019 23:46:05 -0700 (PDT) From: To: , Anatoly Burakov , John McNamara , Marko Kovacevic CC: , , Jerin Jacob Date: Thu, 18 Jul 2019 12:15:42 +0530 Message-ID: <20190718064543.33383-5-jerinj@marvell.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190718064543.33383-1-jerinj@marvell.com> References: <20190716134609.40930-1-jerinj@marvell.com> <20190718064543.33383-1-jerinj@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:5.22.84,1.0.8 definitions=2019-07-18_02:2019-07-18,2019-07-18 signatures=0 Subject: [dpdk-dev] [PATCH v3 4/4] eal: select IOVA mode as VA for default case X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Jerin Jacob When bus layer selected the preferred mode as RTE_IOVA_DC then select the IOVA mode as RTE_IOVA_VA. The RTE_IOVA_VA selected as the default because, 1) All drivers work in RTE_IOVA_VA mode, irrespective of physical address availability. 2) By default, the mempool, first asks for IOVA-contiguous memory using RTE_MEMZONE_IOVA_CONTIG and this is slow in IOVA as PA mode and it may affect the application boot time. Signed-off-by: Jerin Jacob Acked-by: Anatoly Burakov --- .../prog_guide/env_abstraction_layer.rst | 18 ++++++++++++++++-- lib/librte_eal/linux/eal/eal.c | 6 ++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/doc/guides/prog_guide/env_abstraction_layer.rst b/doc/guides/prog_guide/env_abstraction_layer.rst index 77307e3a6..b17c9dad9 100644 --- a/doc/guides/prog_guide/env_abstraction_layer.rst +++ b/doc/guides/prog_guide/env_abstraction_layer.rst @@ -445,11 +445,25 @@ kernels. - if the preferred mode is RTE_IOVA_PA but there is no access to Physical Addresses, then EAL init will fail early, since later probing of the devices would fail anyway, -- if the preferred mode is RTE_IOVA_DC then based on the Physical Addresses - availability, the preferred mode is adjusted to RTE_IOVA_PA or RTE_IOVA_VA. +- if the preferred mode is RTE_IOVA_DC then select the IOVA mode as RTE_IOVA_VA. + The RTE_IOVA_VA selected as the default because, + +#. All drivers work in RTE_IOVA_VA mode, irrespective of physical address availability. + +#. By default, the mempool, first asks for IOVA-contiguous memory using ``RTE_MEMZONE_IOVA_CONTIG``, + and this is slow in IOVA as PA mode and it may affect the application boot time. + +#. It is easy to enable large amount of IOVA-contiguous memory use-cases with IOVA in VA mode. + In the case when the buses had disagreed on the IOVA Mode at the first step, part of the buses won't work because of this decision. +.. note:: + + If the device driver needs IOVA as VA and it cannot work with IOVA as PA + then the driver must request the PCI bus layer using ``RTE_PCI_DRV_NEED_IOVA_AS_VA`` + requirement flag. Absence of this flag, dictates, the driver must support both IOVA as PA and VA modes. + IOVA Mode Configuration ~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c index 2e5499f9b..34db78753 100644 --- a/lib/librte_eal/linux/eal/eal.c +++ b/lib/librte_eal/linux/eal/eal.c @@ -1061,10 +1061,8 @@ rte_eal_init(int argc, char **argv) enum rte_iova_mode iova_mode = rte_bus_get_iommu_class(); if (iova_mode == RTE_IOVA_DC) { - iova_mode = phys_addrs ? RTE_IOVA_PA : RTE_IOVA_VA; - RTE_LOG(DEBUG, EAL, - "Buses did not request a specific IOVA mode, using '%s' based on physical addresses availability.\n", - phys_addrs ? "PA" : "VA"); + iova_mode = RTE_IOVA_VA; + RTE_LOG(DEBUG, EAL, "Buses did not request a specific IOVA mode, select IOVA as VA mode.\n"); } #ifdef RTE_LIBRTE_KNI /* Workaround for KNI which requires physical address to work */