From patchwork Mon Dec 30 21:44:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lucero Palau, Alejandro" X-Patchwork-Id: 13923489 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2050.outbound.protection.outlook.com [40.107.94.50]) (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 8820019D092; Mon, 30 Dec 2024 21:45:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.50 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735595115; cv=fail; b=Md9vRdRkav2wISb6xnflzjK00t/0QM3Qld78BB0P79uZrcoaxxhCReUi+tQ9Ii/GgwgB4dm8fMmjZ0egrSnczzq+zmBQebPd0qZOsjs0U+DnWXObNaPJKMcGNl+MNqDn2TTEpU9VEVyx0LWjDALWtjrBzAfvN6Zi3JiyQGmGFmo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735595115; c=relaxed/simple; bh=A/RR3t07Pmv7BN9JfJS2CBmv3zegqq144sTvGlCsXKw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jTucBwZeMDPy+zyVSV114/4gBzWKNcq7X6u8JAF9o2n14QeAh904doAfM0OIefdjSQ7+/cGu2V6R4/Jg4v4uaFvfP3gMghp0Y5T+6ppuzcb2mhaWlsV9Pf/gPDOFjSucP53oITsz63cuffgSRkG2gwD4jsv8Gjo7heZ6yWLjaQI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=tL2Vn/Zl; arc=fail smtp.client-ip=40.107.94.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="tL2Vn/Zl" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GPetv4a+Jsh/V6tBnJKKeqtOHayGPvpHAR4QuWqnkzgQyvr42AL3rSHyfQQc/L4CKebjbpiXwk8UZOAYVMuPGYT4hnspQa5vdvBtp2eWnHjiPFDX7egjx6lnfozFAPTNz9cMAmqL83bk/3Cx8fieFvc2RoKYBE6v4keGeLnGgpIsnDutr1U0QOLf9OC31WfnGW20xsXOqw9lYvAc73JoQQ6Ff1uNp4DrSrqgDPx0u8be3EoRweEmtzNLEFUpow9jKIUcf2My8E0aZozvJ4J8CLeHraD56oD+YzqWsXMKCZkDo+OUlrhELxdmb5Y4V0bwdpZKdkVh5pkZZetI8twzOQ== 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=bUf74OjDJgoB+EctjmQxbsSB5Rrg94AX4/Is4roB0zo=; b=bJhpmFdYA7lul28kU+yaovlp8psFRupZPdwi0SprVd364txuU1lcO7VDSe9JM/G4y6XUnJMBbPKtI6UbTNf/QFsEcuYJd7KYwBewlym5QgyBP1HGZ4X4Ke3pxYfiHGmQFENzZ08Ot7jIcg9VfsMNX6nfLCENDPlH/MLfQ5S6y8GyOJuvU213ityRBt3Cbl9QW+uw31jo2dBi8vqYg1mN+7XS5rOF2paC158Slq9HjVFyE9kS1x85f71LS55raTSphYHhSmlgif8nStiS+VWO0ldZWGpWVYqd+cLjJJfOaOzB/48e+8qkHGxDcqQHmslmP8zC0EnFVy1E1tO7aqyRmQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bUf74OjDJgoB+EctjmQxbsSB5Rrg94AX4/Is4roB0zo=; b=tL2Vn/Zlk8VQGH8w54g2G2YBi+GfeHm3mWVGgoVeuGxGOToVPUsojZcSwUyOQWVPzjKmENRRjKwSc1pcIK/ZSUmgphG08xpsvNBrK7kmlMyn+jeLmL0I/g6Rf54mZTInMYK7ewVcbVbzF4jPrMkR41eBZvzlk+lNxTHEDtSqcJA= Received: from DM6PR17CA0023.namprd17.prod.outlook.com (2603:10b6:5:1b3::36) by PH0PR12MB7957.namprd12.prod.outlook.com (2603:10b6:510:281::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.19; Mon, 30 Dec 2024 21:45:05 +0000 Received: from DS2PEPF0000343E.namprd02.prod.outlook.com (2603:10b6:5:1b3:cafe::72) by DM6PR17CA0023.outlook.office365.com (2603:10b6:5:1b3::36) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8293.19 via Frontend Transport; Mon, 30 Dec 2024 21:45:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS2PEPF0000343E.mail.protection.outlook.com (10.167.18.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8314.11 via Frontend Transport; Mon, 30 Dec 2024 21:45:04 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 30 Dec 2024 15:45:04 -0600 Received: from xcbalucerop41x.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Mon, 30 Dec 2024 15:45:03 -0600 From: To: , , , , , , , , CC: Alejandro Lucero Subject: [PATCH v9 07/27] sfc: use cxl api for regs setup and checking Date: Mon, 30 Dec 2024 21:44:25 +0000 Message-ID: <20241230214445.27602-8-alejandro.lucero-palau@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20241230214445.27602-1-alejandro.lucero-palau@amd.com> References: <20241230214445.27602-1-alejandro.lucero-palau@amd.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Received-SPF: None (SATLEXMB04.amd.com: alejandro.lucero-palau@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS2PEPF0000343E:EE_|PH0PR12MB7957:EE_ X-MS-Office365-Filtering-Correlation-Id: 92973ce6-813b-4417-4572-08dd291b38b9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|82310400026|376014; X-Microsoft-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BtlCmjXhkgtx3k63eaTaKh7MoLK9CeW4GhMVhIIHg3n8Ud1fIcK1JIyk7Qr4R798pwrGQaPaCpQzu4pPV6omsOjFdHDtiac87nRTGMfKYh6nICeZ7sGacVJ68wXXTdi2slFIKsrz/i58abIedt4Cts8Q1i+86Zq2hucx4fFk4Pu/PORlYxBiRamUMShmbEWE3D+DdNKkXP3R0bHzjQ83M//6CyZdswk4IqDyrf+A6y0qSb+zM47/Ckx6aankLfrbJXiU9nREtoijncsnrtdBV6KJKieGB4U6uYOFH65TYRnNgAlEWDcTsRSSvd2ZoVUWsr1kboTYNiqMz9SxcB+AUuaga1CQO0H81IcqqmbgPAKbRYAiYFAQWqAIk8LMxqpTiNlPAwfp/uV4r9v+H1Hyy0Cc7bSLc8dZ4qdu0Xslf+Vlnc= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(82310400026)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Dec 2024 21:45:04.7906 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 92973ce6-813b-4417-4572-08dd291b38b9 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS2PEPF0000343E.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7957 X-Patchwork-Delegate: kuba@kernel.org From: Alejandro Lucero Use cxl code for registers discovery and mapping. Validate capabilities found based on those registers against expected capabilities. Signed-off-by: Alejandro Lucero Reviewed-by: Martin Habets Reviewed-by: Zhi Wang Acked-by: Edward Cree Reviewed-by: Jonathan Cameron --- drivers/net/ethernet/sfc/efx_cxl.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/net/ethernet/sfc/efx_cxl.c b/drivers/net/ethernet/sfc/efx_cxl.c index 12c9d50cbb26..29368d010adc 100644 --- a/drivers/net/ethernet/sfc/efx_cxl.c +++ b/drivers/net/ethernet/sfc/efx_cxl.c @@ -22,6 +22,8 @@ int efx_cxl_init(struct efx_probe_data *probe_data) { struct efx_nic *efx = &probe_data->efx; struct pci_dev *pci_dev = efx->pci_dev; + DECLARE_BITMAP(expected, CXL_MAX_CAPS); + DECLARE_BITMAP(found, CXL_MAX_CAPS); struct efx_cxl *cxl; struct resource res; u16 dvsec; @@ -64,6 +66,25 @@ int efx_cxl_init(struct efx_probe_data *probe_data) goto err_resource_set; } + rc = cxl_pci_accel_setup_regs(pci_dev, cxl->cxlds); + if (rc) { + pci_err(pci_dev, "CXL accel setup regs failed"); + goto err_resource_set; + } + + bitmap_clear(expected, 0, CXL_MAX_CAPS); + set_bit(CXL_DEV_CAP_HDM, expected); + set_bit(CXL_DEV_CAP_HDM, expected); + set_bit(CXL_DEV_CAP_RAS, expected); + + if (!cxl_pci_check_caps(cxl->cxlds, expected, found)) { + pci_err(pci_dev, + "CXL device capabilities found(%pb) not as expected(%pb)", + found, expected); + rc = -EIO; + goto err_resource_set; + } + probe_data->cxl = cxl; return 0;