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 D6EBBA0A0C; Thu, 15 Apr 2021 09:36:49 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5D31C162094; Thu, 15 Apr 2021 09:36:49 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 89DAA162091 for ; Thu, 15 Apr 2021 09:36:47 +0200 (CEST) IronPort-SDR: wZHTq+v4NMdPAVtOGV9yYyTBsvHDYJY7KWe2Ldn66L+NWwa17oC+x21rf7eXlZXKwTFyoNKA+I +1rqHLiLKRdQ== X-IronPort-AV: E=McAfee;i="6200,9189,9954"; a="258766598" X-IronPort-AV: E=Sophos;i="5.82,223,1613462400"; d="scan'208";a="258766598" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Apr 2021 00:36:43 -0700 IronPort-SDR: +TFIiYOQOIuE+BV0rQ/Niq4NlSJYbQV0dmCQr98NEUcL0efYFjUkY+DLBXLxddrVSh7L2z4dE7 VcBPmbhRLV2A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,223,1613462400"; d="scan'208";a="399485718" Received: from orsmsx605.amr.corp.intel.com ([10.22.229.18]) by orsmga002.jf.intel.com with ESMTP; 15 Apr 2021 00:36:37 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX605.amr.corp.intel.com (10.22.229.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Thu, 15 Apr 2021 00:36:37 -0700 Received: from orsmsx603.amr.corp.intel.com (10.22.229.16) by ORSMSX607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Thu, 15 Apr 2021 00:36:36 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Thu, 15 Apr 2021 00:36:36 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.49) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2106.2; Thu, 15 Apr 2021 00:35:42 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j5mnvyHXI6if0RByLmTR6w4mNiBtQhA2+bAKamdDdc3N91hw7Bl4hdueNpM7Ck+Tm24cg6x/+IGQgVg52YXXm3g0dMOsi+xWSu4lqkGVx1vzH8JjoHZttO9JpobNX785+/bTq5avq7s91yTWRf5UnpPDrfJstLwmAgBZfYCJoiVXmPqxAVMCh+r20+nJC8T1KyFgW5/xzfccLefugxTkJitw0XqtBjMVtb0hqY9i7v1ruEdNZ9u+vTqsA5fwXSe17xSGLx1sjmVQY9BK9ZaV0ZbIG+rOLGMGHz++4F3dfGg72SNh5v+gY6xtcDSUdf6V4CgrSmuZNjCXmC56Mi+cgg== 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=YKIBhg8ZarI1TiSzPv9BBm9AWXKIKRkgE2REzUlwVi4=; b=ZzQx+cz2VkLuDyPJGDTlvP1OOJv0KINhFqAz6703Sf3Wxu/ceAiT7GnalhMPhCpKTD1CpSCndBaJlRC2LRvJPPha9yNOg+q5ENHPjbVF9PqbqcyY8sP+nAt/bSbhRW2TEfJLGHSyJ00QUCa1cUQ6HnSPAT9RPcdLA4Btj7tXWuiYWD9z8E5FuSJ3cF+mhOsBif/mHphOZ1uRq8k7tpYvIsiy/HUpxBn5eHfNRltCEjuKsUBWhEHNBNFgGJd0RHckzUrsYNCA8g7Jq/ydO54bdE/4d0PwDQ+eEvKuS1SZ9F8AK+YxlEO1s57ySdSC9R5UM1buhfvMfhgCVJYhYy3HyA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YKIBhg8ZarI1TiSzPv9BBm9AWXKIKRkgE2REzUlwVi4=; b=djqtgXTgIFfmKYwAySDgDdhi3GpyJr0FUTjNG/JFnyUTItubTDNomVlHoxcp+jG3Xi26yfkVQAFIF7UsTqil44DR/xQAEQIlqEAQzc3ocRNXvQn9Au9HNvqfUbVjtwLoG2Ntam/bks/23PeJwBvkJjj3rno5oMsAdZE1q1djB8k= Received: from BN8PR11MB3795.namprd11.prod.outlook.com (2603:10b6:408:82::31) by BN6PR11MB1665.namprd11.prod.outlook.com (2603:10b6:405:f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.16; Thu, 15 Apr 2021 07:35:42 +0000 Received: from BN8PR11MB3795.namprd11.prod.outlook.com ([fe80::2dfc:3be2:c305:6346]) by BN8PR11MB3795.namprd11.prod.outlook.com ([fe80::2dfc:3be2:c305:6346%6]) with mapi id 15.20.4020.023; Thu, 15 Apr 2021 07:35:42 +0000 From: "Wang, Haiyue" To: Xueming Li , 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: AQHXMBSKvCrREl25EkK71KLI/BpYYKq1Ms4g Date: Thu, 15 Apr 2021 07:35:41 +0000 Message-ID: References: <20210311130113.31382-1-xuemingl@nvidia.com> <20210413032329.25551-1-xuemingl@nvidia.com> In-Reply-To: <20210413032329.25551-1-xuemingl@nvidia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.0.76 authentication-results: nvidia.com; dkim=none (message not signed) header.d=none;nvidia.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.55.46.54] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 543f5443-fda3-4b78-78b9-08d8ffe112c4 x-ms-traffictypediagnostic: BN6PR11MB1665: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 23kPGLOMAFhP1Z0vvrpdWcMYzxZF7U7cEjDCeZXhI4XTMEQ+i25JwJtoY6sesrxH8vTwNaaw1a6o4c4nj3BR207hNcKSTW93nQP4vj8Sy9PGxuuCoSKvCGtBCGciM4mzy3H1EyLhvdk9on8hraR8B732vcv4cUov5/p/hCR+IQqipeAe/5YhptPVfYHgMJ9Jjw0ZjHPbkELGB/T0frayLCRropw3JjHf8ZZcblxRkdds0mW5nT/QGvEGj1lu+V2ehVipnTWXhncOqTYayMP9ehH/W9B9wQYN9kRZwXbeAe/IQ5nS7e91ELL8KF/NiLVKuWwwAi1W33e359VvdFoCdMiJYUurpcy4cJc6dfrsNbm81n6hMZ+wLdvXti976eHbipcIN3iuqYKIxKnA0KKczs2G/WqFv/HYyXQoZU1X5uwuIwk7OS+h4FEdRu1fvgbNyKeJwtd6e4C2f9RJExy8XRggMOFmUs6auszeP+mYCayQ5LSQ/xRVdWi54HduWZXIXjIgKKCNozfA7tJdjMBgXh3OG07rQfYbct9Mc/8y83lSNmX3x+thZsEk/uTJX+LT25+lzjueP3djvlChLEcfeokRrANoWL9wv/b5AO82mHpYVWchSHxkv/Bc3Xwaznb/9UA3f517m6eJXdQORuqs8/3At8uxnmymkVYxO9ENCu76HYic8nBUPIWJSS4PgvC+ x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR11MB3795.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(346002)(39860400002)(376002)(366004)(396003)(136003)(186003)(76116006)(52536014)(8676002)(478600001)(86362001)(66476007)(66946007)(110136005)(6506007)(5660300002)(64756008)(83380400001)(66446008)(316002)(54906003)(7696005)(33656002)(26005)(55016002)(71200400001)(53546011)(9686003)(2906002)(66556008)(8936002)(122000001)(966005)(4326008)(38100700002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?EEL5+olTxkjj9PRQgjh4t5E4BxHt+/tUXiKzQe68D0NDNmHnTxutgiLgUih6?= =?us-ascii?Q?6lTmIbx5qeuCE/Y5ns+EuEHnANDSxq2FH0KvXLB/NCvbu7+5lMP0M46zfhzw?= =?us-ascii?Q?Tr39ZxqizSDAmPLb+uHquDVB1gJcKWEv9TEwv9gUf6hSLLOz1+XVrhG6amz4?= =?us-ascii?Q?U7LoYh6Pff9DJlQvz1S+i6NrsbtB7yGSlKqJz0d3k9OdA42d/iaLyVcbpR39?= =?us-ascii?Q?Fv8cRanhUTDyHAy26YVOCds0VcIYZ4g6+Vqoa2sxF5JfxtxTA+SXCncKgudc?= =?us-ascii?Q?ve41er4d6izFhfbz7+OmpJK+hw68SSwwz/ql18ucNg6XNIktPwC+LeVi0wXW?= =?us-ascii?Q?r/QLV6vozV5aynHePCYz8fuWsRirf8Fg2z7ZGViPmHLkXr8S1fHpKt4dv6Q7?= =?us-ascii?Q?0b+WcRi/DXf9d1gP2Yw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iUypF?= =?us-ascii?Q?AMs=3D?= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN8PR11MB3795.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 543f5443-fda3-4b78-78b9-08d8ffe112c4 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Apr 2021 07:35:41.9506 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: NOIIb5o4vAe8Ky3LAgAzqYgpp55OWXrXTjnP9p+iLjR3z19n356qxVfyLB73g2Yts5i3X42QbAei+3SGZlkyzQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB1665 X-OriginatorOrg: intel.com 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: 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 ; Par= av Pandit ; > Ray Kinsella ; Neil Horman > Subject: [dpdk-dev] [PATCH v1] bus/auxiliary: introduce auxiliary bus >=20 > 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. >=20 > Auxiliary device is identified by unique device name, sysfs path: > /sys/bus/auxiliary/devices/ >=20 > [1] kernel auxiliary bus document: > https://www.kernel.org/doc/html/latest/driver-api/auxiliary_bus.html >=20 > 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 > --- /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 probin= g. > + */ > +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, void= *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. */ These API type can be pointer type defined, then no need "*": typedef int (*auxiliary_dma_unmap_t)(struct rte_auxiliary_device *dev, void *addr, uint64_t iova, size_t len); auxiliary_dma_unmap_t dma_unmap; Like: https://patchwork.dpdk.org/project/dpdk/patch/20210331224547.2217759-1-thom= as@monjalon.net/ typedef int (*rte_dev_dma_map_t)(struct rte_device *dev, void *addr, uint64_t iova, size_t len); > -- > 2.25.1