From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0087.outbound.protection.outlook.com [104.47.42.87]) by dpdk.org (Postfix) with ESMTP id 9C98F8025 for ; Sat, 15 Oct 2016 15:44:42 +0200 (CEST) Received: from BLUPR0301CA0042.namprd03.prod.outlook.com (10.162.113.180) by DM2PR03MB333.namprd03.prod.outlook.com (10.141.54.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.649.16; Sat, 15 Oct 2016 13:44:40 +0000 Received: from BY2FFO11FD033.protection.gbl (2a01:111:f400:7c0c::170) by BLUPR0301CA0042.outlook.office365.com (2a01:111:e400:5259::52) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.16 via Frontend Transport; Sat, 15 Oct 2016 13:44:40 +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 BY2FFO11FD033.mail.protection.outlook.com (10.1.14.218) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.669.7 via Frontend Transport; Sat, 15 Oct 2016 13:44:39 +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 u9FDhhgO021870; Sat, 15 Oct 2016 06:44:36 -0700 From: Shreyansh Jain To: CC: , , , Shreyansh Jain , Hemant Agrawal Date: Sat, 15 Oct 2016 19:14:59 +0530 Message-ID: <1476539108-13170-9-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1476539108-13170-1-git-send-email-shreyansh.jain@nxp.com> References: <1473410639-10367-1-git-send-email-shreyansh.jain@nxp.com> <1476539108-13170-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131210126798809406; (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)(1110001)(1109001)(339900001)(189002)(199003)(5890100001)(77096005)(8676002)(229853001)(8936002)(189998001)(50226002)(104016004)(36756003)(586003)(68736007)(19580395003)(76176999)(305945005)(19580405001)(7846002)(5003940100001)(97736004)(11100500001)(85426001)(8666005)(47776003)(50986999)(33646002)(4326007)(87936001)(5660300001)(2906002)(2351001)(92566002)(356003)(81166006)(110136003)(50466002)(106466001)(48376002)(2950100002)(105606002)(6916009)(626004)(6666003)(86362001)(81156014)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR03MB333; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD033; 1:Jqs5IQoLD/ZEVBs/eDemn+Ov2iEVWwpvzS2rG0S4AU4t2Xh6aw7UNyPY6lEIWjo55ivsQfcQs0nV/qNvSm3j9l/f3xdvlK+ZzC1CBbJYjeSHd7tTMe4geKAJujbyhY0NMps5C4iGHF7WSQMLC+v3VHoHeMecmO8AkybiJ5ZuevJ2mY9jBVd1eO1utZ7wTqDw3jnoiP6u6p1VO+bGRLVIBr1Oi8DZwBH8X5NE1sp+xW+zcE29ZOZkLis3kYAVuSM/yQegF23TULQ/3jfmJTK+aI2rmEDBWkDFvcb9J93jOZlNJnnxCoBVfpNqlxzQuvqt+0jTlPrwp2e608BIa6cbM+b5tnUyXEdUZwMz414GyrPOHZAQstXPwmVR1+FTOZr/+AkBUV5VxVypD3t1tM9JcNXIlhM+CtemK4YBfRUyBR7XTGl46jHeH9qB+fLFmIBIsvIJCWNw1njrN+3FDGDfXStdb0AydT3tApfttJIBNSPD9bMxvijLhPVtO1iPMv3F/ocQZ7LzWLprPaLGeqKHH0MwlsM5EsMoYZvB15zf8aQDrZg9B1MXhdP7nTd6VHXb67sE80HHhnGnxsjrbSOyjOXZQoW135uD8XXxxG0p5frR6e9AGvoCpNeG4FBKkiCbOsJcd/sVgiKjoZZZqykG7uUdeCzf/Ly6kKc4IhxvBj4HblF9J0BThWKv7jtW/fNDXDMzqfPHYIV7O/k/NB/N3/T9sKm4cBYK8Luf4jfCwuY= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 66fc16a4-4fba-4aa6-de2e-08d3f501692a X-Microsoft-Exchange-Diagnostics: 1; DM2PR03MB333; 2:BtiougavSUbPeIejeKypFTnsNYD2E933vgy+NEQ/i/h2fqZwAJ+arGIQ0wV6RNAj1X9HIIZPV+SyzO5FxmZf+qUmCWCZCnKWVNTEmG+3LJKAlAibcZKYq4iq26LzRDXNcfm8ZSWFqqUvfd5IZCQv3v5x3+BmT8cWqh41J74XPFvmtEm4ydxiFfiRPtYhjc5/FxS4tXSoSiwPtY+9IGrXJA==; 3:cn+mf9fJHzV7aH38LArRRVZkzG3RYjJuO+66hoPzsn64V0cF1lPjdPR+ZRT91DReYspCEoysoR1hDHIp5qwz6IK5SIlKVguPLnz3Z/V4WtqPzaNBdMj/etqlktHNlMnVjqyz9FwTEtON0+weKb2mM3KG5jIeXAxLYj0c1esvT5TKfSd5G7ir0NTBwyGW5xcuOIZ0+0fSdoRJdARWQeH1xNuUe2LxBve/+ilSy9LuXoRNPKfbd5RHczkdWwMJIsLK; 25:h/k+3Orwx6tsDgjW8otFncqM18Uw4R1lNpB3q2crCFZV0tb696kJ1C0hmcP9tYBXICxCkwt8F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sQK+cxWlKHDVItGDqVFqh3UdmHQzvz3zj801Tk+v1oI5SSlaGrv5Ys+gKhiDCm/ev+fEzyAecWTxkQuJddC7NOIw15GV00q/BKUWhyyaH3sqSS4rVXi9vk5Z5jSg+G3FnExBLHHzPKmZ6M4kJ1PelD5DA9f2TAyX0KsplSoZMeJpcvYFmTi8yBJAfH+7rhjyfTES1wEoAZVZrfyy1DFljY0hjxkTTNt5He/G1PaYg4bI8gVy3grCubB/5Bq1PwmSUV4AX/yjFhijOejzgS5m259pzKMj78ah 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)(13018025)(8121501046)(13015025)(13017025)(13023025)(13024025)(5005006)(3002001)(10201501046)(6055026); SRVR:DM2PR03MB333; BCL:0; PCL:0; RULEID:(400006); SRVR:DM2PR03MB333; X-Forefront-PRVS: 00963989E5 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR03MB333; 23:/jODibfjU/h6MUXU6O7sOc8Z9PJFH38xjznkf603qD?= =?us-ascii?Q?s9Y9W42bVL3Wv7TqdSmyJhACXxISDoTqbvObiaFLojEy837QOgIJLD9Vk9yn?= =?us-ascii?Q?FfEWHYLIEhmHqEwo4tSCD5dGkaS7AnS2BaWmEXD3FQmxmKQYHV/JTHCLmH8E?= =?us-ascii?Q?vwlhrhH5sCekKO0Cdeg5kEqS/j69W5rBwmxGMfRxkVwCd/7NQzLGy50AAelR?= =?us-ascii?Q?iKraLeEEGB87MUceq3k1hsYGypy6GSoM/SnqExSB++9qYjCs3jM1kS2LV1At?= =?us-ascii?Q?YiXJ1oy0oBgGixmHqlfdKA9xZMgsOcqRMSXGPj0fWay/Xj9xY7n1kT4zsyf7?= =?us-ascii?Q?jrj8PUUb9bevYnxQH2YwFIw07CLV2BXWQ6TqYCvsV96QWGP03y207c+RG2db?= =?us-ascii?Q?TEIt3S4g5JDtZ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Diagnostics: 1; DM2PR03MB333; 6:znGa6p/9Hl83c2omcvkonYshtt27XJyg68l0ZuDoCd6Q/Ucz1P91i/lNuZpIebXmc8CGnooFv3XLMsvVpeptdearXo0Jnu/TsPUQdWydizYHZlGFyW93rR83P1Hc1l5iP/TIwPAAef0AQRg4oBnl17twcrUHQZRkItQGGsoiplbMp7h7veXrk/VLk3gkYmIU0dxBrgXJbxIHyMdexz658znEn4KO73IIIu4aJkV1Clna5jTJX0bGtD1JD3Grr9Y1wHHkJWabr/WODX5bXqtYmHxyj4ZJLuE6bLErq6UKbqpIypJWzyPCUHgI4zqQ8kYv; 5:Bs/7An+6f3lpT1zInFnbFzy+yTmU0TwD88Sia4l3e9sG8P6KS/7BXkL182MwKtWd064N6rYpTXfkQheNq9GfunP7rWAelHXV+7Ltnujk93fOwq97q4elmwZyhKOK4vIa/MNpWDYAy6N9yoEIu+YTILv3kMge6DjP7AgCiKZcpuVVO3C7L+tBnlzZTWpboNnO; 24:o4tO63I2ZbVZedtHAbv68Fd/xfS+DfPsGjCGRgVo86bMDqi0Tngp7t1mru9kzOAjFdfPzBZyULIS0z3h2IipgbfKcCU7+A4WvaLLZRnNoKM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR03MB333; 7:xHaZVw7Ciq22RvsKnLSASgIEjhxjZNYw4+mtBL+ZYls4ghuxpzhkdDGNooioO5xqN8HErPAeWicOwUZ6m5hQN562SmRjr/I+PbIwGjUM3PKP7nJQJ27vWD/jPRUw3o1KeNBDFu3pTNJQdL85roT4Sf9nGxAHhE3HK5txdEm6HDTF9dpdBaIetwlCGaPHTOYu/GnA9yPE2gdP4v6vBNAu0F212kGFG6n7qJz10WjwEyaqMe7zxvWFZRPi5Ei1uIr5sl4Vla/SvAgjpMc1BGTJoQmGmOBMOt8AvjuW6tH4STsKaGFrQ1IM3LPuQUnRxvH6yb+DhxBSy6XzDo8YaEUeXcPXbxm7SCWKpNfP75FB32o= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2016 13:44:39.5689 (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: DM2PR03MB333 Subject: [dpdk-dev] [PATCH v4 08/17] 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: Sat, 15 Oct 2016 13:44:43 -0000 From: Jan Viktorin 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 | 61 ++++++++++++++++++++++++----- lib/librte_eal/common/include/rte_devargs.h | 8 ++++ lib/librte_eal/common/include/rte_soc.h | 24 ++++++++++++ 5 files changed, 120 insertions(+), 17 deletions(-) diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c index 457d227..ebbcf47 100644 --- a/lib/librte_eal/common/eal_common_dev.c +++ b/lib/librte_eal/common/eal_common_dev.c @@ -107,17 +107,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; @@ -132,15 +138,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 256cef8..44f5559 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" @@ -70,6 +72,21 @@ rte_eal_soc_match_compat(struct rte_soc_driver *drv, return 1; } +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) @@ -85,6 +102,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->probe != NULL); return drv->probe(drv, dev); @@ -129,8 +158,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); @@ -233,17 +262,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); - if (ret < 0) { - RTE_LOG(DEBUG, EAL, "Requested device %s" - " cannot be used\n", dev->addr.name); - /* Failure for a particular device is logged and - * ignored - */ - } + + /* 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); } return ret; diff --git a/lib/librte_eal/common/include/rte_devargs.h b/lib/librte_eal/common/include/rte_devargs.h index 88120a1..b5dd436 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, }; @@ -83,6 +86,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 030df6f..90cd6aa 100644 --- a/lib/librte_eal/common/include/rte_soc.h +++ b/lib/librte_eal/common/include/rte_soc.h @@ -164,6 +164,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; +} + +/** * Default function for matching the Soc driver with device. Each driver can * either use this function or define their own soc matching function. * This function relies on the compatible string extracted from sysfs. But, -- 2.7.4