From patchwork Mon Jun 24 22:47:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13710223 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2064.outbound.protection.outlook.com [40.107.237.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 05E4D1A2FC1; Mon, 24 Jun 2024 22:47:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719269270; cv=fail; b=KReeM6BfqKJE+D8vou0UDd726nMNZ+HQ7hfxE296SJqWZXUtUWOd3CP5s2kOYE4ZgjMbLFyR0fjZ5foYOC0T/EJbJyuqNf+q3lDS/2x6Cn83KsZ6J/mw6rGyGaza9ZY7uZo9l8wZhb+rDn7FQ1ZBwbri9nB/5M6B2CbStomxxBM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719269270; c=relaxed/simple; bh=8OD2Hfx/2G14AFgglBk1QAzWsKVoply2tS4MrhiZpkU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=aTacyTCRuV/f+N1lwoP+BJ+Ev+DFmBsQ7xzwwEUCu3sHUBsvU0xZld77mz4fn/TKZ+eYUd4afPE09S8cdP0A2Dbwtpc10T4nFYyfDxGw5MfTjoDoEMYw1iAI75qCnz/uStI5EqxgKyXjhcdTZNYsnxuXtWKxmzaMuowXAwE+oFs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=AEPFunku; arc=fail smtp.client-ip=40.107.237.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="AEPFunku" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D9nBXT3lp6mrakV9OWtqBE4L8A2JrVKaCCN1HUlK57boFBLtAbocn9AFzy+N6dQzPjxHf8CtkpVW/eQzEBknGsW+SMprtBcQ2vC2mFJ2drwDybZ/hbl25WstLusKaUHaem8wa17WLfvELb/Zk7KQn6H/ZJjcYncCV5iLECDyva57ODMqfP9uLhUQ7BoOqJba4AoFZ2ghUtjjDKQb1XQYbTQLR+jQyiCza+Buw3q1s7xJ1K8PZJBXi9kEcSN7K7tcUH7qJcISlPQe5Axr+69bua6Rc39LK87/qmyjXCsGWe7L0bdmIImb031jraW4tUwo9K0ep7A/x3eQStdQgdUx7g== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eCI4chK7kbXXkpq7Y0mXZ5pHELGxM+ZuWnWxVCW7XP8=; b=Z8+B31TuFS76PzoyGzCm95oBzrN6bfjb7UHFqt59ZLQ6/P7Tzq1hguBwgO8zXW12PMzkUARpIxOZD2sBOqLld9XXzjwEGIR4D52iED93OraLj4sAKOQvviZWIO93wHdHhmsugPwv2o037NWXMqrp31AhBeyE4l3Hx7og8UzKjFHwPg21sBJyBLrp9nk6BcgTvCHEzzWD1c1jkffZkiUOKSrZvfC6pwkCMzKucNi80mjUqj2va12iA5cPCvtZ7mHgPza1Ode58aHkI9ROHZNZADkBs2LTneNTrfGQY7nOIJ5X5x1n2NkRmQ270rUZNzmjMEG4Kg/D3YBHpBVxuf9wOg== 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=eCI4chK7kbXXkpq7Y0mXZ5pHELGxM+ZuWnWxVCW7XP8=; b=AEPFunkuyYpnEZDlRAFfTKpJ5+PKULq8Bh5R8rv92PaEd1pyKQkc9T2Wuyqh0lHd7YLij2hJZXAhgdaXHJU4SkrtqWISDF33NvBlMM8xtdsUQt+yHMKCxQdaxzt3UKaudzkWrAXm45/B1NeqwsuxQ2S3+aJ7P3nyKFgLI2MJT+2rhSvtx9mIFESnUQDJsBO22/8YTZcIXvLYf9naqPt8wkwMPELBzc1HgiFnwOVvvt4TtBE5CoPXkJgpOuJsjnPZ0mGPpM7YG6RycjGBLA1cy1IrG8ityqfzpduIHPwP6qCaseRrFHJou8MbS5eyfaiUI4a5GaeVX9kc83YIsxyc/A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from DM6PR12MB3849.namprd12.prod.outlook.com (2603:10b6:5:1c7::26) by BY5PR12MB4147.namprd12.prod.outlook.com (2603:10b6:a03:205::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.29; Mon, 24 Jun 2024 22:47:38 +0000 Received: from DM6PR12MB3849.namprd12.prod.outlook.com ([fe80::c296:774b:a5fc:965e]) by DM6PR12MB3849.namprd12.prod.outlook.com ([fe80::c296:774b:a5fc:965e%6]) with mapi id 15.20.7698.025; Mon, 24 Jun 2024 22:47:38 +0000 From: Jason Gunthorpe To: Jonathan Corbet , Itay Avraham , Jakub Kicinski , Leon Romanovsky , linux-doc@vger.kernel.org, linux-rdma@vger.kernel.org, netdev@vger.kernel.org, Paolo Abeni , Saeed Mahameed , Tariq Toukan Cc: Andy Gospodarek , Aron Silverton , Dan Williams , David Ahern , Christoph Hellwig , Jiri Pirko , Leonid Bloch , Leon Romanovsky , linux-cxl@vger.kernel.org, patches@lists.linux.dev Subject: [PATCH v2 8/8] mlx5: Create an auxiliary device for fwctl_mlx5 Date: Mon, 24 Jun 2024 19:47:32 -0300 Message-ID: <8-v2-940e479ceba9+3821-fwctl_jgg@nvidia.com> In-Reply-To: <0-v2-940e479ceba9+3821-fwctl_jgg@nvidia.com> References: X-ClientProxiedBy: MN2PR05CA0043.namprd05.prod.outlook.com (2603:10b6:208:236::12) To DM6PR12MB3849.namprd12.prod.outlook.com (2603:10b6:5:1c7::26) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR12MB3849:EE_|BY5PR12MB4147:EE_ X-MS-Office365-Filtering-Correlation-Id: f201e901-df8d-42d4-176d-08dc949fa34a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|376011|366013|7416011|1800799021|921017; X-Microsoft-Antispam-Message-Info: j5qqx8Af2Z4wK5YbT91++zpdljiy1xSm3XiujLtRf7cUJl1ueUQtkKkEzTlGNhjGzDB277f+dmdd2WceMFuzuS7AEC4x5PB2EVC22/LcEsxPj0GrBPIw0WMZjWLm0vKu43SSN1PQ9JljHTg/1yXUR8WQsAqhD2bvNVA3D24xlou3cAlE5lfDrr0q45yhWw0SgdIfW4vGi9RI88/XsTnw2cCtww4gV7FljUWeLHEBwUBMd1xgi9eKOQ6TWS3+rSvshpg/5W9amachIY4DO1dXyxjgqv2kbY1ztkvPfolj8kuionzrwWD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ispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB3849.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230037)(376011)(366013)(7416011)(1800799021)(921017);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mFVGX2tjKRw26bFmxWZ4o1xiRUz5iJQuYO8fDdaq3BLTJIBB9CGviBSJVI0eziRNBW6C3m7aJ1zdH70g3sYz4l101Zk2QQwpBFO1CaZ5x4aagTnaUcsL85rc8XvzDIDnbrcU+eeV+ON01hJCRq09SOYRj0ABBZy7wXVhjM3QqdUBD9AY8M18aVYHSP+v2TJoC4Rc7qY0sICcdnhMYjFbeITEm+plACsvbotiqmxUVTcIYnmawzI+vKjvrMuANCMS/KuBRz1kaO9o5/og7KDpbsYWAfj22ffWx1vYqFxKpMHzoJN/sjWZ5ICFMJ6hbqQC3yT5D7kJTtAzTn+xjT0ActwpENClQFeL+qjiGpEJhiJGdJlMuDnbaozXQCGwSK1qVvJHjWS1LWqDYOi1LiKqY0L2/Q7LzvSXoPqutmC7wxd78JTnzxo3IEyBuUt81qR92dk6Aj4CSaIag/UcJyOhwJjroV75letAgzLGMJJcSfiie5hXkYk+6NHUfWVjEl8ibNWD+aQp5GWlyZjbRYdNj5dMDtA9+LTSbbLsfM+KY3psc7ybA1i5FI/miEgqtDV2zXpdlVXbapSHLlxco8tfnM0Z3xBXDwPREX6ZoeEQUV5oDXuM9i1PAHlIgPEH5+n82Rnt6dGQqlJVexl54CzSUDuG23FXva1WTUgiR9mE+gOUa+XmOKz6xbpTRsocl9X7Bo/69YKwxDPnyUgMtPQ1mEvmSqOArTM/yMZ6s/c4Ko9SO4u8rqs6CUz7xtAHl2ZECUXFsG4TP5Dp0OxjsdV/QYHb11ZqKJcfMtlNxuKLpGtJyXwudUUlSRUMrQdrxJu1MLVtKluGxWgVr2PePMrA8k5k/vwxZOvNrO/IlRCosvfg9CC/Eecg4PhrgWJK3gjcUExlXnQP8uIt6ObiqJMJM5NRqkk590T7QeVl3iuhJqi6xg6elD/SQJnx+Kvs/bWumGajxdeUsGtypV02dRCR2K6wxM0qbWdL/yCljSG2Ig9jPIrSn9l4Nmz4g8+RyS2uc7y7ohKJDLeU3fbIojLWT/NgN3s3uDAB0qu56AF3J6+NHxYr2hSXMAuTRUkrORNAqKqEQFoOPGDYw7PzntPjKIQuk5Ez/EqhjUBDMW6kdMUmFsSmnb2OlYkLCKJYcWyiMjhfbWCkNwXCCLo9ZthjfFMX0/8ehbb7gNWmNArMQ2aRsrNKHooL7EbUNYRUc8UK9QHAOBy2yyBM9iM4+HeuSmsJ22zyUXYQabmcy/6GFKwgvh1ponduJJaysPFx3bm9zLcmYg2WaEmYlVXGf397O00xbRDjzZD47TBRiFCeVC3oTm8nLUaoHzGOPe1laKTGr/QAvFylcHwuMk3NObGecoULSMqoyWB9EDaqbvjqmfepFDY/k/ny6W/BN065G0r2CoMxcCShFut+/ChY1zRRuWKTwi1qvw5NuPmdx6Cd2erwt+Sn+cBdNEopYieN0RJZxqZyLv/UXUjT47Vni80yKU8kHSk03ZyUugauwkvFH5DNsivR2spP+Ea+1BwKpBiQzzw/Vg3FLqpz/XfJk9y/FSXzfFoLCeWyb+I0OvYGY/jIIgeVwpN4EH2MQeK1CPm5 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: f201e901-df8d-42d4-176d-08dc949fa34a X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3849.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2024 22:47:34.2478 (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: FtBr1mZRKP7YzAVc3mlyK1SVNGS6lgG66hWgRi5AaA76H97t+oi0jINQtgiDkNl5 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4147 X-Patchwork-Delegate: kuba@kernel.org From: Saeed Mahameed If the device supports User Context then it can support fwctl. Create an auxiliary device to allow fwctl to bind to it. Create a sysfs like: $ ls /sys/devices/pci0000:00/0000:00:0a.0/mlx5_core.fwctl.0/driver -l lrwxrwxrwx 1 root root 0 Apr 25 19:46 /sys/devices/pci0000:00/0000:00:0a.0/mlx5_core.fwctl.0/driver -> ../../../../bus/auxiliary/drivers/mlx5_fwctl.mlx5_fwctl Signed-off-by: Saeed Mahameed Signed-off-by: Jason Gunthorpe --- drivers/net/ethernet/mellanox/mlx5/core/dev.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/dev.c b/drivers/net/ethernet/mellanox/mlx5/core/dev.c index 47e7c2639774fd..6781ddb090c475 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/dev.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/dev.c @@ -228,8 +228,14 @@ enum { MLX5_INTERFACE_PROTOCOL_VNET, MLX5_INTERFACE_PROTOCOL_DPLL, + MLX5_INTERFACE_PROTOCOL_FWCTL, }; +static bool is_fwctl_supported(struct mlx5_core_dev *dev) +{ + return MLX5_CAP_GEN(dev, uctx_cap); +} + static const struct mlx5_adev_device { const char *suffix; bool (*is_supported)(struct mlx5_core_dev *dev); @@ -252,6 +258,8 @@ static const struct mlx5_adev_device { .is_supported = &is_mp_supported }, [MLX5_INTERFACE_PROTOCOL_DPLL] = { .suffix = "dpll", .is_supported = &is_dpll_supported }, + [MLX5_INTERFACE_PROTOCOL_FWCTL] = { .suffix = "fwctl", + .is_supported = &is_fwctl_supported }, }; int mlx5_adev_idx_alloc(void)