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 07EAC6C9B for ; Mon, 24 Oct 2016 13:59:42 +0200 (CEST) Received: from DM2PR03CA0046.namprd03.prod.outlook.com (10.141.96.45) by CY4PR03MB2808.namprd03.prod.outlook.com (10.175.115.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.12; Mon, 24 Oct 2016 11:59:40 +0000 Received: from BL2FFO11FD037.protection.gbl (2a01:111:f400:7c09::102) by DM2PR03CA0046.outlook.office365.com (2a01:111:e400:2428::45) 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; Mon, 24 Oct 2016 11:59: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 BL2FFO11FD037.mail.protection.outlook.com (10.173.161.133) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.669.7 via Frontend Transport; Mon, 24 Oct 2016 11:59: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 u9OBwEMW008267; Mon, 24 Oct 2016 04:59:37 -0700 From: Shreyansh Jain To: CC: , , , Shreyansh Jain , Hemant Agrawal Date: Mon, 24 Oct 2016 17:29:31 +0530 Message-ID: <1477310380-17944-13-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477310380-17944-1-git-send-email-shreyansh.jain@nxp.com> References: <1476539108-13170-1-git-send-email-shreyansh.jain@nxp.com> <1477310380-17944-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131217839801310144; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(979002)(6009001)(7916002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(104016004)(33646002)(86362001)(305945005)(50226002)(97736004)(47776003)(87936001)(356003)(2351001)(229853001)(7846002)(68736007)(92566002)(81166006)(8676002)(8666005)(106466001)(105606002)(85426001)(81156014)(19580405001)(19580395003)(48376002)(11100500001)(5660300001)(626004)(50986999)(36756003)(76176999)(5890100001)(6666003)(189998001)(586003)(110136003)(77096005)(50466002)(2906002)(8936002)(4326007)(2950100002)(6916009)(5003940100001)(7059030)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR03MB2808; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD037; 1:+/qTslhQok7R2Dpb7WbhbaQUDXHxNwX78NoFyCXUozzs00cHWgXfxtriJuXf0LBGZJ/tV1imoi6l2RCGX5AfDXVHb9mchO449V0lyp5AohUvLZqt9o+ZSR5Ny/0k1m3V+vd+9OeoLCKE2+P9rdaV1HjRl5FdMBoyjniKVdT/LpY+6VDbb7WWQQnc+f0K5Y1xk2GcA+tXXLgCXwKMZaiP62AdbTrsnL+jwdlRGz4p89qcowLT8I7gZ9xjvMVoJRcPMzt5dT/JNWMtVC/FN2KJ0Hdy4dzfI4699Zd345KtScbrlzq95Y6yZtzuUSQyHGO1+GOKQXNnYzIUjCQySQHbkSaNYRP5MJDEAMTiL7EUxiwmNNpkderz6iP7qAcPT0vXz1u+bsNvbPlS6gI0wB3gptOIGfBRFXRMzOSa3CSR/dfY8bIphhQytEhk8cSMCzT1BwnXuWn4NZzEINKXTtKklCtFoiGNkeDCJ3ngVLy8aMAm4D61MNowVsmaWyJCXSc1wlAh2UINxh4zGSGHzB2w2Ue8a7pAWkKMLomXApmNE8QnazKrUVOksTTuX8bhoyMq2ji8kw8WmZBOEepTSPsu9W5iQyjMPN28y/eSfhoKO/hGef8sdyd6rAnJT7aGUF6X/r31edQMOYcETIr8myuKNdvk5Ogha2R6JOMl0PUonVc0i8JzBn/WIevTXIxxaC9psNHX6rcTcGF0/oEwAFRxtI+3+tdAmDJxPSdHXZwYu68= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: a43dda77-85a6-4ae6-ba5f-08d3fc053c01 X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2808; 2:c9OfjI2SCgf3rvfk1Mff6thpqGqCZNEf8ltgfMuvvcRQz5ODa362woql/D7pZmqQiIo6MHoCpUGs1RZ/8GbaBYRHd85/WS6mRTN/o1R+LokFGEkb0csnfJSVG/uSjZJOzV8tLzxvaQ/mBT5URbCjOirlDlmaFN/zUe8zGUI/KKKLvk4I1aarkVxoRUde2rpLbew4cDdHppPYv2Or6vvcgA==; 3:395eYZ85l9+ONnVTO38+Zsc9mycPftQRu3hsFSJeP+PgUWkhi8RfIwmOFgTknF70JDQZWTkybRmyO407gLIOuN2JFzqP7AoSns0lP/4iS0lLRhX0MQRa5YXkRCttK20Vv7FqbwmSr0OGboqD9MQQQ6yUG3Ltg9Irxepq04mUEYJGdBuNzql2flUXRc00RlYmJ05b3637KVr0sRvRixFjSUY9S6LrUG9nA+8iEE9yvdEYoOZ1WwzOkARHAlvumiXH; 25:SO4oBLpgflWpGPk5/SHruZMWrm4by36CLsFbUPTPq9qxuCePD5zkAyA1xdB8yvjV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KsVsxKVu8PBmLSVCZfc/+4jeKOt7R9m8ZFzf/vaZBTAmFfAC98raoutfRPFhTHU73rL/fzLEoySPC+KDLPsAr1fo5u8dr3glcOBqeU6gxvQZ8P86tT72VYtrkJv84iAQ5/KdinVA8BgR8n8wFCjw5G+rP9DCgPN8aILWn5lm9bbryOlxJzEcvCOT9cEhV8hPLl2DMGwvTmZglXfOnTsXLxjGfxroOXMTqG4qO3Sdlg3O2WXVlu7MVFk2Jt24YF34gS1PDsDnXJKOEZz5n35y+lG6MTUYnw+PUYdMC6oTBycEKQ 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)(13023025)(13024025)(13017025)(13015025)(13018025)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:CY4PR03MB2808; BCL:0; PCL:0; RULEID:(400006); SRVR:CY4PR03MB2808; X-Forefront-PRVS: 0105DAA385 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR03MB2808; 23:ywNvyM/3xP2CKTaQrqtk/V5lcvzKNQxXXBvREDX+B?= =?us-ascii?Q?JFR6+AlIZx+bxvEO0prWrl+XSgtU7VpFBlDEzhv46QKVODWal5ymM4J4ZFhZ?= =?us-ascii?Q?gSJdsrW2rKzLSu6NOFnl5ig0EbcDZ9GALv0RfNOY12n9yYvuGgQOBtade7Q3?= =?us-ascii?Q?hi1dyyxmzbKUCXO14/de8jeQuk5VIRldGqJvVFMkhjRsVKi5tnFldMFjxFkO?= =?us-ascii?Q?FsYjeavlQnCBiSbnIHErIQBb/FeGtvPe85HpO2n7i8BCF8w2TqX4UZNpgfuV?= =?us-ascii?Q?B4eDgp8MzdjCSgis5aJlK2phHVkW1WI4RkNNk65t3Foe+8z0mUsMhN7aiC3u?= =?us-ascii?Q?yPnI4De6evkh3QA0vPeIdefMnVVYmUASWv14UWAPQlj1bdU2GN4yMUh13ZVq?=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a+JmtIBABnIozc5KZgfjcZcCQQ0JabPwRb0qP19CC8m4K0WflegORLc+IFWdgfD9Ab+DeuLpQWqD7Yza/Kxxg464FAotQnSTghE4xIc5n+oXQ3CjUtvwDBoDQ6cyitrCEsoGq4U= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2016 11:59:39.9438 (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: CY4PR03MB2808 Subject: [dpdk-dev] [PATCH v5 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: Mon, 24 Oct 2016 11:59: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