From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hemant Agrawal Subject: Re: [PATCH v3 07/11] linuxapp/eal: auto detect iova mode Date: Thu, 13 Jul 2017 17:15:56 +0530 Message-ID: <2f44995a-b34f-88fc-ff3c-5214e9157dd8@nxp.com> References: <20170710114235.18970-1-santosh.shukla@caviumnetworks.com> <20170711061631.5018-1-santosh.shukla@caviumnetworks.com> <20170711061631.5018-8-santosh.shukla@caviumnetworks.com> <84703290-1800-1f0c-8a48-bc2b60eb7839@nxp.com> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Cc: , , , , , , , , To: Santosh Shukla , , Return-path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0089.outbound.protection.outlook.com [104.47.38.89]) by dpdk.org (Postfix) with ESMTP id 5584829D9 for ; Thu, 13 Jul 2017 13:46:10 +0200 (CEST) In-Reply-To: <84703290-1800-1f0c-8a48-bc2b60eb7839@nxp.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" On 7/13/2017 4:59 PM, Hemant Agrawal wrote: > On 7/11/2017 11:46 AM, Santosh Shukla wrote: >> - Moving late bus scanning to up..just after eal_parsing. >> - Auto detect iova mapping mode, based on the result of >> rte_bus_scan_iommu_class. >> >> Signed-off-by: Santosh Shukla >> Signed-off-by: Jerin Jacob >> --- >> lib/librte_eal/linuxapp/eal/eal.c | 16 ++++++++++------ >> 1 file changed, 10 insertions(+), 6 deletions(-) >> >> diff --git a/lib/librte_eal/linuxapp/eal/eal.c >> b/lib/librte_eal/linuxapp/eal/eal.c >> index 2546b55e4..7b4dd70de 100644 >> --- a/lib/librte_eal/linuxapp/eal/eal.c >> +++ b/lib/librte_eal/linuxapp/eal/eal.c >> @@ -799,6 +799,16 @@ rte_eal_init(int argc, char **argv) >> return -1; >> } >> >> + if (rte_bus_scan()) { >> + rte_eal_init_alert("Cannot scan the buses for devices\n"); >> + rte_errno = ENODEV; >> + return -1; >> + } >> + > > The original place of the bus scan was with the following factors: > 1. The bus scan requires the VFIO to be enabled atleast in dpaa2 case. > (VFIO code still need cleanup to be support non-pci cleanly). I tried > moving it before bus_scan, this helped in bus scanning. > > 2. During SCAN, the bus may allocate memory to devices or for it's own > usages. rte_malloc or mempool is required in cases to support > multi-process environment. (e.g. dpaa2 create dpbp or dpio device memory > using the rte_malloc call). > > Since none of the other rte library (mempool, memzone, tailq) is > available at this point, it will create significant restriction on the > bus scan. > > We will prefer if you can re-introduce the "iova_mode" and allow the > application choose, which mode it want to run. > > This auto-detect logic may not work for many buses and it is going > to create serious restrictions on the bus_scan code. > Is it possible that you offer a *rte_bus_pre_scan* kind of infra to detect the bus iommu class only. This way it will address all the concerns. >> + /* autodetect the iova mapping mode (default is iova_pa) */ >> + if (rte_bus_get_iommu_class() == RTE_IOVA_VA) >> + rte_eal_get_configuration()->iova_mode = RTE_IOVA_VA; >> + >> if (internal_config.no_hugetlbfs == 0 && >> internal_config.process_type != RTE_PROC_SECONDARY && >> internal_config.xen_dom0_support == 0 && >> @@ -896,12 +906,6 @@ rte_eal_init(int argc, char **argv) >> return -1; >> } >> >> - if (rte_bus_scan()) { >> - rte_eal_init_alert("Cannot scan the buses for devices\n"); >> - rte_errno = ENODEV; >> - return -1; >> - } >> - >> RTE_LCORE_FOREACH_SLAVE(i) { >> >> /* >> > > >