From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0081.outbound.protection.outlook.com [104.47.33.81]) by dpdk.org (Postfix) with ESMTP id 8074868D9 for ; Fri, 9 Sep 2016 10:44:59 +0200 (CEST) Received: from DM2PR03CA0051.namprd03.prod.outlook.com (10.141.96.50) 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.609.9; Fri, 9 Sep 2016 08:44:58 +0000 Received: from BN1BFFO11OLC004.protection.gbl (2a01:111:f400:7c10::1:189) by DM2PR03CA0051.outlook.office365.com (2a01:111:e400:2428::50) 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; Fri, 9 Sep 2016 08:44:58 +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 BN1BFFO11OLC004.mail.protection.outlook.com (10.58.145.15) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.587.6 via Frontend Transport; Fri, 9 Sep 2016 08:44:57 +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 u898hoZ1018305; Fri, 9 Sep 2016 01:44:55 -0700 From: Shreyansh Jain To: CC: , , Shreyansh Jain Date: Fri, 9 Sep 2016 14:13:51 +0530 Message-ID: <1473410639-10367-8-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1473410639-10367-1-git-send-email-shreyansh.jain@nxp.com> References: <1451682326-5834-1-git-send-email-viktorin@rehivetech.com> <1473410639-10367-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131178842979498473; (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)(105606002)(106466001)(36756003)(50986999)(575784001)(2351001)(86362001)(50226002)(92566002)(8936002)(76176999)(229853001)(104016004)(5003940100001)(2950100001)(11100500001)(77096005)(626004)(5660300001)(586003)(110136002)(189998001)(8666005)(97736004)(356003)(33646002)(5890100001)(7846002)(47776003)(68736007)(19580405001)(50466002)(48376002)(19580395003)(8676002)(87936001)(305945005)(2906002)(81156014)(85426001)(81166006)(4326007)(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; BN1BFFO11OLC004; 1:CS3zuOK7dXo8WSolZ7N/ra4PEP3yTHnhjfyL13/jBRWRMDmKhQ8+STlIgpFPTbzjlbxovzxvotKzQ1sh1MyKVO0MbKtQuh+T3ZtzcsuGC7k6Knm6BBCr2yNwAsH1Rr1RIrvScYw3exvgAPzRmqmXVaGnu85nhZ9j+badVHoBGVQBVaSZeEmzzSkqSCZdaZ5GQmebDWvqviZKKeGcz0mhnqDpwGSv+eg//MQhWWY4JTCcztk/LMjG6IbfusyljgdoWFG9LfaOt+/VjPiXj1ypqo17nqAgPOM/IZW1oyIDZgvekKCycoU67L3iueSNT8Ts5oV2WY+Hqnzo0W83PwxeCkcJM+PSINLVItnZSIzDTSnB1eSfOFST7cbVhMdSSm50fQ0DKMVLSBnPJARj61t2aluSU4EMBk/g5PQXy0CoX7cNGFCrOnMh2ZSsRldIZpljwfdCaLxqUX57omklOhGHCnpDLrsmzYoopNpaFtkI8ErWoeirPcSRP3LXpAeg+8Jjaq/DM4U7q3AEhh5KFR1OqLO68J/k67jRh1Y2YV9rHs8rLKUGUti4ZBwz2hWSPRIm13+zpCIAun5RspdvI2CQomjsXI9C3KmLh0Ei7AM/AvR3MPFM6CeQkVrfTy+z32nHReWDCVDheqcRDZD/KjESLbUmp8ma2atbUztw7RO28JOaTdURIEvWcYkRiDWqwrF8kpLFjJuQCdne2Ofc517o9WyubXk/1VDoDpeQja68Hw4= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 5e2c485a-dd8e-4dd0-988a-08d3d88d944b X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2442; 2:+Tp+tdh09RL5n8FVDAX4V7hZO9dWkY88ax1CjgnzqXNF0GamQv1LMcWp0jU3+Ub7OHD6B1HTOvhxksYJhbOyeXUIt9YU+T7bsfkNfW9QSMbN1LOGz8x8/i9LrCQzSn2lVgLetnwFkzw+ctzPPCFnpCTr+If87xQJUG4ommoABjflPZpdf7Amdqb9soiBP1i2; 3:DA8BlPqyvwAVN2byi3uQn/y3L/Wh9uIl6ydyHUp36nUCGxrBoFR1WvxS6KcCWP0qJj+0Fswo42H2tKKceKqfDvRSnp6+K/JPaX+sRH6Am8i9UA1YyzY/gXaAHQuyXfAN0N8IpznC+K03O6ti5ioLiAz74BcJWG7urt98ZBQiu057+dvrXCHRGeOlhCEFeDxPXQ7eRfx6/jbNyVWIuFi9TzBq6nl+TsqnvEnxZtv+330=; 25:BT7bO9Op72oy/Qk4cDmF3pGD28FPHhG3OQ57W4GsiBDIhoHO/hKeWIEdlcBdfTjET6/ZGgdLNRLwyjNxhI26n5gwx3OFj8XtmG4Cu2D9Ev6zBP8UMxRsxjSuYqeephpsONLqrVmD4A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gqkKTDXWw06o3Xw1whLYACWOhMD7CRk8hOu5657u8kCJKHQPeOJPK4g53xzqPimgkxvzoKijoWWrE= 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)(13017025)(13015025)(13023025)(13024025)(13018025)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:DM5PR03MB2442; BCL:0; PCL:0; RULEID:(400006); SRVR:DM5PR03MB2442; X-Forefront-PRVS: 00603B7EEF X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR03MB2442; 23:miu2eBatE8M7qeWUu1kJDRsztd72RA1qz/N3YHCmG?= =?us-ascii?Q?GtVVC047Yi2ynGIn1w+fBoNuNw4M+b/vGv79RF/ydeKU1F0E88LyJrM1pph4?= =?us-ascii?Q?1UwObVPkHbVRw3mPRz4m2PxlktRRbZlKf1umaOjRXcXKeRGHcnEUgi+Ix11u?= =?us-ascii?Q?0Uj1l0rdGGEQr3oGDHoyNkmSuzFpOrGGROSKUfigQuuv1Aoe7HZTDLHvurV0?= =?us-ascii?Q?UoMH5stFwdUQ/A8/kw2iQuv+vSQFRX2mxlTx7bVMHeGPq1WCLaMij9n6V3VR?= =?us-ascii?Q?N4Ly2znbkcomeSSWPjVbTASAE8IoG75dohrxAIu3QxjS8igpjh4hf5/kV5Ji?= =?us-ascii?Q?coaodhD/7r+R+kWdZnHmhrWQLnBwZzM5SnnBTW0r0N4+Np19LZAu/ji10yl1?= =?us-ascii?Q?K6UkPrbiGZYhcZFIsJY+Kgdu+cTvQplL2J3m6jYV3PsGnTHTdduFwsPGgnou?= =?us-ascii?Q?pdirBCxk2XZ3XdRN16yzAq1HlHzg7yab5iSas7KrMk5hgomZr/ukIXzMfwSU?= =?us-ascii?Q?l3CAwL0I5gqhdeaVT0CfGnxhoBt7tFoQ+Vx/OkpAnXPDbmkjC2WavR4/j3ue?= =?us-asc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pl7JNFIoHlYgU21RcVxfvbBC3/pT+lt550wQH61UAfGyNAAd89Vz9RC3l2XEtJ3oeyqFdjWOgsU=; 5:WVyeyPPZ/Fi6QvsCD4TWxLty/43DTORgq8Z+2sCcZmGVj7Kson5XVeLU68yNAV5tax3xNh2SB5bDj8eQCYbW8hPBYHTvBS0ZOIDc1tMcZJVyQwUUJVubFKaGnP51Nt7MnzQfWmb9dZtgwy9BUBFGw3DuHWaGp8ttWbB1P+bySwk=; 24:gqc1Q6do2R5nu6GHIXPPWAf0WkyqkbGCZ2p29/QyLkKer/KskzmTtAXkMRIphqb2YTqis9qqnYmoRqUPi4aYoX/DdkqriNy/+HQgkxBSX90=; 7:fPmd3TTcqPsCT0gBsH1IfK/3p9QVyRdSvOK9AzcKENHW7jHnc5GasKpbupal8FhwF75jMCCo3zLDEEw232JlugSC6730Ag9kY/U54KifsFbm0oz5QE0X62Uos1NOgmeXGQephlNJlOBUVWPcC5kel5WcfTztWy1uUpU/wWMgzRvhm1rfRNvKQ4ziWJVOQ0VFZvuVsC+uZct2hsYm/5y3N8Cvq2mdmiGes+DvatTQhA/Gb0rQp7pXYre52NyIGjDA SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Sep 2016 08:44:57.7470 (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 v3 07/15] 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: Fri, 09 Sep 2016 08:45:00 -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 bb87a67..e9d413a 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" @@ -71,6 +73,21 @@ rte_eal_soc_match(struct rte_soc_driver *drv, struct rte_soc_device *dev) } +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) @@ -84,6 +101,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); @@ -128,8 +157,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); @@ -242,13 +271,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 bfb49a2..0bbef7d 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; +} + +/** * 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