From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0057.outbound.protection.outlook.com [104.47.36.57]) by dpdk.org (Postfix) with ESMTP id 8B0EBBB30 for ; Thu, 27 Oct 2016 17:17:55 +0200 (CEST) Received: from BN6PR03CA0058.namprd03.prod.outlook.com (10.173.137.20) by CY1PR0301MB1626.namprd03.prod.outlook.com (10.162.166.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.12; Thu, 27 Oct 2016 15:17:54 +0000 Received: from BY2FFO11FD016.protection.gbl (2a01:111:f400:7c0c::162) by BN6PR03CA0058.outlook.office365.com (2603:10b6:404:4c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.12 via Frontend Transport; Thu, 27 Oct 2016 15:17:53 +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 BY2FFO11FD016.mail.protection.outlook.com (10.1.14.148) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.679.5 via Frontend Transport; Thu, 27 Oct 2016 15:17:53 +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 u9RFGIfg027183; Thu, 27 Oct 2016 08:17:50 -0700 From: Shreyansh Jain To: Date: Thu, 27 Oct 2016 20:47:38 +0530 Message-ID: <1477581467-12588-13-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477581467-12588-1-git-send-email-shreyansh.jain@nxp.com> References: <1477310380-17944-1-git-send-email-shreyansh.jain@nxp.com> <1477581467-12588-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131220550735245550; (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)(2906002)(4326007)(50466002)(5660300001)(86362001)(6666003)(626004)(97736004)(586003)(48376002)(8936002)(87936001)(50226002)(7846002)(305945005)(5890100001)(68736007)(356003)(85426001)(8666005)(76176999)(92566002)(189998001)(47776003)(77096005)(50986999)(81156014)(5003940100001)(106466001)(2351001)(229853001)(81166006)(11100500001)(36756003)(33646002)(19580395003)(19580405001)(104016004)(8676002)(6916009)(110136003)(105606002)(2950100002)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB1626; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD016; 1:8ykCr+KAXrZ83TJ6c8AYlrlVjREeynXtTwwWOc1Tn5bO9qFGXrV2iskoQ6QHVFlDDJEY3m34zHbqtVdGl4GAGbqDREeEH/l4ulRDgmMsfAI0TSHIlHCIAszFj/78w/N57cma03WNsFO1ltB01MQCzcDmJtVmCLXVnMmdOOAeKpf/ZOVnKtsf3jNtcojcfNFrI4HPmX18uVxChTwP5Jto/t9jRLQ2IAjRR9F5UjSPqMX6KDJcP6ruxcBhIM5QN+Qv6Ue67LDdx15Fe3xiPGe/3fi54gUUth5DV7YRBm1yTEf4uJzSiXUId7K4N9894XfsqeD0QNcOgu8NKbVImecKcc6Y1c+8yqhCZnCa5Va3S70wyPkks9Lec+aqe+uqMn4iU33VpIS6K/lLUBsPH/p87VHdQ/9Lv9Y20T/IcPNbvDMHzi4K5wbzlLP0f1mQjd/d+WIBq09pLEfV7mC/6EqWwE3OikGpQsJMbglbtl4FNFemkoMEjcGMLV3UAbCZ/I7Db4mvXavOQ0b/gRGUWPjzpuPdo3lvcXAV7xgUj1V6xkDmvladBwHcs1tustshkOTT6dEeqwU57RgZh9oo+iN8jJuKR5AbhHayJ2IVJ38ZYjkPKlWkMoOViQNhRhQQuMHNoMMjzuZUQxywgu6GXA/+acflUMHDJpnUBWi8VHeJC1Eo3/saLJjOM1ajX1KyCIccYNiEAauYiJKvi5kx163NE3jKYk7kWfUyApBnPlfEl2c= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: ba0e1432-fcb3-4197-cf8d-08d3fe7c6c42 X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1626; 2:YOfrSyoxZo5i8s+QOYdobO+JcCQW5unEJEUuiUz4q6ccjX+y78VpEum9cXiqBPkaYvbmZqTEzv4GSQil5FqXoz6RnweywyEXQLRf/gDeB/JRinkNshv1jLbj96HKO3QezG2IUF9lEHBLcx+JnYbrdxGYIPV7H9jMRVbbUeTRUW7DUKbSIVyzDaAcVKZP+cKaXIoNl+M/1c+LfSGFdECsaw==; 3:joAjqtxqbErf90JjDSQQlP0ghZa7uG6KnXZCPYR0v9NYcDDRNCqSKpZ3Dnz3gbd3B+iqxptcjjS5fgsCNLadpFGivr9diI/FWC57H5/PAZwI6W9HfT+xY/dumHv9kei/R39KoO+Yqr7Ps3SxlqJd251ffxzb5PBcOf4ASPIPXT4HGrQOwCdFdtzeVkOxlqUgffJyGgeJTMXxBtup2PmUZWXQqbMsHm10UOVrkLzk+XKVi2jPRNj0sN0unmvMbFBq; 25:PNIalsI3TAgn2WsCw9982Ez/vxJXlY0PgHylKpeQazusSFTsw519gNVSosScg21f6XN/PXGhX3mJQwU/lkfElvDcqxSnu2+4Ly4r7UrU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3Y8TlCS8oa2Ucyc+nd/9S+RTKq1DenNO1Yj25z76HFah9eR96Wc+lOoRZftxC4prrGCtszt8HO4QnMZOqIKQJCYY2rO8VstH7aUeKKkJEFqgGDyq790Ot8b0QxuihehwMZc4rP63jEqI0D3mXkpwwoKsjOXZtEmxz8MQbfqX7RXau+XcNnTQwhahnZJvtwLKiYr2tP6VXWpi2xgBvQLYS4g7sAw2kUSN88GMEr+PgBmgO 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)(13017025)(13023025)(13024025)(13015025)(8121501046)(5005006)(3002001)(10201501046)(6055026); SRVR:CY1PR0301MB1626; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR0301MB1626; X-Forefront-PRVS: 0108A997B2 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB1626; 23:YfHf9GtU1K8oBVHaNAf5yEv1YvMHILuF8BRDi0y?= =?us-ascii?Q?eYsjvmXT+OD3ZFOgLgeD+vsAtiiX/euqsGXPJdTOyys4ithrHBa8tGVocoww?= =?us-ascii?Q?kKQIRD6iJucwHAIe/WifoyOz/BBqAPHPmLv6LNSfUXVCHXWvAcZLtegdkueu?= =?us-ascii?Q?UW9unkJtpKKBRL4XnK8JFglJ43N2jYB2dho994otN9Fjt2FdiB5Lv26rAfg7?= =?us-ascii?Q?ZBqWd7wpSscHBJxc8erDZ216mbVtWzpEVN4vsvuxFTir7Z8EoK2/u0aQINF/?= =?us-ascii?Q?wKn9mZtBdb+yhzLhRJ78FhSMO6q6KQhipKHLMx5Xy3M+7DTfd6PcnXU+RwcW?= =?us-ascii?Q?+Nc51Sm5r0oaxfqW6Ohg+PvF7iwYBdWUQDxclFN2CYLpcddYVODfmnQvXdOS?= =?us-ascii?Q?oDmgUlE1tAGRzarjgE1WbZ5eEYqmIsgCCisNR+0W8VN+qPYfVYbA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vD+UqCWSqMRFYx9Gkaz8w8LQ9r27E1UbB/bLEYnqFbQ9h4NNwdO7etfBpwxwmdR27jQAWfQ9EUuYOmPcPes5TeM+WNmbNjDQIsNr8kxf9X7jY8mMXwfbYsncCKw/QIzKLmQXUxTRTqtXbC1S1yIWRTomiTtr6UTpyhTDPPJzubsVG4GU1khPJ4llGGgBapJYGiHJY+Yf+xPrQ02rctUgulBFgDyf4dO51gkj6fZEvTaUjkleks7OGLlf4afzaiTEw+kVUVBvC4cwqDsC1IYjG6GHq5pOG3tCBLnJ; 5:HkyUUEPna3CmAN2zV0zg2YVNjkGl5gtf1WIYEDwFkuyiJ/srSle4FwdYMcC2iGDQHErYg2bmsjZkh2r4xEX3pdfozFxbYOcFCaHAfXQvB6wvbusxnoowke71gSdH36p1rLBga4gcKvDqx5ZgnbdjKg2DUFxC2qTvyIJiDanCtGRHp6MRdgkv7OM9po9j2KnV; 24:LedGsO2SLqCYKScAORpJbESRZo12MMlWvbVj1tEXxSwASubX+P0D9H3mgK8wGiCOeIvqdUg7DgdoSNM5OSvToAHs4BQgu15rTECF3bDzxZo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1626; 7:jRW585KKR0Pd8QPvrC4vKSAbkz9/9UguOthfrSLuTV2inX7Fp47ZnJTcJn4IzU5NtsXk0IOFDgr1ZMXwW51IuAPR7eAGe5SWHV0yqCiool8kZSigxI3ZS7ppjQzZupyp+wa6jxlmRut2S+jz+ag4Y06e1IqZNiG1xMkz6nogfqhXgO3ebM1ad4JJ7yW5h2rquW2t5ju+nbmarnkODXyTjaM1w5TX0A+TfCM2DXDijmoh3DBrk3lxiaHNDl+kgcCm8Exwppnj1MJfXLoiTyB8GsFEQWl/tEF0aIGy5jYrQw53JygOyMPxguOKHykgUCTboX+gc9k7VT4kwfA25JJZSHQUMdLAl5vHOOVtrr6EHbM= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2016 15:17:53.3217 (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: CY1PR0301MB1626 Cc: Shreyansh Jain , thomas.monjalon@6wind.com, viktorin@rehivetech.com Subject: [dpdk-dev] [PATCH v6 12/21] 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: Thu, 27 Oct 2016 15:17:56 -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 53a321b..fb5ea7b 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