From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0075.outbound.protection.outlook.com [104.47.42.75]) by dpdk.org (Postfix) with ESMTP id BF3DEBB0C for ; Fri, 28 Oct 2016 14:30:58 +0200 (CEST) Received: from DM2PR03CA0047.namprd03.prod.outlook.com (10.141.96.46) by MWHPR03MB2813.namprd03.prod.outlook.com (10.175.135.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.12; Fri, 28 Oct 2016 12:30:57 +0000 Received: from BY2FFO11FD009.protection.gbl (2a01:111:f400:7c0c::108) by DM2PR03CA0047.outlook.office365.com (2a01:111:e400:2428::46) 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; Fri, 28 Oct 2016 12:30:57 +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.679.5 via Frontend Transport; Fri, 28 Oct 2016 12:30:56 +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 u9SCPEMO019399; Fri, 28 Oct 2016 05:30:53 -0700 From: Shreyansh Jain To: Date: Fri, 28 Oct 2016 17:56:29 +0530 Message-ID: <1477657598-826-13-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477657598-826-1-git-send-email-shreyansh.jain@nxp.com> References: <1477581467-12588-1-git-send-email-shreyansh.jain@nxp.com> <1477657598-826-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131221314568613494; (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)(97736004)(92566002)(8936002)(2906002)(50226002)(77096005)(626004)(5660300001)(4326007)(19580395003)(586003)(19580405001)(87936001)(6666003)(85426001)(68736007)(47776003)(104016004)(5890100001)(106466001)(50466002)(105606002)(5003940100001)(48376002)(8666005)(86362001)(7846002)(356003)(36756003)(189998001)(81156014)(81166006)(8676002)(2950100002)(76176999)(11100500001)(50986999)(229853001)(33646002)(305945005)(2351001)(110136003)(6916009)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2813; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD009; 1:RVZT4bi5aznKo4+OY89tjKitK5iFezb4aTqtAbB5r2J0GYsSeiqB0Y9i5Dk7nFjbImMQK2Pr2+4Wq7VWWlKPb5HnUq65OeFp3FB4r+J65g1g4ccuasjjhCIfPMbRODb5/HyrDmDEnEaORWvrzxuD9z5ZTG5Qbg+UcXij2J+75kRC6gcTZQPQ5z+usx8prKoqgL93SnKephfwGNeUTv3JxsZjwE+7Upjo51C5lm+n14HLYmpy7rdd0ZnyC9rPM5SgafBFaeu715ZpLasnHYIrd0B5UnzOm2x/aprPaNz+7Se7LOFz8S+Z1UGqQG8CkSe6c6FMMk3kEnIP9OzeUxO9Yr/c4ZuaDr3Y4D5WpUAcOMuk3+wOSQ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ZkUx5uyazJens2UqLznO0Form7n038GQWLACgCFlcImgrNe3QoKmof0G1XrPfUIZFQIW71HUhj/zmOsT6zvo0c2vPSjTn4W8Qaar/HwC22dFKrmaYqhIxrvEUpZeqno7faVzd4APal/VAZrBZlroPl5cQ7G7yt53vT/K4JoEovK5BahC7DwpeKfFT+xwuMHZ41m1RAYJa9s1eWJmmitnyrg99HWKgSEQIKdMEXElhgKQ86YLZikRU9VxIuVt9sxI22L4Lahj++OQTPmuy4XFkr6XfdocZnupZKBwU1xg2BK9N3mTZr3gg7C/FdlHinbtMHiZeS0B9LgiARXuiydQlrHJ/5bwewF66tOecKFu/s9gznfDB809WeQzNhiZBaNEvW0w== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:MWHPR03MB2813; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2813; 31:lLYvkrUpNY0/a5p8nhg/KDDXWnzyf4XHGYCLl3LEM5YI88v/Obr66WppR+bQmg7k+q1VRRk7ljrZwwM2YEHboDgaNPTA543ONA0pjK5OoqV0fstdlJNPTqPnSbjgun3fO/1DcemSalClfF1Tv1JEDLu3vE1YIoaNtmccRuLSML9ZYltMElVJbTumdwFHKtWrHxOf5OYXlsi7pnzodZM48a0XZ/NyKY2ex/brCQs8HVxGmm7eFY57dbj4UCDA5TlauLPDkXbvHtI3olJgpmtaog==; 4:ukUV5/NpekwYYCDnCUqYOCE8svaC+qpkmnvmOSbGk9xsA7IJo7WpkmCjMTUwnYK0TjOTtyVzdNxQBDJk/4MnIAAhNnUlLMrsePKrIG3ivuGL5ycbLbHEBzoBQW8xw8Ku8UeYvgFMEuc/iUfAuI0eesTu6XG+iPtdf66urnhKiuVsD19cveb41NL/V++Bh/mm91PBBuYgjAOJVkNIdxHjXpDBeUsvpUXjbz97Ui1DVFAKlzHjUgXVk+zDvk8i8/asIyfk1L6qA2sE2PGnoKLJkj2obiTDlB/3ESyGZHQJDYz6xF03DYD2xx+EkskRYGgbu+V3cIsC07HpVZBgUSq+cVYRmTsDcrewbeaDMkFL7WP6DQMd1BgDXclaF630LOJSdQkN/51DY8A1ey+9C+WeRY19eKTOwrlImIKFXFj1y9c5B7ALRmra1ArlYme1ZNE0EDZq6SAb5slVXZq4ySgDUEPwL2DVtY/xbi4hd0KN2YaffzAW6ng//kFz7WbCp1xiXeJiUtQNULn3RFD2q7HCKXMZF15zKQucOQcwS3yH4rKDaQTG7LvXUw+wj91xVaqm 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)(8121501046)(5005006)(13017025)(13018025)(13024025)(13023025)(13015025)(3002001)(10201501046)(6055026); SRVR:MWHPR03MB2813; BCL:0; PCL:0; RULEID:(400006); SRVR:MWHPR03MB2813; X-Forefront-PRVS: 0109D382B0 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR03MB2813; 23:8oEYWJ74k1x28D5AZwvqSp/Sw3phhsLTSb5VZdVt/?= =?us-ascii?Q?8gZzM/eGYaQnJlBWdy6jcV1pRvlnjJdo1g8DOJINgB2OUpNpCbg+gBQK+z4X?= =?us-ascii?Q?d7yO6sWdOliOS3OOFIIaN9w938MpXmmcHJ+g/BvG2r6a2j118H8sxI/mkAEP?= =?us-ascii?Q?w/VR9fEElgOAYLlnICDMoYX0jl+YT20H/mO16r0qvY/C8PNZYKDMVfT3erBK?= =?us-ascii?Q?8xR6q1+gK42foSVD7BQOMxLNshDYDOkXtFF/XkAbBDeJEBERhJGkc0+1uW/L?= =?us-ascii?Q?BWiWRChb1QZqbu/I9uYu1sa9I1FYx4SO7nRXMhaNFLFXFxIndmFXRYc5Tupg?= =?us-ascii?Q?ZbD38FiaGPCtTD4zXaVopQjHx+csjqPIFrkdux1mTq0sonIzerwZTstDKV8x?= =?us-ascii?Q?WWMDWyogXD3iLhyWE1DlGu6dyQhwnY9KYq6eBGqEHnFan3vGmJ/FCK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zYVsCMeSLVKjmeAyVdb9Afae1YgVhwbOKrdnW8wbt3jmijBpc3U8knMz5gcqO6OHSWHv+2KwSi3r8i0aYf0OynREWLJS6rD3teHSt5TePM2EUe8ZiN/kD7irDM//wv27py7yxlmbKsaozVcI1ECDP+wyhF3PdhKBXepcixVT2DYOfT8HHAKoicXhRPEo00KU/x0ENmdg3fTPTqCVlHmN4GJSDcr1TtmKb2nnsF3iwuQFr1cUwrB74/BS+MgKVKzmb4S9WPiM7KS3vS85BfP3ZOW7BzEst2G; 5:NOpQpqVn4g2b9a+ixpkxvs2KfoMSiP21qeimk5n8tc523i88Cg97PGY5QVM3OrqgI8BqFsq6TrBcmOxtXENuRt/KvCgjjIc6Ho+0AR6L/XZ6sdKQpHKaqPjWYUGj8+O44Gi+wosYAtwgLz/ZLhgq1jEq2RlWRTzxKe4zBbkP5DND7Gh9jRGYJGhhbmLpYa3q; 24:/7DLTu6RwUScG5TKhBX0Yes2yNUB6r4IcHqw3czirUUBFXmqslyO3K0WnwfuVspiIcXJ0/M3zVAxInm5awijCkCn+gRrqmLmZnQkyj7w2l0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2813; 7:MM/MM/h2vhlzM1ylWkHQci3OWUBDZMgls1c9LjpF+JPGbxnjdEre988659kQs6y32y5K7FLZU4zTfhQt4YB+ieyS/1cH+OS1320ShXnqFXAVHBQk0ezEuE9roARq31nlz/IbgK+R+EnmBkA3rqcQfppW3Eo1Aoq/8VL695WcNPQsihI+2mKd4pY/Wtz46SeajegWy+JbqKOrK1OoNBP9EjacB3ffjYf3kg2Bvjo7+RgG0MDVpCiWRBWy7IqjXvq2vj/MF7dYwBd9Cgod6dMptKKyG0NvAfUYKWrmCja6sMQkaja6iui2Ht6h+elO5xDwBCpyMK3oN/kERoGKzjZ7GyZ1iiRvFuqNLC0CI/eVESk= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2016 12:30:56.5961 (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: MWHPR03MB2813 Cc: Shreyansh Jain , thomas.monjalon@6wind.com, viktorin@rehivetech.com Subject: [dpdk-dev] [PATCH v7 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: Fri, 28 Oct 2016 12:30:59 -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