From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0049.outbound.protection.outlook.com [104.47.42.49]) by dpdk.org (Postfix) with ESMTP id 6BBA837B8 for ; Thu, 10 Nov 2016 10:08:45 +0100 (CET) Received: from BN6PR03CA0036.namprd03.prod.outlook.com (10.175.124.22) by MWHPR03MB2749.namprd03.prod.outlook.com (10.168.207.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.12; Thu, 10 Nov 2016 09:08:37 +0000 Received: from BL2FFO11FD036.protection.gbl (2a01:111:f400:7c09::147) by BN6PR03CA0036.outlook.office365.com (2603:10b6:404:10c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.693.12 via Frontend Transport; Thu, 10 Nov 2016 09:08:37 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; linaro.org; dkim=none (message not signed) header.d=none;linaro.org; dmarc=fail action=none header.from=nxp.com; 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 BL2FFO11FD036.mail.protection.outlook.com (10.173.161.132) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.707.3 via Frontend Transport; Thu, 10 Nov 2016 09:08:36 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:1192; Count:13 Received: from [10.232.14.87] ([10.232.14.87]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id uAA98Xdg003080; Thu, 10 Nov 2016 02:08:34 -0700 To: Jianbo Liu References: <1477581467-12588-1-git-send-email-shreyansh.jain@nxp.com> <1477657598-826-1-git-send-email-shreyansh.jain@nxp.com> <1477657598-826-12-git-send-email-shreyansh.jain@nxp.com> <9e25635b-a7cc-8ba3-76a2-ed906774e4ef@nxp.com> CC: , Thomas Monjalon , Jan Viktorin From: Shreyansh Jain Message-ID: <9c727b8d-2fc1-49f6-04f4-33a847b2c915@nxp.com> Date: Thu, 10 Nov 2016 14:40:52 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-IncomingHeaderCount: 13 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131232425171036200; (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)(24454002)(199003)(377454003)(189002)(54356999)(81166006)(77096005)(626004)(81156014)(85426001)(305945005)(356003)(8676002)(5660300001)(50986999)(2906002)(92566002)(65826007)(7846002)(36756003)(8936002)(87936001)(23676002)(6666003)(6916009)(110136003)(2950100002)(5890100001)(83506001)(50466002)(68736007)(86362001)(586003)(189998001)(106466001)(64126003)(105606002)(4326007)(31686004)(31696002)(33646002)(97736004)(104016004)(4001350100001)(76176999)(230700001)(93886004)(65806001)(47776003)(229853002)(65956001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2749; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD036; 1:ockziSVq6dov9absFz+7uJ5/Xc5lAA4HTk7MjDNA5WlXeFZgZ+xyM58ZrqsszHDrJQfkU1o/5uVjryzoJsBRsK9QnL/y2Eb32AjIF22v9ReEKUvsOrVGdxTkchC5bIHCLKT8ilfADWNZrV9TV3A5rA8cWXqbr/ow3s5aHqy10hVMr8QzHrf74DtOcRE6Ea9scn94uKJVOtMF+1I0ca02lQaz3lpdYAAxH04dLqzoFI4mwTVz8jf6F2PDQtgXJFPAc9yGK+vSl3tSsr1Chmd70W7RI8mD4zVOfJsct3X/kZyAriSyO/6DyQ4R5xy+eowrkROM8lNTliuQFq4sMm2ZFahY5aDQnXs67frvvh+seMta8FCdhdSZ+9KfeW13TjplopubhnFn28qh9Mkc+qlCrUAjmthM/PTezxLiOtTe0ueSZlHaacFJ3jIXF6CQrVZhCu32FWwyM68minm52yA+RsKCyNjxElBq5coMOr2Za5W2a5dsZ+3AXTqUkimjjnefK5wsdvrJO3yZYDQFaQlU0u4UrQpGtv6NZt8gWf2Tg86OoJf5ilQRqIBSOwM4PZHFRiN2emFFY2QdxETU3wPapQOWuhAL6fioN95xwNJV6kI= X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2749; 2:hGebQPf7qi1EswkIFm/cCeOFTpc27q1YlABrwojlM6Y6UI02aGS8asWQ+s1ptPwtmFIO9aKwpo+WFTHQMYklDVNCnKoNcMiCdt9TX/HbBLSyMVUz7HPSBNQ/w7GfV++77mICDZa7MM9uKf4n+tiTFyxmtmITriAPt78Y3Bql328=; 3:Lay4GLZGORDsF+WAyAClXX3cDaIfT8sQ+xqeIXUZqQXN3h7b5Siol7DsEf3qmDuNprJ4ueLvJvM7I7uYaLIcHIKPL4UcfUkhnXUDpO7oHDrONkk6FfTkJXf6hiLqROKg/P8uMsoPU5Qzc2y41lV8ugWCu2B/LSp7TmouVzm7alFZcAU+Kf7urKnTb8vUdsihKM3SKS6i9DvcQqzBbHT7a9tWIC233yDy0Bt6th8s1FIQwRs/FYuh9inryYavLWxB3Y3L3pjVI5TQ0mPowWnTAQ== X-MS-Office365-Filtering-Correlation-Id: cde20421-f895-401c-c6c7-08d4094927c9 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:MWHPR03MB2749; X-Micro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STSn+bqyfA7ABj6wRS4P9B2DVb82Na3+6W/37Kl3kfrSMmKwKmiTG/JCscGp2fkQzTHUY6bXhNnfNcGoqzdh/OYi9nL/HFrWo9eyfiFmg27ezW76Evri2P35BM1N3; 4:DYW4llR664ttGkTAs/u0I1c3T6BfU1ONHICM2SPq9H1JRYPcW6QDaRDxPRyNRWATf+nG8qiUnYK0SRyektqKTDjcG/3ouTonqaJemGd01rhj41Kug8+g08uPuYO49gIEXQTz7DLQ06BSRZCbtXlXdfP4jj6UybiPXFfoF9kovwygkkhgAYFX9s31nQW6WfrsQ572TxeWG4cZd+O9C0BLaM3tO8jP6u0SaB0I8gE4AKYWJnbXR9xIOiMR3uDMVaD+6fLWKZn2sCr2T9xzwTV/mxy3zXyv6ZwPRqtpVOR5Bkn3ia88MMKg8T+ALVDgeBLAYDq53itcI7GN2b7Ex1PDHsVKAI/zZyHVRp3/4kSU3O2J/4XNCPdBcBooT50gvtL7AWT8zIv6DHdyL2yP4127CYZygW4oEtUwiYEh8TCzNNrE2WzHAdxY8MQjAJsjdYkO24TjF3c23r9+NiZAJsyj17Qf2ieoEpedBLOfuOTqX7Rf5WtWM+Q95x/D2UCFDhL+WDnqeLGbe0l2AsU1DwGtrT6wuhf6yhcUBon/LAWHb78IPQyYtfbuKErp084kheEu 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)(5005006)(13018025)(13015025)(13017025)(13024025)(13023025)(8121501046)(3002001)(10201501046)(6055026); SRVR:MWHPR03MB2749; BCL:0; PCL:0; RULEID:(400006); SRVR:MWHPR03MB2749; X-Forefront-PRVS: 01221E3973 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtNV0hQUjAzTUIyNzQ5OzIzOlFrTWY3bmFIZTZ1TVpGYlQwTkpKcXdMcDVz?= =?utf-8?B?MUJxYzZKKzBqZjV6eHlmUWMvVVA5d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Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2016 09:08:36.8384 (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: MWHPR03MB2749 Subject: Re: [dpdk-dev] [PATCH v7 11/21] eal/soc: implement probing of drivers 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, 10 Nov 2016 09:08:46 -0000 On Thursday 10 November 2016 01:11 PM, Jianbo Liu wrote: > On 10 November 2016 at 14:10, Shreyansh Jain wrote: >> On Thursday 10 November 2016 09:00 AM, Jianbo Liu wrote: >>> >>> On 28 October 2016 at 20:26, Shreyansh Jain >>> wrote: >>>> >>>> Each SoC PMD registers a set of callback for scanning its own bus/infra >>>> and >>>> matching devices to drivers when probe is called. >>>> This patch introduces the infra for calls to SoC scan on >>>> rte_eal_soc_init() >>>> and match on rte_eal_soc_probe(). >>>> >>>> Patch also adds test case for scan and probe. >>>> >>>> Signed-off-by: Jan Viktorin >>>> Signed-off-by: Shreyansh Jain >>>> Signed-off-by: Hemant Agrawal >>>> -- >>>> v4: >>>> - Update test_soc for descriptive test function names >>>> - Comments over test functions >>>> - devinit and devuninint --> probe/remove >>>> - RTE_VERIFY at some places >>>> --- >>>> app/test/test_soc.c | 205 >>>> ++++++++++++++++++++++- >>>> lib/librte_eal/bsdapp/eal/rte_eal_version.map | 4 + >>>> lib/librte_eal/common/eal_common_soc.c | 213 >>>> +++++++++++++++++++++++- >>>> lib/librte_eal/common/include/rte_soc.h | 75 ++++++++- >>>> lib/librte_eal/linuxapp/eal/eal.c | 5 + >>>> lib/librte_eal/linuxapp/eal/eal_soc.c | 21 ++- >>>> lib/librte_eal/linuxapp/eal/rte_eal_version.map | 4 + >>>> 7 files changed, 519 insertions(+), 8 deletions(-) >>>> >>> ...... >>> >>>> /** >>>> + * SoC device scan callback, called from rte_eal_soc_init. >>>> + * For various SoC, the bus on which devices are attached maynot be >>>> compliant >>>> + * to a standard platform (or platform bus itself). In which case, extra >>>> + * steps are implemented by PMD to scan over the bus and add devices to >>>> SoC >>>> + * device list. >>>> + */ >>>> +typedef void (soc_scan_t)(void); >>> >>> >>> I'm still not sure about the purpose of soc_scan, and how to use it. >> >> >> For each device to be used by DPDK, which cannot be scanned/identified using >> the existing PCI/VDEV methods (sysfs/bus/pci), 'soc_scan_t' provides a way >> for driver to make those devices part of device lists. >> >> Ideally, 'scan' is not a function of a driver. It is a bus function - which >> is missing in this case. >> >>> If it's for each driver, it should at least struct rte_soc_driver * as >>> its parameter. >> >> >> Its for each driver - assuming that each non-PCI driver which implements it >> knows how to find devices which it can control (for example, special area in >> sysfs, or even platform bus). >> > > Considering there are several drivers in a platform bus, each driver > call the scan function, like the rte_eal_soc_scan_platform_bus() you > implemented. > The first will add soc devices to the list, but the remaining calls > are redundant. Indeed. This is exactly the issue we will face if we try and move this scan/match logic to PCI - all devices are identified in one step. There is a difference in principle here: A SoC device/driver combination is essentially focused towards a single type of bus<->devices. For example, a NXP PMD would implement a scan function which would scan for all devices on NXP's bus. This would not conflict with another XYZ SoC PMD which scans its specific bus. There is caveat to this - the platform bus. There can be multiple drivers which can serve platform bus compliant devices. First PMD->scan() initiated for such a bus/device would leave all other scans redundant. More similar caveats will come if we consider somewhat generic buses. At least I couldn't find any interest for such devices in the ML when I picked this series (from where Jan left it). Probably when more common type of PMDs come in, some default scan implementation can check for skipping those devices which are already added. It would be redundant but harmless. > > The other issue is adding the driver parameter. Do you need extra > information from driver to scan the bus? > >>> If it's for each bus, why it is in rte_soc_driver? >> >> >> Short answer - lack of a better place. It should be in dev.h probably >> (rte_device/driver) but it would look out of place (as that represents PCI >> devices also which cannot implement it - all PCI devices are scanned in one >> go irrespective of driver) >> >>> I know you will implement bus driver in the future, but we need to >>> make it clear for current simplified implementation. >> >> >> Current implementation makes only a single assumption - that rather than >> relying on EAL for identifying devices (as being done now), next best option >> in existing framework (driver) should have control of finding devices. >> >> This is primarily to make the SoC work parallel to PCI implementation >> without much top-down changes in EAL. >> >> Bus model, improvises it by moving this implementation a little above in >> hierarchy - in rte_bus<-rte_driver<-PMD. >> >> I understand your apprehension - 'driver-scanning-for-devices' is indeed not >> correct real world analogy. It is just a place holder for enabling those >> drivers/PMDs which cannot work in absence of the right model. >> And that is still work in progress. >> >> >>> >>>> + >>>> +/** >>>> + * Custom device<=>driver match callback for SoC >>>> + * Unlike PCI, SoC devices don't have a fixed definition of device >>>> + * identification. PMDs can implement a specific matching function in >>>> which >>>> + * driver and device objects are provided to perform custom match. >>>> + */ >>>> +typedef int (soc_match_t)(struct rte_soc_driver *, struct rte_soc_device >>>> *); >>>> + >>>> +/** >>>> * A structure describing a SoC driver. >>>> */ >>>> struct rte_soc_driver { >>>> @@ -104,6 +120,8 @@ struct rte_soc_driver { >>>> struct rte_driver driver; /**< Inherit core driver. */ >>>> soc_probe_t *probe; /**< Device probe */ >>>> soc_remove_t *remove; /**< Device remove */ >>>> + soc_scan_t *scan_fn; /**< Callback for scanning SoC >>>> bus*/ >>>> + soc_match_t *match_fn; /**< Callback to match >>>> dev<->drv */ >>>> const struct rte_soc_id *id_table; /**< ID table, NULL terminated >>>> */ >>>> }; >>>> >>>> @@ -146,12 +164,63 @@ rte_eal_compare_soc_addr(const struct rte_soc_addr >>>> *a0, >>>> } >>>> >>>> /** >>>> + * 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, >>>> + * a SoC might have different way of identifying its devices. Such SoC >>>> can >>>> + * override match_fn. >>>> + * >>>> + * @return >>>> + * 0 on success >>>> + * -1 when no match found >>>> + */ >>>> +int >>>> +rte_eal_soc_match_compat(struct rte_soc_driver *drv, >>>> + struct rte_soc_device *dev); >>>> + >>>> +/** >>>> + * Probe SoC devices for registered drivers. >>>> + * >>>> + * @return >>>> + * 0 on success >>>> + * !0 in case of any failure in probe >>>> + */ >>>> +int rte_eal_soc_probe(void); >>>> + >>>> +/** >>>> + * Probe the single SoC device. >>>> + */ >>>> +int rte_eal_soc_probe_one(const struct rte_soc_addr *addr); >>>> + >>>> +/** >>>> + * Close the single SoC device. >>>> + * >>>> + * Scan the SoC devices and find the SoC device specified by the SoC >>>> + * address, then call the remove() function for registered driver >>>> + * that has a matching entry in its id_table for discovered device. >>>> + * >>>> + * @param addr >>>> + * The SoC address to close. >>>> + * @return >>>> + * - 0 on success. >>>> + * - Negative on error. >>>> + */ >>>> +int rte_eal_soc_detach(const struct rte_soc_addr *addr); >>>> + >>>> +/** >>>> * Dump discovered SoC devices. >>>> + * >>>> + * @param f >>>> + * File to dump device info in. >>>> */ >>>> void rte_eal_soc_dump(FILE *f); >>>> >>>> /** >>>> * Register a SoC driver. >>>> + * >>>> + * @param driver >>>> + * Object for SoC driver to register >>>> + * @return void >>>> */ >>>> void rte_eal_soc_register(struct rte_soc_driver *driver); >>>> >>>> @@ -167,6 +236,10 @@ RTE_PMD_EXPORT_NAME(nm, __COUNTER__) >>>> >>>> /** >>>> * Unregister a SoC driver. >>>> + * >>>> + * @param driver >>>> + * Object for SoC driver to unregister >>>> + * @return void >>>> */ >>>> void rte_eal_soc_unregister(struct rte_soc_driver *driver); >>>> >>>> diff --git a/lib/librte_eal/linuxapp/eal/eal.c >>>> b/lib/librte_eal/linuxapp/eal/eal.c >>>> index 098ba02..bd775f3 100644 >>>> --- a/lib/librte_eal/linuxapp/eal/eal.c >>>> +++ b/lib/librte_eal/linuxapp/eal/eal.c >>>> @@ -70,6 +70,7 @@ >>>> #include >>>> #include >>>> #include >>>> +#include >>>> #include >>>> #include >>>> #include >>>> @@ -890,6 +891,10 @@ rte_eal_init(int argc, char **argv) >>>> if (rte_eal_pci_probe()) >>>> rte_panic("Cannot probe PCI\n"); >>>> >>>> + /* Probe & Initialize SoC devices */ >>>> + if (rte_eal_soc_probe()) >>>> + rte_panic("Cannot probe SoC\n"); >>>> + >>>> rte_eal_mcfg_complete(); >>>> >>>> return fctret; >>>> diff --git a/lib/librte_eal/linuxapp/eal/eal_soc.c >>>> b/lib/librte_eal/linuxapp/eal/eal_soc.c >>>> index 04848b9..3929a76 100644 >>>> --- a/lib/librte_eal/linuxapp/eal/eal_soc.c >>>> +++ b/lib/librte_eal/linuxapp/eal/eal_soc.c >>>> @@ -44,13 +44,28 @@ >>>> #include >>>> #include >>>> >>>> -#include "eal_internal_cfg.h" >>>> -#include "eal_filesystem.h" >>>> -#include "eal_private.h" >>>> +#include >>>> +#include >>>> +#include >>>> >>>> /* Init the SoC EAL subsystem */ >>>> int >>>> rte_eal_soc_init(void) >>>> { >>>> + struct rte_soc_driver *drv; >>>> + >>>> + /* SoC is disabled by default */ >>>> + if (!internal_config.enable_soc) >>>> + return 0; >>>> + >>>> + /* For each registered driver, call their scan routine to perform >>>> any >>>> + * custom scan for devices (for example, custom buses) >>>> + */ >>>> + TAILQ_FOREACH(drv, &soc_driver_list, next) { >>>> + RTE_VERIFY(drv->scan_fn); >>>> + drv->scan_fn(); >>>> + /* Ignore all errors from this */ >>>> + } >>>> + >>>> return 0; >>>> } >>>> diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map >>>> b/lib/librte_eal/linuxapp/eal/rte_eal_version.map >>>> index 0155025..c28e093 100644 >>>> --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map >>>> +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map >>>> @@ -175,7 +175,11 @@ DPDK_16.11 { >>>> rte_eal_dev_attach; >>>> rte_eal_dev_detach; >>>> rte_eal_map_resource; >>>> + rte_eal_soc_detach; >>>> rte_eal_soc_dump; >>>> + rte_eal_soc_match; >>>> + rte_eal_soc_probe; >>>> + rte_eal_soc_probe_one; >>>> rte_eal_soc_register; >>>> rte_eal_soc_unregister; >>>> rte_eal_unmap_resource; >>>> -- >>>> 2.7.4 >>>> >>> >> >> >> -- >> - >> Shreyansh > -- - Shreyansh