From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0079.outbound.protection.outlook.com [104.47.42.79]) by dpdk.org (Postfix) with ESMTP id 58CA2301 for ; Wed, 31 Aug 2016 13:01:50 +0200 (CEST) Received: from DM2PR03CA0008.namprd03.prod.outlook.com (10.141.96.18) by DM5PR03MB2442.namprd03.prod.outlook.com (10.168.233.12) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.599.9; Wed, 31 Aug 2016 11:01:47 +0000 Received: from BY2FFO11FD009.protection.gbl (2a01:111:f400:7c0c::191) by DM2PR03CA0008.outlook.office365.com (2a01:111:e400:2428::18) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.609.9 via Frontend Transport; Wed, 31 Aug 2016 11:01:47 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com;nxp.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BY2FFO11FD009.mail.protection.outlook.com (10.1.14.73) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.587.6 via Frontend Transport; Wed, 31 Aug 2016 11:01:47 +0000 Received: from Tophie.ap.freescale.net ([10.232.14.87]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u7VB0laY010481; Wed, 31 Aug 2016 04:01:46 -0700 From: Shreyansh Jain To: CC: Shreyansh Jain , Jan Viktorin , Hemant Agrawal Date: Wed, 31 Aug 2016 16:30:28 +0530 Message-ID: <1472641235-23626-8-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472641235-23626-1-git-send-email-shreyansh.jain@nxp.com> References: <1451682326-5834-1-git-send-email-viktorin@rehivetech.com> <1472641235-23626-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131171149081758403; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(2351001)(106466001)(47776003)(5660300001)(305945005)(68736007)(48376002)(2950100001)(33646002)(85426001)(11100500001)(5003940100001)(8936002)(50466002)(8666005)(92566002)(7846002)(356003)(97736004)(229853001)(36756003)(5890100001)(575784001)(86362001)(189998001)(81166006)(87936001)(19580395003)(19580405001)(76176999)(4326007)(50986999)(77096005)(105606002)(104016004)(8676002)(2906002)(81156014)(586003)(110136002)(626004)(50226002)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB2442; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD009; 1:XFDjSQ7Bq4e4UZ1V4yBaPTs+EwdKZwVLRbJHSsNevpov3/KADpEm5xF9dVd92Q/3wAaoTYnqxIfJ/tNvbzvziRaBPfx3Gy1lIDadp5M+okjBRW+kLV2GSmLwhCf0RtWV1fIrrkgyqQeax80WsQkApRh3cgY2N13zfRFxvh86dWPwbdSa23PPAPKAvuMCKxJEdRdOhkrI7PcwLnK3yhzGuD0VHdyYLmo1tqggf0sM5aJtHRI2jSugyTYSfXLB3ZD3OvlzDNfRlB3jq8pQHhaHkysmpTL9TFeGUzoZm2bh0WTQA/kHW5dkG0YJh7EQO26k4zAomySosItgB+wGfKGKVHIgywV7eecm2cLuy8JNCK+syBcmiEJWhOKPxwuNpfOjY9fTSaCmuv6xRkU+8r5SRq4GgkFsDIrRwJJ2sEa5PGmOHeZNnQBlmUhKhs0VVAFxh/kSgJwUByIwN6e5t+tptZM2lVKB8Icv2/4+nB3KpTyMxufDkPdk1sxNrshLgCnWeqS+QsPo+cA64ah+NUhmvgepLBbbzSKMQbQ7eJ17su8uVnENxBzDtOkQg/DREqd2XlI5vJdHTeTWd4qNx76uxSllOSWN9c3PYBI6Ou7nMsGTMy/cCRH/jXrO0c1W3fSu1q3Za7Nzb+WcGCtZcHuPNtgSQWPiYl/YSUWMrxqG4Y6b7J50rUHOO7O5MxYYIvh4lzBPNfs5JZ+9QZV4fAkmlak+xJuT3uS1GtXtZaVkZjQ= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 5e3f99e0-3a9c-41ec-e962-08d3d18e3440 X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2442; 2:dDL+LPWmre7P7lU1nxsi0y5kBQC+ZSmoGZUZtouXyVfj6sfrozfAKLj48kOw7n7m74wYvVSfYTU6qLEoImmZKWBl4VxTG6xsOKPh4jOFB/pyiOLzrvSoAsTPxtru9uB5iNjvB907YAvxZow8gsxwhTzwvTQBFsIOMvK1r8JKONLacX2FGjJ3E2Fm1sBqdVWj; 3:0LFMw/VsmAhdi20+UWpUP3DHFITVOMmRBb8l++C+7KvPpT17th4ZzfxiOXTVqBivCZJY+sTEE71xqqT2Pw3sox9wfnIKCD4Zk15I1E0gWmbTgGZLtMAAKG9lTvtegv7OAV5/UeJdD9O+RIaXBX7zsjBixnSVlHfU9X22tg/LRq18POAu+6fUxjM1tywQhFtA+dsxKTZJ642aV9U1L086zAP6Tcf611iqbQvWTnvdfPc= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM5PR03MB2442; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2442; 25:f5M3k/b/iokDoI8ECZT9UzpJZirK53g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1SKRK58hg5vvPJtxftlEg123Y1ugtF7uU92kRRAVXlLQ9NsGyaYD4N7ydl0B3aL6/Sp5+bmSs1SvzMVieqcA6gSR69fp/2MlZmF32DbBfAIa+K9rabCE/Ame9mpCqe9jjyqep9a91HDqwTVSRJiBYZRaRnMKikfVXa6Lb/S3kbJOpPMwzKmPxYM5P7NIWcKXfuaWfjQ0g/r/hFjtruwbcRvHTmtFEU5Pt+YBlkxRhFXWmQWNttm5oVgNG0o6e2xZoE72r+cPSA58bN9Bvx/7y5NG6ivntm5/c/HTL//KGJ7fEeFm5tM8u/NrLCPunHQwSmtLNxrUJWNfuFaXQDsDWOGR6I6lIicIaV1z9z8eV8wiomNcQGBefDOlCAYEZxv8WXRngYo6sI1TLHs4+Uc4GzqcbD/NqFC1dmQB8ktPf9cLK27RGw7GH3W0hMFyTC0fG7Lx2krDdmbI0vv3+kTkvVrA3jVbuCdsxiE8hyp2DI+2dwpKBhGE= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(13015025)(13017025)(13023025)(13024025)(13018025)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:DM5PR03MB2442; BCL:0; PCL:0; RULEID:(400006); SRVR:DM5PR03MB2442; X-Forefront-PRVS: 00514A2FE6 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR03MB2442; 23:OGZHhGzipO9ax4K7ANqygwXeC50dNuhykUHFxG2/R?= =?us-ascii?Q?1Suu8yTDNMXPJjSClxCVnVlHtsHDmMncP18Hb/XvzHHXfO9igNpm3OvSdLnH?= =?us-ascii?Q?7gbcNm0lgJEglLpyDSEyDE7xrYnxiYnJtbcfJ2NSfZYoAEi2dkGadd8TiAh3?= =?us-ascii?Q?jnj7Q2GkOh7ketbgHYZNWmfSObQuzOCoSm07xL7rBS+F5ATEYruNO4cYtDAP?= =?us-ascii?Q?dc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amDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2016 11:01:47.9730 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR03MB2442 Subject: [dpdk-dev] [PATCH v2 07/14] eal/soc: extend and utilize devargs X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Aug 2016 11:01:53 -0000 It is assumed that SoC Devices provided on command line are prefixed with "soc:". This patch adds parse and attach support for such devices. Signed-off-by: Jan Viktorin Signed-off-by: Shreyansh Jain Signed-off-by: Hemant Agrawal --- lib/librte_eal/common/eal_common_dev.c | 27 ++++++++++---- lib/librte_eal/common/eal_common_devargs.c | 17 +++++++++ lib/librte_eal/common/eal_common_soc.c | 55 ++++++++++++++++++++++++++--- lib/librte_eal/common/include/rte_devargs.h | 8 +++++ lib/librte_eal/common/include/rte_soc.h | 24 +++++++++++++ 5 files changed, 119 insertions(+), 12 deletions(-) diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c index d1f0ad8..fbc4443 100644 --- a/lib/librte_eal/common/eal_common_dev.c +++ b/lib/librte_eal/common/eal_common_dev.c @@ -106,17 +106,23 @@ rte_eal_dev_init(void) int rte_eal_dev_attach(const char *name, const char *devargs) { - struct rte_pci_addr addr; + struct rte_soc_addr soc_addr; + struct rte_pci_addr pci_addr; if (name == NULL || devargs == NULL) { RTE_LOG(ERR, EAL, "Invalid device or arguments provided\n"); return -EINVAL; } - if (eal_parse_pci_DomBDF(name, &addr) == 0) { - if (rte_eal_pci_probe_one(&addr) < 0) + memset(&soc_addr, 0, sizeof(soc_addr)); + if (rte_eal_parse_soc_spec(name, &soc_addr) == 0) { + if (rte_eal_soc_probe_one(&soc_addr) < 0) { + free(soc_addr.name); + goto err; + } + } else if (eal_parse_pci_DomBDF(name, &pci_addr) == 0) { + if (rte_eal_pci_probe_one(&pci_addr) < 0) goto err; - } else { if (rte_eal_vdev_init(name, devargs)) goto err; @@ -131,15 +137,22 @@ err: int rte_eal_dev_detach(const char *name) { - struct rte_pci_addr addr; + struct rte_soc_addr soc_addr; + struct rte_pci_addr pci_addr; if (name == NULL) { RTE_LOG(ERR, EAL, "Invalid device provided.\n"); return -EINVAL; } - if (eal_parse_pci_DomBDF(name, &addr) == 0) { - if (rte_eal_pci_detach(&addr) < 0) + memset(&soc_addr, 0, sizeof(soc_addr)); + if (rte_eal_parse_soc_spec(name, &soc_addr) == 0) { + if (rte_eal_soc_detach(&soc_addr) < 0) { + free(soc_addr.name); + goto err; + } + } else if (eal_parse_pci_DomBDF(name, &pci_addr) == 0) { + if (rte_eal_pci_detach(&pci_addr) < 0) goto err; } else { if (rte_eal_vdev_uninit(name)) diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c index e403717..e1dae1a 100644 --- a/lib/librte_eal/common/eal_common_devargs.c +++ b/lib/librte_eal/common/eal_common_devargs.c @@ -41,6 +41,7 @@ #include #include +#include #include #include "eal_private.h" @@ -105,6 +106,14 @@ rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str) goto fail; break; + + case RTE_DEVTYPE_WHITELISTED_SOC: + case RTE_DEVTYPE_BLACKLISTED_SOC: + /* try to parse soc device with prefix "soc:" */ + if (rte_eal_parse_soc_spec(buf, &devargs->soc.addr) != 0) + goto fail; + break; + case RTE_DEVTYPE_VIRTUAL: /* save driver name */ ret = snprintf(devargs->virt.drv_name, @@ -166,6 +175,14 @@ rte_eal_devargs_dump(FILE *f) devargs->pci.addr.devid, devargs->pci.addr.function, devargs->args); + else if (devargs->type == RTE_DEVTYPE_WHITELISTED_SOC) + fprintf(f, " SoC whitelist %s %s\n", + devargs->soc.addr.name, + devargs->soc.addr.fdt_path); + else if (devargs->type == RTE_DEVTYPE_BLACKLISTED_SOC) + fprintf(f, " SoC blacklist %s %s\n", + devargs->soc.addr.name, + devargs->soc.addr.fdt_path); else if (devargs->type == RTE_DEVTYPE_VIRTUAL) fprintf(f, " VIRTUAL %s %s\n", devargs->virt.drv_name, diff --git a/lib/librte_eal/common/eal_common_soc.c b/lib/librte_eal/common/eal_common_soc.c index 4797dd9..efa722d 100644 --- a/lib/librte_eal/common/eal_common_soc.c +++ b/lib/librte_eal/common/eal_common_soc.c @@ -37,6 +37,8 @@ #include #include +#include +#include #include #include "eal_private.h" @@ -47,6 +49,21 @@ struct soc_driver_list soc_driver_list = struct soc_device_list soc_device_list = TAILQ_HEAD_INITIALIZER(soc_device_list); +static struct rte_devargs *soc_devargs_lookup(struct rte_soc_device *dev) +{ + struct rte_devargs *devargs; + + TAILQ_FOREACH(devargs, &devargs_list, next) { + if (devargs->type != RTE_DEVTYPE_BLACKLISTED_SOC && + devargs->type != RTE_DEVTYPE_WHITELISTED_SOC) + continue; + if (!rte_eal_compare_soc_addr(&dev->addr, &devargs->soc.addr)) + return devargs; + } + + return NULL; +} + static int rte_eal_soc_probe_one_driver(struct rte_soc_driver *drv, struct rte_soc_device *dev) @@ -60,6 +77,18 @@ rte_eal_soc_probe_one_driver(struct rte_soc_driver *drv, return ret; } + RTE_LOG(DEBUG, EAL, "SoC device %s on NUMA socket %d\n", + dev->addr.name, dev->device.numa_node); + RTE_LOG(DEBUG, EAL, " probe driver %s\n", drv->driver.name); + + /* no initialization when blacklisted, return without error */ + if (dev->device.devargs != NULL + && dev->device.devargs->type == RTE_DEVTYPE_BLACKLISTED_SOC) { + RTE_LOG(DEBUG, EAL, + " device is blacklisted, skipping\n"); + return ret; + } + dev->driver = drv; RTE_VERIFY(drv->devinit != NULL); return drv->devinit(drv, dev); @@ -104,8 +133,8 @@ rte_eal_soc_detach_dev(struct rte_soc_driver *drv, return ret; } - RTE_LOG(DEBUG, EAL, "SoC device %s\n", - dev->addr.name); + RTE_LOG(DEBUG, EAL, "SoC device %s on NUMA socket %i\n", + dev->addr.name, dev->device.numa_node); RTE_LOG(DEBUG, EAL, " remove driver: %s\n", drv->driver.name); @@ -218,13 +247,29 @@ int rte_eal_soc_probe(void) { struct rte_soc_device *dev = NULL; + struct rte_devargs *devargs = NULL; int ret = 0; + int probe_all = 0; + + if (rte_eal_devargs_type_count(RTE_DEVTYPE_WHITELISTED_SOC) == 0) + probe_all = 1; TAILQ_FOREACH(dev, &soc_device_list, next) { - ret = soc_probe_all_drivers(dev); + + /* set devargs in SoC structure */ + devargs = soc_devargs_lookup(dev); + if (devargs != NULL) + dev->device.devargs = devargs; + + /* probe all or only whitelisted devices */ + if (probe_all) + ret = soc_probe_all_drivers(dev); + else if (devargs != NULL && + devargs->type == RTE_DEVTYPE_WHITELISTED_SOC) + ret = soc_probe_all_drivers(dev); if (ret < 0) - rte_exit(EXIT_FAILURE, "Requested device %s" - " cannot be used\n", dev->addr.name); + rte_exit(EXIT_FAILURE, "Requested device %s " + "cannot be used\n", dev->addr.name); } return 0; diff --git a/lib/librte_eal/common/include/rte_devargs.h b/lib/librte_eal/common/include/rte_devargs.h index 53c59f5..757320e 100644 --- a/lib/librte_eal/common/include/rte_devargs.h +++ b/lib/librte_eal/common/include/rte_devargs.h @@ -51,6 +51,7 @@ extern "C" { #include #include #include +#include /** * Type of generic device @@ -58,6 +59,8 @@ extern "C" { enum rte_devtype { RTE_DEVTYPE_WHITELISTED_PCI, RTE_DEVTYPE_BLACKLISTED_PCI, + RTE_DEVTYPE_WHITELISTED_SOC, + RTE_DEVTYPE_BLACKLISTED_SOC, RTE_DEVTYPE_VIRTUAL, }; @@ -82,6 +85,11 @@ struct rte_devargs { /** PCI location. */ struct rte_pci_addr addr; } pci; + /** Used if type is RTE_DEVTYPE_*_SOC. */ + struct { + /** SoC location. */ + struct rte_soc_addr addr; + } soc; /** Used if type is RTE_DEVTYPE_VIRTUAL. */ struct { /** Driver name. */ diff --git a/lib/librte_eal/common/include/rte_soc.h b/lib/librte_eal/common/include/rte_soc.h index cc17829..c45b37e 100644 --- a/lib/librte_eal/common/include/rte_soc.h +++ b/lib/librte_eal/common/include/rte_soc.h @@ -158,6 +158,30 @@ rte_eal_compare_soc_addr(const struct rte_soc_addr *a0, } /** + * Parse a specification of a soc device. The specification must differentiate + * a SoC device specification from the PCI bus and virtual devices. We assume + * a SoC specification starts with "soc:". The function allocates the name + * entry of the given addr. + * + * @return + * - 0 on success + * - 1 when not a SoC spec + * - -1 on failure + */ +static inline int +rte_eal_parse_soc_spec(const char *spec, struct rte_soc_addr *addr) +{ + if (strstr(spec, "soc:") == spec) { + addr->name = strdup(spec + 4); + if (addr->name == NULL) + return -1; + return 0; + } + + return 1; +} + +/** * Probe SoC devices for registered drivers. */ int rte_eal_soc_probe(void); -- 2.7.4