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: 13904497 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-cxl@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+0w0RDh78Tch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kb6G2gsYZ8fK4Af4fuIj8p1/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;