From patchwork Wed Dec 11 23:39:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 13904448 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2087.outbound.protection.outlook.com [40.107.220.87]) (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 64B871F2C42; Wed, 11 Dec 2024 23:40:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.87 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960425; cv=fail; b=K4i5X6xYTuJsgb4T/qKTarFYDYdxF+sXforB+ukaOC1W5vmx1HY8P0MB0HyC/vmknUD+OrY8JjpA0n0h/gO08Xbvm4xPCp1t7ujIyMdFRi6hIxqbKn/whKSOo+vw+FMxkk/wCrxLWF9OGLMnPZzZpENpw0U1HpFXuRrMbdyVDG8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960425; c=relaxed/simple; bh=+bJEK5eygtMiUs7y2/ViHSO5BB5lFwzx9FGP7CVNJrI=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Cn1fiOQ2hznuIyL76hOpBBSvjDFubdgVVizim6m3cUVZbKPaAEAPG4dLvVT46HeDrjidwTxvZ0lb0d7OulRYqYJ+ixbYBGXDxzvLoyuKtq7clw6RW1wl0hsmovan43DRrs6fymU5wcByodLYm4ri9LY/lXd2Z44cmUtknA0O/dI= 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=X7B/9B27; arc=fail smtp.client-ip=40.107.220.87 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="X7B/9B27" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yHvCBwI3DHIkyz851qtRrxPi9oisX82qSwJ0F3Lf6gVTKz5cMFUnEoqyNure5MK+vH10KzmvA/klJxqMkFrP39/ZryN/f36+sVi2CfLXXQVDtXu5m38R/08ep71DZ0+ovqeQWfdaqhq8F6Kqzre5NdwvV/QMttutPEmRV5wo7qFNsVvOAqsVVU8E+Xo8IsvrkdW7jNew/9QWcO0mw+J+GoKXryG1uXOJ5i8tegUUzB8AieS/xfcEu3w/Wqtl8uvbO0tk1zgUzRCF8annF90+dSRj4ITAXHkZph3/W0tcy9bcJLhyBCivotlgBd2Z6AMAZSSD0InrwdpYsDGB9uVB3A== 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=/ETr2tXbf/OccNN5hwjorryDGEInd+RxiF+E9PdkWCY=; b=Vrqc6Er2Lrx78UR80AhEqxSvrYYp1C0jpelvl0l2uvckKKt0b1fPqsYHkFu+c68rR1nMe70W1XRi7/4NHJ9hWeWOSmGz97d7S7sNO/G8zluDUHt9Iq+PG9oPE9sf0SdLWAsQPQy+w5fzQDeS4AuRLbG5k/l9jXiQkuY1yGvfvZc+f3fKQMUj4pNBiYnydO8SMBDyc3sIRSzYsfaYpRoymdegKw/2qAo5gpcdLqGB6SajXsGHgBow28vxG3vnJBQICRic/YBP+oMBYKpuLByrYntzsSNathClUHRjoMm3bLJWarU6zFdFGHItf9S4IdEr4duqPlM+ZEVlq0RXpKRR7g== 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=/ETr2tXbf/OccNN5hwjorryDGEInd+RxiF+E9PdkWCY=; b=X7B/9B27s0TBVynLcoZrQ5Zi4k6ja3sPX4pqI3JPU18LGa4rbyM1ZYlI8YUSY8eXTmkwhZRO3vauiCubnrTJO8g7V9peUoHuEsjt9jdEQ/5tmuFBUQuOLn6FQpBUaxyotfgSTZ3UewG27uJxczAnbz+xbZzsESx78TRXBJWJpqw= Received: from BLAP220CA0018.NAMP220.PROD.OUTLOOK.COM (2603:10b6:208:32c::23) by CH3PR12MB8282.namprd12.prod.outlook.com (2603:10b6:610:124::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.15; Wed, 11 Dec 2024 23:40:20 +0000 Received: from BN2PEPF000044A4.namprd02.prod.outlook.com (2603:10b6:208:32c:cafe::83) by BLAP220CA0018.outlook.office365.com (2603:10b6:208:32c::23) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.15 via Frontend Transport; Wed, 11 Dec 2024 23:40:19 +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 BN2PEPF000044A4.mail.protection.outlook.com (10.167.243.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Wed, 11 Dec 2024 23:40:19 +0000 Received: from ethanolx7ea3host.amd.com (10.180.168.240) 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; Wed, 11 Dec 2024 17:40:18 -0600 From: Terry Bowman To: , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v4 01/15] PCI/AER: Introduce 'struct cxl_err_handlers' and add to 'struct pci_driver' Date: Wed, 11 Dec 2024 17:39:48 -0600 Message-ID: <20241211234002.3728674-2-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241211234002.3728674-1-terry.bowman@amd.com> References: <20241211234002.3728674-1-terry.bowman@amd.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF000044A4:EE_|CH3PR12MB8282:EE_ X-MS-Office365-Filtering-Correlation-Id: 15918b21-5eed-4646-1d22-08dd1a3d2c70 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|7416014|82310400026|921020; X-Microsoft-Antispam-Message-Info: SuNMyOnLMN7t7exF+0ISwWpaCqPu/M7Yf68f75BUXB4Z6hUsnaCuxB57mDKthE8WGQb9/JAN5o/+2CxoBXayJFx4fYPaJeCld9qxXcc72UOyZQC04Fncbd9RPuGscK6FGW+VWsbPz/re+0w0RDh78TchxlSSOsJ2t2AEYoZQzy4lDkr/uAcrvheOgffKysYjdXuII7edyh9Z43H3DAHqDPvZS8hXoMAScr7qqwH+PkDQbM5zJTZK71B9qHuh/iX18HRr7oyc2zEJl5/zaWLkULJq9tX06b04sLe3Q/oJtZMd3w9m8QTfbn/uu5zi2SWXhbvUaQJ/TX4tvNipxg6r7WppPfAqCOlef7CYNNjUgHBc3T0B7PjHUM0ifItPkpzyXwXjpbKa6JgwL8O7acTRaVUYkZMUf1eP/V7jZhvQNqn0Xi4IKkxC7Vmq4I2JasB3lUcdjxFFXKOMwCxDb5JFVSuvOYP53uFtx1U/bWxdvcAaTlPUM6KgrdkXLdwZktQb59pf3loiJ0yZe1z/lthJYgknoliorOEldDyTwAeMFWmJUwg12oBZa/E9rkT/32lT4fPpC7juExnJ6vfVp77cENRuRlgHf4vPTqA6JBZpbZ823SpBbA7Lix7bnB+JBGtxAcDbR8t5CM/63W7XzNoRxFq4fQmkNBjH+gy+djRJ9emGpXcZoKiSjP0BR5Xd1unjOvtbOdXc2XA+xE5BrKOwH34Ys6VaId/GXdXqYeklTP/p2AFpUMflrwxMQZZJA+IiDr5vNMc6ctUkZNmJ6RnYHv8cFWHY9RDia0Fn6sefnQ2Z5+JkaYgLpqxcDlGqKTPWDzCoL9O90tlUY1bpIEMD26L2grw+w90vWv6zYObZNikCrpd7vclYFEvs52iGEW4JKGYxa02JwjWuyz4zDnOU0C9Q7HOtquEGcDed7XLF0t1QsoIyV8565FLInkpegEp189iqFhXNGviRQI9WsyiL/GncXGPsz1kPEM8T9KhuERlpvd7IiRtSxIycSH9JwhYGHtahax1c5+pIiEoq3SODfNduEZ21s7HW1370klgake1/2jmeO+a3M1ywWyxX69L8+5BIzBDXS6y/f9TkjqbD4BQnfdrgLeAQFEVlgbDBpKIa+UDcBSpb1ob0H2qm4QWfz39SAgTho2b29eEzJbc2n3L4sapY3G2aoD7mMZHhYauAbOvZgC59AHAYkvNG9ERTK4TBt7MabaC1bDPCOrgFio0c7Dkb6G2gsYZ8fK4Af4fuIj8p1/3SLCKVvwEISnaKMFFyILRTZGF2EOtB4N7QpbVYeYyDIYrvuXkTkzc5t6aatdQGPzWl5+5679u1fnjcYsMPPX/oTU7d5ReuN3IOeXPwfACxqPGKOYbDYdqq5w24x+Dy62hVjMPIt+aJxVHbcuy7yMc3W0eHC1UpyCkd+Yy39e/ySRzNL2JLFtL+Vs8ln9u3SHOInDF7EzHLQrFlz0JUPx2Mr1+zGSdsVDzBnQ== 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)(376014)(7416014)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2024 23:40:19.6569 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 15918b21-5eed-4646-1d22-08dd1a3d2c70 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: BN2PEPF000044A4.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8282 CXL.io provides PCIe like protocol error implementation, but CXL.io and PCIe have different handling requirements. The PCIe AER service driver may attempt recovering PCIe devices with uncorrectable errors while recovery is not used for CXL.io. Recovery is not used in the CXL.io case because of potential corruption on what can be system memory. Create pci_driver::cxl_err_handlers structure similar to pci_driver::error_handler. Create handlers for correctable and uncorrectable CXL.io error handling. The CXL error handlers will be used in future patches adding CXL PCIe port protocol error handling. Signed-off-by: Terry Bowman Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang Reviewed-by: Fan Ni --- include/linux/pci.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/linux/pci.h b/include/linux/pci.h index 573b4c4c2be6..f6a9dddfc9e9 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -886,6 +886,14 @@ struct pci_error_handlers { void (*cor_error_detected)(struct pci_dev *dev); }; +/* Compute Express Link (CXL) bus error event callbacks */ +struct cxl_error_handlers { + /* CXL bus error detected on this device */ + bool (*error_detected)(struct pci_dev *dev); + + /* Allow device driver to record more details of a correctable error */ + void (*cor_error_detected)(struct pci_dev *dev); +}; struct module; @@ -931,6 +939,7 @@ struct module; * @sriov_get_vf_total_msix: PF driver callback to get the total number of * MSI-X vectors available for distribution to the VFs. * @err_handler: See Documentation/PCI/pci-error-recovery.rst + * @cxl_err_handler: Compute Express Link specific error handlers. * @groups: Sysfs attribute groups. * @dev_groups: Attributes attached to the device that will be * created once it is bound to the driver. @@ -956,6 +965,7 @@ struct pci_driver { int (*sriov_set_msix_vec_count)(struct pci_dev *vf, int msix_vec_count); /* On PF */ u32 (*sriov_get_vf_total_msix)(struct pci_dev *pf); const struct pci_error_handlers *err_handler; + const struct cxl_error_handlers *cxl_err_handler; const struct attribute_group **groups; const struct attribute_group **dev_groups; struct device_driver driver; From patchwork Wed Dec 11 23:39:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 13904449 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2054.outbound.protection.outlook.com [40.107.102.54]) (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 5784E1F2C42; Wed, 11 Dec 2024 23:40:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.102.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960438; cv=fail; b=OY7TIicR+X8VvQyMb4RzyqeWL0KCoOhq5Hk5ft95IZ3DosIKGdLtOcHeC5+y6rj4AR4BmfsH6aIc3b4ng8QVYAKd5nH7yjyxRWSoXUkyKgijV5zP6q8IO4whC17VHFbrD6J8HXmAPGg3Sa3bZjtC3JT45aKLoZCq8z1okV6Vfio= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960438; c=relaxed/simple; bh=uSrmHLRSxdHrjGSJAZAl04ChwG9kd92Li16IGVCmWcg=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Yl7yNsGP9TXzPKXwX2msiepThyrPJBO7K3n18z22k9TONDBVLbV+fqOkMRsEYnT9kJpl9Wmd1Gu94pdMGl6rG7K306BYfVfP+W0EA74dJWjkgKtI2t4uvPnGmiOVtvpO3B+Gn39q1Xln2ndve3l7b5Ry6tv4V6dNMaIiz9jqy+0= 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=Ee2WM9sH; arc=fail smtp.client-ip=40.107.102.54 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="Ee2WM9sH" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=OZum3G0JGDLV78MyCfNF0D0FGOOcRUE74twfHzzTegyC6UrogH4JdFinnDYiihyFUBBUAx/cHVkBvZkQ5tMCwmNuhc0CuxZlNpPSePA7MP4B1VGl/rxQHo1FWUi91EzADZ5DRUPEcsjIuC3LdP5m3KAIQESobbEvImIPOahxEjMGIdTSn/Yqh2szMbqKsRbUvIg4AEQTg/k+sTBj9EXwEBGUyY1uo3LmyjhbsjvRhKuoXCXjbe2Ga5xbT1sbJjdtf0zKznZM5WRwBCFt25R05zErt6s+ppLTtufoMDjtoyFF77AeiEXZed8IPSphWGhaKjmYpcl9BHKVw6OOjaw90Q== 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=tUOKviXyM0eWW7tqIyf/Iomz3+pPyDTqFmrrSIqRpe8=; b=uAR6WmLd/Q3HEYcgHyrEUkHeMQxF82Z9/PVKNah3T8liQjP2Q9bcRNmX9f7slNtorlxubCdqfkDkjpRaLe+JpuSfsZPUBnIwz0jSpXU7lBxNiQQFiSbCApPJMn6gy8XgjeXoE5kpJ+kPGN/Ky4l4xZ6HBLfLy9sDhmMReqpjX+/ocJVnIn3e8ZeEOWa6dkDZ8Z1W44VUNjQ/YAKsUcC3ENWjPc6oyUtxzclueVnFYxt051OpxgGQ7pvwy3kixbOdbbXHBTEvo7IIMqW//0sx/GPVFERogXuEUTplGMg68S+1jnboEYdBiI2lZnE/NfIUGfC5qlj3tBFe3wGjVpd0cg== 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=tUOKviXyM0eWW7tqIyf/Iomz3+pPyDTqFmrrSIqRpe8=; b=Ee2WM9sHRd4ZVjYsxuxG4+M+kWt7+hgT0ctrbzhKLh0YnmABHvS+/mMHGfzgDTi3x06sMh4BxKCP/VGR3aQzPKzQJsr+fLrRgKiWaX/J+rxQT7EApjbLiYNo6eU3ICiMYnbHYIx2ngtQOQS4Vo9WG1ZWLqTHzzGrshZwZ4oBkm0= Received: from BN1PR10CA0018.namprd10.prod.outlook.com (2603:10b6:408:e0::23) by PH0PR12MB7012.namprd12.prod.outlook.com (2603:10b6:510:21c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.18; Wed, 11 Dec 2024 23:40:31 +0000 Received: from BN2PEPF0000449F.namprd02.prod.outlook.com (2603:10b6:408:e0:cafe::d6) by BN1PR10CA0018.outlook.office365.com (2603:10b6:408:e0::23) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.14 via Frontend Transport; Wed, 11 Dec 2024 23:40:30 +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 BN2PEPF0000449F.mail.protection.outlook.com (10.167.243.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Wed, 11 Dec 2024 23:40:30 +0000 Received: from ethanolx7ea3host.amd.com (10.180.168.240) 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; Wed, 11 Dec 2024 17:40:29 -0600 From: Terry Bowman To: , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v4 02/15] PCI/AER: Rename AER driver's interfaces to also indicate CXL PCIe Port support Date: Wed, 11 Dec 2024 17:39:49 -0600 Message-ID: <20241211234002.3728674-3-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241211234002.3728674-1-terry.bowman@amd.com> References: <20241211234002.3728674-1-terry.bowman@amd.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF0000449F:EE_|PH0PR12MB7012:EE_ X-MS-Office365-Filtering-Correlation-Id: fd267213-320f-4e58-e782-08dd1a3d32fb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|36860700013|376014|7416014|921020; X-Microsoft-Antispam-Message-Info: sXsjmK1MzP3FY1RfxL9Gn32eklxQUUn0GZNq/FjB3fONGaoof0z4CwypFyG7rWZwLh4APKBQYevZc6C6oBEBzMWusvGz9v/z76TupJk2keZTBU4eTdMSrZ67sqSpOIz1zk6zNA0R9Eyfo7E3I0oFGOHerj6/S79m42qRN+Y9ISnNaXiKb6fpvKqv28HX1ZIHEqUhGm4uhJdctBEVYnerYZ5Mvk+kzLTooe6IAxqAhDZp3wjI9Tii9W5YheyiZhC/PXWkafHiGyDu+MC0mG5u4QmjfzC6+wXCV5/vBQTO8cy5NgBXKNUvnCupEtpA1ezY8RlId0SIUM2j4EPz3Jsd1cB/HlksRfRKRAy9F4GxhRM0zzoTZu33PrtJjDYIuchMazA83gVFENwqv4ATaSmlIyrhn8BVtoHd2+afJudT3sRiUDS230tJuhIFiUV9Gwm0d8eC8cOX54GNoU4Dwc0yIY0IF/6PvaP6O4pCZsQPlaM/HFIWwxnwaSVdeYjdT3bqwreuHUfalOCS53DDvck/X5OwJFyYFCoybt+ZC7bh+iZII5wQbXG2FE6FQaDdFxy7iqmoo6S7UfZZci3isJJoAXtrxTwBuS3wYl/HMd3zzkLeJgi16MWuIjU+aft4XsrX3KWMk1wBaTKuTGFiU99jxQWULQFTIICFpUySlqQeRTbg7HpjEfd9X1SRQ5yoWugk2nR1p/45iZF8zwwqbmfjSAbIF6nVXrU06TJ7vkL2B0/7oQX3uLKDpzzEeuEPIe5yolPd6VkolJ68pBFVoxtbPJQflh/oQvdKvT4THeoonAlqbje1VJJgiu6njHJ42eiKADIMQ6TME9u0RSnUe0Y6r5iOksX+oTwXbFtXVShIKIW9pyc9oHviDCzv5Va59mVsbu5VvhLicK/jba7LaM4c4apej5kpNmiMFXa/rmjv144+Oq1Zi8cdULBm2QIDcPUbwNxreycMRMsfLk9QlToQWXix8dtgCLkcOoAb44tyyBAe+WNnFCkuAmiJDB/N9r2F4RJQmzuwoJ/Zg3SZJ4F9L8U512wIWlNvPbh4HR9qTCMo8U/EJHtXcwnffZRuS5NHsgcmD3pzvHmBYxSX7jhuS1eDq3/CrZP/TNNrCFeCL//ZBduGVNjqaXLf6R1fzkLh2B/gnWtMQdPoJh6mXr4iBtMwNJK6HgHs3ATZn+sfstb2feR46L0NzKlKCB0DyrbPie3R6f7289pRZhbLKw53nTr7x8JQbFWXxaxRwUPytYbXjT3Mj9IWQjRUhpUegCpeKucF9Z0bswELS6uSxnvtysaFpNVRkjY3YOQtHnami7Q2cdwRkJzQl1kJz8IBV5oOyj6kee8oxCUyMgGAfqheznZ2WWt5Zzv6Q5mQOF0e5+nykeNEwCoKtZj+j/4omNJJ7fpYZC1GtWgZ454xQK0hmX1e62BzNOiwNbTGbhTzu331XWye6Lm8/qHFT2QM60rx6ujWoXFdopf5FyoZhw0YMA== 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)(82310400026)(1800799024)(36860700013)(376014)(7416014)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2024 23:40:30.6550 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fd267213-320f-4e58-e782-08dd1a3d32fb 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: BN2PEPF0000449F.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7012 The AER service driver already includes support for CXL restricted host (RCH) Downstream Port error handling. The current implementation is based on CXL1.1 using a root complex event collector. Rename function interfaces and parameters where necessary to include virtual hierarchy (VH) mode CXL PCIe Port error handling alongside the RCH handling.[1] The CXL PCIe Port error handling will be added in a future patch. Limit changes to renaming variable and function names. No functional changes are added. [1] CXL 3.1 Spec, 9.12.2 CXL Virtual Hierarchy Signed-off-by: Terry Bowman Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang Reviewed-by: Fan Ni --- drivers/pci/pcie/aer.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index 13b8586924ea..fe6edf26279e 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -1029,7 +1029,7 @@ static int cxl_rch_handle_error_iter(struct pci_dev *dev, void *data) return 0; } -static void cxl_rch_handle_error(struct pci_dev *dev, struct aer_err_info *info) +static void cxl_handle_error(struct pci_dev *dev, struct aer_err_info *info) { /* * Internal errors of an RCEC indicate an AER error in an @@ -1052,30 +1052,30 @@ static int handles_cxl_error_iter(struct pci_dev *dev, void *data) return *handles_cxl; } -static bool handles_cxl_errors(struct pci_dev *rcec) +static bool handles_cxl_errors(struct pci_dev *dev) { bool handles_cxl = false; - if (pci_pcie_type(rcec) == PCI_EXP_TYPE_RC_EC && - pcie_aer_is_native(rcec)) - pcie_walk_rcec(rcec, handles_cxl_error_iter, &handles_cxl); + if (pci_pcie_type(dev) == PCI_EXP_TYPE_RC_EC && + pcie_aer_is_native(dev)) + pcie_walk_rcec(dev, handles_cxl_error_iter, &handles_cxl); return handles_cxl; } -static void cxl_rch_enable_rcec(struct pci_dev *rcec) +static void cxl_enable_internal_errors(struct pci_dev *dev) { - if (!handles_cxl_errors(rcec)) + if (!handles_cxl_errors(dev)) return; - pci_aer_unmask_internal_errors(rcec); - pci_info(rcec, "CXL: Internal errors unmasked"); + pci_aer_unmask_internal_errors(dev); + pci_info(dev, "CXL: Internal errors unmasked"); } #else -static inline void cxl_rch_enable_rcec(struct pci_dev *dev) { } -static inline void cxl_rch_handle_error(struct pci_dev *dev, - struct aer_err_info *info) { } +static inline void cxl_enable_internal_errors(struct pci_dev *dev) { } +static inline void cxl_handle_error(struct pci_dev *dev, + struct aer_err_info *info) { } #endif /** @@ -1113,7 +1113,7 @@ static void pci_aer_handle_error(struct pci_dev *dev, struct aer_err_info *info) static void handle_error_source(struct pci_dev *dev, struct aer_err_info *info) { - cxl_rch_handle_error(dev, info); + cxl_handle_error(dev, info); pci_aer_handle_error(dev, info); pci_dev_put(dev); } @@ -1491,7 +1491,7 @@ static int aer_probe(struct pcie_device *dev) return status; } - cxl_rch_enable_rcec(port); + cxl_enable_internal_errors(port); aer_enable_rootport(rpc); pci_info(port, "enabled with IRQ %d\n", dev->irq); return 0; From patchwork Wed Dec 11 23:39:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 13904450 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2048.outbound.protection.outlook.com [40.107.92.48]) (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 BB32E1DC74A; Wed, 11 Dec 2024 23:40:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960448; cv=fail; b=RBPU2+snTLNGSdAxKWdsuHXKgF/ZYr0fp+pR1blL5PjOox0jXe9C4o8/lhPeRYDgU1CoPvlFg7Ea0W82QF/9LwzqoBLzLL9cwFZ8/fWzZbDBq+m1dcW2+nTHwwUfXWu07s+NM8ak8tKpjeEFi6dkVDlwq/lAqzLbYYQ9B+V38f4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960448; c=relaxed/simple; bh=wCxYOzVP1PG3xf7tbDQIOGXw2n0Ef06XmdVDUPR1m1U=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rcxtE4tTGOHnb00j+ACYUlGDSHjaz/7v0axFIhTiky+MSiNg1Gsn8Glx5gHz5JzA36Hv1Wyzl2qhWpKPnXI43MW1MzCUHbBxJsqrHIPG6byVhFC4kRfubXEWyYiGTlYxRlS0Bosr+e8Hf0aowlYJwu/U2dMxRJeTIey0xghKDOE= 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=Dw8whzrW; arc=fail smtp.client-ip=40.107.92.48 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="Dw8whzrW" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NFDj2SbvKHhbQ1bEjB81tyFcllv9VvUvn6DsP1hmhB9+LWi/D/+1uBvrkbtKnkp5T3sWEEt8kTp45UzbNwBm4F06PVZFO3e9tYafAPxyOXsx140hhxxshCEW90r7Zn7MDedu4ECm9T9IT6Eaimukf86NIBdjpJA3tkddHTenu8Cl9RnrYml1G+JsxrcT3O4+iZLNedStZ6aLosXSDMIGvKU6zawMzcyCQmWhrNkmzHvVj4blKKhaPnoanyAaMagq1ZTV95+5M0NK+SyQO2F51u4MSIM1zIBIpDD6YGYJe3JGe7Q1p4WXgQfigbmrWiAofyQQ7CmPXFwj2Yh3Rr3pDg== 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=QSF6ubtvJ0BwYMnb83pdbsHf7idOSrdUjNdRSpz2IDY=; b=RIjiBs39YqjyY6bnFqpAibfZV7md7K5Xp4Ydnwtyd1UjLqkwb1WdjHr95ftXxtaFKZ6hWY/uzr6Ln47QX84t2iwWLkpw5S+gvTG1WzkwBP/wpmFvef1X8eFYd+z3GJ5K+IpziA4JgM237Fo8R6YZOvsQH08sgLkKfjQqKCest353ZXR0CEm62nY0bpdZl62PtGipvh70vaKAtd6czZYdHdm4fnkASMhoUkjrOm3NXN5wMLh8eny/Q0l3T+vDJp+RozeGpSPDI7l/5PWAvKHnSNfG7Vys6sN00jxylWyQiqPJkQa6Qxz80XucGsXVZgqTFGGMrAXJrC0W8aO44QDu1A== 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=QSF6ubtvJ0BwYMnb83pdbsHf7idOSrdUjNdRSpz2IDY=; b=Dw8whzrWAtMlWMcYfKbIjD8g6jt5ASkmnINlOIIqZ236C+FJ0P0RH3iONIYuVihcrDZiZ50D3RsdCm+Fa0qlGqESI3uDDREbNKk8O/iOPvyPaEicTvHMp4iwWC6ig3abXrqnjtL0BI2Q7R5XpPGqKMOt3dgsaTGlidHFz4romnM= Received: from BN1PR10CA0016.namprd10.prod.outlook.com (2603:10b6:408:e0::21) by SA1PR12MB7101.namprd12.prod.outlook.com (2603:10b6:806:29d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.15; Wed, 11 Dec 2024 23:40:42 +0000 Received: from BN2PEPF0000449F.namprd02.prod.outlook.com (2603:10b6:408:e0:cafe::42) by BN1PR10CA0016.outlook.office365.com (2603:10b6:408:e0::21) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.15 via Frontend Transport; Wed, 11 Dec 2024 23:40:42 +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 BN2PEPF0000449F.mail.protection.outlook.com (10.167.243.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Wed, 11 Dec 2024 23:40:41 +0000 Received: from ethanolx7ea3host.amd.com (10.180.168.240) 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; Wed, 11 Dec 2024 17:40:40 -0600 From: Terry Bowman To: , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v4 03/15] cxl/pci: Introduce PCIe helper functions pcie_is_cxl() and pcie_is_cxl_port() Date: Wed, 11 Dec 2024 17:39:50 -0600 Message-ID: <20241211234002.3728674-4-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241211234002.3728674-1-terry.bowman@amd.com> References: <20241211234002.3728674-1-terry.bowman@amd.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF0000449F:EE_|SA1PR12MB7101:EE_ X-MS-Office365-Filtering-Correlation-Id: d8d7ad88-60ac-454e-4b16-08dd1a3d39b5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|7416014|376014|82310400026|1800799024|921020; X-Microsoft-Antispam-Message-Info: MgG7S2MKiH2cAhcyNkyanf2LClkEnu/MP2opOCkQvzi6ZWXktTeI4d9QF4YPUhyzMCS2TinlBnxSUFShL3gD/jADWHj1f8ta4nS6y8oRcwDWIHvjE+t/+5w8KFpe3v4328YJ6QzUdQXnaxvXCby7j3x/YA3E2GtL0iMnhTieb8dPazBsIRz+yJWnwOTOaNCa9PjLMkQcKOOdw9pGNvSd07mfP3SkkVBoweBa4H/q2NcR5TBwi/Yb1EabZ0kAiR1vOtyDpRHWZrcwID77R3u08L/c9EFwsL7TaG1+mvrQeQZQLRNKVo1+Xf0pUPwZHhqjIozLJr9huUxKu2QK4tkU2odMrVFr223OQ4v3KFvvBrRZ3Nx+5CUVxcIVhIoV7e8P6fbupgeJgQbdPQ6W4DZO7aelEr5bkS9KeUouVPxfvzLlcKlbTVCI9JLq/eYJV7tdxmwErZ017NlXQiHxRUW8ldC0jhAlyabYH4o/XEJgI1mcCyfcpB7qx+Of8QUewQGCWqI8wnPQ1Z0d8Jc1NiLBzOVJ/zCuNRSWJunLsnyYxTQkP6eh7wM+QKkxUpeRjl7bbhG2ID13+kTozb2AWK6o8j0b2LcmnhFRhRxjekNB61deFhCVBGaBjeOdb32i2lNuPy10WRu0itcQSzfnqTq9UlMZX1mFcetFiftN/PLXtGXm8TMCgYBv/ujyEHiJfCPGcOV1Amuejh2R8hkbM703vFM0gQVv8ZTcutHNWp3SI1KR6PtFYVG5iAdStZg1NfIsdKSSC3MFsoTBuc7JJ9fJ0D7dLelObykzd6U0xYKBwtM7Y2G8XV4CXWyS8uaKym4mcPi1buuGYCqqZz4RZWBebf44Gu5+O2VkQeNnjrBSkdVA0rgwXwGGy5e+4mpqGwRFblYmAIFcUuBADNliYUyR4J6hT680iGXxpGGL6/IpzqosU4xQksARUBg3BwB/zsCGW816skRzRJjOxNOOv9tQHFJJX3DaGu0Y7yMLtpLhJgmYebA3zIMGm4OqRB4cUshpMw5503WRem8h+POdfVIJ7YJJEpi1yFqHao7JGcb1qe15JVxiQbVPjHpvi+AfQIJOzHjRGc8adVhrUE+ingDmH7Ykc58DJ9HGKPh+1/tO9nCH2g8eUpmFiS3zEpGSW9mRc4g2mfS0nwd1dxL8h/B1AOmuFpo3oZWZMmPpD39V6hPWxG45Gkn2VcC8jANILXeQ7KaCevVVQ1AlLtn2dr9GgQTz0Sz5baTkqkocGc+d+Wxjlyp8jh/j7DL2ylLh++Nd+rWIRDM5iO5VRRGvLuWI/K8QwxZS0NJkBYo4ORCU+uHH9k0bbKQGQboAhlXinytJCQZ9RROj0BChUIFhk7u8KmWfyaBLiUuaaFdeX6leOyW0cPhJJ4X361Fy8Hv1E8VAkzlUYX2lX+eHL5j2XNOq+7+bDfw2QcojzYRyktq8wJnFG9nzVxjWVOjurvG+rlQDgArgKsarreJqmknmfaX45g== 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)(36860700013)(7416014)(376014)(82310400026)(1800799024)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2024 23:40:41.9207 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d8d7ad88-60ac-454e-4b16-08dd1a3d39b5 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: BN2PEPF0000449F.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7101 CXL and AER drivers need the ability to identify CXL devices and CXL port devices. First, add set_pcie_cxl() with logic checking for CXL Flexbus DVSEC presence. The CXL Flexbus DVSEC presence is used because it is required for all the CXL PCIe devices.[1] Add boolean 'struct pci_dev::is_cxl' with the purpose to cache the CXL Flexbus presence. Add pcie_is_cxl() as a macro to return 'struct pci_dev::is_cxl'. Add pcie_is_cxl_port() to check if a device is a CXL Root Port, CXL Upstream Switch Port, or CXL Downstream Switch Port. Also, verify the CXL extensions DVSEC for port is present.[1] [1] CXL 3.1 Spec, 8.1.1 PCIe Designated Vendor-Specific Extended Capability (DVSEC) ID Assignment, Table 8-2 Signed-off-by: Terry Bowman Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang Reviewed-by: Fan Ni --- drivers/pci/pci.c | 13 +++++++++++++ drivers/pci/probe.c | 10 ++++++++++ include/linux/pci.h | 4 ++++ include/uapi/linux/pci_regs.h | 3 ++- 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 225a6cd2e9ca..c96c304bc799 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -5034,10 +5034,23 @@ static int pci_dev_reset_slot_function(struct pci_dev *dev, bool probe) static u16 cxl_port_dvsec(struct pci_dev *dev) { + if (!pcie_is_cxl(dev)) + return 0; + return pci_find_dvsec_capability(dev, PCI_VENDOR_ID_CXL, PCI_DVSEC_CXL_PORT); } +bool pcie_is_cxl_port(struct pci_dev *dev) +{ + if ((pci_pcie_type(dev) != PCI_EXP_TYPE_ROOT_PORT) && + (pci_pcie_type(dev) != PCI_EXP_TYPE_UPSTREAM) && + (pci_pcie_type(dev) != PCI_EXP_TYPE_DOWNSTREAM)) + return false; + + return cxl_port_dvsec(dev); +} + static bool cxl_sbr_masked(struct pci_dev *dev) { u16 dvsec, reg; diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index f1615805f5b0..277e3fc8e1a7 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1631,6 +1631,14 @@ static void set_pcie_thunderbolt(struct pci_dev *dev) dev->is_thunderbolt = 1; } +static void set_pcie_cxl(struct pci_dev *dev) +{ + u16 dvsec = pci_find_dvsec_capability(dev, PCI_VENDOR_ID_CXL, + PCI_DVSEC_CXL_FLEXBUS); + if (dvsec) + dev->is_cxl = 1; +} + static void set_pcie_untrusted(struct pci_dev *dev) { struct pci_dev *parent; @@ -1945,6 +1953,8 @@ int pci_setup_device(struct pci_dev *dev) /* Need to have dev->cfg_size ready */ set_pcie_thunderbolt(dev); + set_pcie_cxl(dev); + set_pcie_untrusted(dev); /* "Unknown power state" */ diff --git a/include/linux/pci.h b/include/linux/pci.h index f6a9dddfc9e9..33a9abecdaba 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -443,6 +443,7 @@ struct pci_dev { unsigned int is_hotplug_bridge:1; unsigned int shpc_managed:1; /* SHPC owned by shpchp */ unsigned int is_thunderbolt:1; /* Thunderbolt controller */ + unsigned int is_cxl:1; /* Compute Express Link (CXL) */ /* * Devices marked being untrusted are the ones that can potentially * execute DMA attacks and similar. They are typically connected @@ -743,6 +744,9 @@ static inline bool pci_is_vga(struct pci_dev *pdev) return false; } +#define pcie_is_cxl(dev) (dev->is_cxl) +bool pcie_is_cxl_port(struct pci_dev *dev); + #define for_each_pci_bridge(dev, bus) \ list_for_each_entry(dev, &bus->devices, bus_list) \ if (!pci_is_bridge(dev)) {} else diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h index 12323b3334a9..5df6c74963c5 100644 --- a/include/uapi/linux/pci_regs.h +++ b/include/uapi/linux/pci_regs.h @@ -1186,9 +1186,10 @@ #define PCI_DOE_DATA_OBJECT_DISC_RSP_3_PROTOCOL 0x00ff0000 #define PCI_DOE_DATA_OBJECT_DISC_RSP_3_NEXT_INDEX 0xff000000 -/* Compute Express Link (CXL r3.1, sec 8.1.5) */ +/* Compute Express Link (CXL r3.1, sec 8.1) */ #define PCI_DVSEC_CXL_PORT 3 #define PCI_DVSEC_CXL_PORT_CTL 0x0c #define PCI_DVSEC_CXL_PORT_CTL_UNMASK_SBR 0x00000001 +#define PCI_DVSEC_CXL_FLEXBUS 7 #endif /* LINUX_PCI_REGS_H */ From patchwork Wed Dec 11 23:39:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 13904451 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2051.outbound.protection.outlook.com [40.107.92.51]) (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 0C07D17838C; Wed, 11 Dec 2024 23:40:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.51 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960459; cv=fail; b=DHj7HttY8pSy6dJTJTZ3iD1B3rCty8Y4/O5CiOnYsoQRHniEkwrjIlmPfXpEp5WR0cb4UOLQdojhhRWAUvbtVSEUNQwanTReK4D1fE2KWtqyjEkBeTnl7rRuUiQ94kaboQhdjmwZVs7klj4wMPHDn52sybgU5qUnk6QQS9nPnBk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960459; c=relaxed/simple; bh=ZBuUM8SG5EdLQJ2R5ge9rgup/R7vP3IVYoZDdFBnqqI=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tYhVTAH6VWO7oMUEMWFPfDbQX4D1P+C2uT20xXiMslkDy+H7LGFw07Im7eJJhEDYRD8D/G70synA5zHek7/gw2EkqchcRAAoYvaO/+z1LNAsWSSLWsqlsnBGbkWckiCaLhy21P3t9n86oZS2o09bLC3lPP3azr2XUlOfl4EKO8Y= 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=bx+m4BqY; arc=fail smtp.client-ip=40.107.92.51 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="bx+m4BqY" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ju/TVLuQtpzGprUNHdpOHChcn9u9PRCZi6AtY2LKfxs0pxtKGxgsZCZuFgghoIXpUoRhN34NM1LYWV8n5813Q0cj4iJVVG7cKaCS8HTu1NU39SF1ifWUGJh3iKWIQOwKhqo20hkaRcqhG9lyOdjQuuvLEZ96J2uIbg/cShCEmVT/DlxhCxxZmTiL2kVHZYFMYp5mB/T9k5f+WntPqJT86O2A9pCrjz7rPpAvn9mhWK4gHIJj+uZoGtsH2CgGIatWacnds1hmmOLZggJG4ptLb4mOyF053HmP4SA26Aa/z3zp00A6S3IdoxDGjsDX0xkBkZaDesaauPOoLBeeXD6z4A== 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=xABIalKPiUbSakFCC0gi1+YWxkSsqB+qdVXHkyN1Y7I=; b=w021Mj2Xfk/KxTSmESPIkZiCkmuqf2BQPpF0ujFR7VCLEnzGovejUx4i6U0UOMWilmeBRoYfZTGGaEJJWG/tfMC6VgmV6rYIyK7Yiky9h2T4+NsCz/eLhVBERDm/QAfhoFPrRtUKp+X+ADggOamdHkRzN4fid7v4oLIA8AslodTgGE51dLUehOXDcAbutk8zWgaqF5vwNZTdzOSXwIg56Ot2N1dFyMwjrWeUYpaIv3rRUgZ+sBS5AGqYQLw2rHc/0RwHTTJ9SBopPuyosIMcZ/mQW/B19bcpFoF6Gbacjd7DfZERsIDAEfNT5JaZuLqKtflNLZKVEkpVIn9nWzoPig== 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=xABIalKPiUbSakFCC0gi1+YWxkSsqB+qdVXHkyN1Y7I=; b=bx+m4BqYL3utxb+Lqx9l7I4nnzEOXYgxiywwlRAmfyY6nB7fOdqvX+WKLSQUpzI9JW+Iflwg+4Z6EQ7vDaFyqV/sIsAjTJN1PcTOKGI+QcdioBdWbRwazPUhbwsWRhIUOmUXHwzuwGoGL+AR/fWw8gOVmN8r34tMsZIa1kTF1M0= Received: from MN2PR14CA0009.namprd14.prod.outlook.com (2603:10b6:208:23e::14) by SN7PR12MB7955.namprd12.prod.outlook.com (2603:10b6:806:34d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.16; Wed, 11 Dec 2024 23:40:53 +0000 Received: from BN2PEPF0000449D.namprd02.prod.outlook.com (2603:10b6:208:23e:cafe::bd) by MN2PR14CA0009.outlook.office365.com (2603:10b6:208:23e::14) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.14 via Frontend Transport; Wed, 11 Dec 2024 23:40:53 +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 BN2PEPF0000449D.mail.protection.outlook.com (10.167.243.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Wed, 11 Dec 2024 23:40:53 +0000 Received: from ethanolx7ea3host.amd.com (10.180.168.240) 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; Wed, 11 Dec 2024 17:40:51 -0600 From: Terry Bowman To: , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v4 04/15] PCI/AER: Modify AER driver logging to report CXL or PCIe bus error type Date: Wed, 11 Dec 2024 17:39:51 -0600 Message-ID: <20241211234002.3728674-5-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241211234002.3728674-1-terry.bowman@amd.com> References: <20241211234002.3728674-1-terry.bowman@amd.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF0000449D:EE_|SN7PR12MB7955:EE_ X-MS-Office365-Filtering-Correlation-Id: f9c6d093-c8a5-46e1-02b9-08dd1a3d407f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|7416014|82310400026|921020; X-Microsoft-Antispam-Message-Info: jyvWh1NHSfpY6V/GOTq4qRo4uxOxloNlPaPhgSrRLwkYkgBOGYnc3asT5DDlrS/al4O08i/TXvoMKzhVNDdg3aj+CfyoYgjUVFh8QlqN5axLwY0ay9HYMhZtuC2AzNHMzhlNrM9Qr5t5CbiLFKeeC96DM43VFUsDrcPpYGvg7UZ5K2pLnPsItOMMWrGPLB9qpOpWf/+rp9lL38cUaepKOhjZoMn39qz7p8VOHP2i6ECwjub3ah/cCIrBsbUHWWmUL9L9kQpx9p9kQ+0bfJ2ylD7FdzRwS6/UN3C7eh2+dfLAkYGb0tiZDALEyIoPigd5XZH6kOZ1FYYpwmCTOvQx44x3Eo42DUh4IXKpaTp+dkvC31Imv0apmimQjQ1FQPfoBAjrmtq4EzxebHtAKAYysLIaITcdoN8bdM0g5PDYh1u/l6Q8T6zz6wxB09CgneFLx5zuLMAjsRkhiH8cnEsGJOO72DF8K30IDRKTeIoFxuhr4NJ94iW1UlAT4w9Y696OdUfIYgpHpnoUOESW0kZnnBoER66HZktCScyusucB61N7shoJbZHlTlm0xIBW7lw5ZOj43/lOYra5LeXBlHPad7QBwW1VRcKtcnq+9gaEHBOjRh0IIoBa1SkAmPJp9kd2JXFveFHWurGoG2eiVfhJONk+0die8YqXywoMJv0/xQ5PMpHYb1FtCZ5JalbicFv4g2dqMtUPlK+q5IJi5I651Q2E+LSTSkOSAiG+6RxmJX80ZRB4W14g9CtoUKLfy+hu0R7EdEOk85/AWeWi0UvwTFIcN3fYo+vm50xLxyYHFEpV8RiGOF+rCphyF70g7uajbVVkyx4HMJyF+9L8rYDSCPMUBpjHEjtPEpJBd9x2tnIkmSoSyozh9GYn1ho+VQfMdEJzYuAgkn5HacDz/4roYUV2VVjvV11/v6VT5J9DJQIq7go/+XRxvzF3u72BpbuPGfmoHPgLo0b8Z+WP69p4WCceiQwLrEeXmjHdyY8GLwSrPPbVXMJyi+0j6BNtBZZsKYCabzhiOCalQCXUunGhdqA9hulBJB2szA1L/kKI08vexXlLIWJe8lejnwWm/VDgu/eMx2z5yrB9ENcNmw6LOiKCVrdjMzPgd5M1H0DMbIcJLzIr4txesovPm5E57tf9C+CqtYjZPI/3Hg3IPd8eLumIFA+NQ85g7JGkH+YVTf7iYniUF/wnriTdpKUDK+Rs7ZXgGV2fvsR9pNZYykCdkhAF+VsamGWGubBeP4jYTtNI81oXYI7lDpA1ZhgzPYungqxbCzG13xFP6+l3DEVkmklsy8W6lboFzmonJtI1v33VoYvex3ibI5FG0n1ZcH570z55KtPmwr8yc9kIjyx/5RYSihvIPEodVUWquOcFSsM1Kwqe1uXV2x2fA8MSdj8FSn84fxGqG3hkuHxW/RD+5ldliJEnmF0GPfoP5pdXhkAAq9WSwg32vxufKPjd9QVLmSR/bRMzmoPZEuxTzpuDYA== 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)(376014)(7416014)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2024 23:40:53.3246 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f9c6d093-c8a5-46e1-02b9-08dd1a3d407f 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: BN2PEPF0000449D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7955 The AER driver and aer_event tracing currently log 'PCIe Bus Type' for all errors. Update the driver and aer_event tracing to log 'CXL Bus Type' for CXL device errors. Signed-off-by: Terry Bowman Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang Reviewed-by: Fan Ni --- drivers/pci/pcie/aer.c | 14 ++++++++------ include/ras/ras_event.h | 9 ++++++--- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index fe6edf26279e..53e9a11f6c0f 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -699,13 +699,14 @@ static void __aer_print_error(struct pci_dev *dev, void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) { + const char *bus_type = pcie_is_cxl(dev) ? "CXL" : "PCIe"; int layer, agent; int id = pci_dev_id(dev); const char *level; if (!info->status) { - pci_err(dev, "PCIe Bus Error: severity=%s, type=Inaccessible, (Unregistered Agent ID)\n", - aer_error_severity_string[info->severity]); + pci_err(dev, "%s Bus Error: severity=%s, type=Inaccessible, (Unregistered Agent ID)\n", + bus_type, aer_error_severity_string[info->severity]); goto out; } @@ -714,8 +715,8 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) level = (info->severity == AER_CORRECTABLE) ? KERN_WARNING : KERN_ERR; - pci_printk(level, dev, "PCIe Bus Error: severity=%s, type=%s, (%s)\n", - aer_error_severity_string[info->severity], + pci_printk(level, dev, "%s Bus Error: severity=%s, type=%s, (%s)\n", + bus_type, aer_error_severity_string[info->severity], aer_error_layer[layer], aer_agent_string[agent]); pci_printk(level, dev, " device [%04x:%04x] error status/mask=%08x/%08x\n", @@ -730,7 +731,7 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) if (info->id && info->error_dev_num > 1 && info->id == id) pci_err(dev, " Error of this Agent is reported first\n"); - trace_aer_event(dev_name(&dev->dev), (info->status & ~info->mask), + trace_aer_event(dev_name(&dev->dev), bus_type, (info->status & ~info->mask), info->severity, info->tlp_header_valid, &info->tlp); } @@ -764,6 +765,7 @@ EXPORT_SYMBOL_GPL(cper_severity_to_aer); void pci_print_aer(struct pci_dev *dev, int aer_severity, struct aer_capability_regs *aer) { + const char *bus_type = pcie_is_cxl(dev) ? "CXL" : "PCIe"; int layer, agent, tlp_header_valid = 0; u32 status, mask; struct aer_err_info info; @@ -798,7 +800,7 @@ void pci_print_aer(struct pci_dev *dev, int aer_severity, if (tlp_header_valid) __print_tlp_header(dev, &aer->header_log); - trace_aer_event(dev_name(&dev->dev), (status & ~mask), + trace_aer_event(dev_name(&dev->dev), bus_type, (status & ~mask), aer_severity, tlp_header_valid, &aer->header_log); } EXPORT_SYMBOL_NS_GPL(pci_print_aer, CXL); diff --git a/include/ras/ras_event.h b/include/ras/ras_event.h index e5f7ee0864e7..1bf8e7050ba8 100644 --- a/include/ras/ras_event.h +++ b/include/ras/ras_event.h @@ -297,15 +297,17 @@ TRACE_EVENT(non_standard_event, TRACE_EVENT(aer_event, TP_PROTO(const char *dev_name, + const char *bus_type, const u32 status, const u8 severity, const u8 tlp_header_valid, struct pcie_tlp_log *tlp), - TP_ARGS(dev_name, status, severity, tlp_header_valid, tlp), + TP_ARGS(dev_name, bus_type, status, severity, tlp_header_valid, tlp), TP_STRUCT__entry( __string( dev_name, dev_name ) + __string( bus_type, bus_type ) __field( u32, status ) __field( u8, severity ) __field( u8, tlp_header_valid) @@ -314,6 +316,7 @@ TRACE_EVENT(aer_event, TP_fast_assign( __assign_str(dev_name); + __assign_str(bus_type); __entry->status = status; __entry->severity = severity; __entry->tlp_header_valid = tlp_header_valid; @@ -325,8 +328,8 @@ TRACE_EVENT(aer_event, } ), - TP_printk("%s PCIe Bus Error: severity=%s, %s, TLP Header=%s\n", - __get_str(dev_name), + TP_printk("%s %s Bus Error: severity=%s, %s, TLP Header=%s\n", + __get_str(dev_name), __get_str(bus_type), __entry->severity == AER_CORRECTABLE ? "Corrected" : __entry->severity == AER_FATAL ? "Fatal" : "Uncorrected, non-fatal", From patchwork Wed Dec 11 23:39:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 13904452 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2051.outbound.protection.outlook.com [40.107.212.51]) (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 52DCF1C173C; Wed, 11 Dec 2024 23:41:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.51 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960470; cv=fail; b=ImhnVivAbma7ZKilw71PqRH+qgyErh74iIXm1fzNlTj7oU6RXAZ3mjDWQEnLyVskWcQ3M47tAq6MkCK/bw7nNwme+H0xl2nA1kTk5yEC5tIWq7eBgtWFsxMK23zSiTIWbII4mbnjSgx/j4ehADqisV2uZijRodYXy1jIZXm2dN4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960470; c=relaxed/simple; bh=rkCgeRnhngSVlNm5OQKkMQdh0HaT9H0fn3si2Ifmkaw=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Bf4b/CFRhNF1exqPJ1PfFpQgmtAohgbF74wHk9C7pRIXHhMmBVzJIT5CXZ+qEirYKZi6LpQO2bUoqujtvgiJHPmIDbBakrP9x/Uc72FgU4cItfL4yhL4uey4KyJ2vq9uEwG7+RWaxKb6jkx48zE27Oo7+dIYYzoYn6tQQZicYX8= 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=2oBJ4hEN; arc=fail smtp.client-ip=40.107.212.51 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="2oBJ4hEN" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pMOdTZaWER15Se+cfvHYXj2nC6d/VEAE62Q4saTwrHgCPYyH83bXYDpMffEnIwGTx2rzlFSEcoe5ZnZRxgfunEj6lQVwNN2KS0pI/BZXEXDU1TIsIw+hYgMlLJsY+TS/Jq9Rf3D9g5eLej5Auwb9N+mFzWS2q+zQ32B8jZ/YR/kC0WHWpBGdQn1BaAYn9PhscwKSkVbT483Nu80K3+QGJmXmYUrpzcK8zJA9u7Ip+tKMBAG5BKUvVOpnh2z7b0il/HdcM4kqunTObv2Oj0sybQA4ktMs0o2aWAeLIRQ79pYUSAObwIqKGtlLaeDCehHWBkZ9SgWWlC0EW+A49VkgIA== 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=crcsOxq9A60Azlh321bwmCr3DOIcG8bPM2grnLtn0xE=; b=wHdiH4C5W1wU5XVxSKN9vVZk6u3OtZVC92sE7Nks30ttGUDLb2eU/gDO92YmL0zuIPCe2TMgPtMHJlL38RKrMcr/6roBEDIO1peC1D1q/7gGF/wTZheoVKxphOQDe5LDYvOau/Hca67fYhOJLo3SF9Q24T1EfpEJ+8lfwZGT+jw9zkuYwUhsvrikRimiU6tl8tD8XU8+4lxtu7YrXlme5XZA6oPu0jGKY9n8IZh/lewejsaOCdGt7wJM0MgIxHbsxcVY8WB972dYnQJUtPcqv9pPjbqT/FFV3/Dgq3rv8nHw++fIEoCDmy9raP4Davc0QdQpzKsysxGfXXfXAFMpcg== 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=crcsOxq9A60Azlh321bwmCr3DOIcG8bPM2grnLtn0xE=; b=2oBJ4hENtgw0keNWbQSl+zWV/P8wJrwJBsm+jw0sALuuZWLCS/gogWce3daZlSSMcUzhSSp1WOp2tYAoFP9bgwCZd3XjYdjU9waklfz0eGAwgEQfyR5Ov3lhieIEuPbr2P0RLMIdWYTg8J++PjMVBdCFVN8AMuivgADLGiaKhGk= Received: from BN1PR10CA0002.namprd10.prod.outlook.com (2603:10b6:408:e0::7) by MW3PR12MB4427.namprd12.prod.outlook.com (2603:10b6:303:52::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.18; Wed, 11 Dec 2024 23:41:04 +0000 Received: from BN2PEPF0000449F.namprd02.prod.outlook.com (2603:10b6:408:e0:cafe::50) by BN1PR10CA0002.outlook.office365.com (2603:10b6:408:e0::7) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.15 via Frontend Transport; Wed, 11 Dec 2024 23:41: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 BN2PEPF0000449F.mail.protection.outlook.com (10.167.243.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Wed, 11 Dec 2024 23:41:04 +0000 Received: from ethanolx7ea3host.amd.com (10.180.168.240) 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; Wed, 11 Dec 2024 17:41:03 -0600 From: Terry Bowman To: , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v4 05/15] PCI/AER: Add CXL PCIe Port correctable error support in AER service driver Date: Wed, 11 Dec 2024 17:39:52 -0600 Message-ID: <20241211234002.3728674-6-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241211234002.3728674-1-terry.bowman@amd.com> References: <20241211234002.3728674-1-terry.bowman@amd.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF0000449F:EE_|MW3PR12MB4427:EE_ X-MS-Office365-Filtering-Correlation-Id: f7f0b816-6113-4989-6277-08dd1a3d46f8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|36860700013|82310400026|921020; X-Microsoft-Antispam-Message-Info: /7wrMf+eTw2bAgzGBoZht1hm0+Cl4fsMOuiT53ouYI3aqII7vfkBKQ5/gJ7/WNuW4BzEk+DBjyqYniz+clVjzlEppAHe8UHjVYyR2SIBpEpnKbagcFcAyH0Mc7PNBLTQ8jHy/He7xYcAdo7G03hQvmhGzzJL6gfroA/2fXv1Rt0+IlQWWazvbwAcCsztbmtpKou/fyw/la0PQZKUcbX6XvVpIUkRlVfjz1MdITgv2/5O5lpIhstXW9TElBPsjo2zrq2eVxay0ifkSZumOw0H3jCs0/yJXBzIRG2nK8CJ9pasn2YJa+utxz2KT9vIAqw/0S6/sBjnowNYv393kx82qbhszgtMbFPHLaIgzobOVCNbsTexXv8EnWX4J2TAEUYentYvrokfSNz2n9zWsynLCA3erFfD3nzl1feoVneaBUHucDb9B3aWAlTYN4RjbZ4qTts5LYWG8w2C/Ong00wWOMMJydM1pNrlPP4Www9ljmjSrgMqZEF15hoXtvonmb9tLAGNOg4o5Y37qk/rVMIJVs88VFA13SqsqVDomWRY5hQEzVZk0kzRGjUpvZGOb9E6eVECTjU3JkBIobVzO7BVEAlr7SdPEcq/lHI02jJwBVRW1Z0wcG1/1ZAUErKwJ2koGG+DN1YyCSdPStAd90Tk+vWL7d2NZjgbM6LDmQlHh16bpF5HYUwODCMgwmnV3JiRoqHxLuUbNHAabGsTi9Jfv6t5DFHWXHS1b/L6Vemxl6whLQZSfYZdL9MFsKneVWkm3xvu41hRN1Z9tfwWvJ7pr0VcOFIebvBkn3j6yz1mTIN0+Scho/WDoXVp+M4vX/osi2I7R8BxIBZyAN3fkk9o8SX271ju7TszDZxwnijl3KXNj/YKRWsBUoFF8F27FZqx8rM4uzdAAyaE7mywM3sU4yVCF2qaUfzrbZdtfmoEj8Yo7qLO81mK2CUSWx5L8YFuwZq7L0LsvsYaBCmNV+NJQAceMh01uWFwsAiPjNyO9+UkgEbnB4ph3bPrDfK+CoDqznvADfRhlWLxfeWPOYwoYgCDuhLjgQW4mSywFrDT7x932tfJzcsCRM62heveVwYOzB/pKPz3tINMDEptB5WYWwQbIPidWLCyqsrdpIVrvurhuhRc+fMNr7Xc7p2iTOKGnQ+asQe8mPgvByVWjDOKtYDWjHK/iuKlNswaVkx7DYmrAH0bz4Mnktg7tBPioBYBoUdOdb0myr4k0zUd2/P5KSCexKfs153oYIcvMHP/NI6zNtCtyd5DXQ674E/X/z1fPucHYvlRcxvUHYmjpDgt10MDa4Qv864ghQ1gFM4pv6ATEmEisAxbSTUTxbR6E/rRGfgz2OkcMB2mS4wrvQZnzzniyoHVjLjwNJjDwD+rffFo3o8Dc6GLIx/lXWCI4Y5cDGDBS0Y+lho+eLgy/nZB3f69/4642gwsG44JLSFnj13pldMZ/uYavLtAuSMEa8Nm7gVQ1iw9+PWG73Yu+zgcmA== 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)(376014)(7416014)(1800799024)(36860700013)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2024 23:41:04.1863 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f7f0b816-6113-4989-6277-08dd1a3d46f8 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: BN2PEPF0000449F.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4427 The AER service driver supports handling Downstream Port protocol errors in restricted CXL host (RCH) mode also known as CXL1.1. It needs the same functionality for CXL PCIe Ports operating in virtual hierarchy (VH) mode.[1] CXL and PCIe protocol error handling have different requirements that necessitate a separate handling path. The AER service driver may try to recover PCIe uncorrectable non-fatal errors (UCE). The same recovery is not suitable for CXL PCIe Port devices because of potential for system memory corruption. Instead, CXL protocol error handling must use a kernel panic in the case of a fatal or non-fatal UCE. The AER driver's PCIe error handling does not panic the kernel in response to a UCE. Introduce a separate path for CXL protocol error handling in the AER service driver. This will allow CXL protocol errors to use CXL specific handling instead of PCIe handling. Add the CXL specific changes without affecting or adding functionality in the PCIe handling. Make this update alongside the existing Downstream Port RCH error handling logic, extending support to CXL PCIe Ports in VH mode. is_internal_error() is currently limited by CONFIG_PCIEAER_CXL kernel config. Update is_internal_error()'s function declaration such that it is always available regardless if CONFIG_PCIEAER_CXL kernel config is enabled or disabled. The uncorrectable error (UCE) handling will be added in a future patch. [1] CXL 3.1 Spec, 12.2.2 CXL Root Ports, Downstream Switch Ports, and Upstream Switch Ports Signed-off-by: Terry Bowman Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang --- drivers/pci/pcie/aer.c | 61 +++++++++++++++++++++++++++--------------- 1 file changed, 40 insertions(+), 21 deletions(-) diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index 53e9a11f6c0f..d75886174969 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -941,8 +941,15 @@ static bool find_source_device(struct pci_dev *parent, return true; } -#ifdef CONFIG_PCIEAER_CXL +static bool is_internal_error(struct aer_err_info *info) +{ + if (info->severity == AER_CORRECTABLE) + return info->status & PCI_ERR_COR_INTERNAL; + return info->status & PCI_ERR_UNC_INTN; +} + +#ifdef CONFIG_PCIEAER_CXL /** * pci_aer_unmask_internal_errors - unmask internal errors * @dev: pointer to the pcie_dev data structure @@ -994,14 +1001,6 @@ static bool cxl_error_is_native(struct pci_dev *dev) return (pcie_ports_native || host->native_aer); } -static bool is_internal_error(struct aer_err_info *info) -{ - if (info->severity == AER_CORRECTABLE) - return info->status & PCI_ERR_COR_INTERNAL; - - return info->status & PCI_ERR_UNC_INTN; -} - static int cxl_rch_handle_error_iter(struct pci_dev *dev, void *data) { struct aer_err_info *info = (struct aer_err_info *)data; @@ -1033,14 +1032,23 @@ static int cxl_rch_handle_error_iter(struct pci_dev *dev, void *data) static void cxl_handle_error(struct pci_dev *dev, struct aer_err_info *info) { - /* - * Internal errors of an RCEC indicate an AER error in an - * RCH's downstream port. Check and handle them in the CXL.mem - * device driver. - */ - if (pci_pcie_type(dev) == PCI_EXP_TYPE_RC_EC && - is_internal_error(info)) - pcie_walk_rcec(dev, cxl_rch_handle_error_iter, info); + if (pci_pcie_type(dev) == PCI_EXP_TYPE_RC_EC) + return pcie_walk_rcec(dev, cxl_rch_handle_error_iter, info); + + if (info->severity == AER_CORRECTABLE) { + struct pci_driver *pdrv = dev->driver; + int aer = dev->aer_cap; + + if (aer) + pci_write_config_dword(dev, aer + PCI_ERR_COR_STATUS, + info->status); + + if (pdrv && pdrv->cxl_err_handler && + pdrv->cxl_err_handler->cor_error_detected) + pdrv->cxl_err_handler->cor_error_detected(dev); + + pcie_clear_device_status(dev); + } } static int handles_cxl_error_iter(struct pci_dev *dev, void *data) @@ -1058,9 +1066,13 @@ static bool handles_cxl_errors(struct pci_dev *dev) { bool handles_cxl = false; - if (pci_pcie_type(dev) == PCI_EXP_TYPE_RC_EC && - pcie_aer_is_native(dev)) + if (!pcie_aer_is_native(dev)) + return false; + + if (pci_pcie_type(dev) == PCI_EXP_TYPE_RC_EC) pcie_walk_rcec(dev, handles_cxl_error_iter, &handles_cxl); + else + handles_cxl = pcie_is_cxl_port(dev); return handles_cxl; } @@ -1078,6 +1090,10 @@ static void cxl_enable_internal_errors(struct pci_dev *dev) static inline void cxl_enable_internal_errors(struct pci_dev *dev) { } static inline void cxl_handle_error(struct pci_dev *dev, struct aer_err_info *info) { } +static bool handles_cxl_errors(struct pci_dev *dev) +{ + return false; +} #endif /** @@ -1115,8 +1131,11 @@ static void pci_aer_handle_error(struct pci_dev *dev, struct aer_err_info *info) static void handle_error_source(struct pci_dev *dev, struct aer_err_info *info) { - cxl_handle_error(dev, info); - pci_aer_handle_error(dev, info); + if (is_internal_error(info) && handles_cxl_errors(dev)) + cxl_handle_error(dev, info); + else + pci_aer_handle_error(dev, info); + pci_dev_put(dev); } From patchwork Wed Dec 11 23:39:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 13904453 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2085.outbound.protection.outlook.com [40.107.237.85]) (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 EDED81F37A0; Wed, 11 Dec 2024 23:41:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960482; cv=fail; b=aU8DeNTLsE9u3ZtEihOXX8GGAu46WbQQtpAeE2+FfxNTPN50RwTA3kI2UFXXe9/HT0xswQfp3pBo/mqW1b3dp/DkEqq3kQ1+Bhb2nPyaA1jJvWN3c06F76Mqb6ScOxIFX2B44hDXqxgyAPA4NVeWsv+2C2h7wg314Dc40mHRh18= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960482; c=relaxed/simple; bh=4xy79RvMUBTSuuqkSgmoDFbN2MhKV7BM8fw6S2gWZcI=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=B3I5NLno13xnxeeDCxOLzvkAM0OA31z8H6mJyvGTt5rtuHGeTi1I4gp/ocNS51TSGAClzK2OzCk/gKLPNBvTjXGhYK79xnpWMPCTBE4UjSNA4xXuEoi7hA9Lr0jEgvrxDuKw7kV9L7yJ9hkf+ppK9BlfgPySILLDgNm3/Immiw4= 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=PalfcSEy; arc=fail smtp.client-ip=40.107.237.85 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="PalfcSEy" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CsYR2gHRa9Xoec2ukZeX7HkEQYcH9vpdRfWVIsaJOBCFJj0nvc09QaJekAUAw3nHjvk+gBACB4Qnt+IzvgWLciuQWfJ5B9FkETAt4ZQlrSfg5/OaG+iNeVcGKiMAkwjWeZINurn7MKz6HMMjOq1zao6jXzaJ5C5BbYmNpIYbBtuhQVkBegb91p6NxWtKS06kRsunfKZFM0NXt05l/zMXDYhEbYDQsGHR+HSeOxlUcIA+1HUAgUi4KgoWGUiuQh8cZ31NjKF5kHW+rSLqFiqOapuwme3QkK2QVhLYLNIhCkdxCWlIv/pPW4p3+VPvRnPbGfqZD6TEQsb5GwBXQcdJXw== 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=Ec7aZQy4HhCIDEEOv/YdM1v3AL0Ausk68X92atOdWKQ=; b=YfObB0eirFFjNRIux3OXAYIgWj7o+jhFf7HWi1ba8ILPcmgfQdhWYpRh9XLcVtCv8ktHBUIpR90x1qtc1jBsP4TJcg9H+tB4kLaUiOgHK5VdZZgip1UJIjiDjUSIwHC5FHI6gOLku9D/HXfYDriGcLKtInjxiAI7Qq6DClT7yT/8n6pD1aPteWB3Stcto+hDqZ9k1r313sm4seaeEED5fJaFMu9wOmi3+itYFYjoFc5QAVaEFFMgGhAc8NYjov/EWkIbp1274amyOQgIKJZvUZpg63NN0GO3eQLSeLkWELp7ZoFmtTkYhLY4WxXLEkF3IkoOKFoJbYC1pjNqWziK2Q== 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=Ec7aZQy4HhCIDEEOv/YdM1v3AL0Ausk68X92atOdWKQ=; b=PalfcSEyv6MABjskYOrKLYA8P6E4A8dWOEevkRBgXh4KhJFo/N1Dw2MhLnV2TUTOMI+O+R8MgbghAJwJ/QThBwhw8wR6LzA5LGz5H6ZC7VdL5SWy9tEbIR0rraBXSRyS2+wvPziCm4vg2DGeMa8tiiXlXxn4SjXP1z/002F46LY= Received: from BN1PR10CA0017.namprd10.prod.outlook.com (2603:10b6:408:e0::22) by SA1PR12MB5613.namprd12.prod.outlook.com (2603:10b6:806:22b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.18; Wed, 11 Dec 2024 23:41:15 +0000 Received: from BN2PEPF0000449F.namprd02.prod.outlook.com (2603:10b6:408:e0:cafe::50) by BN1PR10CA0017.outlook.office365.com (2603:10b6:408:e0::22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.15 via Frontend Transport; Wed, 11 Dec 2024 23:41:15 +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 BN2PEPF0000449F.mail.protection.outlook.com (10.167.243.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Wed, 11 Dec 2024 23:41:15 +0000 Received: from ethanolx7ea3host.amd.com (10.180.168.240) 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; Wed, 11 Dec 2024 17:41:14 -0600 From: Terry Bowman To: , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v4 06/15] PCI/AER: Change AER driver to read UCE fatal status for all CXL PCIe Port devices Date: Wed, 11 Dec 2024 17:39:53 -0600 Message-ID: <20241211234002.3728674-7-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241211234002.3728674-1-terry.bowman@amd.com> References: <20241211234002.3728674-1-terry.bowman@amd.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF0000449F:EE_|SA1PR12MB5613:EE_ X-MS-Office365-Filtering-Correlation-Id: adf6eec0-1a6b-4ac4-78ed-08dd1a3d4d84 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|7416014|376014|1800799024|82310400026|921020; X-Microsoft-Antispam-Message-Info: rw7v9Gt3tr7H4g1L24wmAIH3aoWcT/bzag//m36sZjwCR4zyLkvI9qoIrfb43u+JqlWC6zT/62te6K49zBhD++ro/AzFI51r0YSvKS6o1QcZb2UQe1IvW1OwmbcecSt5IBYwBph2glNYCYyChaEwdkh4qQh8n2SRoVCRfFm50hhPDcCknmB7LErLnSkiQ6gjBmpv7/d+j/Rt5OxFytFQR0Yza39idjDxLXv8Era4YDKsBd2d1ZxS8YizpG1pm+VZSPLxsoa/DeyYRXcIyk88VYLN2lvDJAzy6xoKSZ9mn7o6fzxDZoi5I43pgghuLssoPKHF43t1OgAhjQ4nCgA04K1A9E0tfCce5krxexVx6Q0l5VPl3pQYh9LkGcP0FZinEvh+jCRsyDbt1+Mxp6x8IcOD3Q77OamLZLxi0KLQwuno2bhxSWnlTwuBPaw9H//7DbXkUhJNDGfYWa8GFHZA0T342pHLZ7wbuY7nFgl3yEsIEt6tzhz15y+7vkh0Fph+q6jQdptxqdV23eOqOTja/2X+Yc+1eg0P6559Y6sCtaPriDnsQdEHI7wAUbTIc5TVsXFzMicFyEtcPI4pg9C98e37aqVCLkmqB+LIXvenWFYQksl+FdvCrF5T3zYBYqQajX47F6HPoBooiDJM9oS4rEAYRKYsmzsThCE9mftk2kXRFoT6QSbHFPBkkwlWiQSBbkqY23aa7XayeGJuODdLn4IIQ+Bkb4pgpAd3tHDDiWS8j9m3KGIw4N01lv37+2Sbi3HOBH1dlvs1sMK/onObZE5Rqh4Kth9QhK5nT5PsrthXAyyZ8sbR9cezohpH7DrPpbgSaEjybV1fMaaMr3VacYlgc44sBxd2tC8H5DqK6+zTLApqCy+1Tpy7yf00zyForNExcW8/k/mLdcZVamYxtn2eWPPAHxutzwWfZrNfYtEpQf6bEbe3cgKBOez/v3m64mIExDGc6em4zKTEMaEUuu7F6GIKjoz2avTYzrJL/8KvubgOM+AjZqE1dVyVRqJNVK7e/lLQ/yv1MoAfWRW+903VzEx95qxpXsxkgydxqkAHsSbjd7lHbL2pHJmVdaYGEQJN+Vib5Qn4z66P7BptKSn8m5jWzxCnEtJD0K/pHifA9jBx14hmuV+onZnb4v02bgnvbOdZDU4sBP4242MMZnUpWCZMo8APohpPch2FAvUupEPWuZrsnq1VnvDhQonSYVZtxF1ynNTlufnbZiavvncCTtG6u7ZSqQU3IhAPsuQX6PUNoZcB/OyahXWsYQWaaVilfwCMR56mwHldCZ0oob5AHMQK8e68kuCg8clqo4Qu66ISEhxAMW/R/3iKSMVBb3A03u/EDfdX9/S7CMYG8Xfaya9hKdvbPrrPtQiSdK1W3hiZ8HuXA3hvkD2sg+wAqbT/PWBIztvWz8cKf+eA8tgk0BNtAOhf9rhgGV8AdMVCNa4uajUCCArVLfTuhl3gMpeOa//rA+NJl3R4eQuoiQ== 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)(36860700013)(7416014)(376014)(1800799024)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2024 23:41:15.1708 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: adf6eec0-1a6b-4ac4-78ed-08dd1a3d4d84 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: BN2PEPF0000449F.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB5613 The AER service driver's aer_get_device_error_info() function doesn't read uncorrectable (UCE) fatal error status from PCIe Upstream Port devices, including CXL Upstream Switch Ports. As a result, fatal errors are not logged or handled as needed for CXL PCIe Upstream Switch Port devices. Update the aer_get_device_error_info() function to read the UCE fatal status for all CXL PCIe devices. Make the change such that non-CXL devices are not affected. The fatal error status will be used in future patches implementing CXL PCIe Port uncorrectable error handling and logging. Signed-off-by: Terry Bowman --- drivers/pci/pcie/aer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index d75886174969..c1eb939c1cca 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -1250,7 +1250,8 @@ int aer_get_device_error_info(struct pci_dev *dev, struct aer_err_info *info) } else if (type == PCI_EXP_TYPE_ROOT_PORT || type == PCI_EXP_TYPE_RC_EC || type == PCI_EXP_TYPE_DOWNSTREAM || - info->severity == AER_NONFATAL) { + info->severity == AER_NONFATAL || + (pcie_is_cxl(dev) && type == PCI_EXP_TYPE_UPSTREAM)) { /* Link is still healthy for IO reads */ pci_read_config_dword(dev, aer + PCI_ERR_UNCOR_STATUS, From patchwork Wed Dec 11 23:39:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 13904454 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2086.outbound.protection.outlook.com [40.107.243.86]) (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 464F41F2C5D; Wed, 11 Dec 2024 23:41:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960492; cv=fail; b=SxH88HPBoFZVAyXso1KW92n5cfOvu1W3Yetf4IkMUQgTrwfcFJrUPlp50WPWCqJtrJFz0a0Sh658DaXtzbGR+eCvKETSNrxGl73u0s2H0CsNBTQvVyo1Brjp339WjnAySJ5zixRV1FixHZCXtASt4cDFAhjIJxBuVwqREl9V36M= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960492; c=relaxed/simple; bh=4DP2sKE8MMJlnRh1xHiQj/0zMxjVXGZQGxREotjQoJg=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bFb0sIyzb7fefsTXOHWAYvitstbQW2qH/oqtYLQ+TAc/drAl4klitdTUWpLpl5M6HM3AfWjtIX2sVVPJJ2EP1edQlTUwlW+AI92LJzbiKiIQOI+0+SqLEqFLsMRtjNyaM10AXkXEWRaFJ5weql77SddcokVHOmaCBSMP8nz5EEk= 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=wd/MtCHz; arc=fail smtp.client-ip=40.107.243.86 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="wd/MtCHz" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QsyUGemx9rs91ofG80CcXLKZ4om7bZFTMqWNGXCMEx8qn6ROuuGEWyi2kc2JxyM2DLULmkCd/RWomTFAo3i1kYxJZERMJ6KZ6ZXJGRi96J2qqRkbJSgkcAucC9bvvcHnv3bkytKmzkHNHOnfh/ff64jfS9bYosv8Ck+sPzDRgOEO7/aCrJDUvtLSolb7pv4aLA9diLH0Bgf5yeyofP1N82N/TMrISXJpH93oKyd8No26Kk9EC+UvTVzgPsNDaV7ZnmSHjxN/ZmLu72Ufd2fQelQLQXS8A3vJMJnVVSzAFzwTziq24IMDXAUykGpOxWJ/nnzz/ISEfwJ0A2mqM0cFJA== 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=Xxn2XskkBLk8N7BvLiL23tQLbCP/TSEdqj0j5KpGR+U=; b=s/17HqB1XA2cjtYbd+8tcZeG85ZCuzQCQsCPW6jn8uYlwRwzl848Uh/o1Xus1dQT3NCywTfxiLpVbroVAB0O/S4PooGpyi+tn+fPBUgopD4u5ZOZhgd5RGVaublbeSB2sWwHeLgK8zM+YYeoacE3J0oK+qlcrytGP/BVtJhGvXGcynwEOGzwSFVADyk1RNQ4y1zJi8zlZY0kSU8v54ZBM64GEI9E+y6x9ZEH6cEqgO4KPdD3Tr9sFgllcKQckPhsOxOaXAOsRFajH8H+VHUxVF8NAe/mtGA4+8rw1FpUZp9MAAEB6obld3XT3x7IQMNrDI59qLf3Z9FzkxhWGDX3Jw== 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=Xxn2XskkBLk8N7BvLiL23tQLbCP/TSEdqj0j5KpGR+U=; b=wd/MtCHzmKyHdovv04VDmoVkNKIbQWfEf9gtHNvHIImqBUebmzpBMI/HeKyXjFvRjDoRFvhAJFYknA1tDxJAxGz/3cA6qRHh4+ddna0Vv3PhVEM4mWLq1RQdUhuf9eHFMteqcNfMPLOlyb9m7+2ZgJOfQ2hBZAh9hIW0IeGir7Q= Received: from BN9PR03CA0764.namprd03.prod.outlook.com (2603:10b6:408:13a::19) by LV2PR12MB5918.namprd12.prod.outlook.com (2603:10b6:408:174::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.12; Wed, 11 Dec 2024 23:41:26 +0000 Received: from BN2PEPF000044A1.namprd02.prod.outlook.com (2603:10b6:408:13a:cafe::c9) by BN9PR03CA0764.outlook.office365.com (2603:10b6:408:13a::19) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.15 via Frontend Transport; Wed, 11 Dec 2024 23:41:26 +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 BN2PEPF000044A1.mail.protection.outlook.com (10.167.243.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Wed, 11 Dec 2024 23:41:26 +0000 Received: from ethanolx7ea3host.amd.com (10.180.168.240) 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; Wed, 11 Dec 2024 17:41:25 -0600 From: Terry Bowman To: , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v4 07/15] PCI/AER: Add CXL PCIe Port Uncorrectable Error recovery in AER service driver Date: Wed, 11 Dec 2024 17:39:54 -0600 Message-ID: <20241211234002.3728674-8-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241211234002.3728674-1-terry.bowman@amd.com> References: <20241211234002.3728674-1-terry.bowman@amd.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF000044A1:EE_|LV2PR12MB5918:EE_ X-MS-Office365-Filtering-Correlation-Id: eeb67c5c-42c2-4b66-0ef3-08dd1a3d5422 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|7416014|82310400026|376014|921020; X-Microsoft-Antispam-Message-Info: JaDcOCHfjsPVfvlnwCBm4Qp8Ebrj6j6vuxR2OHs1oNH1FtsLmx8PfJMjiHipGQSnOSN7HY8K/HiYbO0Kt7XEvggryrgMRoIsYRXlywSuCtJnx9y867w8/m/P1h57EynrmYPJO6utokT6v7V//r6IE5MeTLfPhr3NJDDFCCf6FgPnmFVNRdIO6vALu0V/MnPH8p31m8HZrijWkujEGf7dIGCsRuwdxTIjswpITHUNSBLnuhXJweiDxyzD2BJ/qBchx0ZwDXryQuG7twlSh6OHKXgJN8FEkKvAOGf5z8Oqc1Qo/GMbjgClX6GLqXV7ckAR4ELoXvRWLo0cne0/T5aEk+3MoJbfYaFxJLp51a/sZSk3P7KrdXB90gkEpeWgXQiZ775dMb58/kWJWfgYekMFW1bAWy7XrroeOGlT7tvdu+X/3VEwVvk1cc6LEWz3BzLiAXfErFsGu4Ad79ri0k1x4FfvmXpxQYEXwhFHqt+gonQ7x4J+/5+87ZUyrB9wDw9MoxQui2u/fcvqxm0TcyaYCYz2llClqNh50ZwTFWHlLZCxjw01wXYNgvBsX7b76HmAzUyVlnyWKjHKswYlR7FRCqo4oWGH5p7p5fJOuxOQuZBXCcHmKphAYBzXKVaCgA7RufVRmKEZuGTDuJl+uEaucRonVwZ33eoKE74F6d96Y68GMxPSsyB5k9evuFAJjYRYqT22eNEKl6ebWl6neLhtkxBd90QajgWHgjshqUKaaOPJVEXzoh7KyyGzrDvdy6bppV7vs9hbzkm7hd5xGYMF23F/c8Yw7fG3ww1V3TvfcZrg8Nulgn7GeLr41I1ocCLelkVJcNL4IDTsjIlCE/5mw35XfPCBiO5J5fKH0KPTpWNEPfvs2jEI5jAYTyinItr20QmAAoyCEb1iTT9+32wFsBGvJLVXysltP4Zt+ibc7TBfdmco0QFXFnIC2ZcQ3Fga4yRWnqkYbAvOKGB5enU/2uc/sHNpCDwaHA/4+80JuJ/oFHqR7bW0UHdOq5qVxO3WbQFkt/3oEDB+kMjmwmN44Qkfjhj2PnI0k/8UbljO4MhFqHWwX2Hmvw5UjDj4aCn30xNteJHggXFn9/IrNGKuK4ONrJz3EWuhIPGRZ4cgz2dXL+xwrKorSVc0m9lJQI2RekNkIT57XOnbXq7YUhFg19epqoAZjQQAydGPINave1JeXnq72RJyDZzjfBCCiZiTrxUNyhqMCnKHlIIIWze9aNcn25nkbpFPtc3yiuX4kHycX/3csz90NGDNVtAylMcWsgpaCVawke2ngSePlUGVVnn0R/+66nPYBdDr/K0jBS69TUkiAm+rQX2LogG4YgqV0tLHHZjNLfClpGQwBrNAuGOZPi8RVPA6l/MazTOffJEZOuoHCYopeAYrVrc88tE4/0oBV7ZCbl0MW6uZh2LS7Jo1Leanw+lYeHqzS4uQH/3LScckPXWMCm9QoS/zl/svco0LKMyGS11iud8H+5LPnw== 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)(36860700013)(1800799024)(7416014)(82310400026)(376014)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2024 23:41:26.2698 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eeb67c5c-42c2-4b66-0ef3-08dd1a3d5422 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: BN2PEPF000044A1.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR12MB5918 Existing recovery procedure for PCIe Uncorrectable Errors (UCE) does not apply to CXL devices. Recovery can not be used for CXL devices because of potential corruption on what can be system memory. Also, current PCIe UCE recovery, in the case of a Root Port (RP) or Downstream Switch Port (DSP), does not begin at the RP/DSP but begins at the first downstream device. This will miss handling CXL Protocol Errors in a CXL RP or DSP. A separate CXL recovery is needed because of the different handling requirements Add a new function, cxl_do_recovery() using the following. Add cxl_walk_bridge() to iterate the detected error's sub-topology. cxl_walk_bridge() is similar to pci_walk_bridge() but the CXL flavor will begin iteration at the RP or DSP rather than beginning at the first downstream device. Add cxl_report_error_detected() as an analog to report_error_detected(). It will call pci_driver::cxl_err_handlers for each iterated downstream device. The pci_driver::cxl_err_handler's UCE handler returns a boolean indicating if there was a UCE error detected during handling. cxl_do_recovery() uses the status from cxl_report_error_detected() to determine how to proceed. Non-fatal CXL UCE errors will be treated as fatal. If a UCE was present during handling then cxl_do_recovery() will kernel panic. Signed-off-by: Terry Bowman --- drivers/pci/pci.h | 3 +++ drivers/pci/pcie/aer.c | 4 ++++ drivers/pci/pcie/err.c | 54 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+) diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 14d00ce45bfa..5a67e41919d8 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -658,6 +658,9 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev, pci_channel_state_t state, pci_ers_result_t (*reset_subordinates)(struct pci_dev *pdev)); +/* CXL error reporting and handling */ +void cxl_do_recovery(struct pci_dev *dev); + bool pcie_wait_for_link(struct pci_dev *pdev, bool active); int pcie_retrain_link(struct pci_dev *pdev, bool use_lt); diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index c1eb939c1cca..861521872318 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -1024,6 +1024,8 @@ static int cxl_rch_handle_error_iter(struct pci_dev *dev, void *data) err_handler->error_detected(dev, pci_channel_io_normal); else if (info->severity == AER_FATAL) err_handler->error_detected(dev, pci_channel_io_frozen); + + cxl_do_recovery(dev); } out: device_unlock(&dev->dev); @@ -1048,6 +1050,8 @@ static void cxl_handle_error(struct pci_dev *dev, struct aer_err_info *info) pdrv->cxl_err_handler->cor_error_detected(dev); pcie_clear_device_status(dev); + } else { + cxl_do_recovery(dev); } } diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c index 31090770fffc..6f7cf5e0087f 100644 --- a/drivers/pci/pcie/err.c +++ b/drivers/pci/pcie/err.c @@ -276,3 +276,57 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev, return status; } + +static void cxl_walk_bridge(struct pci_dev *bridge, + int (*cb)(struct pci_dev *, void *), + void *userdata) +{ + bool *status = userdata; + + cb(bridge, status); + if (bridge->subordinate && !*status) + pci_walk_bus(bridge->subordinate, cb, status); +} + +static int cxl_report_error_detected(struct pci_dev *dev, void *data) +{ + struct pci_driver *pdrv = dev->driver; + bool *status = data; + + device_lock(&dev->dev); + if (pdrv && pdrv->cxl_err_handler && + pdrv->cxl_err_handler->error_detected) { + const struct cxl_error_handlers *cxl_err_handler = + pdrv->cxl_err_handler; + *status |= cxl_err_handler->error_detected(dev); + } + device_unlock(&dev->dev); + return *status; +} + +void cxl_do_recovery(struct pci_dev *dev) +{ + struct pci_host_bridge *host = pci_find_host_bridge(dev->bus); + int type = pci_pcie_type(dev); + struct pci_dev *bridge; + int status; + + if (type == PCI_EXP_TYPE_ROOT_PORT || + type == PCI_EXP_TYPE_DOWNSTREAM || + type == PCI_EXP_TYPE_UPSTREAM || + type == PCI_EXP_TYPE_ENDPOINT) + bridge = dev; + else + bridge = pci_upstream_bridge(dev); + + cxl_walk_bridge(bridge, cxl_report_error_detected, &status); + if (status) + panic("CXL cachemem error."); + + if (host->native_aer || pcie_ports_native) { + pcie_clear_device_status(dev); + pci_aer_clear_nonfatal_status(dev); + } + + pci_info(bridge, "CXL uncorrectable error.\n"); +} From patchwork Wed Dec 11 23:39:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 13904455 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2070.outbound.protection.outlook.com [40.107.102.70]) (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 9D8591F37A6; Wed, 11 Dec 2024 23:41:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.102.70 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960504; cv=fail; b=lXuMWTxxUeNSAfUa+iFi2v2+NDrIrH8BKxNdQU0EzJkrCLvpk/3fPMjVGXzaLHAg37lOVcw9rcmSyk3S5lAVv6dMJbZeMA1DGRTKAwdZpizDFj0U5DHVvdD1bKX9/qYgZekHQ1qorY2F/UNIpUKf/7+eUBPj6NSosu4LAq57kkg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960504; c=relaxed/simple; bh=oiXwLyPZJhvaulF6wrXqKz9z3JWnr7knYWLpCLRwZeY=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=b8SZRltcuybutfP5xKoIel4HGG9tQ0u0M7x2WDb5sybWEO0uW1RJPDRcDYfalJqB+qJGKV5xKv6UcyzGHsP85mqC0DjUngbAWBwC5A/IvzdrROw8vcurwEO4t+ZwGixp2QF8MCFA/Hsk7Dm/UN9RLoJ9G2O9awodT5bkmJYVA80= 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=QV/3LFcY; arc=fail smtp.client-ip=40.107.102.70 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="QV/3LFcY" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ffBoSKBj5zmedNfGl47gUEtNUTpTjYHms58bnUVWc06slcbMlhWqRgtbYzG0yjZXy5axg4d3RYuDGLXrOfxfVPEgjNNJ4tqoZbzkJrfsy5ayiCFfGvl/3aNNc63RbbbB4MXeRFyauMFX56cH4eh35Jbo2e0wL89ZwvcJF83eTFC/HUhWtqeRkbkIrRDNhqg1jJ2KNasin6BT3jFd1lzvhiTzky1rDfzqS9ABT1zNwxk/WiNUOwupWMYc5I3kQX5/SWFmiwqnu6mKswPlijlCfAtvcyTTyp02v41Kk0zSQU8FoTq+WKsDP5/YpHzHCQnAai6N1ukZUjk9FGXYHIkAKw== 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=2rFf6Uny1Z+OxZ0tUNapKapwPriwe4ZoZcpUh/xlrkE=; b=k9yLulDViqLS1/67fqAHAOcSvSRoYvGrtd88eQ05UYlf+08Dbr/s+o5cU4bILpjWYxCvxgl1cKZhXCOwEOTxzQ/vzeu0w3B/RV6WnkdMEk47PMjT2g5BMFz32hAod/h+tqKBfvGwdX6Ty5zAyTRwxHohWVhaxVTUX7eb2ZWNB4tKPPBkyR0EQ0yLdz9E7l8UL1m/+6eERbtMzWFxpy2yj2cVap72AIJFcf2v4cMnHwzp7XnLp49QjLXukezareJDyo6BU2ppY4EL2Vxz8CCJ7gk/kJRQCWwqhy7Cpa+TsQwD/gK9MKLHdVAWYq3TVuOXyeYmyCTZqXx1GGiF9i2hnw== 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=2rFf6Uny1Z+OxZ0tUNapKapwPriwe4ZoZcpUh/xlrkE=; b=QV/3LFcYB7DUFd4yrJ5IxPWS4OmqY6oHblSkL1tCwOIJv4VD7/FnqTDSKb/J1xHO2lr6RLvEfVa9GisO5EzXOFcneU3vwoEyQ81seo/pcNjtPdduK0Hcs2anYCcB43UJloBYYg9f6V4YMNEz7FqT5nt/K8T1iS8bEc4oc5y+XpI= Received: from BLAP220CA0019.NAMP220.PROD.OUTLOOK.COM (2603:10b6:208:32c::24) by IA1PR12MB8287.namprd12.prod.outlook.com (2603:10b6:208:3f5::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.16; Wed, 11 Dec 2024 23:41:37 +0000 Received: from BN2PEPF000044A4.namprd02.prod.outlook.com (2603:10b6:208:32c:cafe::20) by BLAP220CA0019.outlook.office365.com (2603:10b6:208:32c::24) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.14 via Frontend Transport; Wed, 11 Dec 2024 23:41:37 +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 BN2PEPF000044A4.mail.protection.outlook.com (10.167.243.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Wed, 11 Dec 2024 23:41:37 +0000 Received: from ethanolx7ea3host.amd.com (10.180.168.240) 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; Wed, 11 Dec 2024 17:41:36 -0600 From: Terry Bowman To: , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v4 08/15] cxl/pci: Map CXL PCIe Root Port and Downstream Switch Port RAS registers Date: Wed, 11 Dec 2024 17:39:55 -0600 Message-ID: <20241211234002.3728674-9-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241211234002.3728674-1-terry.bowman@amd.com> References: <20241211234002.3728674-1-terry.bowman@amd.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF000044A4:EE_|IA1PR12MB8287:EE_ X-MS-Office365-Filtering-Correlation-Id: 0bd2c84a-f225-47e3-e5e4-08dd1a3d5aa8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|1800799024|82310400026|36860700013|921020; X-Microsoft-Antispam-Message-Info: Rl1CP3YDpd339SptAjwCHHHUJxE1i8f/Fws4dZEorJzxKQLoAVRwTJsHPlKY9gSokzlJIjRXQ95Rcgr8y+TIl2q2JAXBK+WP7NKToUNPyxVRfctq9X+2AvKiCNqnnv8l1H4H1L0ekan6ucWsK2/ToZ+6ixBsiBrMqJkQVrn2Qx7/REcW6/360JKn3qpajd6dTBYE+tmKE4hWlLfcrK0FPz0FyWaTO906pxAu9mQynuBDqlNN/mWLP7OhDUhbYigdVrlz1ioN+z6gFKKVtYR6hIauBmVPEI/NLlKYiS1Z/uSQK8x6Hb2SHuSntpN0JDUGlE0wfXotrlWjceLU8J9uwLK6eCwtiuaoRPbgYCqnU2/fsuDhsoG4zOu5vep9v64W9EXIb8QHBLpCC2ylb6ZwBbk3lYjMpHTxZCLKsE0NL/09ZONWQVZonxZxjumJp5HdvZBkeMgK/xrzJJLYGeclubNBiaJ5Kx8IdFpYi10s4ResBnrpHCRBeER7y00DYxoFxhrkYG8rLQlF1GBwOuHMNzhgo1xeRw/flsGXYWmhwRrhcnisw55rpF+jIXmqRqASmeMBQWriw4BAita9aANF95n0HVgzqI4YlwWoswHp2vHHvaDZlm3tp7M8UzOw1aWefmQryTyedKnI8usoG7pbVeFm0NmUFbqRI9sbTRIpBSChJ+NbFKZVKi4pZpU7TIQxeNtyzpH1i43PkVvdhx4YxbV0tEgVkAgMHzJOfFMpD4cGB4E6FO/HST590H4KYsQEln4XUaP7ujxrPYrHXjIrbkCTe+fYCA9yaEKnWjrqVnNSXgr7ltKxX4BAOJ4aTVdXJi8jqH5YamxemLElooVOHozVsGlgxTjaKBixcXAHRe6HWoaAPY/xh0yZ2XCCrCp07wWf8CSEC1uAi8mY7+YqSUaVS2VmG1rjkEQBC/lmDmyEMMlkG5afAK+9lgeNXrZ0XDusg6kJ/fhJ8B7hxzUk3RH2siPyq4iwd95eg3gYk/aIpPMq5S+1nmda4ALFNe0A5FNURIHozjooQr7yKQ/QQeIs/bbHcDiOWbefxPPfnb8d8SWhMmk2UWXTxaQcBs74NmBRAKeKBvC4NpVHzL75I7nLXIyXNRDF87uC3o2cJuoZR6oKAupdctQi6TyfkyHn5K70JL2ONkMzmO+3D3USL30vfmwvZa2JSoJ80rWkCh4N/YO3RoujPDbcdocnukuOVubHIDNtB0eocPewl37n1njoKEZhi8i9dC341twu3EXbzTLtfJccJkVXb8ZVCBn4xgjYCcrr8xgRiTg5lrcuZ5NYjiJcWyDRVyFh2UIhT1rpZyzgHpE8OpSqY6iEeCzx03+NWSgNhj8bYHZb+SZE6lofnRxunI9N39czp3Lbamo0t69XxQ7kQ0jkAFILqxsl6n9w9BBeZCPd0oQU9PICVW0qhyWwGuAIMotDE2JzSUyen/4ebwnApOUdr8KEn6hejwdmOYJnSgGrZAPXvk/NNQ== 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)(7416014)(376014)(1800799024)(82310400026)(36860700013)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2024 23:41:37.2199 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0bd2c84a-f225-47e3-e5e4-08dd1a3d5aa8 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: BN2PEPF000044A4.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8287 The CXL mem driver (cxl_mem) currently maps and caches a pointer to RAS registers for the endpoint's Root Port. The same needs to be done for each of the CXL Downstream Switch Ports and CXL Root Ports found between the endpoint and CXL Host Bridge. Introduce cxl_init_ep_ports_aer() to be called for each CXL Port in the sub-topology between the endpoint and the CXL Host Bridge. This function will determine if there are CXL Downstream Switch Ports or CXL Root Ports associated with this Port. The same check will be added in the future for upstream switch ports. Move the RAS register map logic from cxl_dport_map_ras() into cxl_dport_init_ras_reporting(). This eliminates the need for the helper function, cxl_dport_map_ras(). cxl_init_ep_ports_aer() calls cxl_dport_init_ras_reporting() to map the RAS registers for CXL Downstream Switch Ports and CXL Root Ports. cxl_dport_init_ras_reporting() must check for previously mapped registers before mapping. This is necessary because endpoints under a CXL switch may share CXL Downstream Switch Ports or CXL Root Ports. Ensure the port registers are only mapped once. Signed-off-by: Terry Bowman Reviewed-by: Alejandro Lucero --- drivers/cxl/core/pci.c | 37 +++++++++++++++---------------------- drivers/cxl/cxl.h | 6 ++---- drivers/cxl/mem.c | 31 +++++++++++++++++++++++++++++-- 3 files changed, 46 insertions(+), 28 deletions(-) diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index 5b46bc46aaa9..8540d1fd2e25 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -749,18 +749,6 @@ static void cxl_dport_map_rch_aer(struct cxl_dport *dport) } } -static void cxl_dport_map_ras(struct cxl_dport *dport) -{ - struct cxl_register_map *map = &dport->reg_map; - struct device *dev = dport->dport_dev; - - if (!map->component_map.ras.valid) - dev_dbg(dev, "RAS registers not found\n"); - else if (cxl_map_component_regs(map, &dport->regs.component, - BIT(CXL_CM_CAP_CAP_ID_RAS))) - dev_dbg(dev, "Failed to map RAS capability.\n"); -} - static void cxl_disable_rch_root_ints(struct cxl_dport *dport) { void __iomem *aer_base = dport->regs.dport_aer; @@ -788,22 +776,27 @@ static void cxl_disable_rch_root_ints(struct cxl_dport *dport) /** * cxl_dport_init_ras_reporting - Setup CXL RAS report on this dport * @dport: the cxl_dport that needs to be initialized - * @host: host device for devm operations */ -void cxl_dport_init_ras_reporting(struct cxl_dport *dport, struct device *host) +void cxl_dport_init_ras_reporting(struct cxl_dport *dport) { - dport->reg_map.host = host; - cxl_dport_map_ras(dport); - - if (dport->rch) { - struct pci_host_bridge *host_bridge = to_pci_host_bridge(dport->dport_dev); - - if (!host_bridge->native_aer) - return; + struct device *dport_dev = dport->dport_dev; + struct pci_host_bridge *host_bridge = to_pci_host_bridge(dport_dev); + dport->reg_map.host = dport_dev; + if (dport->rch && host_bridge->native_aer) { cxl_dport_map_rch_aer(dport); cxl_disable_rch_root_ints(dport); } + + /* dport may have more than 1 downstream EP. Check if already mapped. */ + if (dport->regs.ras) + return; + + if (cxl_map_component_regs(&dport->reg_map, &dport->regs.component, + BIT(CXL_CM_CAP_CAP_ID_RAS))) { + dev_err(dport_dev, "Failed to map RAS capability.\n"); + return; + } } EXPORT_SYMBOL_NS_GPL(cxl_dport_init_ras_reporting, CXL); diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h index 5406e3ab3d4a..51acca3415b4 100644 --- a/drivers/cxl/cxl.h +++ b/drivers/cxl/cxl.h @@ -763,11 +763,9 @@ struct cxl_dport *devm_cxl_add_rch_dport(struct cxl_port *port, resource_size_t rcrb); #ifdef CONFIG_PCIEAER_CXL -void cxl_setup_parent_dport(struct device *host, struct cxl_dport *dport); -void cxl_dport_init_ras_reporting(struct cxl_dport *dport, struct device *host); +void cxl_dport_init_ras_reporting(struct cxl_dport *dport); #else -static inline void cxl_dport_init_ras_reporting(struct cxl_dport *dport, - struct device *host) { } +static inline void cxl_dport_init_ras_reporting(struct cxl_dport *dport) { } #endif struct cxl_decoder *to_cxl_decoder(struct device *dev); diff --git a/drivers/cxl/mem.c b/drivers/cxl/mem.c index a9fd5cd5a0d2..0ae89c9da71e 100644 --- a/drivers/cxl/mem.c +++ b/drivers/cxl/mem.c @@ -45,6 +45,31 @@ static int cxl_mem_dpa_show(struct seq_file *file, void *data) return 0; } +static bool dev_is_cxl_pci(struct device *dev, u32 pcie_type) +{ + struct pci_dev *pdev; + + if (!dev || !dev_is_pci(dev)) + return false; + + pdev = to_pci_dev(dev); + + return (pci_pcie_type(pdev) == pcie_type); +} + +static void cxl_init_ep_ports_aer(struct cxl_ep *ep) +{ + struct cxl_dport *dport = ep->dport; + + if (dport) { + struct device *dport_dev = dport->dport_dev; + + if (dev_is_cxl_pci(dport_dev, PCI_EXP_TYPE_DOWNSTREAM) || + dev_is_cxl_pci(dport_dev, PCI_EXP_TYPE_ROOT_PORT)) + cxl_dport_init_ras_reporting(dport); + } +} + static int devm_cxl_add_endpoint(struct device *host, struct cxl_memdev *cxlmd, struct cxl_dport *parent_dport) { @@ -52,6 +77,9 @@ static int devm_cxl_add_endpoint(struct device *host, struct cxl_memdev *cxlmd, struct cxl_port *endpoint, *iter, *down; int rc; + if (parent_dport->rch) + cxl_dport_init_ras_reporting(parent_dport); + /* * Now that the path to the root is established record all the * intervening ports in the chain. @@ -62,6 +90,7 @@ static int devm_cxl_add_endpoint(struct device *host, struct cxl_memdev *cxlmd, ep = cxl_ep_load(iter, cxlmd); ep->next = down; + cxl_init_ep_ports_aer(ep); } /* Note: endpoint port component registers are derived from @cxlds */ @@ -166,8 +195,6 @@ static int cxl_mem_probe(struct device *dev) else endpoint_parent = &parent_port->dev; - cxl_dport_init_ras_reporting(dport, dev); - scoped_guard(device, endpoint_parent) { if (!endpoint_parent->driver) { dev_err(dev, "CXL port topology %s not enabled\n", From patchwork Wed Dec 11 23:39:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 13904456 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2072.outbound.protection.outlook.com [40.107.223.72]) (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 D944F1F4E48; Wed, 11 Dec 2024 23:41:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960515; cv=fail; b=DW4vVUJI8PBlb/QHckfMa8ft9S3Feayfy7j6FD+bSzyQMYQ7imsz0PA6SUbydTR2H8pHb8R4WrvQzNRSXt9B2m/FPU2n6cjx5loOMAsoBl8xcdbtsoN++HxPEgLsKAGll41Ls3r50YakgupRn6/TcJvJS4WqM/sy1bHmmZAoTWI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960515; c=relaxed/simple; bh=LS726Kr6PYlyEh/1SDVT0wJ9nm1VPbiIG8vukmWhF6Q=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=q4kscndgHSm0S9TXvuV5ipAtogYkux9KdTKw3+GuxrH4px5R1yzyNKjyjD6NTTMNnJFkRfDKng7K3Ij3g745Vb8/CDK8ekdIirtti9iDP1PtvZPVdk/ZT5zG+Rw1wpjmWr1Kfjp7lpVUM6c0NXjWbsqQbarjdfJm+AgKCdQH37o= 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=K9EnAqxE; arc=fail smtp.client-ip=40.107.223.72 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="K9EnAqxE" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=OqH328/VXv7NCvesD4uWACy8x1A8Gzh14GJ55bNvLwT1n6JtL27hCh6PIOsxlxbGh4aaPuvJq3DPHvS3PlRXasa9JmwF+796g7aTeJHTi81Q5l/szp68T0WH3OlDBRJxbm4RkA8RVQJk6iB9VruuvuX3SB86bViEzvlucE7zLa5l/ekpcnmjJKICwMmqmD78Cjg318xtBr+JIZyuWcQv+6lE8bbtI5Ob/5ZelEsVEW6TNCAUhNc2vqf6ruoWW6/igdtGjqSH6yqQxK/XJXY+SaqaQI3nKve73VOISb9S7ujOruRV57OCQpIgMVcxZ4B7sa3ACU/2euZkryXEHnmfQQ== 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=8uQk5sE1gQAZVT4BOu/7WwDs/4GgHDzNFghqmAF4m/4=; b=aqBDcfA4qNrCWN1dUcC/hF1j1q09ybunLWolfbwWs16baXmk+dV5ly/6lxzw3xsfMDJ325l+QPq8el/frBJDNMJ33jlCgWOqF1XGMhpV/umz0Ng/+M5aaMGCqMPaaJ+/gKN5d4sH7kK7rBnWFP5eTOgjMNGQ60VwKqAZkhG6APCqH89tGFy9aa5OWwFqBCord1hzLCw7sTnpXUhsntgRg4VbvWLazCGHgMU89gSpG3p1EvcpIbCvTuXU81pVvQOo58Ft7BNrXcgHxACDI3YIaBm4Ijq9ClH5ePyzk3oBT+R9pJPb9DR9IOwMyAsje576eAeWFD7J+vbxWS2dvbbeIg== 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=8uQk5sE1gQAZVT4BOu/7WwDs/4GgHDzNFghqmAF4m/4=; b=K9EnAqxELB09ueL2tujuaIXzTayQr1vgH1LPor8NwUkeY/Ac3EKgro908iTz4vjdt8/f+KatEeFPZo+dZo++omBwPM/ShFnRLvagZ3feEw7LWHmuVR8uRzMHBQ19lJvLYxIaLJ0QijxAkQZ2eKRmMljqyrlE8Yd92xzdjctJ0mE= Received: from BLAP220CA0008.NAMP220.PROD.OUTLOOK.COM (2603:10b6:208:32c::13) by SJ0PR12MB6686.namprd12.prod.outlook.com (2603:10b6:a03:479::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.14; Wed, 11 Dec 2024 23:41:49 +0000 Received: from BN2PEPF000044A4.namprd02.prod.outlook.com (2603:10b6:208:32c:cafe::8a) by BLAP220CA0008.outlook.office365.com (2603:10b6:208:32c::13) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.15 via Frontend Transport; Wed, 11 Dec 2024 23:41:48 +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 BN2PEPF000044A4.mail.protection.outlook.com (10.167.243.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Wed, 11 Dec 2024 23:41:48 +0000 Received: from ethanolx7ea3host.amd.com (10.180.168.240) 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; Wed, 11 Dec 2024 17:41:47 -0600 From: Terry Bowman To: , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v4 09/15] cxl/pci: Map CXL PCIe Upstream Switch Port RAS registers Date: Wed, 11 Dec 2024 17:39:56 -0600 Message-ID: <20241211234002.3728674-10-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241211234002.3728674-1-terry.bowman@amd.com> References: <20241211234002.3728674-1-terry.bowman@amd.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF000044A4:EE_|SJ0PR12MB6686:EE_ X-MS-Office365-Filtering-Correlation-Id: fd57e1c8-fd97-413e-104f-08dd1a3d6148 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|7416014|36860700013|82310400026|921020; X-Microsoft-Antispam-Message-Info: JEe7++0Qed5zRBqgfVo+bVsGxhXXhin8E4a6+pwpmtlLnrxQDvd8g38xnuxBBMDD6xBHXFtgeyZf1Qgp/O6S8fWkri4tnYyVKX5Saz41Xlet3G3Ryxwy0dAFPjABqhlnwD4t+P3rzOxvo6ROF5Aq43OIPjyHhK4jwYLzborBaB5PbW6kLgIbxiXT9JJFsmChLjbr8E7SBMyFcrKay4SVpWirC7cm8RuXq5vML9Gs0vLRO22Su3QEBSd7NZn3gEOGMsXE5fkobbIXo/Op/rHHkw9mSUckxRADsaeV1jwXDqUfPUdVa5A/8KmRd6QZTkc1Dzm7qmJnThqhVpBCKCk8yBNq+Vvn8/ozV0aNWbFKfyFg9qC7r+ZdVN0JlGkBz4wuawVHFsOybGhQ1Mq3fkN1Io7BwDVrShXDEues7cEhdB8AMT25YFdWCO53VtJWTYOd+Y5GBLtWLi3tdZIVFd+bYNxkjyuYkjqbSBQdzp+VyeFoTY/1KS0uELMHv6jR3aBRQ323kvx6kfNaG5gvp7BDoWeQOPsf9lqHUnBZsZ0LGiyqY3H5BD+IOPQXQ4KJ8G5fxAuMbEEi9TfYm6yZHA6kpamkPjL0ftyrZ8wJ+V8ZjoMIV5HqOJ+HIKDMTnrdrOHMrJ/zX1LuamR4LF76iAisH6XgKBsibixawFkwzbsm322Py7FADXzwyQysYc3mR/QU40uH/YJ7XdarU1fTeHMH66SUHOIEfwKVph0b6987gkL6uM/yMEwoxJ14zhu1fHZxE4rnK6kO57j34fxEP3Q4IhfXcoVYlJ+MypB0e0RbLBcAYvDmdH6Jql3jLVcAniOHTcnnUtlt0WI+R3t6+Mfwpktt/tqwUJHXlHUBY4zilGRZEtAKoqxkdoIwTqujYosHGZFPaWxHxTPYUSGU4RTVKAxih5b1ePmN1NMBOixi3V7dT07ZxbcczK6pTUB5k6hN1c1Icc0N04jAWWY69gW6CklyF+qcO7ee/GgGRna4aNlJ6qAeKJTyNK8gmlXXIK45umYAdH1PmDuBP+/uPszTcvohxzwOXmS8r1kt4wKdDTwzSAq4wv5akm7CTZg+EtRkXlCS15oMhlx3TcAd7gJ8gSptDV252WbPBU7wgQGVoHgxKdq8TX7CLKWa3Ctu5nJBZqWGzoPq4bedfWCuJdlLtuNwi6wwJqndIlJjHIrs36gG3x8jFM8FfdQZrYYeTspUi4GOGN4JG4tIgfDEphywBbgZPZDFJN4Czc1aIC7QCgACMb+E3w7IDaK0334AysxCclcPG2cGfQT/7O8L8leV5DAH8+Kvphgi7JvZc6epASu3Fl6mn0CiekcMtzta3djR9KQmCxwdyDdfSoAoT7u6THiXKrHkrGxE+Bm/Fr1ZN9fdqabZ6Z9CvmlJLGoqjeKLwCAeHC/22w/ZU0rzjvF+Vq9mvQ1yXuXrC+zHK1VnFEn7GBautvKYm9DW5smsC1YML9XeNHH/WuPqELI1VQFVIg== 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)(376014)(7416014)(36860700013)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2024 23:41:48.3293 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fd57e1c8-fd97-413e-104f-08dd1a3d6148 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: BN2PEPF000044A4.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6686 Add logic to map CXL PCIe Upstream Switch Port (USP) RAS registers. Introduce 'struct cxl_regs' member into 'struct cxl_port' to cache a pointer to the CXL Upstream Port's mapped RAS registers. Also, introduce cxl_uport_init_ras_reporting() to perform the USP RAS register mapping. This is similar to the existing cxl_dport_init_ras_reporting() but for USP devices. The USP may have multiple downstream endpoints. Before mapping AER registers check if the registers are already mapped. Signed-off-by: Terry Bowman --- drivers/cxl/core/pci.c | 15 +++++++++++++++ drivers/cxl/cxl.h | 4 ++++ drivers/cxl/mem.c | 8 ++++++++ 3 files changed, 27 insertions(+) diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index 8540d1fd2e25..08073bbe2697 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -773,6 +773,21 @@ static void cxl_disable_rch_root_ints(struct cxl_dport *dport) writel(aer_cmd, aer_base + PCI_ERR_ROOT_COMMAND); } +void cxl_uport_init_ras_reporting(struct cxl_port *port) +{ + /* uport may have more than 1 downstream EP. Check if already mapped. */ + if (port->uport_regs.ras) + return; + + port->reg_map.host = &port->dev; + if (cxl_map_component_regs(&port->reg_map, &port->uport_regs, + BIT(CXL_CM_CAP_CAP_ID_RAS))) { + dev_err(&port->dev, "Failed to map RAS capability.\n"); + return; + } +} +EXPORT_SYMBOL_NS_GPL(cxl_uport_init_ras_reporting, CXL); + /** * cxl_dport_init_ras_reporting - Setup CXL RAS report on this dport * @dport: the cxl_dport that needs to be initialized diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h index 51acca3415b4..0cf8d2cfcd8b 100644 --- a/drivers/cxl/cxl.h +++ b/drivers/cxl/cxl.h @@ -592,6 +592,7 @@ struct cxl_dax_region { * @parent_dport: dport that points to this port in the parent * @decoder_ida: allocator for decoder ids * @reg_map: component and ras register mapping parameters + * @uport_regs: mapped component registers * @nr_dports: number of entries in @dports * @hdm_end: track last allocated HDM decoder instance for allocation ordering * @commit_end: cursor to track highest committed decoder for commit ordering @@ -612,6 +613,7 @@ struct cxl_port { struct cxl_dport *parent_dport; struct ida decoder_ida; struct cxl_register_map reg_map; + struct cxl_component_regs uport_regs; int nr_dports; int hdm_end; int commit_end; @@ -764,8 +766,10 @@ struct cxl_dport *devm_cxl_add_rch_dport(struct cxl_port *port, #ifdef CONFIG_PCIEAER_CXL void cxl_dport_init_ras_reporting(struct cxl_dport *dport); +void cxl_uport_init_ras_reporting(struct cxl_port *port); #else static inline void cxl_dport_init_ras_reporting(struct cxl_dport *dport) { } +static inline void cxl_uport_init_ras_reporting(struct cxl_port *port) { } #endif struct cxl_decoder *to_cxl_decoder(struct device *dev); diff --git a/drivers/cxl/mem.c b/drivers/cxl/mem.c index 0ae89c9da71e..0ce71af8ce22 100644 --- a/drivers/cxl/mem.c +++ b/drivers/cxl/mem.c @@ -60,6 +60,7 @@ static bool dev_is_cxl_pci(struct device *dev, u32 pcie_type) static void cxl_init_ep_ports_aer(struct cxl_ep *ep) { struct cxl_dport *dport = ep->dport; + struct cxl_port *port = ep->next; if (dport) { struct device *dport_dev = dport->dport_dev; @@ -68,6 +69,13 @@ static void cxl_init_ep_ports_aer(struct cxl_ep *ep) dev_is_cxl_pci(dport_dev, PCI_EXP_TYPE_ROOT_PORT)) cxl_dport_init_ras_reporting(dport); } + + if (port) { + struct device *uport_dev = port->uport_dev; + + if (dev_is_cxl_pci(uport_dev, PCI_EXP_TYPE_UPSTREAM)) + cxl_uport_init_ras_reporting(port); + } } static int devm_cxl_add_endpoint(struct device *host, struct cxl_memdev *cxlmd, From patchwork Wed Dec 11 23:39:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 13904457 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) (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 32DE21FC102; Wed, 11 Dec 2024 23:42:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960530; cv=fail; b=UIrjj30TQ2mBoZ/HDZzZTxCutsrZnGgSeb9aGiq1gj4IxYufFAEa9oDkvgmKUFobPzxF1NHPu7IH/scwDQQmo+XwnA+bx+3xqffbOLobg7LeFaxu1RRJACfBor3NJWogjMkt8TKErytcD7fCpE49tLapzFRmLGwFrRn5sDmRmvo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960530; c=relaxed/simple; bh=E1M3tWs0O9nhMFCjqU23iYUf3cc6bS57oUswWq7hu7c=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=T7Y0D42ct9M9Bl/cHhsGE4TW83B+avRlhMh2QkOcHjw5XBj6rSnahy2DeOyk2Ux58P8sANUKwo+P24bwjuPOhOSkBPWzMwsZgNU9jdNNhXH+gSN9bqsrd4LqLT+JXy68fURrOtn9C3OWScAHPCQv+iSiaD3clzSTW0SE2IcLvhY= 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=bd+ibH/Y; arc=fail smtp.client-ip=40.107.236.41 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="bd+ibH/Y" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FHzI6RFqdc2z7pqNJO+ft4JcyZJcq8sUbCcfB5YVoEj7u9cL98X3xCEpR1e2nchss28D5+IVwXCxxXDkUJSuxz2FhFda97SEB6A0Ax5a+JhmtqhiJc+obAmlotVs52qI2QCCFWZwbctv5YV4pyHy8aImIUt3pNJCwIYtjD/LqNOGvllfb0oYTxqgZpSi4RYXw1X2nEviT/AcTs0J58PNrlKIfvXLHeo24klnksd6lFB8lugYa4gaCnCKEzYz+59w/7qHV75177xuT4/9cdNHcKRy6MTSjSntMV+5IZpiiKL3ijQFbFbFzI8QsXaK/JfTUI4c4HyiAHVZUBDqgwB8Ag== 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=Miso7U0fBIPNbIgwku+pRaGhKUCRUdE8eQVx0cmdRtY=; b=ocEEzqf/vnmpICC4vkCPNTO+aVaJsv5USGVSdSyjj51nqPxWVPV74JfYUXfUMgGA9BD2cYYyqykadJA+mRediSFXIergsooGQpeP40VNZPCiCS9oqHxLFVXz+sw1eP2+APitrCP0LPgeeM84SewP+6cnqbZ3E+lE/BM1YWxz8p+fdbrIN013rCKHJi8pAewbuwQ+xGohSV1MdOKxLPb3g9HK6pUtgxO38/O5cmga+bNQhlu8zltgjJZSsvfz+QanCNnlo53SWyGM9jB7Fz5GqYNFo+M8eFvDN+Vkq95XLlrnk/DcFBEhVy+DbpdGObfLL91DbRtgzl3uMljvfaCCrA== 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=Miso7U0fBIPNbIgwku+pRaGhKUCRUdE8eQVx0cmdRtY=; b=bd+ibH/Y5eUtzlPaOgNBApBUtLq/Zjtd9eMdjVZanE5ASHkYNa/R0vcOmayfOTggKr4FJqI7wSuDud+aqDC5gEInLqIC1iylZ86+YBD3LHXGUJV/KnAxkjJm2+Fktxtxb2vifNZnLyZqm0hZQNMgBSFp1InNSsw1UFirt3TEsVQ= Received: from MN2PR14CA0025.namprd14.prod.outlook.com (2603:10b6:208:23e::30) by CY5PR12MB6035.namprd12.prod.outlook.com (2603:10b6:930:2d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.18; Wed, 11 Dec 2024 23:41:59 +0000 Received: from BN2PEPF0000449D.namprd02.prod.outlook.com (2603:10b6:208:23e:cafe::67) by MN2PR14CA0025.outlook.office365.com (2603:10b6:208:23e::30) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.15 via Frontend Transport; Wed, 11 Dec 2024 23:41:59 +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 BN2PEPF0000449D.mail.protection.outlook.com (10.167.243.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Wed, 11 Dec 2024 23:41:59 +0000 Received: from ethanolx7ea3host.amd.com (10.180.168.240) 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; Wed, 11 Dec 2024 17:41:58 -0600 From: Terry Bowman To: , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v4 10/15] cxl/pci: Update RAS handler interfaces to also support CXL PCIe Ports Date: Wed, 11 Dec 2024 17:39:57 -0600 Message-ID: <20241211234002.3728674-11-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241211234002.3728674-1-terry.bowman@amd.com> References: <20241211234002.3728674-1-terry.bowman@amd.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF0000449D:EE_|CY5PR12MB6035:EE_ X-MS-Office365-Filtering-Correlation-Id: 97659a9b-d1ea-4e31-1dc5-08dd1a3d67e4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|7416014|82310400026|376014|921020; X-Microsoft-Antispam-Message-Info: AXRnzjIBHKQkUrv70YE+TVaqfXqdgEKdj0dL/8n+DJXigegLza0nryzPL9p/UMK3mxB8dNEH8/5BRxLKya0Go2aQ8PzMt1YFyEGrz4Bib2hB1i5iT8dBiPRa51suI3VWPXMd77/wG3EMngK67km7h25O+gVDC4v3EzsLgoZzbyoEXdNGjM4vVCSk6qcZo+1SB5/+b50q9IqPrLWSyfz+RkzN3EBHeS/3It+0DiM20hp5nZPb1uzvYnfTBya1zli5NN0Utdeb2ki2VDRFk9c+YGPg22Sr5KcRO+oO6AO1fD/pvhDrZVNSIVRA2u98TGnv1kIj/+rfrTT+IY/WLxQ6ZJsBa3jLK6a8MLZ/g3o7eY6LpEflstNV5Du88DiOVG2u8gkh4B0Cy7jAO1d8c8OevCuGCpi0NiS03Lmts9SW5ZoL6lpQ0xFWFpvCjNHAarDdcE6pAgKCd1fC4nUSzLdrMRmPkLm9f5RMaoCa3Rv0fljnbAomTHOUu6mg5ilr3MqGPw3zazV8IyIv5VG9D87Y+C07Q/qezO6M1YUKPbePHPTry5V6BnOzr6zEGIDlDujZVrvniGbLlqvJ6XMVUKXpao6G6IJphXBjwLYUGVieBNTt4RSpE55sz4uMzkpL2bKIMwmGmC95vTnGUg0wGau0WwAcCrSXRQ9LyQ/omth1qXT8yIpYXUdslGS4HWwAlfYH1JQVVzyDJIp9DLqWq9ClCTncvNeRtdrsyai2XKQdyviDzEY2wuKzO/7/HBLvc/zkET5vq/whjCSQzr0KiygW5dZbCDQYErlbHtHkOzkvbICoe0AqKtF5QeJpK++zsjtjoJbPDy5x940Ux+hR74BCO/eOlRwa14v45ZxMJAJUcLQz4Ff4Qz/Zx/qAy21j8458QYQOgDyFX2QEPDAoCDHLk7Z/GLmaeYnWzpDAWvmOUhnZkRGSByRU5bOGkoM4T6mZlowq6I5MuVbOLaOTDiNaYoiePC5YxMIOqzpWRU65I54aJ2Cdroz536jgq7OVhT7gks94Ba2G7ac8JgecpIaXGCTMCTGOEOvOl0Iv4CY3moIahsZbfpH43WP2cq1dgPZE7HskaHJW2c+rGBPfRv3LtXflh6iMUIx7GSiJ+EoEjnm0dBXNlW7/D4WtuNZ2jfG7U4AB5p8dwnc5QnC8Whvqjxo0mW2gT/8vy/Kl/YlkzK7dy6427wVIEUCmn4Vef7cewI3bAILq1elFvFgVC2Lpzs6vvXFsKIyl1ynJxdV8vFNvrWXNKhqREkCza3BmHB4PkouUMPlkNuPtbhksF0tyf5QVwTkwmlTKU1kEubcWHo/V+lrLq1MX6BrrNaeI5W+S+aMmNNf2SJ7GUdrd78u8SCgkrn6z5HkwzQ0vOueXQeKhgEH05Fm6debcbiLcZpmQ1AHbgn6q45uHkYy1jHIVgPJX+zMb7+R3ZxVcSf/7NEPa4x7yN3vjlmjHoXh9pCzaPLbp9QgITr3GfLg681Xkkg== 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)(36860700013)(1800799024)(7416014)(82310400026)(376014)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2024 23:41:59.4027 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 97659a9b-d1ea-4e31-1dc5-08dd1a3d67e4 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: BN2PEPF0000449D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6035 CXL PCIe Port protocol error handling support will be added to the CXL drivers in the future. In preparation, rename the existing interfaces to support handling all CXL PCIe Port protocol errors. The driver's RAS support functions currently rely on a 'struct cxl_dev_state' type parameter, which is not available for CXL Port devices. However, since the same CXL RAS capability structure is needed across most CXL components and devices, a common handling approach should be adopted. To accommodate this, update the __cxl_handle_cor_ras() and __cxl_handle_ras() functions to use a `struct device` instead of `struct cxl_dev_state`. No functional changes are introduced. [1] CXL 3.1 Spec, 8.2.4 CXL.cache and CXL.mem Registers Signed-off-by: Terry Bowman Reviewed-by: Alejandro Lucero --- drivers/cxl/core/pci.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index 08073bbe2697..89f8d65d71ce 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -650,7 +650,7 @@ void read_cdat_data(struct cxl_port *port) } EXPORT_SYMBOL_NS_GPL(read_cdat_data, CXL); -static void __cxl_handle_cor_ras(struct cxl_dev_state *cxlds, +static void __cxl_handle_cor_ras(struct device *dev, void __iomem *ras_base) { void __iomem *addr; @@ -663,13 +663,13 @@ static void __cxl_handle_cor_ras(struct cxl_dev_state *cxlds, status = readl(addr); if (status & CXL_RAS_CORRECTABLE_STATUS_MASK) { writel(status & CXL_RAS_CORRECTABLE_STATUS_MASK, addr); - trace_cxl_aer_correctable_error(cxlds->cxlmd, status); + trace_cxl_aer_correctable_error(to_cxl_memdev(dev), status); } } static void cxl_handle_endpoint_cor_ras(struct cxl_dev_state *cxlds) { - return __cxl_handle_cor_ras(cxlds, cxlds->regs.ras); + return __cxl_handle_cor_ras(&cxlds->cxlmd->dev, cxlds->regs.ras); } /* CXL spec rev3.0 8.2.4.16.1 */ @@ -693,8 +693,7 @@ static void header_log_copy(void __iomem *ras_base, u32 *log) * Log the state of the RAS status registers and prepare them to log the * next error status. Return 1 if reset needed. */ -static bool __cxl_handle_ras(struct cxl_dev_state *cxlds, - void __iomem *ras_base) +static bool __cxl_handle_ras(struct device *dev, void __iomem *ras_base) { u32 hl[CXL_HEADERLOG_SIZE_U32]; void __iomem *addr; @@ -721,7 +720,7 @@ static bool __cxl_handle_ras(struct cxl_dev_state *cxlds, } header_log_copy(ras_base, hl); - trace_cxl_aer_uncorrectable_error(cxlds->cxlmd, status, fe, hl); + trace_cxl_aer_uncorrectable_error(to_cxl_memdev(dev), status, fe, hl); writel(status & CXL_RAS_UNCORRECTABLE_STATUS_MASK, addr); return true; @@ -729,7 +728,7 @@ static bool __cxl_handle_ras(struct cxl_dev_state *cxlds, static bool cxl_handle_endpoint_ras(struct cxl_dev_state *cxlds) { - return __cxl_handle_ras(cxlds, cxlds->regs.ras); + return __cxl_handle_ras(&cxlds->cxlmd->dev, cxlds->regs.ras); } #ifdef CONFIG_PCIEAER_CXL @@ -818,13 +817,13 @@ EXPORT_SYMBOL_NS_GPL(cxl_dport_init_ras_reporting, CXL); static void cxl_handle_rdport_cor_ras(struct cxl_dev_state *cxlds, struct cxl_dport *dport) { - return __cxl_handle_cor_ras(cxlds, dport->regs.ras); + return __cxl_handle_cor_ras(&cxlds->cxlmd->dev, dport->regs.ras); } static bool cxl_handle_rdport_ras(struct cxl_dev_state *cxlds, struct cxl_dport *dport) { - return __cxl_handle_ras(cxlds, dport->regs.ras); + return __cxl_handle_ras(&cxlds->cxlmd->dev, dport->regs.ras); } /* From patchwork Wed Dec 11 23:39:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 13904458 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2042.outbound.protection.outlook.com [40.107.93.42]) (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 53D641FF5F6; Wed, 11 Dec 2024 23:42:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.42 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960537; cv=fail; b=SIDaNhEVcaicwgaCUgxrO8UQkcd11OBrdQcypnh+P2AAG2hVa0ri2YFaqkENynlNGe+JVOQJ5roHGbSfg7fAPD7rZEWZfZ765xy+vWn2RuhsS1NP5eUEwFeStPelIFDzYe/DrCA9BDhT34HqKkonLQe4u47eg4hWURy/9nS75e4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960537; c=relaxed/simple; bh=39GJQqT4d69UwG7+2o8u98MflRWCc3eZEHSAHjeKQ8E=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=m7S2VegbDKLocNWUbLp4g3TO6iWY1LWPRZGbZn3TnGkvhV84gqwGC4Bnl3LsrEjJ0k55Y/3cQ13AeLTGTy6PVMA/queFZ/QwGFFhlDsyiIuGroPCbClFAdgKdF/zPngJEzT8vDXdCQusQp8n8fR/iS88dEodvBKoXtPOzfWXn44= 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=guc3UBN2; arc=fail smtp.client-ip=40.107.93.42 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="guc3UBN2" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mfgW0JM0jGD9bk2Gf3U+UGXAf8XjXPrrkHru5tXVWRAsDnjH1dDOjz09xUvmtgt37An6ptUWbUzrxsg1VZc5ySbMcUW+RH9Srp3mhLX4oqgfgt8q6FeTEcsm08/wJGQUOPgAzQtLi1uoP37VFvK7/G21HozsSQenRsdhWFfYmQPcw7DHKaAHNbTlRIIn0IqRY9NR3X3PV049FOrlv8riNFOTsvuVb1brJeItBfWwMyxdbuUfgee+sMXOSsHN4Y/f4miUOaD+boacyjxdujf+qUiJ2yl3g37edCfkMeE5Pk2jLEAK99d1Cedf/RqmZkW0N2Kte9gE6L1+KaTq7b5V3g== 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=e7hYzg+A3U8mzpynyVVyB2FoHSrp21VftyBBfDlR+JM=; b=K0OfZFPfU44rA2hbzxbkpvCkBBX1QQLCUAts9JDGrukYtvqukUVu6DAJCDCKYLrU/UibUomusPQhv7lY9i2yZUepftZ/0MxsUKQtOA831cjqWwd8jggn4bPv5G42gUwyVHasAWaz4ZdBQ9j4f5rN9rljuwe9LBnMwyEGLXHd69nq5vwZw2nGf9s2SIIJHkJh1LD6zaQU2q0w1mbHizCkat8pmNmerG+NgS/unsKThyTaaHGgSv7wMohPAUVRKahpFlcENsatAV0+4uI8YRx4zXMxPGh0zoJxIbrD+FEhSxkq7eLuCqFMhBGCyiT4snQGll9eUJY0vViASUgi8GdpjQ== 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=e7hYzg+A3U8mzpynyVVyB2FoHSrp21VftyBBfDlR+JM=; b=guc3UBN2gJ46FGAv4XgNDRFQ7r6jN5BNhp3onPo/+7g0yF/PUZhvWLo2NF8zqnaHxzJN766rbfI/Gzflqy92aHn8PMt3gTNK0A3JYFuKGZV5rrTNd2bchAIVXIKvJqBGDh40BDqwChYR3c2dxJBW8Dvy1f++BX2r14+5UBaK1Ic= Received: from BLAPR03CA0046.namprd03.prod.outlook.com (2603:10b6:208:32d::21) by PH0PR12MB7011.namprd12.prod.outlook.com (2603:10b6:510:21c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.19; Wed, 11 Dec 2024 23:42:11 +0000 Received: from BN2PEPF0000449E.namprd02.prod.outlook.com (2603:10b6:208:32d:cafe::b6) by BLAPR03CA0046.outlook.office365.com (2603:10b6:208:32d::21) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.15 via Frontend Transport; Wed, 11 Dec 2024 23:42:10 +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 BN2PEPF0000449E.mail.protection.outlook.com (10.167.243.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Wed, 11 Dec 2024 23:42:10 +0000 Received: from ethanolx7ea3host.amd.com (10.180.168.240) 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; Wed, 11 Dec 2024 17:42:09 -0600 From: Terry Bowman To: , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v4 11/15] cxl/pci: Change find_cxl_port() to non-static Date: Wed, 11 Dec 2024 17:39:58 -0600 Message-ID: <20241211234002.3728674-12-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241211234002.3728674-1-terry.bowman@amd.com> References: <20241211234002.3728674-1-terry.bowman@amd.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF0000449E:EE_|PH0PR12MB7011:EE_ X-MS-Office365-Filtering-Correlation-Id: b5af011a-c664-4b1d-c438-08dd1a3d6e70 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|7416014|376014|82310400026|921020; X-Microsoft-Antispam-Message-Info: 0qQPLvHauvgFi8qYIfs3v2MomZiQ98cujpg6Bu2gIB8u91OchPsVla6NsjvGSCPQ5xCA7e1XRYtm96x6rNi4ZW+dN+SdFJw1YCoXjAdlsGP2a2F1W13oq4rsTf+2hKgmq4KaXvGpTJuo4/Y3jq7PCDMovVnLrcmilHXyZXLfsKZbwkjIQaxuDhNgV6p8IGjXYElkpoUSllFStJTYyWcvoGL+8JBAu+ZEQhIX7WQ/Kt2KU5uqcupxNR0cWagdMucx4d+v4PQ1ao3Yd24CB5djKlI+tNBDpqsdFElUsgxmJfcCZaTUx6GMa7NXiWu1/b3CFPbQ6U5ZjKahx0VhfcyH6N1EPqTAfhP4P1szlD3I3ZLvCeMRGRpaPWX7A7FfuRpZxZ5KdLTXSxkInRRkCiS0+azudGd9qjbxYeFXj97dX9/ZZsq1rRL6EjeUPVx8yPK2DarnX8jALeeKLaBetUMcruOnVIplz91Elu0YCZZrxgrAc+3lULiDcJ+9eAh0dtA0ARKbdzV9S15dCg11BVwYwLFL0FneexRzCfnLAokbY1nHs7UGGP+WbTQXYrkC2EyS9rnfjGostY3Au+8lNh5k46pjzpPx6MV65hS7ZH20Xu0oZuGh/Kw7FKuz879a4Xb0c7g1t7Q8YOfm1LjixnG4sF1RGpXic1bzkzpkT3ErlaRi4jCV+42B+B4HGK/Jj1Olf3j/avotZ2/GQBcawN0H/wviIs18OSLPZJmUwiZl53J/gSwFX3GN62nVetsX+Fma4vr06yRh4VL5yfsWwS8rP/vlodcFGzMgPKXYM6UDz3RG5c7uWdyL3NBae9svKiYQ6m4m4lAB9F980AAc+xTUiR7u7xmbFIyka/4dTX/W6recar1zwsKDKAspHqVITlptMLyR7Iz+BB58XIcPsC39y6L3xWW//iN3DHGjQMgS94upvxyNmijWvqbW1JWDg5SLAfrpKznoLCDq63lulVWAkrZlDE3CQ7QyV4JZeLxsP5KDdDsdYN1Mk6j3qYM2YnijANjl8iMrWai2tCGuFTP1qO1r7vw1P0yHFtGVhU1XWpgf1CoZcLNBhnwfpd7QPgb0RlyYd6/+2NPjrYQ5riczmUHV+fWcyfmgVOJQtI9aykCjS4UhKJISyPKlRwXIPQjFtqL2gQ1JFIHQpYd6Klex92Ty4MZDOaKpThcZYYC5AFfntXFyr55IpZwZMjAjf2W1ot7eaRdm/kvM6SV6/ghF+cxzwM0C0hT/mHKrGeA6FyiedwyWGXE/L08Fnj3jty+P0suBiqBg/FYx7+k9CwlXtFKA0e+mAqXBxbThOLymsOrr0ktloee4qLbRvWqbfOvhHWmq0+jYbGzKmdOpZZeV4gi6yZ50rse2PUUIcM7nquW21vgz/2LjmYvwUfsS27f765Qzbf0Ds2QP0dXS1nj99ghbXM7aC5dgur2CEA0r+O6lkuSBJMt0nzai39DeVqYPfuOlGJk20/ku1ZwO/NX0Nw== 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)(7416014)(376014)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2024 23:42:10.4064 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b5af011a-c664-4b1d-c438-08dd1a3d6e70 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: BN2PEPF0000449E.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7011 CXL PCIe Port protocol error support will be added in the future. This requires searching for a CXL PCIe Port device in the CXL topology as provided by find_cxl_port(). But, find_cxl_port() is defined static and as a result is not callable outside of this source file. Update the find_cxl_port() declaration to be non-static. Signed-off-by: Terry Bowman Reviewed-by: Jonathan Cameron --- drivers/cxl/core/core.h | 3 +++ drivers/cxl/core/port.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/cxl/core/core.h b/drivers/cxl/core/core.h index 0c62b4069ba0..d81e5ee25f58 100644 --- a/drivers/cxl/core/core.h +++ b/drivers/cxl/core/core.h @@ -110,4 +110,7 @@ bool cxl_need_node_perf_attrs_update(int nid); int cxl_port_get_switch_dport_bandwidth(struct cxl_port *port, struct access_coordinate *c); +struct cxl_port *find_cxl_port(struct device *dport_dev, + struct cxl_dport **dport); + #endif /* __CXL_CORE_H__ */ diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c index af92c67bc954..1c4daf9fd2f3 100644 --- a/drivers/cxl/core/port.c +++ b/drivers/cxl/core/port.c @@ -1342,8 +1342,8 @@ static struct cxl_port *__find_cxl_port(struct cxl_find_port_ctx *ctx) return NULL; } -static struct cxl_port *find_cxl_port(struct device *dport_dev, - struct cxl_dport **dport) +struct cxl_port *find_cxl_port(struct device *dport_dev, + struct cxl_dport **dport) { struct cxl_find_port_ctx ctx = { .dport_dev = dport_dev, From patchwork Wed Dec 11 23:39:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 13904459 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2058.outbound.protection.outlook.com [40.107.220.58]) (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 E57CF20458A; Wed, 11 Dec 2024 23:42:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960547; cv=fail; b=mgU/NpfgxHWcF1I8dsqWE11GOL1pVw/g+eUIDkr7Oyee9l4cYhx3LwMfg2TQJTkSLo68qijzR16BpE3/w+HQNHiYAUKFX2OcSQwruehK09o6QApV0l9EamxdrTaUgykyU9MQvqq9qxECMGxVy40yH+Un9wFKCR/YPWp9oDqZMyA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960547; c=relaxed/simple; bh=4cPsKlFt++zvohsC5rQLAX8JOAKT1LMWaZIAryfgzHY=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HQ4y3f1+2kmkUPM0ymiOGF4wM/UGDV2HVn0S2/v2vFx3qiM64TyzXXxlf6TLv2IwFaRl0os5f3ZWG7qFapEzWExtINxISRaU5QgttHeoXcduDjBHHuW0TVKH3ZR0GtlwcgRDbVIOGEr/DO383Z8pv6Lfu25kRXCvWIZVAsTTi2Y= 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=HxZO8dZy; arc=fail smtp.client-ip=40.107.220.58 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="HxZO8dZy" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GHyfXiqx9WhULUMg4iLBFiDXrLYJbwZOIHxUo/8MliRuOhmMo/fHh/CAT+kRwWdnLGfTW7kGxKhKe7Q32zWQAFoBwuksZW3/LROwMjJL4DzNGxaouBuTCOXKRxuqFJFanyjxy5qOLcYgJm11mfUW5lgro8PqC3pAMTbOVbQA0Phkdk/DyxteCLzDduFq5Nspk/x9eyKUdolO9bmBJjs5UwzyaguJloJdhpST0mIA1K3KCYQB17Z1EgMofcpeCJTqhE9ddb+Q66s/HyYJAhFiZFDqy/P9QUAhugRAj3bI9rUnaQTYDawrlZ2jkLeEwDK1jtIMH9kZI/rbDcUdX/iNSA== 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=PXRkULOVSlxF3lmBrBh5OMwDmVOHfpfnq+i/bj/YHKo=; b=ORKaqykkGYWw+ZcANzO6YI84SVnto31RGwrjS611oOzOlgGbA3tTKRO9Fujw3zbUdlN2jVerqsQNdlzgKaVBLnw2v0UXXNuZrbgZ7+iHmKEdpWAcXoFoT+l21m6qKBeJ0Ga6zxOQ9ZgX2iHI8bpTz+ESQttMhfEpB1tcu1RTWhMvQepP1t/9Ijhob0cEuBUNqTmU8ENjq32rNipnIQJLMZ7OqaHcE+CpfJ5u8wUWwWkylLQPZbADuAgLYbHFpAXzgK2OZtenO4Ge0FHH4El9gsW1elRIsiGNvtwe4AwJu7Z/C9wXB3K+3qoFsKi1SSNhvd8IAoO3G8P5bGTEpUU6EQ== 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=PXRkULOVSlxF3lmBrBh5OMwDmVOHfpfnq+i/bj/YHKo=; b=HxZO8dZywOKpxzmM55b+LUz4WwGrikmsgdWSSghOsvGsSouJyQzf0fiDWjTnolMAQ2/FttI5H6AlOKF7KPrfb14Q94CKlgKLLs/2d3b/ka/yhmpkuUthLJhLinvh1sZQBCkDsXRDzVLab8BZZqoFXNXTdGaBZmOPvdSQEJm0N9w= Received: from BLAPR05CA0021.namprd05.prod.outlook.com (2603:10b6:208:36e::17) by LV3PR12MB9403.namprd12.prod.outlook.com (2603:10b6:408:217::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.15; Wed, 11 Dec 2024 23:42:21 +0000 Received: from BN2PEPF000044A2.namprd02.prod.outlook.com (2603:10b6:208:36e:cafe::54) by BLAPR05CA0021.outlook.office365.com (2603:10b6:208:36e::17) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.13 via Frontend Transport; Wed, 11 Dec 2024 23:42:21 +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 BN2PEPF000044A2.mail.protection.outlook.com (10.167.243.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Wed, 11 Dec 2024 23:42:21 +0000 Received: from ethanolx7ea3host.amd.com (10.180.168.240) 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; Wed, 11 Dec 2024 17:42:20 -0600 From: Terry Bowman To: , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v4 12/15] cxl/pci: Add error handler for CXL PCIe Port RAS errors Date: Wed, 11 Dec 2024 17:39:59 -0600 Message-ID: <20241211234002.3728674-13-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241211234002.3728674-1-terry.bowman@amd.com> References: <20241211234002.3728674-1-terry.bowman@amd.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF000044A2:EE_|LV3PR12MB9403:EE_ X-MS-Office365-Filtering-Correlation-Id: 6ef6ac58-e7a6-471c-0a45-08dd1a3d7517 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|1800799024|7416014|376014|921020; X-Microsoft-Antispam-Message-Info: RKbiwenWqDwx1vKveEQv8o0uDVJ/t2u3Pmc8rYCF4l1Ezd9JrjAqR3s/35mRNT0vFOULSY+WIfZ9oJOwJgzfcnLyXSSjEUGBk+8V1iEPK/qHGMHlbitda5gKmTXsMbe/bZO2SpfLDPy61YsmPDGOBARi2uQNLOKtfnyEWy5Oysor0oGGiUOe7dQBp44f7a5pKP0qCXzq57BYGhkdItyjXsxb3LLHZM0Qu0sfAS6EyfIimHdcvz7xdqxE23Najhv80NAA2+0coN4MT7ntWVifuFpOfvtXIRVFOFAFSWqqCWoLGTW3euE+jOmaxrON/SOL/Ro1C2KSzcvN0pcLopKzr7I+JGRl8cVSpJIZWmYYuVRqt9ZVb7/r8vOMW0oQT9UKEMkucQtIcmdWKeaOhpVcxD8qAcduZ8g484mKs7+pfzbEioHBdNHitFoclCxp4xwuK1gcZswF+0spYTShxhEaEgUQAGoV6dKa/0EGom2v/6JniUW7nMYx8jmfMXU7cO0uzPtNrOHaJJpyVPHCuL56MFT8Gsp9ado6DJ59F1DvJIZ9qSvrn91HoUuZ1hpClLbgx1Gg9G9gWHBBBlC5nZDwreTTd+nV8titLB5T99IOAB5CwkqdvCWaj4ocDN1LnDDcKPvC7Z6GqhRIsx9WXEeZt4CN+ShNcd6CcIJHngirbkECgm3Gk1QIATfAq/Mw+y/1seEIIDzTkxjP2CkohTfdcFmshcyNK4DEskO3RBy3DtqJU2UY14zU42/sCXgs7CWXxK/43qgVCd6qPXAumqnfe8jsVZafiRN83NPyZqg+0FnYJMiOFOEg04dQ0AzfdnjsAP59nTXG6e1tXqHCiQKrlwbV1H/RxzPI/+h9yWvYYNjilRAt7Pax9fDgD9jAjACcLTsZaA0t4Dc3RbrglZpbTAsM+/YvB4MUMya6gQJLJr9vVMqEf38RMu3siQk/IOA2YAyTDlRPkP8qnGazEA0CaC0/LjRFdhQcvf9O//aJKnNYkt2Hd2qAB4hkRO9YaVKTTiKiPBKmRncUmivncfsaCpW2iL7ilD2Bk4CZ3C7tAya/7tuZjswDh7gJh7s1N4J6jShlAqYygPHXUPtHipnre3c+S/YIQzE4rU5awqSbU8zNaMn+nIk+gQ0XPAPMFFb8X8lAEMXZ6YUuhnULc4ZcZZQbU92rGjEhhcBievIz2gR5hfd2cVNfAnTzu82XODDwJyZDEc4BNFdTQYg6EfPWMzTmbVM+uTdOpOTtY6ACX+oTAgkD+40kVWFFHYRFGXttaoICcOdN3509WmlbcbFaNuIuwp3p4uBb7eDC92363U8fLoJEz0UV9ogGyF38su3nNe48Md/bf5NHNtWM7flca1bYpdwVVLV5+dg8GG7CqWxuTb9Gjiy4pUyqgwTOytwvRHLjzKiv6I7l8oLd09sOgCyD9BdXZQsBhNEURvLAZmm0/lpeufV0B9dba6ANtGfeH83XLqCrUA2SzSXZyJDrhQ== 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)(36860700013)(82310400026)(1800799024)(7416014)(376014)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2024 23:42:21.5468 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6ef6ac58-e7a6-471c-0a45-08dd1a3d7517 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: BN2PEPF000044A2.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR12MB9403 Introduce correctable and uncorrectable CXL PCIe port protocol error handlers. The handlers will be called with a 'struct pci_dev' parameter indicating the CXL Port device requiring handling. The CXL PCIe Port device's underlying 'struct device' will match the Port device in the CXL topology. Use the PCIe Port's device object to find the matching Upstream Switch Port, Downstream Switch Port, or Root Port in the CXL topology. The matching device will contain a reference to the RAS register block used to handle and log the error. Invoke the existing __cxl_handle_ras() or __cxl_handle_cor_ras() passing a reference to the RAS registers as a parameter. These functions will use the register reference to clear the device's RAS status. Future patches will assign the error handlers and add trace logging. Signed-off-by: Terry Bowman --- drivers/cxl/core/pci.c | 61 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index 89f8d65d71ce..52afaedf5171 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -772,6 +772,67 @@ static void cxl_disable_rch_root_ints(struct cxl_dport *dport) writel(aer_cmd, aer_base + PCI_ERR_ROOT_COMMAND); } +static int match_uport(struct device *dev, const void *data) +{ + struct device *uport_dev = (struct device *)data; + struct cxl_port *port; + + if (!is_cxl_port(dev)) + return 0; + + port = to_cxl_port(dev); + + return port->uport_dev == uport_dev; +} + +static void __iomem *cxl_pci_port_ras(struct pci_dev *pdev) +{ + void __iomem *ras_base; + struct cxl_port *port; + + if (!pdev) + return NULL; + + if ((pci_pcie_type(pdev) == PCI_EXP_TYPE_ROOT_PORT) || + (pci_pcie_type(pdev) == PCI_EXP_TYPE_DOWNSTREAM)) { + struct cxl_dport *dport; + + port = find_cxl_port(&pdev->dev, &dport); + ras_base = dport ? dport->regs.ras : NULL; + if (port) + put_device(&port->dev); + return ras_base; + } else if (pci_pcie_type(pdev) == PCI_EXP_TYPE_UPSTREAM) { + struct device *port_dev; + + port_dev = bus_find_device(&cxl_bus_type, NULL, &pdev->dev, + match_uport); + if (!port_dev) + return NULL; + + port = to_cxl_port(port_dev); + ras_base = port ? port->uport_regs.ras : NULL; + put_device(port_dev); + return ras_base; + } + + return NULL; +} + +static void cxl_port_cor_error_detected(struct pci_dev *pdev) +{ + void __iomem *ras_base = cxl_pci_port_ras(pdev); + + __cxl_handle_cor_ras(&pdev->dev, ras_base); +} + +static bool cxl_port_error_detected(struct pci_dev *pdev) +{ + void __iomem *ras_base = cxl_pci_port_ras(pdev); + + return __cxl_handle_ras(&pdev->dev, ras_base); +} + void cxl_uport_init_ras_reporting(struct cxl_port *port) { /* uport may have more than 1 downstream EP. Check if already mapped. */ From patchwork Wed Dec 11 23:40:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 13904460 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2040.outbound.protection.outlook.com [40.107.243.40]) (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 631061F37B0; Wed, 11 Dec 2024 23:42:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960558; cv=fail; b=OX9GZrJWXnSB3u+eYMfuWA8AzFaoA5u5KvidIZ1/JyVrP08VZw3tMdiv/8cE05AbdHhmdhXvIuPwj5m43sC6FBKvplnGHE+zFxp9escF7rRNB4B2oFmgyWEqlzARk9ASN+oqIMPmWBAZbaF2DN+pJerxgXGM31hTK5KBgzAe/Rc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960558; c=relaxed/simple; bh=6QBwewHPT/LO0YJSqUxQOiFF8nN18qldRJ7wbyyNUOE=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=REI5LepiP6vzx2Ku06FVsySDmp4URk7bjXrtV2/saCl5Ae3yYbEwYYfLWEoRmoxQvvThHByOSEkKCmB+RGR7NxZlVpqTIGmTeBcFkA8c1Jz/6h/38j/P9304WKFk8mdtyH3nuu30EDt2DCp55IietHUhDYqtFOUyJyt0qLP/hVQ= 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=IGAtuHMy; arc=fail smtp.client-ip=40.107.243.40 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="IGAtuHMy" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=y/gMVEDRkWFP4oRYAS2ysC3VbysRyXDT8cYb0ITAWksJiINsbnkEx9ZqbnLPhomiV9cJxis7ec/9QHE2DuKnGlvSutQMn82f6zLwqnyI2jFn58UhwFzFpqT0Fjt/0zjt1Aiqs8XmbdeO8f8j9+uvxlj3FKMML1T073oV8VqeSm0WZ/XEsYqwT6rPQP/MyjNNrnrzPFhyr2GVR7i75aSM4whZlioZNDh2vnlECSnQRfKtQlcs8dpmecegiTc9yPMi6PinPl65G5Ql2nKeflOaJCNx4Ajk4BFwVfK5n5tFl1JQI91XTENhZ7meX7oxPLDsiHK/BF2IapXLCyXXh3MbAA== 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=qVa8s1ecQnT3J5D9RiAA476+5RaYmlod9XFoAbNtajE=; b=PM6n1DDGKvwx3C7dmsHeyhIqqsxFXO/cU+1OuaYZIWIN4g93q5Hyp0hHrRrNSXph1aQoF4vGuZ4HVg/FqIzo9Eem5ButBXxI6ezoK2iFHXxLL1ziDVvhkvlQ5HXAHN1mt8fSDAyDCo7Pmo6tZraEaNQrpXGZ774cyZndiLt7gkWe9/o54SbfjUIw5F8lgp4HJ8Tegw2Q8NT86pD+PPsXHipQHbvpSPg2l0rxzYlVoYa51Cd15NQm2kf4LYNEsN/CHYi58nprHYNHreWfsDwPWOxEyH+3G18X6cxfz5AGNpeLJmEa/y8KsmZc05qaKRZ7ZHrkY+GvzBztcyTXYZgyZA== 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=qVa8s1ecQnT3J5D9RiAA476+5RaYmlod9XFoAbNtajE=; b=IGAtuHMyTbuklJOr1r3JrfSkzKGiJmf6iwlqZjsSqFCVpPJre6QVEqBhj2wvORdyPznyC3d0wKjZMlIV9ceVWn61RKDfE1INIIsFRXsK3Y8jKBrMdWhzqAGaQijbnYxpcSf6uNbGNDQgYIHEk5M4N+YKFgK5KDHjhFKC4wUQ04k= Received: from BLAP220CA0028.NAMP220.PROD.OUTLOOK.COM (2603:10b6:208:32c::33) by CH2PR12MB4104.namprd12.prod.outlook.com (2603:10b6:610:a4::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Wed, 11 Dec 2024 23:42:32 +0000 Received: from BN2PEPF000044A4.namprd02.prod.outlook.com (2603:10b6:208:32c:cafe::d7) by BLAP220CA0028.outlook.office365.com (2603:10b6:208:32c::33) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.14 via Frontend Transport; Wed, 11 Dec 2024 23:42:32 +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 BN2PEPF000044A4.mail.protection.outlook.com (10.167.243.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Wed, 11 Dec 2024 23:42:32 +0000 Received: from ethanolx7ea3host.amd.com (10.180.168.240) 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; Wed, 11 Dec 2024 17:42:31 -0600 From: Terry Bowman To: , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v4 13/15] cxl/pci: Add trace logging for CXL PCIe Port RAS errors Date: Wed, 11 Dec 2024 17:40:00 -0600 Message-ID: <20241211234002.3728674-14-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241211234002.3728674-1-terry.bowman@amd.com> References: <20241211234002.3728674-1-terry.bowman@amd.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF000044A4:EE_|CH2PR12MB4104:EE_ X-MS-Office365-Filtering-Correlation-Id: 9a5a068c-d4e4-44cc-0a41-08dd1a3d7bb4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|36860700013|82310400026|1800799024|921020; X-Microsoft-Antispam-Message-Info: nZBo81der8kZ28DGlshNfN0iP3Jve6iyMTh/cLSs5wXbfQG2qFMtXedJOFkEbs2XSnIjPVJtPokYK44YaD9ULBp4bfZXZ2JCwRJ3t1xXUOeXqMHhqrgFXOp2PFl7rlvSe0HD91Bd3cUe+gwlQeYsm3ffdeqve5fZIJwTNe/OqdpePOqRsGbgVHTKxlhsqrA9TxPCmPyhv4ydW7MlD4Y+6IrjQzzJavmKDEDMUGpnngxeTHXCpomE4PDUj1gG3xrmrpJhEoOpoXYRUiqNOz9amaXefhQTVDN2TQ4yqe83oGwnUVNjKEtMlfhKhb2mobpu+o7C3Nk2CIJ8GACa7gd0t9sqFl/3HgZzkDmcKD0K6rCCQbUlsivlzSiFO72Dv59ITPPu6tgQicE8ewPlMCW8PfvCoHsScXmJuqoKiyysKS7J2A+KArgiuwnMp5FaBq6qWCJYfrEYTbdwCnAYGPCrUzHlnRETNU3MttZVYWKOgbqUoOEiFE54mdrUDwbHLySUZonMKsZid0sdElsRdu7/8oDHjUkpwHUf+C/YCJaeS21lP376lYTjneHFN7MRfVWxm0rq7neegCMw6A9+rD4g71OXNNcabZ9cbbwaMyEnk901LM5V0q8VY7tlvuMG7wwvWuIODG7zFzXAXJkwkHxYBTAKavqguabmnIp5VDe8UkdmLXvChhnvk+oalOIVg8VnqXIoX4Gyu+to9YWAoktih2Gc+C+3XRqqbHLIdfASotCMnrjLjUVOT3UfkWHEdwId7cNt9qNycXgde69oQf+Q9c+XWoX9BZE4EI09bFdetLN6dNcrVIO5w+0Av+KybdcuFlkw2yyy+uV5J7VJrgud35Bh2wZhOdo/YqxGJKJE/tJXCCcZ4SZN88NOc4kzaOKYRWwNbJU/y6pObubddehWYei+sL7OECwI4i58g+riN2TOyKd0i+GGSsj9iH/LjFkL9qJcxZ+P6ZPHrafmSlYcM5vuBTtT4Kvksw7jojlI/2SYFfCi8bfRn1AFuXM40e0iMTDXP16s3Nt8JHlN4mJKf3eSKZu8HQIvRqTDlRzUBstUPYzg4Wa8jCvucDwdQVQ9yxZxUeG34jj9e/hnYTadPPFHMwN+75YzcgeRYFISDz8FOtD+CPeMle1/gDOT3Ekc3c2PCR8JHyLbNEpv4DN8U9DNAq3Qs9YN4BHUwaXHCoiQX/Y/R1PdBov+Tx7AaB5UaA22qgb6FHyBATQM7MSHerr9klNg/Xd9ddy8UIjl+T7hiu8trjbdrfkGkzRIlq8O1JNZoQpBo/c4GJ7/slZuM9m6E5fBcNNr7swDIrAxFqrMIcifXaG90zVG+RJNQn2x9imGTL8DDtmmupDPiTUiWPDz7Lzq9Iz5poJ38wIc3o/MxSe6PLr+Gl1BuhZoDj1lcWtvDhc1adpnaG7dQbnqNeNfoYkgfejELemRg0TQc5RsH/fNwC8rzVZo510VPh9a27Xd8zOacf6wNgzj25Irww== 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)(7416014)(376014)(36860700013)(82310400026)(1800799024)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2024 23:42:32.6577 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9a5a068c-d4e4-44cc-0a41-08dd1a3d7bb4 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: BN2PEPF000044A4.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4104 The CXL drivers use kernel trace functions for logging endpoint and RCH Downstream Port RAS errors. Similar functionality is required for CXL Root Ports, CXL Downstream Switch Ports, and CXL Upstream Switch Ports. Introduce trace logging functions for both RAS correctable and uncorrectable errors specific to CXL PCIe Ports. Additionally, update the PCIe Port error handlers to invoke these new trace functions. Signed-off-by: Terry Bowman Reviewed-by: Alejandro Lucero --- drivers/cxl/core/pci.c | 16 ++++++++++---- drivers/cxl/core/trace.h | 47 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 4 deletions(-) diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index 52afaedf5171..3294ad5ff28f 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -661,10 +661,14 @@ static void __cxl_handle_cor_ras(struct device *dev, addr = ras_base + CXL_RAS_CORRECTABLE_STATUS_OFFSET; status = readl(addr); - if (status & CXL_RAS_CORRECTABLE_STATUS_MASK) { - writel(status & CXL_RAS_CORRECTABLE_STATUS_MASK, addr); + if (!(status & CXL_RAS_CORRECTABLE_STATUS_MASK)) + return; + writel(status & CXL_RAS_CORRECTABLE_STATUS_MASK, addr); + + if (is_cxl_memdev(dev)) trace_cxl_aer_correctable_error(to_cxl_memdev(dev), status); - } + else + trace_cxl_port_aer_correctable_error(dev, status); } static void cxl_handle_endpoint_cor_ras(struct cxl_dev_state *cxlds) @@ -720,7 +724,11 @@ static bool __cxl_handle_ras(struct device *dev, void __iomem *ras_base) } header_log_copy(ras_base, hl); - trace_cxl_aer_uncorrectable_error(to_cxl_memdev(dev), status, fe, hl); + if (is_cxl_memdev(dev)) + trace_cxl_aer_uncorrectable_error(to_cxl_memdev(dev), status, fe, hl); + else + trace_cxl_port_aer_uncorrectable_error(dev, status, fe, hl); + writel(status & CXL_RAS_UNCORRECTABLE_STATUS_MASK, addr); return true; diff --git a/drivers/cxl/core/trace.h b/drivers/cxl/core/trace.h index 8389a94adb1a..681e415ac8f5 100644 --- a/drivers/cxl/core/trace.h +++ b/drivers/cxl/core/trace.h @@ -48,6 +48,34 @@ { CXL_RAS_UC_IDE_RX_ERR, "IDE Rx Error" } \ ) +TRACE_EVENT(cxl_port_aer_uncorrectable_error, + TP_PROTO(struct device *dev, u32 status, u32 fe, u32 *hl), + TP_ARGS(dev, status, fe, hl), + TP_STRUCT__entry( + __string(devname, dev_name(dev)) + __string(host, dev_name(dev->parent)) + __field(u32, status) + __field(u32, first_error) + __array(u32, header_log, CXL_HEADERLOG_SIZE_U32) + ), + TP_fast_assign( + __assign_str(devname); + __assign_str(host); + __entry->status = status; + __entry->first_error = fe; + /* + * Embed the 512B headerlog data for user app retrieval and + * parsing, but no need to print this in the trace buffer. + */ + memcpy(__entry->header_log, hl, CXL_HEADERLOG_SIZE); + ), + TP_printk("device=%s host=%s status: '%s' first_error: '%s'", + __get_str(devname), __get_str(host), + show_uc_errs(__entry->status), + show_uc_errs(__entry->first_error) + ) +); + TRACE_EVENT(cxl_aer_uncorrectable_error, TP_PROTO(const struct cxl_memdev *cxlmd, u32 status, u32 fe, u32 *hl), TP_ARGS(cxlmd, status, fe, hl), @@ -96,6 +124,25 @@ TRACE_EVENT(cxl_aer_uncorrectable_error, { CXL_RAS_CE_PHYS_LAYER_ERR, "Received Error From Physical Layer" } \ ) +TRACE_EVENT(cxl_port_aer_correctable_error, + TP_PROTO(struct device *dev, u32 status), + TP_ARGS(dev, status), + TP_STRUCT__entry( + __string(devname, dev_name(dev)) + __string(host, dev_name(dev->parent)) + __field(u32, status) + ), + TP_fast_assign( + __assign_str(devname); + __assign_str(host); + __entry->status = status; + ), + TP_printk("device=%s host=%s status='%s'", + __get_str(devname), __get_str(host), + show_ce_errs(__entry->status) + ) +); + TRACE_EVENT(cxl_aer_correctable_error, TP_PROTO(const struct cxl_memdev *cxlmd, u32 status), TP_ARGS(cxlmd, status), From patchwork Wed Dec 11 23:40:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 13904461 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2080.outbound.protection.outlook.com [40.107.237.80]) (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 0B8A91F4E4A; Wed, 11 Dec 2024 23:42:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.80 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960570; cv=fail; b=VhY3CrPAWAoE1UHC6gx7NrH59eA2fJ6+M4B7F2RUG2EozZzXXUloNjRha48bA4/dqFjUjB0tbIe91l8VHK2A9I5msd+vaqdG24UoWXd/tbTUdZT9VsQB0qJMkYMsnOx6b/dhTnrLDPuUtn7dDuuhh+0+5H/XZXTj982vDO38TgE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960570; c=relaxed/simple; bh=s8m/gTDZ/ukh5YECRk+9O2l+bpcmrGDWsewg/ITepb4=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZbMLxWK17ATo/iYe6De9VH8ion6mWLqJEgofAakDx3z84sUUdLCsdtXjJjATEpm1mt7cE7x/5SkgJMeK6e9eS747VvNrvId2NwNS3dsoNDDiS1d3iRCv4jKX0QRl6I1gszPf4TealnMLhEFlCdsjK7fzCAOz+8LS9vjMKUrC6PI= 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=DZtbma46; arc=fail smtp.client-ip=40.107.237.80 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="DZtbma46" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VYFJ4i/nN4EFIepdxJFuRg1T9hS8mcqaYCOY1o6IhpZQYiS9MDO63ILdgTyaJyF7f44IHGO1Ad0TkIfgJdJnE/Kxvol0IVn0SKc5vAiKVG1nKTbWDFyz6CzsG97Ve7duD8FBAq2H19PMspSHWW0cqR0aEOmkmvHZREBEMGdpLDA91rioPM+Aset/tqyGn04vaIO3Osd0kkhe2UsdChYpbVJB77/WUUrGidff98EYvtJUyR/RqEqy7JlShfL4GNnuSDwqRgA66lo48Jed17QDh6FvCBp+p5vq2pEfv1fgYHrrxOxj8BMxT9iOb9r85BtyHKCifTwywWKwwNOeKTeZVQ== 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=wkG43q+qqCNUFDjYbxstmwCKvZ/MzsP0P/HPxBZSk60=; b=JnMadKMhjzgwasw9ZLqozYjLRD2cCKfjmHRuuhvhknbP1pzL4EMyPFqv8kb/Hhlg8YRm/tITxtbWNMIxGgv1yacH8BORifb/uL4j5WednNSabrFbeAQsSee4GfNfp7mJbRRZW1RWb2cG8V+qbQMXQqPX2+NghV8S2+tnWaBaYbgxgrz85MyEZZgSf/qjk1cL5jWyTjlrd/LLKW9emrqtrZQ8zJEyCrYz8Ees3Z3yXrwjv5kDIIho5F09+JT/gSsOnBA/wjr1UgoiGCa9h/fYL6bP7nj59TTh6x6M6JYhsaYhvl8hSE4GhcnZuTdS8JiGiKuiRasQvNX/ShMWdPJxtA== 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=wkG43q+qqCNUFDjYbxstmwCKvZ/MzsP0P/HPxBZSk60=; b=DZtbma46uZ+AURHMtxUlpV69HcZYDraRAujmJJlh6XhtNZwXiycfYXTX3638yK0bzI3OO+i4ODUdwXWpwGapOdsICCdJeGmZXcghb1jyfMFyGtR/RLIg06on6HWcOwK5OCTx3quHfsUeX38WXLgNyJulAn2MCpgmj6y7NkLeD5s= Received: from BN9PR03CA0759.namprd03.prod.outlook.com (2603:10b6:408:13a::14) by BL3PR12MB6403.namprd12.prod.outlook.com (2603:10b6:208:3b3::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.14; Wed, 11 Dec 2024 23:42:43 +0000 Received: from BN2PEPF000044A1.namprd02.prod.outlook.com (2603:10b6:408:13a:cafe::fe) by BN9PR03CA0759.outlook.office365.com (2603:10b6:408:13a::14) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.14 via Frontend Transport; Wed, 11 Dec 2024 23:42:43 +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 BN2PEPF000044A1.mail.protection.outlook.com (10.167.243.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Wed, 11 Dec 2024 23:42:43 +0000 Received: from ethanolx7ea3host.amd.com (10.180.168.240) 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; Wed, 11 Dec 2024 17:42:42 -0600 From: Terry Bowman To: , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v4 14/15] cxl/pci: Add support to assign and clear pci_driver::cxl_err_handlers Date: Wed, 11 Dec 2024 17:40:01 -0600 Message-ID: <20241211234002.3728674-15-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241211234002.3728674-1-terry.bowman@amd.com> References: <20241211234002.3728674-1-terry.bowman@amd.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF000044A1:EE_|BL3PR12MB6403:EE_ X-MS-Office365-Filtering-Correlation-Id: d19605c3-19a8-4472-fc54-08dd1a3d8249 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|376014|7416014|36860700013|921020; X-Microsoft-Antispam-Message-Info: RTo8qDvHcgeOiWD6HWOABSct8hKtEIrCeirz3jU47rNASTMRJNBNAb5mO2Nf1XUBlnmCjOd/HrAmizC4OWnR2sZjgIlB9oMkgi2UF3W0XqVAMKOVliD/w7M7BvlJn85N3OZcuFxHDPZXx5JpNO5H0Y2C3cSvuX9rcbJyglZAKzM0b+ylGW1LFp9UIoi5KSPxczlOr54uYjl8BiNakZPy4ot/1TmCLYh68LDOsNTImA4hJPK8XCY/6hAjswZyBnc+FfFNe/dfaauueDER34e+aJCNSXnxJ7C0Kzid31NwUlAQd/SzE+tmwVX/vMakFMwGOQ29zyIp5x7BgNb9zujXqY76LHkenVhPfmtE6ykskLr4DOOhE14BpQCaYRFExnCLZ+I1/WWRiZx6TRw6NgcW7qcbqO6bjWlZMPVcll3dDl4AoTwcpQqXK0sc6dwhDTFrPdKzgRswiQckjnvfdmJpVUN/b2bIg9Vqpzv6IDp9iEN2FlUIu/BJaoxut/Kx547kI+j2+zsW7QuvCeFkCbe8gdln6KqYjDXwpCZwA6bsXUl06M52M50uZzTBkkjJhWE56yDzTThI+dUZsxKyoMVRPihS5b1QGfJ7e8/jUczjKrDCnGNwmEqKbl9BI5DXHpER5DJA/Mf8dISKApwZnApaC4YkHj+MEf+JbKdjfOyC/mDpfYAYeayUOYbFrY3mpjfWk1B2M38Xng5UUGwdNVWGUWNfRi5Oz3y7aeeuoSjzQmXYQuLOaPr1EBzPa513sEAU8rc5/4TLx5WbFznIBl8OcjIUnQTwzZ9zbCCaAF/xT5U5eYH59S8YsrXVrTM5N4uwhIbjBwM8+nbGIB06AL0TFYLEvsTg5glVI3R5c3oCtOjNpRGSOMamIPG0WK8trZ7dhGPSkXMI4gsoo9oK4KXGEjtvZEI6/AqtCtzz+TvvyTWL6MP3mZO0DxLIeOuAf8OODqbGOSFXZLFdVSFXED5OBsumkdRN/g3zwY4TnKN+gMZ1Kj25jNxYX0pGQxyfIHdM2qs5nvegEfIznHUlvXnzKSHRWTWdlAL0kaGsXNBKaaMbeq7VY4klkEUT0ZmvvCsiFS68kHWrdrq2AC2LhUYbMHpynr23hUZNNS25l8i+NMShv+KeZlDhlGSdsAVtzJjj0F2/X6Ye4+053ycsj9XOMy1HTqffUtPqOD+vJwrOKqOjGEcJpzhtrvADpkNK/UkayaCaC9zaDe7k9LLQkK/BtNyga3oGrV1kUl5/DvpgJ2uuBAtWK7tEKfRih3I9ddwGsFaD/xY3zqJfM5mgO8NEORiwbP3HPRfGNS43NSYR0lwUvLJN6FrKczip23ocQJJUoM/9pTVn2yJYmVU2fTo5Lsc+7WSjAIhLeoyW8Q/X9GpGkj+oVSRs+FjBViFIuDsORuzx18liv/2TRgwEAbuiUSIRgiI5qfYkHdDPtQ3EIu/3NsIJzJ01SIrk1cvTxGlCPtv+jb6rgFyWCjKq6yas4w== 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)(82310400026)(376014)(7416014)(36860700013)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2024 23:42:43.7067 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d19605c3-19a8-4472-fc54-08dd1a3d8249 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: BN2PEPF000044A1.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6403 pci_driver::cxl_err_handlers are not currently assigned handler callbacks. The handlers can't be set in the pci_driver static definition because the CXL PCIe Port devices are bound to the portdrv driver which is not CXL driver aware. Add cxl_assign_port_error_handlers() in the cxl_core module. This function will assign the default handlers for a CXL PCIe Port device. When the CXL Port (cxl_port or cxl_dport) is destroyed the device's pci_driver::cxl_err_handlers must be set to NULL indicating they should no longer be used. Create cxl_clear_port_error_handlers() and register it to be called when the CXL Port device (cxl_port or cxl_dport) is destroyed. Signed-off-by: Terry Bowman --- drivers/cxl/core/pci.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index 3294ad5ff28f..9734a4c55b29 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -841,8 +841,38 @@ static bool cxl_port_error_detected(struct pci_dev *pdev) return __cxl_handle_ras(&pdev->dev, ras_base); } +static const struct cxl_error_handlers cxl_port_error_handlers = { + .error_detected = cxl_port_error_detected, + .cor_error_detected = cxl_port_cor_error_detected, +}; + +static void cxl_assign_port_error_handlers(struct pci_dev *pdev) +{ + struct pci_driver *pdrv; + + if (!pdev || !pdev->driver) + return; + + pdrv = pdev->driver; + pdrv->cxl_err_handler = &cxl_port_error_handlers; +} + +static void cxl_clear_port_error_handlers(void *data) +{ + struct pci_dev *pdev = data; + struct pci_driver *pdrv; + + if (!pdev || !pdev->driver) + return; + + pdrv = pdev->driver; + pdrv->cxl_err_handler = NULL; +} + void cxl_uport_init_ras_reporting(struct cxl_port *port) { + struct pci_dev *pdev = to_pci_dev(port->uport_dev); + /* uport may have more than 1 downstream EP. Check if already mapped. */ if (port->uport_regs.ras) return; @@ -853,6 +883,9 @@ void cxl_uport_init_ras_reporting(struct cxl_port *port) dev_err(&port->dev, "Failed to map RAS capability.\n"); return; } + + cxl_assign_port_error_handlers(pdev); + devm_add_action_or_reset(port->uport_dev, cxl_clear_port_error_handlers, pdev); } EXPORT_SYMBOL_NS_GPL(cxl_uport_init_ras_reporting, CXL); @@ -864,6 +897,7 @@ void cxl_dport_init_ras_reporting(struct cxl_dport *dport) { struct device *dport_dev = dport->dport_dev; struct pci_host_bridge *host_bridge = to_pci_host_bridge(dport_dev); + struct pci_dev *pdev = to_pci_dev(dport_dev); dport->reg_map.host = dport_dev; if (dport->rch && host_bridge->native_aer) { @@ -880,6 +914,12 @@ void cxl_dport_init_ras_reporting(struct cxl_dport *dport) dev_err(dport_dev, "Failed to map RAS capability.\n"); return; } + + if (dport->rch) + return; + + cxl_assign_port_error_handlers(pdev); + devm_add_action_or_reset(dport_dev, cxl_clear_port_error_handlers, pdev); } EXPORT_SYMBOL_NS_GPL(cxl_dport_init_ras_reporting, CXL); From patchwork Wed Dec 11 23:40:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 13904462 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2060.outbound.protection.outlook.com [40.107.92.60]) (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 DEAC41F4E4A; Wed, 11 Dec 2024 23:42:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960580; cv=fail; b=u4IQsTjjDGSSDrce84wfG+0zVoAVOQVs0PQ2F7PB0CZzICKHNAvFne9SzuW+Jyl1JE3ILO+D9pOTt5X8it+VmaE/CHDFYV2NJ/KlrafoU13eRBOU/v8yjCmgNuGkulm7mS6H2+WMhvv9zusACfX3LIT/Btan0BnfruXCTv6Udh8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733960580; c=relaxed/simple; bh=uCaqCnoTPgDLOQvbOfPwbyeji4GQLKPQ0p+Miu4hq8g=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=X+GX+HFRbv/BqSGNcCY8n6lJTbOFLSXeM573CeCpIT1wu7DhR8lC6ne+t7MS8h7R3pEqX4qhr3FYSXmbRlqMSiA/PCNku/Et3R2hbMXDfztvc6zR/C9FtM2mDlpd9mSGC2ZCKGCiDVasU/zyAZ1rY+7NhASzHM3RcDn+n9kzZok= 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=4UZ9f0A3; arc=fail smtp.client-ip=40.107.92.60 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="4UZ9f0A3" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WhxW9OZQZDrMUvOi0GE5yv9bOiT271o1V1V8TmmMhN7ioE8msw0Fklgq3p2ZUgKAJlKQ8FL4SlCTmuGgjc6GDTaMh7O7M6I9mf5pNTbjV+IMGddFuRTNNlQfBetOokKipo5iY9/Fy6fkUv62GzksobfcOlx6CP+vS7Yrk7gbeiaugc7xw2k/bcAMTlTzVEFYZdfHqEpCm9nBv0IZRwtM+pXoqxaGtJBFZVD0JCMqLv21r5XvMNB4pZ3exFtQGDCuPXrRJRYDc2wDvud9Z+MyPirLOG8PESNoTgSK5WRhiCG7zRsk1HPJJno4sPfPlft9n4vJHyQI60EFc8qhLgM3xw== 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=0z/PYTNRFHqOqUMGfAnfARnPvXwjXqdCcwMaFgItM6g=; b=sptfZ8GCqI3q0c6ejr8UHzZPrmZgCbq2ODonSKvdPuSmIchAlmKD/UC/zQS6npgQM0fEae0FDLS876aAtDb2bXC7xpA+hhaG/auB/gPMrfIEjQoLIN1HV5uW5Jv5TzbYUWXe6kKyvB6PFMJ4/foMN3kySwh+wonsNi2+3lDxN29WBGwZJR/XFnA2zQ+Xh/AWOSrtC1UL4+xVv1NiFoDmPmHtwIOd2mmDGLdYfMj6eJkbf1x+cOEfN3UQr6HZHe3ZJFDLCMyLUOCcdCz5vqMjUzFHy7V5upgii+hmcqUE7PYtSONtTKchQw1oq1c6egdUffkCn3+gqSJP1IYofXWjqw== 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=0z/PYTNRFHqOqUMGfAnfARnPvXwjXqdCcwMaFgItM6g=; b=4UZ9f0A31MOmUl0pARkzKWOSfQ5vmgDyLYwGsM9cBPcDW98rWEjGG+oTPc0Y223K0oLui6m2Q3M2FXCfkP8DqAEg3ewigswmqVMIL56OFkMNmwoAixjVynGCOXOyiDtuhP3eWqrwdp6j5vWBXAox9TAbWqH/2QljrGkhdceShWE= Received: from BN9PR03CA0768.namprd03.prod.outlook.com (2603:10b6:408:13a::23) by SA1PR12MB8095.namprd12.prod.outlook.com (2603:10b6:806:33f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.18; Wed, 11 Dec 2024 23:42:55 +0000 Received: from BN2PEPF000044A1.namprd02.prod.outlook.com (2603:10b6:408:13a:cafe::ed) by BN9PR03CA0768.outlook.office365.com (2603:10b6:408:13a::23) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.15 via Frontend Transport; Wed, 11 Dec 2024 23:42:54 +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 BN2PEPF000044A1.mail.protection.outlook.com (10.167.243.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Wed, 11 Dec 2024 23:42:54 +0000 Received: from ethanolx7ea3host.amd.com (10.180.168.240) 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; Wed, 11 Dec 2024 17:42:53 -0600 From: Terry Bowman To: , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v4 15/15] PCI/AER: Enable internal errors for CXL Upstream and Downstream Switch Ports Date: Wed, 11 Dec 2024 17:40:02 -0600 Message-ID: <20241211234002.3728674-16-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241211234002.3728674-1-terry.bowman@amd.com> References: <20241211234002.3728674-1-terry.bowman@amd.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF000044A1:EE_|SA1PR12MB8095:EE_ X-MS-Office365-Filtering-Correlation-Id: c8159116-3a61-493d-d2a1-08dd1a3d88da X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|36860700013|7416014|82310400026|921020; X-Microsoft-Antispam-Message-Info: Br6KFD+f319WNekm0CUOMALVPNEiw+2m4qD1B9JJEomu4/JyRNVa5DvoWmdZ720JptDl65T5/9B8d1GodiCsBe4Ao5lNI6VM7/xCt3kuR8N/b71Uze7oCnzNQhxK4D0hmbUZ8PVpccC/4q6c0QeZtYDPbtwClGUjkNXJ+n/dkwPUK+8q20a5oc9BVx4o9VLO5ZlOD5of3qudDTnvk09SgoCYNlNTbFvMEy7H9xuRUiHGk3dAtoJJYwFfzghjqUp48+z5rDj7BbBap2/sdXF7CwWklytebGEqhf1bggsorOf+On5XPgIiSiJtKOv/jetG9i1UM7YlQFptzuBpxEBeBCcEngKY0OmrCO1TFLiz3ydZuBkJdRx/TAk0IFglcLVEmVeyoiYFpd6jQ9qy6s40vS5Bn1UMP1i6aHfkzrjwMI+6R5Z4vQ+oY2deeNwKadd12A2C/6S0grigxEuq/YBOqcOT4Mo/F9zYcP6HhFqHFLl/A8GLm9RDM8/LlKI95BJdv+H2wN6q8JFiAAi1ht69RRUga+iwuEaq1YFE3y6dSoHAHOi5Fp0tj7U0BqD2vZ+Aw2Q23oJnh6gL2i1RokilFk5tPEQAtoxmHRwBqNmrh2Dhp9s8TRgc037deDIFTq5mUrDbK598X6E4lqwmAhA3Gp1m9kRewDJXF2UcnFO7KF2dOXrxLlQHBojRA4LZwOoJHf+YYm1TU4WB+FFiHqT8CC9fuWIrV/aK+OKq3aMb2nAzF2BcGeZ8tT2r66R2tCNfB7YiQXNvFkrLyAvG8wHGnMxFknONauRfd0QyUk01FYDkOW2t5U9OyJ8ibmgXrK/l+lh+AiZENsWV5LYooIiBpF8vApDspUmkLJZ0RSdLrGPOfNCWNAzn3uaWvcu9HJsC7JfMPG2LTEFvcENdhg78y2eC3a/wQFV6sdQHUCfs8e0EMkQk7cQ2dsYgpdO1UGgPOwkCRz7tkD55K2sL87EZujSiOzHlvhy0HNzUT4+DJ0oW7qYjDd4aBWWoatHDxqaKayNJXEL2enx8pCBxmGP6pDSnWOe5iWDwNEd54WdAGMdrybCoDZuTZCatk1vdcWAB7kWHpkTCxrSdwfQMVcZh9YTzNujkcA27RA/9unjEZyWtSPKAA0Ix+g4Q810Pn0VOWd0FLO2hkQ1Dmt3HhBqQ16lodNDaVt0oBQUSmRzoAJIRnndMy5+Ccljc0AIpBN+U0sDAB84xEcZ3RKjTSFDLRU9/g1fRg6cprYYgCfD0s5+wHZBiOW7R4UzFP4jjgtdByfBI9VCDTsTz/eBu2k1MOEbiR+kWtD2wmJw5qP3y4j8jvKaf1ZBIy54DUDLkL5AoR5E1zIBvzZxorja8R1WbdcysGTBcLrVbAigYcbt17CSRj/20s52BvSCFqof8Eol2YpZJFiGOqgmnCfAfkFbRU2Sb/Jyo89oaUBqjZM1OFyyJsizONuhK5mbFgWM+54fmrG3tnziafWODicaQ7mMhPw== 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)(376014)(1800799024)(36860700013)(7416014)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2024 23:42:54.7222 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c8159116-3a61-493d-d2a1-08dd1a3d88da 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: BN2PEPF000044A1.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8095 The AER service driver enables PCIe Uncorrectable Internal Errors (UIE) and Correctable Internal errors (CIE) for CXL Root Ports and CXL RCEC's. The UIE and CIE are used in reporting CXL Protocol Errors. The same UIE/CIE enablement is needed for CXL PCIe Upstream and Downstream Ports inorder to notify the associated Root Port and OS.[1] Export the AER service driver's pci_aer_unmask_internal_errors() function to CXL namespace. Remove the function's dependency on the CONFIG_PCIEAER_CXL kernel config because it is now an exported function. Call pci_aer_unmask_internal_errors() during RAS initialization in: cxl_uport_init_ras_reporting() and cxl_dport_init_ras_reporting(). [1] PCIe Base Spec r6.2-1.0, 6.2.3.2.2 Masking Individual Errors Signed-off-by: Terry Bowman --- drivers/cxl/core/pci.c | 2 ++ drivers/pci/pcie/aer.c | 5 +++-- include/linux/aer.h | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index 9734a4c55b29..740ac5d8809f 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -886,6 +886,7 @@ void cxl_uport_init_ras_reporting(struct cxl_port *port) cxl_assign_port_error_handlers(pdev); devm_add_action_or_reset(port->uport_dev, cxl_clear_port_error_handlers, pdev); + pci_aer_unmask_internal_errors(pdev); } EXPORT_SYMBOL_NS_GPL(cxl_uport_init_ras_reporting, CXL); @@ -920,6 +921,7 @@ void cxl_dport_init_ras_reporting(struct cxl_dport *dport) cxl_assign_port_error_handlers(pdev); devm_add_action_or_reset(dport_dev, cxl_clear_port_error_handlers, pdev); + pci_aer_unmask_internal_errors(pdev); } EXPORT_SYMBOL_NS_GPL(cxl_dport_init_ras_reporting, CXL); diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index 861521872318..0fa1b1ed48c9 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -949,7 +949,6 @@ static bool is_internal_error(struct aer_err_info *info) return info->status & PCI_ERR_UNC_INTN; } -#ifdef CONFIG_PCIEAER_CXL /** * pci_aer_unmask_internal_errors - unmask internal errors * @dev: pointer to the pcie_dev data structure @@ -960,7 +959,7 @@ static bool is_internal_error(struct aer_err_info *info) * Note: AER must be enabled and supported by the device which must be * checked in advance, e.g. with pcie_aer_is_native(). */ -static void pci_aer_unmask_internal_errors(struct pci_dev *dev) +void pci_aer_unmask_internal_errors(struct pci_dev *dev) { int aer = dev->aer_cap; u32 mask; @@ -973,7 +972,9 @@ static void pci_aer_unmask_internal_errors(struct pci_dev *dev) mask &= ~PCI_ERR_COR_INTERNAL; pci_write_config_dword(dev, aer + PCI_ERR_COR_MASK, mask); } +EXPORT_SYMBOL_NS_GPL(pci_aer_unmask_internal_errors, CXL); +#ifdef CONFIG_PCIEAER_CXL static bool is_cxl_mem_dev(struct pci_dev *dev) { /* diff --git a/include/linux/aer.h b/include/linux/aer.h index 4b97f38f3fcf..093293f9f12b 100644 --- a/include/linux/aer.h +++ b/include/linux/aer.h @@ -55,5 +55,6 @@ void pci_print_aer(struct pci_dev *dev, int aer_severity, int cper_severity_to_aer(int cper_severity); void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn, int severity, struct aer_capability_regs *aer_regs); +void pci_aer_unmask_internal_errors(struct pci_dev *dev); #endif //_AER_H_