From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4D877A0A0C; Thu, 15 Apr 2021 09:46:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3DC2A1620B6; Thu, 15 Apr 2021 09:46:30 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2088.outbound.protection.outlook.com [40.107.220.88]) by mails.dpdk.org (Postfix) with ESMTP id DB685162091 for ; Thu, 15 Apr 2021 09:46:28 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NMpkZSTcYxHiw/HCQ2zW/Qney0wBoQolz1afQVoi5pFTJRcI4SAtg7LCFYUfFIKPrc7xxsfduqjpzHV/PLoyzK4ZHqZGUAvymMucgEc/hvz74Tm0ZKbfpNL9Z2iEQ7r6ooXJPo7ZdgJcQcE87WslIz43PXYbxUVWwNSAPfckFWiIwLRn1nQ4K1BoO7Ff2kFJ4jB7yX2kDmIgqO16JraLkYix/GhP7XKAKyPgXHK/Py1eBb3oYWLnkuajaDK0k1GoTo1EmB/jO5UZAVqxJE3oLLXWxGdh0uyBpbZk1zseJd9sM8xob/ooIEoBJN8Atw6cns8C+11NcjiPyKin/y/ngQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zqYcqaE7QanWalgu8paWNMG8J0qfiyJ8z1KVjm01C6g=; b=V+/oO4DFvtwkXSwHDIy1j9sxWQYg8bUkq/EE0mmtOfq2SAqH0tJJzSpoerCezfE6rGgtrnCvvghG6Dzzvb3Zf6WRQhW8K7WUROcAecg2eHLu0l3NZzr9rg/iNdKskDLrr8GbynSU+TREudMIa8k9ywub5fOSG5qTwgoJ35NHlpy11CL6822zWCAoMTtB0ewZtXcpJLbsf/mQbglYFkzviFat8+FfWciVEAfqEl38kUm7TuwWgLdAp8TAXr7xGJNdR9qRSSLMcH0EvO1tmn/1QCpJZB2Jppb0asIo+r5Da8q3E0g2H9Kynp/84edmB6fREXzAXbvE935PJKRcldTMgQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zqYcqaE7QanWalgu8paWNMG8J0qfiyJ8z1KVjm01C6g=; b=at4i4UyBNguDqo5a5CMlKcbn75QfTWgRdQ9C6b0zVtMjquzdBg/GmKRsb+luPOJNgpfNJ/URy8KRX0El+k67QfwQG9Ibn/PJrJcxEvUKrzfVjgfwfj+QCFyNIiMCwP2Zw0weEFaWC4/X8JX/TZuuxLsA69fqZaOiuR94cILwZu/nk/zioImarnGbCG/eRGOf/XTe8XOP5KRD/R+/f1QfkKo3a2gFORp6v7uE97PuJFFW/ThGVkFbruv101C7Gpp8LztPgAFCplXKqrlkYlsSlJCfaAEcom/yxS95f1B0KUE1zNuWN5ABc13Nr8nlR9Oi+qoQHWPuS8ofmqlaxp+FuA== Received: from BY5PR12MB4324.namprd12.prod.outlook.com (2603:10b6:a03:209::10) by BYAPR12MB2648.namprd12.prod.outlook.com (2603:10b6:a03:69::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.20; Thu, 15 Apr 2021 07:46:26 +0000 Received: from BY5PR12MB4324.namprd12.prod.outlook.com ([fe80::b919:53f4:6757:331c]) by BY5PR12MB4324.namprd12.prod.outlook.com ([fe80::b919:53f4:6757:331c%5]) with mapi id 15.20.4020.023; Thu, 15 Apr 2021 07:46:26 +0000 From: "Xueming(Steven) Li" To: "Wang, Haiyue" , NBU-Contact-Thomas Monjalon CC: "dev@dpdk.org" , Asaf Penso , Parav Pandit , Ray Kinsella , Neil Horman Thread-Topic: [dpdk-dev] [PATCH v1] bus/auxiliary: introduce auxiliary bus Thread-Index: AQHXMBR7KefWjHt1PkOf7D5G3ZHCMaq1M7aAgAABb2A= Date: Thu, 15 Apr 2021 07:46:26 +0000 Message-ID: References: <20210311130113.31382-1-xuemingl@nvidia.com> <20210413032329.25551-1-xuemingl@nvidia.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=nvidia.com; x-originating-ip: [180.162.52.50] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e835f8f4-8c3e-4b29-139c-08d8ffe292a6 x-ms-traffictypediagnostic: BYAPR12MB2648: x-ld-processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 61Ki4TheZDFiOWg5UNAkPiSW7jpMs2NpXOFgyo4L7t1skYKOw+IZcfeyjPZoQsMX0UMwgpb4FQDQnK8qKFKQnCMJ+DfPZgUBGiErpiwtqEekWdb4S4C0WUGwGjQo6FQ3g4ZLScIlFgn/sg9pCb0A7YKj3RESs0pcw04ulfGL3Xnwj8DyjAJwAs5DcKGpCj0ZOGRi/qK4cno6/OPfuzXc4MaMnBW+utzK/gv30pTFpes8os7V7dYYSBhBWWQmycPR0eOuVsUHzbOQsPvAvG4unY9wbqxrFxQEuzFxinuoVODYh2UD2NOIcOu+dqdKcJU0jy6H20go168WIJiI3h3xq2kxl12TS8qUbujnUOGlEQ9XWoZO343qpIhFCx4PsQVI1li5DrlIuG18l1cc0PQY923T1xPPh7tMXZSUek1m9xplREKq0jx+mTllu2fgxUvaXseGqyM2l1AWLdJk0PNLjCM32SrOW3Z5mgNQoT5a3rflce5MBWkR6ZKCaz2MALpFO4Qbmq7Hi6c0ZEV/WttKwdiF0V1xepSQ1agrhd1ffHny9pSCFY6nqb2OgBIELtTphq6e+r6BIa6Hw2D4HjNJFxlO9mrNHLK+0bl4JtK3TnzKc0HKqksJDpYJXgw9SYT1kJIh4/q+t6Z35Cqp59gex/u8rwABRWBoLe0G6pJ2Wr+ki93yMQEYYPzBKGSk0yci x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BY5PR12MB4324.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(136003)(366004)(346002)(39860400002)(376002)(966005)(122000001)(55016002)(53546011)(6506007)(66476007)(66556008)(9686003)(8936002)(33656002)(83380400001)(316002)(38100700002)(8676002)(71200400001)(2906002)(110136005)(5660300002)(54906003)(478600001)(52536014)(86362001)(26005)(4326008)(7696005)(64756008)(76116006)(186003)(66446008)(66946007); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?ezVgsR/3w7mS4XEgt1oEHB3srW8+p82YX/X6ReEY8lKflUKNXlG/KbotrlDK?= =?us-ascii?Q?zEPjY0EpFHueIF97cReNVXiq/EnK+QhclmV5hJ02cJxd2lCHV2XJe0LT5CGK?= =?us-ascii?Q?tUFiH1rd+cuqVHVGF66KP+f1yeWf0wmlBJs12w81m9FfDDI59/a9aoDqPjKM?= =?us-ascii?Q?7k8aT5gV5j5gSAE28oE9xZY7Td2xtmv2MTu6RV6zvTLOI+RCKyay/B3UfKWI?= =?us-ascii?Q?KA6oE/RZygdj9kpdz7Eoro90yDzyadCmQ8dQf8XtJN24pGdMmnBPpTbLIz1y?= =?us-ascii?Q?Tc8lE4/NBu8vZGjcRCXf6nAWiOiSaizlTjhj9KxhRIva3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1QYc4uotZdm+w8/Zd3Dyrnud6c1LTt3eq3KbWZV?= =?us-ascii?Q?A/F4SfrGqDVPtV8axFTxFcRezC6s98+002pVuqeVXxDa2krxhD1dDfTfrwaI?= =?us-ascii?Q?0fdZc+KZjIxIPMtga+jsUDYF?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4324.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e835f8f4-8c3e-4b29-139c-08d8ffe292a6 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Apr 2021 07:46:26.0566 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: s3XFxP5uuEjCXAEQ0LPFbTEVZVKqRLCT4ovyVFdoBOCO5Uv2l1feoLYzdMvuAFOgJj/5QDP7uuDhrYweaOFnUg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB2648 Subject: Re: [dpdk-dev] [PATCH v1] bus/auxiliary: introduce auxiliary bus X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----Original Message----- > From: Wang, Haiyue > Sent: Thursday, April 15, 2021 3:36 PM > To: Xueming(Steven) Li ; NBU-Contact-Thomas Monjalon= > Cc: dev@dpdk.org; Asaf Penso ; Parav Pandit ; Ray Kinsella ; Neil Horman > > Subject: RE: [dpdk-dev] [PATCH v1] bus/auxiliary: introduce auxiliary bus >=20 > > -----Original Message----- > > From: dev On Behalf Of Xueming Li > > Sent: Tuesday, April 13, 2021 11:23 > > To: Thomas Monjalon > > Cc: dev@dpdk.org; xuemingl@nvidia.com; Asaf Penso ; > > Parav Pandit ; Ray Kinsella ; Neil > > Horman > > Subject: [dpdk-dev] [PATCH v1] bus/auxiliary: introduce auxiliary bus > > > > Auxiliary [1] provides a way to split function into child-devices > > representing sub-domains of functionality. Each auxiliary_device > > represents a part of its parent functionality. > > > > Auxiliary device is identified by unique device name, sysfs path: > > /sys/bus/auxiliary/devices/ > > > > [1] kernel auxiliary bus document: > > https://www.kernel.org/doc/html/latest/driver-api/auxiliary_bus.html > > > > Signed-off-by: Xueming Li > > --- > > MAINTAINERS | 5 + > > drivers/bus/auxiliary/auxiliary_common.c | 391 > > ++++++++++++++++++++++ drivers/bus/auxiliary/auxiliary_params.c | 58= ++++ > > drivers/bus/auxiliary/linux/auxiliary.c | 147 ++++++++ > > drivers/bus/auxiliary/meson.build | 17 + > > drivers/bus/auxiliary/private.h | 118 +++++++ > > drivers/bus/auxiliary/rte_bus_auxiliary.h | 180 ++++++++++ > > drivers/bus/auxiliary/version.map | 10 + > > drivers/bus/meson.build | 2 +- > > 9 files changed, 927 insertions(+), 1 deletion(-) create mode 100644 > > drivers/bus/auxiliary/auxiliary_common.c > > create mode 100644 drivers/bus/auxiliary/auxiliary_params.c > > create mode 100644 drivers/bus/auxiliary/linux/auxiliary.c > > create mode 100644 drivers/bus/auxiliary/meson.build create mode > > 100644 drivers/bus/auxiliary/private.h create mode 100644 > > drivers/bus/auxiliary/rte_bus_auxiliary.h > > create mode 100644 drivers/bus/auxiliary/version.map > > >=20 >=20 > > --- /dev/null > > +++ b/drivers/bus/auxiliary/rte_bus_auxiliary.h > > @@ -0,0 +1,180 @@ > > +/* SPDX-License-Identifier: BSD-3-Clause > > + * Copyright 2021 Mellanox Technologies, Ltd */ > > + > > +#ifndef _RTE_BUS_AUXILIARY_H_ > > +#define _RTE_BUS_AUXILIARY_H_ > > + > > +/** > > + * @file > > + * > > + * RTE Auxiliary Bus Interface. > > + */ > > + > > +#ifdef __cplusplus > > +extern "C" { > > +#endif > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +/* Forward declarations */ > > +struct rte_auxiliary_driver; > > +struct rte_auxiliary_bus; > > +struct rte_auxiliary_device; > > + > > +/** > > + * Match function for the driver to decide if device can be handled. > > + */ > > +typedef bool(auxiliary_match_t) (const char *); > > + > > +/** > > + * Initialization function for the driver called during auxiliary prob= ing. > > + */ > > +typedef int(auxiliary_probe_t) (struct rte_auxiliary_driver*, > > + struct rte_auxiliary_device*); > > + > > +/** > > + * Uninitialization function for the driver called during hotplugging. > > + */ > > +typedef int (auxiliary_remove_t)(struct rte_auxiliary_device *); > > + > > +/** > > + * Driver-specific DMA mapping. After a successful call the device > > + * will be able to read/write from/to this segment. > > + * > > + * @param dev > > + * Pointer to the auxiliary device. > > + * @param addr > > + * Starting virtual address of memory to be mapped. > > + * @param iova > > + * Starting IOVA address of memory to be mapped. > > + * @param len > > + * Length of memory segment being mapped. > > + * @return > > + * - 0 On success. > > + * - Negative value and rte_errno is set otherwise. > > + */ > > +typedef int (auxiliary_dma_map_t)(struct rte_auxiliary_device *dev, vo= id *addr, > > + uint64_t iova, size_t len); > > + > > +/** > > + * Driver-specific DMA un-mapping. After a successful call the device > > + * will not be able to read/write from/to this segment. > > + * > > + * @param dev > > + * Pointer to the auxiliary device. > > + * @param addr > > + * Starting virtual address of memory to be unmapped. > > + * @param iova > > + * Starting IOVA address of memory to be unmapped. > > + * @param len > > + * Length of memory segment being unmapped. > > + * @return > > + * - 0 On success. > > + * - Negative value and rte_errno is set otherwise. > > + */ > > +typedef int (auxiliary_dma_unmap_t)(struct rte_auxiliary_device *dev, > > + void *addr, uint64_t iova, size_t len); > > + > > +/** > > + * A structure describing an auxiliary device. > > + */ > > +struct rte_auxiliary_device { > > + TAILQ_ENTRY(rte_auxiliary_device) next; /**< Next probed device. */ > > + char name[RTE_DEV_NAME_MAX_LEN + 1]; /**< ASCII device name */ > > + struct rte_device device; /**< Inherit core device */ > > + struct rte_intr_handle intr_handle; /**< Interrupt handle */ > > + struct rte_auxiliary_driver *driver; /**< driver used in probing= */ > > +}; > > + > > +/** List of auxiliary devices */ > > +TAILQ_HEAD(rte_auxiliary_device_list, rte_auxiliary_device); > > +/** List of auxiliary drivers */ > > +TAILQ_HEAD(rte_auxiliary_driver_list, rte_auxiliary_driver); > > + > > +/** > > + * Structure describing the auxiliary bus */ struct > > +rte_auxiliary_bus { > > + struct rte_bus bus; /**< Inherit the generic class *= / > > + struct rte_auxiliary_device_list device_list; /**< List of devices *= / > > + struct rte_auxiliary_driver_list driver_list; /**< List of drivers > > +*/ }; > > + > > +/** > > + * A structure describing an auxiliary driver. > > + */ > > +struct rte_auxiliary_driver { > > + TAILQ_ENTRY(rte_auxiliary_driver) next; /**< Next in list. */ > > + struct rte_driver driver; /**< Inherit core driver. */ > > + struct rte_auxiliary_bus *bus; /**< Auxiliary bus reference. */ > > + auxiliary_match_t *match; /**< Device match function. */ > > + auxiliary_probe_t *probe; /**< Device Probe function. */ > > + auxiliary_remove_t *remove; /**< Device Remove function. */ > > + auxiliary_dma_map_t *dma_map; /**< Device dma map function. */ > > + auxiliary_dma_unmap_t *dma_unmap; /**< Device dma unmap function. = */ >=20 > These API type can be pointer type defined, then no need "*": >=20 > typedef int (*auxiliary_dma_unmap_t)(struct rte_auxiliary_device *dev, > void *addr, uint64_t iova, size_t len); >=20 > auxiliary_dma_unmap_t dma_unmap; >=20 > Like: > https://patchwork.dpdk.org/project/dpdk/patch/20210331224547.2217759-1-th= omas@monjalon.net/ >=20 > typedef int (*rte_dev_dma_map_t)(struct rte_device *dev, > void *addr, uint64_t iova, size_t len); Thanks, is there a reason to prefer pointer type?=20 Thoma's patch looks good, will rebase on it once accepted. >=20 > > -- > > 2.25.1