From patchwork Wed Aug 21 18:11:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13771966 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 614721B3B38; Wed, 21 Aug 2024 18:11:18 +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=1724263879; cv=fail; b=H7x/KTflT/DRzU5OJdNPU35Mz3etgTyT4Nyqb1rgWirUvGgUUhIhN49IDCekBcwTmoHE3ICCb0AljsJkkix26r/aHE+llkpJeW+d3G9e88xfNRRL63SftdTswBifd1ax+fY4ZZhpfldifOtGdZFg/OQ698LCbtmhJwPro6+ExKQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724263879; c=relaxed/simple; bh=USlx7YBAbBV3ZbwmRWo20Jf9Zxz6LnS7OFYdml5zYfM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=EbONeJB0Se0VpkdqMUVVM8yYf4BgngUqOvN1rgkDo8GM3zeZY30KUpg0VcLZTg+vYGGsFtwqPcL/mySnseTsE/KWT10EAZj45f3QGeH7qkJD7zITH5XNRd0mrNdf48WPkhutKaR989VoVDZM0XRtnV5bOL66B+A2ODc8lTuetQE= 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=sO+M4j/B; 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="sO+M4j/B" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EgfTdFm/v0VxmEzZZAfOf44XaQW+I7QGPSPJi7op8C0bdkOmUOBxcSy7JOdLqwaYQECMAHYd434FnytYI4zcjuqqxqkBHHxncu7IaweaiyJ987dc7g87mhFEakHK/PWVgEjhWVqs87X5N7WN26HsbJaNGQVgBkzq5jbh6ZVHGbxnemnSiOdePdSVPu1BLOrkvnV1ZmsNYtdGNsIenLQfQ8zvGHEndSw4GHUOfnft6rCdXJ855gFXpMd7lKW3VcZOP0OBNlCr64ZkFPosFIC1T3e3ItOlHR29X4e4gFmKzq6S0IDarnPKQuJEJLppBxuiTwWsxNbEfGdpLxw+h+YYZw== 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=GIt3ge5f+/l3Iay/sGuncebBG61co+3+9bM0Kcnrt0A=; b=PdCNf9fpa1fm6/SFf0T1p/77Bud14iiEBRWK5QQr5QVRd3b1Q1Ak/iOPZzVC5TukEOd30w7EBwu9xDD7yxhhdZ8LZQtHJzeJFyIcL+uX1jErBsMFkQAlo+PXGV8/ytqbWdThCrlU0TlxiwFXD1bvZXKGFSkC0PfYPXgy/YnZ6RFAa6SPxXm3DTy654n0lXpql/DYjc09PT48i1WKxMQi/Yyv3ChuPwv5iVy5ztNX/rX2/K+E2XSg4mIYMkaPv/IvoXd1/l68fPP15vvwMKiJ9qGBTyh5eNiVCsIu0clQlW21en7RZ73wlWNZBbZaGIJVBobfa1YBgYEEt2m+/y8SUg== 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=GIt3ge5f+/l3Iay/sGuncebBG61co+3+9bM0Kcnrt0A=; b=sO+M4j/BoEOLIz630vNSzhyNo1+EUA3RSP/k3EAXEVXFpcW2ZZEOfgvTW31YjOsMkTpOgPknV9nS7BRFwwiTvuUc37t/8MyhgfKtSmARpY23UVTcGDTcIBnZVzytGOfbJfdHAxzNHiHgIhgKKuXePLidLEoZxxoAxyH2H8USmWkHXZNm3NJdjf0o0Pal3AmVt4UFfcxv3yiYZZI0QYeG3DzOyHJq8Q6MuimL++V2PHDmsug6Xw6sYD8Y2F4w5aNugUijiTZ6Op8Qytrl3xuNiEp03gf0+Xo4W/69rvIuErtqds/GuS5U0z97FZrF17EuFTWeHEhBg0clu6sgIScsog== 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:08 +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:08 +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 10/10] cxl: Create an auxiliary device for fwctl_cxl Date: Wed, 21 Aug 2024 15:11:02 -0300 Message-ID: <10-v3-960f17f90f17+516-fwctl_jgg@nvidia.com> In-Reply-To: <0-v3-960f17f90f17+516-fwctl_jgg@nvidia.com> References: X-ClientProxiedBy: BN9PR03CA0035.namprd03.prod.outlook.com (2603:10b6:408:fb::10) To CH3PR12MB7763.namprd12.prod.outlook.com (2603:10b6:610:145::10) Precedence: bulk X-Mailing-List: linux-cxl@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: 0859e93c-ee97-4f6e-2ae9-08dcc20c9ef9 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: gibgDFBjITM/pMtZUvWDAsaAH96fCDKD3o5Yp7FeFLcjjaHbobblI8t89O9pGYXveab3H4bC7kMa6iyVEpv8tZzCzvO02Ic7hOtjX7K6PSgt2ygEyLnafsxZ7JEFQuIllFGTUQ/SzaGnH7cMn11/40X3TvpLIeFfHlTXJua6ze8CQXQqxsuTQvwE1y6eeGSIryRh/5fcitRgPUkledfX05Z7ud6az9dj8+4Ft5g9dSp6OcDNqdWMIbqWTMmEfqvcIEmdoxzCfEmBsNAfzmsZIDSHtXBvXw2dJxWPxR/xGa4NWl8B+CuwtlNMOZdEv6S37zwLK90hO3LZOPEKARAaeDYl4DnD8j7F4QPQoZfiHzgqZd295V2295OUuOLrDKNknEWPMgBW5Z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;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: l0gSzONR8mc+X5Ev/L0ZxhAYXmty3JHgMCcp3T1FYfh8n51mfrxnjxaZXiHDogoYBpD/Z4dJB0TyijtLHpCH51G7zeZ4JpUk01QSx+Ak34Xj2eiqb5GGsX+yui6aUwJByPD7IMWBGy4SJEq5+AMsTM/mXdhwlKp92CZI1uBh3+hib91sD61B1WP6Hxd53iiq10RdtX6wJUCKHS/+ud23o6ygPJsGEUx2HinmVQht8fuZ24wqLyFvEdSPjgRComDbXzH0uh1bz76kSGiuo9FIFo3365LW/hLRtLP3AcsTyF+IsMccn60JN2UgyL7zSw3GlBrMMN2YL2JXSpiiYam41Sefrjw+p+jghgrHAzPWMce31cFg0FMe1NbxMnmR/+RpT1QZk/rRcrZkx5TrQpCnPZ5TPIQC8N6EeAgQSCqnN7kMjXnwJ9Vpm+iEI0ycpRGDXpEXY9KjinvFKed3eeS2F7mYtaHPcRZRLMSDblNDG2dr7A93Ao2zjfmRopEigkOX5YmreEAubvt7OSnha4vt60kRfna1ITjYE0gem18fxiZ+Z5PI2v4d9JNW5oEAFyi189ySvuTGoyMl+hUT91M5pK/SCb61i2S9/FQaK6n1kjz6S9WBc424sGGbfKw8iWct39k4L4ayZh/3wCFhtepTFGzBtX7PdVMmthOnDbtEeAEfh0ivexLaD4rofKTc7d8Smq7hQJeNtxSAmvH33gP9KleEoLMfVn16Rvlr+0MOZJpPYYg/ZZyZDYHEBQCrThEbYFKFaYTdIIuw4s63s73Tklh92IDJVs1EQ1E8VRcUNHvj8SITELS21lVsLD+iPgY0DVAvnX9dQ+GWGSuIiUt8Ia3fbXlBISJUQKaZX5Wj7yxsQOKKm60nn67M7ROyNroxk3LY9E8LWalOIz5q5QiVLJoWGYKLtARsPe5LPqO9iTeHIqHhUyB+SV6s1HM0umeHUd1Ls6YFvShlp/fazubJdz03I/LVI/ZCa+3/LcXGgXPuEVSWu8Jn2PjvJz1hQZeYIVc+LEZvWmi8VeUqjB46iFH99fJdsqEgmskhXqwenJwMjIgW/2baHw/wvnSbnFE9MyQPvk1deai5bx63HqzYdYVugPOWCD2StTDXkQhTr/jQBg3EluKfQD3dllhhcL3kZ/BG0WsfZA7dkZdv7yAZUB38UeFFXJgtFGyNGZcs3ukDwN8XRsDvBklS9ZKhMpvV1Uo+jD/lOz730FWkaFz/PxjYonZobUaPSo1NlFnxZRF/09dWyn7mK7fEJqFuAzNuAboYg7n18u5TNXk3IgWK5vl/zERNOUV5uo4hdPHKUeiIgyyihaVgDRmRKZAiTGFj6U8+aYOfdr/3nq3OwaVGSZdVGOLCzkOXciG+qln/I/r/e02DOY9QOZBtTFeoE10dhtrvblu9ov1I1FQmX3S42T4WXI0eWihJflD2Qm9RF744RWHF2Sk+8SEYGPNRJY1nklxOLVYwGhxTpy6tXEKR6jPO3LZAVQawb3zE28HZHlK9lVEcR/aO1KXDySf/592JAASM3AsGLqhYDX3OcxR9pKYILOJLAFRUyFTadkyZlBWjtk3GZUyW0Ves8M3biJJ3 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0859e93c-ee97-4f6e-2ae9-08dcc20c9ef9 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:04.3465 (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: GBPfCgoAKpiB1MAXkmqNzflanCKQtUFqlOzFDuHBbYayNf6gsb/ley2015Gd6zDX X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7199 This will link the fwctl subsystem to CXL devices. Signed-off-by: Dave Jiang Signed-off-by: Jason Gunthorpe --- drivers/cxl/core/memdev.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/cxl/core/memdev.c b/drivers/cxl/core/memdev.c index 15c36971fe43ea..f6f33f0f733741 100644 --- a/drivers/cxl/core/memdev.c +++ b/drivers/cxl/core/memdev.c @@ -13,6 +13,8 @@ DECLARE_RWSEM(cxl_memdev_rwsem); +#define CXL_ADEV_NAME "fwctl-cxl" + /* * An entire PCI topology full of devices should be enough for any * config @@ -1030,6 +1032,7 @@ static const struct file_operations cxl_memdev_fops = { struct cxl_memdev *devm_cxl_add_memdev(struct device *host, struct cxl_dev_state *cxlds) { + struct auxiliary_device *adev; struct cxl_memdev *cxlmd; struct device *dev; struct cdev *cdev; @@ -1056,11 +1059,27 @@ struct cxl_memdev *devm_cxl_add_memdev(struct device *host, if (rc) goto err; + adev = &cxlds->cxl_mbox.adev; + adev->id = cxlmd->id; + adev->name = CXL_ADEV_NAME; + adev->dev.parent = dev; + + rc = auxiliary_device_init(adev); + if (rc) + goto err; + + rc = auxiliary_device_add(adev); + if (rc) + goto aux_err; + rc = devm_add_action_or_reset(host, cxl_memdev_unregister, cxlmd); if (rc) return ERR_PTR(rc); return cxlmd; +aux_err: + auxiliary_device_uninit(adev); + err: /* * The cdev was briefly live, shutdown any ioctl operations that