From patchwork Fri Sep 11 08:35:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sachin Saxena (OSS)" X-Patchwork-Id: 77362 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 76CA4A04B5; Fri, 11 Sep 2020 10:35:55 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5BC281C116; Fri, 11 Sep 2020 10:35:40 +0200 (CEST) Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40070.outbound.protection.outlook.com [40.107.4.70]) by dpdk.org (Postfix) with ESMTP id B2E0A1C0D8 for ; Fri, 11 Sep 2020 10:35:37 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bwI3dIDhcwnOjOcCdgpMlRVSBh2MCJ/AvtrUjEihYSJriaBP197XpjEaL6vH1BrqNnicwuOvk/kTq0nG57T6elQZ6BXSWPcUCwD4833q/fPvoJyrmP8D32yPWn40peERRlfWLmAzDsY3DbapmKJUf8ChaGmye230Nnr8KG2U+Q5EXt4YDyKcUEzaNPSD/infUQAmJ4d1pGV7ebiexmp9lDw8/CsTn5qc7gy8wyU8shqJYNSIORdlOcFQOfG+Iws2xbd2L3S06pKPGRVlq6vw38zCfMoRqnHoZaj7npxwHIIY5z0WyBHnfZ05PYJ+a1XgfMjQqbf5IfT9RMoIQ5lF2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DhYf9P/m+pT4CvVKKftzKE/DGU8A+VbjMrbRkHzFVrU=; b=cdt/2tuI2hr1PzDF3E85IURJgh9pd3LXLjJdbBlC6kvlZ37xRlBiSKMc3wkvcVG/fZvwA8XmmoYTwKIgv+HwQvYzDaDuwsHUdwdojfpCs1PyEQUTSsjWnNzDkDRuJ68Hkl72rE8aQPZ2KQDyH6cr/0Elj74iS87EOLsxwDFioAGLaNIPIBJTMqsTH7+oYKMRZ/wmuI/zCtwQmKHleJK8SZWgKeh7L4rx42DX8p91JIBSl3CqXNnG1Qj47E55gRP/tz2en93ONprfFIANZWuaIX8eAZJlqA7ZTW6eGjc6TjNHZLsjsGgTh2CUMfqvBDIDiwskRqyzdojMP+64Hy84Lg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DhYf9P/m+pT4CvVKKftzKE/DGU8A+VbjMrbRkHzFVrU=; b=iivzqs/zlNsnEWDEXBAQlcnq6jJBPLdUXS5/xwPJ9JTyvr9IqHiQ7+Cc/CzU6W89+pdBTecxr8jGyuPeO2htmdruUIMNsPWvy9TJYDHaFlEtj9dz6nvXsSdbfERrOBmFVyCfM5d+LvJBlvT8wfdLTk9XYyB4C9s2OSHmtNFV/xg= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=oss.nxp.com; Received: from VI1PR04MB5837.eurprd04.prod.outlook.com (2603:10a6:803:ec::28) by VI1PR04MB6973.eurprd04.prod.outlook.com (2603:10a6:803:13d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16; Fri, 11 Sep 2020 08:35:37 +0000 Received: from VI1PR04MB5837.eurprd04.prod.outlook.com ([fe80::cc01:9fe2:2544:8a4b]) by VI1PR04MB5837.eurprd04.prod.outlook.com ([fe80::cc01:9fe2:2544:8a4b%7]) with mapi id 15.20.3348.019; Fri, 11 Sep 2020 08:35:36 +0000 From: "Sachin Saxena (OSS)" To: dev@dpdk.org, ferruh.yigit@intel.com Cc: Sachin Saxena Date: Fri, 11 Sep 2020 14:05:14 +0530 Message-Id: <20200911083520.24020-3-sachin.saxena@oss.nxp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200911083520.24020-1-sachin.saxena@oss.nxp.com> References: <20200911083520.24020-1-sachin.saxena@oss.nxp.com> X-ClientProxiedBy: SG2PR04CA0178.apcprd04.prod.outlook.com (2603:1096:4:14::16) To VI1PR04MB5837.eurprd04.prod.outlook.com (2603:10a6:803:ec::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv03161.swis.in-blr01.nxp.com (14.142.151.118) by SG2PR04CA0178.apcprd04.prod.outlook.com (2603:1096:4:14::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3370.16 via Frontend Transport; Fri, 11 Sep 2020 08:35:35 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [14.142.151.118] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a29e05da-fdbe-44b8-aeeb-08d8562da7ef X-MS-TrafficTypeDiagnostic: VI1PR04MB6973: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2582; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gG5V5QGDq5dNPtTg5qne3jiQQdXiYa2u2jo1GEA1+ctWfaoAmAPP5O9f7rbVPrkhigTNmzpxXosR3lzVCz2N4dDUBUA+ej59t8zdDVgwUQr6ItRcZkPm91k9aaGWLKvrkZbTX37yWZ/mqP/j9B45HiIDh01UVdfDVcLAZeGrpuLiNj+ljx/5seO19It2FBacKOM0bZ3NTXpR9XImxpyONh0laztobZdM6GjIN/vVs8PoEZvWqeYXTnFggjdyIlswQZh+yvxxkffXmHdmtB6QoqNNQviCJgj46PFZnUa+xaIwhflBoqdpS5lmHvDT9DgiOcsLyG3tcol3Ysz98b5oUtAE1UTFgcVPsMxl4xOMEvNmghf9l8j+KcGPOUWxAkN9 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5837.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(376002)(136003)(396003)(39860400002)(366004)(52116002)(86362001)(4326008)(1076003)(66556008)(66946007)(2906002)(66476007)(8936002)(5660300002)(83380400001)(316002)(8676002)(2616005)(956004)(6512007)(16526019)(186003)(6486002)(1006002)(6666004)(26005)(6506007)(478600001)(55236004)(110426005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 8p71zFI43KbV5TNmnSAezzBgEWKC2a5YC1Fv/cgpwQ+kknc6VDv+QF0bxrC3DpycwgiMvwNqOA4ToPfdjymuhJUIgFuFhlkq3yFRJ59QFMErsXkdEM4e0AZ+BRIXmwIkool8rkJfLM7GzkwWHDlfBJnJqLwRlyj8lnfihakRwjQjEnS37KfliTmNMt43sMKDPT93EFEsXr/nIdnA0++C17evDFTv3Gt2cLr0w2ucouVsxgozb9dcat5dnj0ySinbJBk2TdORxYfDQHvrcUOxEz6Feh/A0QZnF8AzHI/yd1s8jiBpXiSgZdyGikMRqKqHcqOkwwgaUDSkRAwdUOIpaGZyAOb01BpL2iC/N2itALgVVcYvVSyDRkqTHkgmaRFVuS2q6T1ttYQHyvk4NU8QXsVIwtW9hJnzFs7sMtvlF71E4SjMJTc1bAHmNNrRE4jxyCYkAuLX+5kHsE09xudm1dmrjzM4p9W7POu026rMakD0bqRk5YhSAnXvQkR/Mk9Kooy0E1cgTQRO98P0YpIuGpiwZoO9hglynuCI1H+s8AqkZfzhisHR4dorYffmT6s5reJ+IkUId2vwM0uZDxabyRQbRFMxS3tDvZ13SkSb1maLqDDbDVIg6i1ZGVa/cT7bLAqOHAhhU8twr0gWvaQOSQ== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a29e05da-fdbe-44b8-aeeb-08d8562da7ef X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5837.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2020 08:35:36.8342 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XHIPjbUnLfQ3dC8t6ttE/TtFvSs3aVc91uBzq7P9H0kGjjmKYViMonbmNhwpDOWRPj/wW6Nm5GHFxjD1M6SFDg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6973 Subject: [dpdk-dev] [PATCH v2 2/8] bus/fslmc: run secondary debug app without blocklist devices 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: Rohit Raj dpaa2 hw impose limits on some HW access devices like DPMCP(Mnagement control Port) and DPIO (HW portal). This causes issue in their usages in shared uses in case of multi-process applications. It can overcome by using allowlist/blocklist in primary and secondary applications. However it imposes restrictions on standard debugging apps like dpdk-procinfo, which can be used to debug any existing application. This patch introduces reserving extra DPMCP and DPIO to be used by secondary process if devices are not blocked previously in primary application. This leaves the last DPMCP and DPIO for the secondary process usages. Signed-off-by: Rohit Raj Reviewed-by: Sachin Saxena --- drivers/bus/fslmc/fslmc_vfio.c | 66 +++++++++++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 5 deletions(-) diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c index 9134ec552..6dd797632 100644 --- a/drivers/bus/fslmc/fslmc_vfio.c +++ b/drivers/bus/fslmc/fslmc_vfio.c @@ -802,10 +802,29 @@ fslmc_vfio_process_group(void) int ret; int found_mportal = 0; struct rte_dpaa2_device *dev, *dev_temp; + bool is_dpmcp_in_blocklist = false, is_dpio_in_blocklist = false; + int dpmcp_count = 0, dpio_count = 0, current_device; + + TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next, dev_temp) { + if (dev->dev_type == DPAA2_MPORTAL) { + dpmcp_count++; + if (dev->device.devargs && + dev->device.devargs->policy == RTE_DEV_BLACKLISTED) + is_dpmcp_in_blocklist = true; + } + if (dev->dev_type == DPAA2_IO) { + dpio_count++; + if (dev->device.devargs && + dev->device.devargs->policy == RTE_DEV_BLACKLISTED) + is_dpmcp_in_blocklist = true; + } + } /* Search the MCP as that should be initialized first. */ + current_device = 0; TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next, dev_temp) { if (dev->dev_type == DPAA2_MPORTAL) { + current_device++; if (dev->device.devargs && dev->device.devargs->policy == RTE_DEV_BLACKLISTED) { DPAA2_BUS_LOG(DEBUG, "%s Blacklisted, skipping", @@ -815,13 +834,24 @@ fslmc_vfio_process_group(void) continue; } - ret = fslmc_process_mcp(dev); - if (ret) { - DPAA2_BUS_ERR("Unable to map MC Portal"); - return -1; + if (rte_eal_process_type() == RTE_PROC_SECONDARY && + !is_dpmcp_in_blocklist) { + if (dpmcp_count == 1 || + current_device != dpmcp_count) { + TAILQ_REMOVE(&rte_fslmc_bus.device_list, + dev, next); + continue; + } } - if (!found_mportal) + + if (!found_mportal) { + ret = fslmc_process_mcp(dev); + if (ret) { + DPAA2_BUS_ERR("Unable to map MC Portal"); + return -1; + } found_mportal = 1; + } TAILQ_REMOVE(&rte_fslmc_bus.device_list, dev, next); free(dev); @@ -838,7 +868,10 @@ fslmc_vfio_process_group(void) return -1; } + current_device = 0; TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next, dev_temp) { + if (dev->dev_type == DPAA2_IO) + current_device++; if (dev->device.devargs && dev->device.devargs->policy == RTE_DEV_BLACKLISTED) { DPAA2_BUS_LOG(DEBUG, "%s Blacklisted, skipping", @@ -846,6 +879,14 @@ fslmc_vfio_process_group(void) TAILQ_REMOVE(&rte_fslmc_bus.device_list, dev, next); continue; } + if (rte_eal_process_type() == RTE_PROC_SECONDARY && + dev->dev_type != DPAA2_ETH && + dev->dev_type != DPAA2_CRYPTO && + dev->dev_type != DPAA2_QDMA && + dev->dev_type != DPAA2_IO) { + TAILQ_REMOVE(&rte_fslmc_bus.device_list, dev, next); + continue; + } switch (dev->dev_type) { case DPAA2_ETH: case DPAA2_CRYPTO: @@ -882,6 +923,21 @@ fslmc_vfio_process_group(void) break; case DPAA2_IO: + if (!is_dpio_in_blocklist && dpio_count > 1) { + if (rte_eal_process_type() == RTE_PROC_SECONDARY + && current_device != dpio_count) { + TAILQ_REMOVE(&rte_fslmc_bus.device_list, + dev, next); + break; + } + if (rte_eal_process_type() == RTE_PROC_PRIMARY + && current_device == dpio_count) { + TAILQ_REMOVE(&rte_fslmc_bus.device_list, + dev, next); + break; + } + } + ret = fslmc_process_iodevices(dev); if (ret) { DPAA2_BUS_DEBUG("Dev (%s) init failed",