From patchwork Wed Aug 21 18:11:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13771951 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2068.outbound.protection.outlook.com [40.107.101.68]) (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 881511B3B11; Wed, 21 Aug 2024 18:11:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.101.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724263876; cv=fail; b=LFNz5BaBwFhnYMRdfLDCAFrr7LB/MEIW4vIfudJ3lJ/yXQ4ZB29dhivyFstemxpxM7V6NcohtiUqTbgALios0MN6FTBn25cqqNcJZpM69dm77LwoEeiFb1TTZIfM68lMhsO8V14YPeCb25FVlDp+3bLMZ+A3llyrrAvr6fG0Dp0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724263876; c=relaxed/simple; bh=suCgcmNktUvgJaB5zPvYDmKarrXp48jh0gfh8cQalx0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=Ji1XQKKS/Ur55QlA+yYkV8whIkotPQC2yimOPnhBwF/hbalBkg9tA0Wzf/izSUp9hPHGGTNu5oAW12xb65ApfYSPqS+AxqEZfoZ1qlh972c5FNH5hke2UfA3mkgcAT3rrluaqX6HAVlObb4rGr9uW6Z0Si9ZggWEvJSp5ZKZitU= 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=U468kwG8; arc=fail smtp.client-ip=40.107.101.68 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="U468kwG8" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fUctp0wBe7IfY+b6D71ksBxrjuxJA5b5Hi/i8e9/tYAzDnrI7hGaljc+5HWZzDkbMA2NHu7skLMBSAlGj16N0WYqgiLcgLhfaVtCdkR2HvpAbSYe9zQ2f0YsMhHsPCi3anCAGiZaJDtETlxWQOWfNs0qYWqpY2xygg/Fw363CcPJ0+Zc79yV6DBM7w8tddrNgjJGbWN+Pn2BKR5TNNzNnIBoJSGfvmDCRYM6WsxTn2T/n786p4EsYjUJWhPzWc1C4iu23hNcI2hYVmvi9CE0ImN4LAFFAqz2pxWsSglcO8qvfhAczRMnYjJeUua1jYX36ZglRFgL42EMGNUQIa1AYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=AoEUo796KhnBL7/w2VPe8nzAdv2FMhK/MN5+Z4HN6DY=; b=k+gPXatbRRy0G/rA4mLlIcOEscFZr+ldYyrr31N+B8Jsq3PVUUKwNQP4wHue92xLPRavNtXrnuUTfRKtHERwsGYuimZcPylL0lTnPDkw90WwYWMUGsBWx7TUzrbG52LHhJdopvUktYjC7/lHixagQr3KaBcVX8OHbSMP5u4sjJIQRH7kqrvkGm8H+DU/xdWgRlPqnq8+XoZ0A6Sripe1qvt8Ulaf233T6SwbHXkxSHghsvUg8iHEcx8Fgl0gPl62bdEDYk5Xf7EOQqzAU3iFx06ERg+bxA+WjQY0plH+oj9zKe0iJ6zw6ZlxymSsgiT5SbRbtDY2Z75pEL/I9xpf3g== 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=AoEUo796KhnBL7/w2VPe8nzAdv2FMhK/MN5+Z4HN6DY=; b=U468kwG8hsRKZ28Jr6d+GUIsF9XtWEw9XiEguMJMV8rdbUk4RQSV/UtSJ/onDWU+irzmMGo+2BHuviUxCuPrSLyCGMROIvEIMVZgmLOZDy+uvRNEmZ2hile11HzB3/VxQ+oygKPlMjV4tlc6mGhW8Sp80ilVJZUcS+mPx2HOr6248q+HCWe1Fh7cGX1dmfO8FOH6EDBB3ZXolam/ov//LWbaG3Pk1I+1C6Imr/SJflNlhoZGbEHv/Ot1GHd/ovIGR9YjmbWuOShFDiBU+Z1mLG7wUjuLjHOB0bJ3pMWj7oIJpu58a5QNKSw6TYtA3OPbRRnh1WCiRKyjwAo8SDBymQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CH3PR12MB7763.namprd12.prod.outlook.com (2603:10b6:610:145::10) by SA1PR12MB7199.namprd12.prod.outlook.com (2603:10b6:806:2bc::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.17; Wed, 21 Aug 2024 18:11:04 +0000 Received: from CH3PR12MB7763.namprd12.prod.outlook.com ([fe80::8b63:dd80:c182:4ce8]) by CH3PR12MB7763.namprd12.prod.outlook.com ([fe80::8b63:dd80:c182:4ce8%3]) with mapi id 15.20.7875.023; Wed, 21 Aug 2024 18:11:04 +0000 From: Jason Gunthorpe To: Cc: Andy Gospodarek , Aron Silverton , Dan Williams , Daniel Vetter , Dave Jiang , David Ahern , Greg Kroah-Hartman , Christoph Hellwig , Itay Avraham , Jiri Pirko , Jakub Kicinski , Leonid Bloch , Leon Romanovsky , linux-cxl@vger.kernel.org, linux-rdma@vger.kernel.org, Saeed Mahameed Subject: [PATCH v3 08/10] mlx5: Create an auxiliary device for fwctl_mlx5 Date: Wed, 21 Aug 2024 15:11:00 -0300 Message-ID: <8-v3-960f17f90f17+516-fwctl_jgg@nvidia.com> In-Reply-To: <0-v3-960f17f90f17+516-fwctl_jgg@nvidia.com> References: X-ClientProxiedBy: BN8PR04CA0050.namprd04.prod.outlook.com (2603:10b6:408:d4::24) To CH3PR12MB7763.namprd12.prod.outlook.com (2603:10b6:610:145::10) Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PR12MB7763:EE_|SA1PR12MB7199:EE_ X-MS-Office365-Filtering-Correlation-Id: 684a2ad1-1f08-4053-23a3-08dcc20c9e5b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|376014|1800799024; X-Microsoft-Antispam-Message-Info: Xv6LOO+8cqxZs62bItCytTJQ/14m2DQvhUz6phJ1f7JUFZYb8it53wy+WG04O1GgibGOEmytcIKGPfJddKk9Z7AnkKORKKgk9KbL8Nim2PdNKYb/Nh8l/Ez0bddsXV6ZgION4rV8to95mQWF6f2DhE9aeMA2Lp3EZiNBwrcaLWb0GQ2gd8ixLncIyaFHv0clgvCCjJjAWhGPXEzmmrlJ/AeY+JfgLfxBEoW3WhZNzXS8GDK+VChuFjxtxFlvDs9b/eaa34VMRGDwBM2v954paddbHnLgz0dYbR2+bLufbiBtbROjA+/HQ2jHKufhOCLTSCmG3DQuCBzBZshGTs9B/EynSFRY2KTOiYjzz7LaubltlswkBUCHb6Xc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namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(7416014)(376014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oxkCEx+OSd+sznIaTtOBcpAlxMWOEwjVC2fguXI+GUKNdFXtt2LrP2+8LKrz2+ei1yNpmulwH233uZCGF+A6VhU34GZMGBZxR+IQkZYXv7UgO0zGLHcHvpOaDoN0eFrwQznxu0vw1kPeyF30fHEqPuTWpmlypGYwBlqrlG0INACIB0iDG4lF3sf0IBZe2hksl1hGtaPcxBILN5IaTjr/b5D54R4q8fdNYgJ5H4v3A/eeIOkn1w8QHgozQLKQW2HDLTqsnBPnNu5oVJse4xwej+JBOO7HBPhtEOqZP2ifCF8xh6E8tKLbn0ckuB/x29rePCFatXzNDLVbcAoGXKIbWur9RqjwYhdfY6ftUEs+Fgh9BS7ADxn6SQX4pwSaYRobDse4NgVWq0PN3bjkrqX7irmASY682Iy8MCvr6MnJxYJnpCro8f+YT6TDviPSnO7ZgsQm7IymwKzBFlZwRpIc5GQVKM7XEv/6QwgrLycXBTQQMCGzcC7xiAlo5ftKlu/03IKovnvtvksjmJN30bTNr0mH8LeuU3vaNDiNRrvBS9NQTRi6rQraRNgu4zN9MSkbqy08+KlTsyUiVpubZbHi34sKtJ+kZzJuq6MPmbli64gIme2+praxGPK4U0v7hP4HY+XtR9FoRyIYHSn1HlergCAK9/zGoJKlstPzG6lzfC3L188JD69mKvGN6RJqvGDv6ryz+tXhfw0JqE8ahRHdG0h2kw59FuT846P2o2vpIRAHqf93yRbi4Q4lDSXzwJJ5sNiFOQgNsSQPkJ1tE6zGIUfuNYvw7KFXPHafbugHboJM8+Lu15MPniAiRdlHBdeQPBcGNFJe+q9V04BrnbnFBkXZGU0m70fXExJcUfVSwKKk7SF1atMr7bwIuOQHO4saHY+XdJPftGGY8o3jKblklwYw4LR/l2OLgvNACcr+HZ5Lv9TS6qdeLdsGshMZLpFp8r+xshF5MlZixlFT26lj5aufCVKAzOtfNajAHyazx8FaQMq+VEa0P2hw9dcOfk9taXFRhwD6zHXds+XpMCDpa+Ge16evRAPhdQHaeFKFfIXfmQ6e8z1bYI2uvmj3zTePW1E48uhhN4gXcAPWcFzEvLuYNcTyO/1v5Rtg5YexooWu3AVVFm60UYtVawmqFaXfAKk9vr/05TwWaDmYHGxtO0zEb6DS1fZ8Emk4eYWWX7G/XFbu3Gqjd7sNDXQHWJnTw3yB+sBXtfQDHTAOlnwWiTq9MLn6OwCRQC2KREj/AwKNCDUI9babL115HEd1wm89LDItchuCadC21yPwEr0MqqhMiMmiAKzaM7unuxWFR5Ojc0s42NECeoSKkP1Q6yzurt+mO1R9A39J8zGqDpdmLLZP6WDenJvIg9Z5wr1R/HLlPJrbIyFmQm/y0SK647nk9tgqLCJTF2FAXpqIKUgi2XzMOznG9pTWWgcw/vy8Nfp7w/JCTdD6gFXvI3d1rabEWzVwRLqE0PKGeCQdktd7qQyl3nSXLZv3N02UyrvLMQIQBemunOAF7EzoPloiJ7uq8cmop9ozUwyFOCfNF9jLikxacKFcGflwONOZcIIL8yI3BIYDuxW3EBi09aw2SiFe X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 684a2ad1-1f08-4053-23a3-08dcc20c9e5b X-MS-Exchange-CrossTenant-AuthSource: CH3PR12MB7763.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2024 18:11:03.3009 (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: G6ozlKcRXosnAaAVxNekEYJs+emaRh5GnzGzetsE5wYuIDykJ/QpuEMhgSKsaX1v X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7199 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 9a79674d27f15a..0786b011a8bc29 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)