From patchwork Tue Oct 8 22:16:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 13826979 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2042.outbound.protection.outlook.com [40.107.212.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 291092C859; Tue, 8 Oct 2024 22:17:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.42 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425841; cv=fail; b=NlkL2WH0vnfYFPt68fq/NzJrhocV11wES2oh0GZtAQZ6tlcmmbsCo1OvuCgvKr38lV+0DWC9DhlTv/5zu0SNbfLjXPTC3MUNyRiESgCBNBihSdwHl01m8nWHcozLZcS7bC1XDhv9Xoa2BBOEd2dmeW+aYbVMdteD4ozUpi4w+HI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425841; c=relaxed/simple; bh=3ajCeJWwKGnIuIRxtZoHxudNg8Sh/rhnFW2YiHLoLsg=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tWZW/5WYhlAXJPA52RZEM2iq1RKecstQkxdoxd/OB1Ij5xPRgsg7jfvq58zkGQzxFnpf5TZuFoiV+2D8LL6Ua0slMu+JL6S4zhPai07yL/7FRuEC3l5POW8JBVkO6/Yg6wcH1cNY1+Kb5RmvLFI10Y3PeJewlZUgu8TY7Z/raCc= 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=HliNjP42; arc=fail smtp.client-ip=40.107.212.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="HliNjP42" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dnqhJNaFlNbg06zpbnWd9AUwqAXSmusK8V7zmrcLEOVxc8iV1bdfgNCANMyVFJL/lAlKs/tA5OUAtZCKZz4+1bosyA/NYOphjffFThvonB978HmM9QzOgGYGFqPYqEV5pNQB8ykvKv7wjZaKTN/ojXJHAofyvrLhwUaUMXedlqHqdAGOcidjaQpMr5QaMfLzMf6edcvOyrzy10XtB+QyVTJER8EOdeC4tmBFEd1k3EPI7K3PyeA/5RimEQ/ZF8hwCiHdQq+L9fN3VpG++lcLwZAEXji/gEmAVqoDXPtgA2gfLVwACgah520yhIOfgYzUlWtfxZ1cVPSds62AEHYIPw== 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=WzeuONoSBQVkfMYVqHFiOWzK8/y4jh1+ot/IDWAMvdU=; b=nUIH3MnNz/D8ak4izxi70EfPzr3tUNCRu0JGxypAZo2Juz6Xla4b+vb//gYYLehUuu0pdsGyIdYr2Dfaygf82JXUndOBa9dAZG696ojs2ytSb+zCOzuRQaXMl/s2/2MAZ3GievEG89FPA7s6geUDPcnsP5SQmMq+ggNZRzSW+4fpPInD9OrWXj9sTljwiv9qK5+FAd7iHIpv1KbJ3il2QoZmDrYAHnKQnTmHszDBAN7XYpW0oJ+fs4mEAdL4QIerlwJp8N9642sYZvefQCI9i2klVrbO13odOnuhSggx9gKuYgIOANUQviQGp3ml3U/EXw1tWi/g/GKnxxIWY0SbRg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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=WzeuONoSBQVkfMYVqHFiOWzK8/y4jh1+ot/IDWAMvdU=; b=HliNjP42pghASFZmoEaIDdBjAZWhnYBgXhHoeizbXFw323vYFZNZ3iBfhTRO79RPOxIG2DsZC9mHp+XOugc07/Kr6gC4kCI0Y4u0CCyauvYe1TV7nWC8wCf8s06MEPrIJzkrt83BqIZN1WaSEzPsINaKO/h3rY6vbaXu5XTu2wI= Received: from BLAPR03CA0090.namprd03.prod.outlook.com (2603:10b6:208:329::35) by SJ2PR12MB8159.namprd12.prod.outlook.com (2603:10b6:a03:4f9::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23; Tue, 8 Oct 2024 22:17:16 +0000 Received: from BN3PEPF0000B078.namprd04.prod.outlook.com (2603:10b6:208:329:cafe::2b) by BLAPR03CA0090.outlook.office365.com (2603:10b6:208:329::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23 via Frontend Transport; Tue, 8 Oct 2024 22:17: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 BN3PEPF0000B078.mail.protection.outlook.com (10.167.243.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Tue, 8 Oct 2024 22:17: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; Tue, 8 Oct 2024 17:17:14 -0500 From: Terry Bowman To: , , , , , , , , , , , , , , , , , Subject: [PATCH 01/15] cxl/aer/pci: Add CXL PCIe port error handler callbacks in AER service driver Date: Tue, 8 Oct 2024 17:16:43 -0500 Message-ID: <20241008221657.1130181-2-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241008221657.1130181-1-terry.bowman@amd.com> References: <20241008221657.1130181-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B078:EE_|SJ2PR12MB8159:EE_ X-MS-Office365-Filtering-Correlation-Id: dbbf03eb-a5d0-41d5-0394-08dce7e6f6fe X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|82310400026|1800799024|36860700013|7416014|921020; X-Microsoft-Antispam-Message-Info: 68BUTrfqrAkzFAo0Da87kN0FeUuI1sjuDq1G/qKHk/O+q//MFWxJ1ZQjpKvJTS9wzo/hvtaBZji1GaOBOnWY7iThQTSDYPiQ0O+yQAsaKBzc7qGXnXi0DCgjoyXBNOyrT2/i+Ni4zG5pHrxUdhHRzU+YT3HALW648olO/YAIfUjw7OsbFGfQ9TSfdBCKq8nqSXLvcyZ7iQiuuISVMCxCDzmKUH77dQeUjtvM661+GlJEXXQyF5cCDw8czcNs9iF1wHBplb60iqq4kiCpaMiDV1Z0ck14RCC7Z4Y2JzfJqR8rXWimlAZnGLPhVN7/o9SFMEHRLX5w7/1EH8Vuv+O3ai/71nm4XXjOhnY91yc3ToRXAMz6qykHb17yJMq9GLFYkerwatMjEf/2b79Oog0Y3z4dtk1PytuSh6luKAQqU65zZVT6DGM66yJqt3OsRc71Jg2y5R1zoqwLaWl5yu+ugwsSmEdl3AN3bV3KinTM7/2VdKb0sVsMTChTbCAoOgyt5v7fcPUZWprXCqQRfiX7iskX/HTZnfp9SFbiBBtionmHoIfJmgX2N/3bMjQ18MjRocY3cfsHORXZMyoFtqLTOQXzoExbSaqk4bMngYYHyZpayFzxowjL6pBDYWuM0S1Y+NZ0hw5lO73Tpa1Q1/RV7Plvyu+LK1Y+IbyubswlqSufAIUOinM1Ppj9C9zqBz1/JNsZ77a2YRqhayZNTLl5Nwcd33L/yAjyL5sZRDTukYmmg/nxRI/MzM5fw9SJeU92DCYpM+byBkf2qr6JtY+kR1Ll+Gr+/1Rju1FpbBAy0uC6IK8lc/ZTDPJwr6EXnuIEPMBU3PtL/57CGaTg96IiuJ2H73NwdWcmbkJhUlJTjA3JfXUEJVrZOvv9eV1kcGraVKfqZek4FKe6Y+CnYfQS1Feah10WT+zKokI1XVvtFJrPFam/SXCYZRYjex5n8C23Afpc5hbvD2pSLnODGLoNiiZogkaXz1VTwNAt+Pqk97GYhkCOgF/HorcYDnyAjkc0kG2XfSW3RHZgJvyFlOOX8M6D/sW7aC9QvnYfxlOadN/V/bX/geINB1WABZO5V8psZPrNI4qy/QCgyn6Gm26r0+H0BkXSVo4JmVLhjQwBWmY8KnUzNHL88wWRHNwMxz2w8b+U7lFY7zBShIMjzs8/NV4qQlQXz7mmv0lnRwhxfdubWiCWeKm59ccE/jWI4kruKjjiM8ZhrUk9P9v81lBSCKONSWXjX7verDB7oWvOkEQuRYMKhzsnXpf46hXpEBsOQ8PUCXgNstOFUEvW8Lml1eUYR7pIM02IaBUu+GOoA1O2grd+CUlyVmwSnGXWoT8L89UgSgt75yHCg5skIGp4Zzw+hZ18z4bxAQ1r+JkgOzTRwJGMf+vgipnypjqQ6TJW 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)(82310400026)(1800799024)(36860700013)(7416014)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 22:17:15.1323 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dbbf03eb-a5d0-41d5-0394-08dce7e6f6fe 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: BN3PEPF0000B078.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8159 CXL protocol errors are reported to the OS through PCIe correctable and uncorrectable internal errors. However, since CXL PCIe port devices are currently bound to the portdrv driver, there is no mechanism to notify the CXL driver, which is necessary for proper logging and handling. To address this, introduce CXL PCIe port error callbacks along with register/unregister and accessor functions. The callbacks will be invoked by the AER driver in the case protocol errors are reported by a CXL port device. The AER driver callbacks will be used in future patches implementing CXL PCIe port error handling. Signed-off-by: Terry Bowman --- drivers/pci/pcie/aer.c | 22 ++++++++++++++++++++++ include/linux/aer.h | 14 ++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index 13b8586924ea..a9792b9576b4 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -50,6 +50,8 @@ struct aer_rpc { DECLARE_KFIFO(aer_fifo, struct aer_err_source, AER_ERROR_SOURCES_MAX); }; +static struct cxl_port_err_hndlrs cxl_port_hndlrs; + /* AER stats for the device */ struct aer_stats { @@ -1078,6 +1080,26 @@ static inline void cxl_rch_handle_error(struct pci_dev *dev, struct aer_err_info *info) { } #endif +void register_cxl_port_hndlrs(struct cxl_port_err_hndlrs *_cxl_port_hndlrs) +{ + cxl_port_hndlrs.error_detected = _cxl_port_hndlrs->error_detected; + cxl_port_hndlrs.cor_error_detected = _cxl_port_hndlrs->cor_error_detected; +} +EXPORT_SYMBOL_NS_GPL(register_cxl_port_hndlrs, CXL); + +void unregister_cxl_port_hndlrs(void) +{ + cxl_port_hndlrs.error_detected = NULL; + cxl_port_hndlrs.cor_error_detected = NULL; +} +EXPORT_SYMBOL_NS_GPL(unregister_cxl_port_hndlrs, CXL); + +struct cxl_port_err_hndlrs *find_cxl_port_hndlrs(void) +{ + return &cxl_port_hndlrs; +} +EXPORT_SYMBOL_NS_GPL(find_cxl_port_hndlrs, CXL); + /** * pci_aer_handle_error - handle logging error into an event log * @dev: pointer to pci_dev data structure of error source device diff --git a/include/linux/aer.h b/include/linux/aer.h index 4b97f38f3fcf..67fd04c5ae2b 100644 --- a/include/linux/aer.h +++ b/include/linux/aer.h @@ -10,6 +10,7 @@ #include #include +#include #define AER_NONFATAL 0 #define AER_FATAL 1 @@ -55,5 +56,18 @@ 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); + +struct cxl_port_err_hndlrs { + + /* CXL uncorrectable error detected on this device */ + pci_ers_result_t (*error_detected)(struct pci_dev *dev, + pci_channel_state_t error); + + /* CXL corrected error detected on this device */ + void (*cor_error_detected)(struct pci_dev *dev); +}; +void register_cxl_port_hndlrs(struct cxl_port_err_hndlrs *_cxl_port_hndlrs); +void unregister_cxl_port_hndlrs(void); +struct cxl_port_err_hndlrs *find_cxl_port_hndlrs(void); #endif //_AER_H_ From patchwork Tue Oct 8 22:16:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 13826980 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2083.outbound.protection.outlook.com [40.107.223.83]) (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 EE0B414A82; Tue, 8 Oct 2024 22:17:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.83 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425851; cv=fail; b=vB5F60b9Ev08qhhAXw6UXIwJIl65AblMsr9NXRochC2HRR9N+PwUaOmc8QgHsAcTIjoi/khR9j3ABYFIqjs6GgW52peyrK9R9RLuzHzpo/WjG0hrB5IGQwm1uAax+VEj6sxB6h+NpJzxpMJ4I/UYdg72ZFI8APBBCGk93m+6pXE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425851; c=relaxed/simple; bh=SSMpZoRLutuTarErOJMvSEXKfHRL9sFXLu5OJJxOQjQ=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=f3FRF+RHirYKA2ALm9FqaPGPl+kNHD4VLedNXplMcFpmLD7vHrzZBmsL1cP+oW62/xtyyYySDEvYJ51zpW/ibuMvmt2ZjF8dTUQNVCTBwFhAIdefz5hW1a/H9XiBn9PZkQ+I4Q+d/Zzy7Ip6O4jxpB5bFgqIpF8WAeuMYG7UdbE= 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=vi3K9S2S; arc=fail smtp.client-ip=40.107.223.83 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="vi3K9S2S" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XqhX20KxOSHLWKbRRir+TCeLZkFtuZt+Vo2eqH+VIgLPiRbSSabRqp/05ar8tfumkh2jPZwudOTyCMJQ2gGdN7/8w4NHtdaHshYjtKdQ3V/9wxYXjgtV+F4swSvZSe+eYqAfzOG3lN+iFSOcEzjQp+F+i9TVmOPDYAildSi7bFeErl0Ghmra71i43E+tojZ5WAF/4AVeh8Rl7F7fFibDZZPfDhjtIEZdgKaBqIIlPXzF0cRtjEUxLCQkOLhZt9FkTa+GuQ0YY8PamII9pznUOK38dKNDEPxiiSPtcIYNTSSxOuo0efSA/QWyMYRMwnf1CwjYxVwRn5X2wy7AFx+zvA== 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=4sk7/Vpa10zq+0W20CuOYCvwvBeBBvNOMtj1SLJC5/I=; b=admtcMLbTIeSf+XIcg1mlBw7GjTkVxjwyArqoxWpoEriShMIKGmVQVDQHQSeqM5maRsVGhCusCpjHS21B3pV93h51m7IbyO2SpizxvEbiBI2ZngIsFI1ulEnk9FkBSKJliv4MmupX3Y51pMY0vwaxvKoBToyZORoYm0hyLkouL8311CYOlURH/8Ndbdu051x8gEwWVVpm0TBdmCpAcnoQjp2WbJPlpq1ulQ7rCqe/KzSihMNgvmbCAydLRb+an5O2yVnkcZd8tlNLQJ/YQNyFwXBw6PvwutHHRT9dyaLo6TFxWBUGPONJSj7xXaKxj5vw5q/LgHtrggrAnRY6VX4jw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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=4sk7/Vpa10zq+0W20CuOYCvwvBeBBvNOMtj1SLJC5/I=; b=vi3K9S2Seh4PtyCXII7kgpPcTjDIVW3b0Ngn4RKoe3cB3tgAczQH1jHOvv+IRKwnoHWU0mww7510RqLU+hcL1+QDSSs5vBc73eq7qyO3iWnuV4aYnJ7fUcAeejcjzv3OHr8Cppm0UAyLK++AEH8dZWLi2O9vSWqFaHUrR6n0XA8= Received: from BLAP220CA0027.NAMP220.PROD.OUTLOOK.COM (2603:10b6:208:32c::32) by SN7PR12MB8770.namprd12.prod.outlook.com (2603:10b6:806:34b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23; Tue, 8 Oct 2024 22:17:26 +0000 Received: from BN3PEPF0000B073.namprd04.prod.outlook.com (2603:10b6:208:32c:cafe::e9) by BLAP220CA0027.outlook.office365.com (2603:10b6:208:32c::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.17 via Frontend Transport; Tue, 8 Oct 2024 22:17: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 BN3PEPF0000B073.mail.protection.outlook.com (10.167.243.118) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Tue, 8 Oct 2024 22:17: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; Tue, 8 Oct 2024 17:17:25 -0500 From: Terry Bowman To: , , , , , , , , , , , , , , , , , Subject: [PATCH 02/15] cxl/aer/pci: Update is_internal_error() to be callable w/o CONFIG_PCIEAER_CXL Date: Tue, 8 Oct 2024 17:16:44 -0500 Message-ID: <20241008221657.1130181-3-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241008221657.1130181-1-terry.bowman@amd.com> References: <20241008221657.1130181-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B073:EE_|SN7PR12MB8770:EE_ X-MS-Office365-Filtering-Correlation-Id: bd1dc2c2-3d7c-435b-58b2-08dce7e6fd92 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: eSmBi+i8hv2iDhumEYjMH88Gaui4STGoBBnBA0cHCQ89fIG3uRNxpxAyo8gBz2LD15qP0X34uyAw3sxnO8EFeZnBI/ql70c7MXeMW35ri1yvH0u2dVNH9lAUFn+72r3TXwClWaB0Mtdy45f7QjYRTLLluNeJJmgp509VtVXpmwlJqapH+P54PBe8btdsBaCVs3zuAjFYn9hOvuTdcOIVux5ahMqK50WTYm+MxQUEDUQrxUkCUNKEjz5SzhsB83BA97pF8TALGtVRdvT6ovQZu099ZY6RR3XuXDF/nQ6vTDJZZnCZwUvFtsmqpD1YPJyRdhIn7d1EArp8Rsyo0BedD/V80dcKLlMK/5d0JAnFqZQidFrZp4lnJKpslbD09omKHITncvmocgQRY3l2ccCfobtMC5ND+NDcMcWz2nLn5n4Vvkhamcb90Y9PzRu4P1UAm8pjI/lyfFIJ+O7dxNTTNwUq4L50cZEJ+C2HYPmMVNwxI5aVTcfzl/AReyIymGKN8beGvQwDlBpcAN8TfRHPAnSxAbpU8o2la3v4PhcbpqVaoW+0KSjWvI78J187SuAzpZCbVbjgHicd/RT6v0xy9vPqlxhTBcDJl0I5XB18lsRpCIdG/fUhtBiS4KUV5pLwh5/F6JOR7Iryo3ogeZsRe6xuHAUJokJO8n5Oa3Z4JrRZFnJ171+XFa295sARzgmnMGlvbKGt1D3PooMM85QnzuvOYAsXq7OuNz5tb25mIgXIoCqu0RzYRwOC+80G90UMv6HmyFiy+R9Mi7ZI2Ortlk7aSOdtq856f9oVNZRZs0+eA8iv475uDSrnpljfyr5ImPlKzEGYtoEVWY4ubjdnURGzJK+gREbZc5i2cCMzG2Ow0U/siyYP5J2k42aKvg8dqMX02QjNdVtqYVDLRkKYcltuUfCUeS+OUlptHHmxoPJREbtpdQQdjgqr4io2APopy+TscQlBPqYa9hj+hKMg5IV/RrdYDoGCn4roweB+ow98yYcl5JYoWV1giRhkHRV6DgwG1fcTOaNFGbs2lmg0pSZU2JmgWFyvkqhAovYeg4YugKcIXzXZNdXCsQqDzl7o103xkrDgMwNhJcU7HgRO7UtJ90AKTzSLW3RzghJZwLHUDQYIVACkCroqNTnF8+ElU+bD8nieDE+pCBD/OjhqQHB6Non97FhAai4SKXlsjPx3ueplRSorkmUM9iRTu8iESROqu0940Kmo3cZLNxTMQDwYWCicZoqFNiQHPTJrORGn2WXs3rR231rtNtnVNrtU+H1yvy69Nd6GZYsZtAQj+T2HtyndBhOEpBHCYq4tPTyE6B6Ih7MKFX1S0Y+QRldPcLyEYQw2KmiHAlG5UYkgzuWGYsyNRvyYbUDmtg3Rg+CKHobJlB8y8a11UDGHvESq 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: 08 Oct 2024 22:17:26.1863 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bd1dc2c2-3d7c-435b-58b2-08dce7e6fd92 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: BN3PEPF0000B073.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8770 CXL port error handling will be updated in future and will use logic to determine if an error requires CXL or PCIe processing. Internal errors are one indicator to identify an error is a CXL protocol error. is_internal_error() is currently limited by CONFIG_PCIEAER_CXL kernel config. Update the is_internal_error() function's declaration such that it is always available regardless if CONFIG_PCIEAER_CXL kernel config is enabled or disabled. Signed-off-by: Terry Bowman Reviewed-by: Jonathan Cameron --- drivers/pci/pcie/aer.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index a9792b9576b4..1e72829a249f 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; From patchwork Tue Oct 8 22:16:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 13826981 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2061.outbound.protection.outlook.com [40.107.236.61]) (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 288E614A82; Tue, 8 Oct 2024 22:17:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.61 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425862; cv=fail; b=hT2AG6YkaMgbLHgiArSSalGkRYJjU6i5f0nkReNxPc63xL4psT7bmUWydlJNTnBSxIovz7PLEBVqiRwJ5YJfAtCHd66xDFU/ECOlbQCiVm0ZMvZIjcrEeFsunLTvkzmptRrz5xqBJgUOGKAvyksWlf4Ug/OWwnuV0tre8EKAHxc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425862; c=relaxed/simple; bh=Khez0xSxToTOHyrUaMypy7f4f6wN+rGwB6rWgLhZF6g=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=W4OCc1AbKgXsm0+IElkc85gYbmjKjkJpq4heInwhl3biu+Q5GtFD4k+W01t2byXCWbiZZnUrBge/yuPSD1ckxfWKnSf5Xvs6tB4Dwy+OXyo2gQDgtOx0xcZh1osVr0043cvNli9fo0xRZ4WdJz/dG1qGP+Ojysjd6Y1u6IoJmio= 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=LQNYyFOt; arc=fail smtp.client-ip=40.107.236.61 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="LQNYyFOt" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=As5RFjVD5M++K1fPAtq2MVuqkkn+LbYLHsMg4j9yatopdXqp73gjzBqhpxxCQfghF7QihRlCZQxSBrFLpmaTMya0c3u0OB39R+x5fN4ZGshllXnKqeoM+KVhmOyiLOeirMGlzvmxiPHxgaEjh7n39o1fn3lnpfhovu97Lf6th6JJTZPqUTSCtQjV5YYth8Vm/bh+TdLqE+gyKulaRNX+NxQgD27M1hvhdcfSa7vX2Wjg5VVpCSdjYdmgYmRrg5hmuIxufKKWpDi92A9slFMVfsDx9EULavu5v4auEtdAGb52STOUUR3N1KZHKzmdMdqFq3YCUEc2ayrBtpCiFNQA/Q== 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=oUox8n1qf0eOfn8XyU10gGsVoUogdkhUmvwdICPzxJ4=; b=bpkUWUYHEqIpY6Mg/xRSriPt+5CvY2iUzqH3tf0rhuu//WFRsZ2eSzrMWIvG9BeWSRo8+omIAl2MD6oCEZD2wukMAqQlz7o/PJtynkLIyWVKmNYZSgNnsmG5cd/Nvt80HzHLTIL/2cpOhiwSQtFbq/hmGH+fyQg3sQX1lP8xjwAgGGXo1UAh9XjPwTirhvSb8OaTlN0cS3Wa8QcVgVEVfM5DyIG9eXU/SYAzll5g8FMtdTx6gB51gBht5V3WgEl2F2J/tFvQfz1afIpzHRgcptSsiXMqrQrDqVpxzcPYpReT8bbEyIoViW3HpmGnRUnpXthP3CcGKD7d+rHteGTQNA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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=oUox8n1qf0eOfn8XyU10gGsVoUogdkhUmvwdICPzxJ4=; b=LQNYyFOtFCk3uetBIu64p7vQFBsyj16mXJmwpqXIT1cONdKuZDOqDqe4GaAAw0Yn43BR2nm+FJbHiroye746JxPiVOeW12leYH1t4HoW0+xRwHnTymwLy1ldIS0QnDf3UqtIKix/AuVo3axSSykpuu/1jYzUj0O/T3T1FipTtDU= Received: from BL1PR13CA0209.namprd13.prod.outlook.com (2603:10b6:208:2be::34) by DS0PR12MB7631.namprd12.prod.outlook.com (2603:10b6:8:11e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.16; Tue, 8 Oct 2024 22:17:37 +0000 Received: from BN3PEPF0000B072.namprd04.prod.outlook.com (2603:10b6:208:2be:cafe::79) by BL1PR13CA0209.outlook.office365.com (2603:10b6:208:2be::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.17 via Frontend Transport; Tue, 8 Oct 2024 22:17: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 BN3PEPF0000B072.mail.protection.outlook.com (10.167.243.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Tue, 8 Oct 2024 22:17: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; Tue, 8 Oct 2024 17:17:36 -0500 From: Terry Bowman To: , , , , , , , , , , , , , , , , , Subject: [PATCH 03/15] cxl/aer/pci: Refactor AER driver's existing interfaces to support CXL PCIe ports Date: Tue, 8 Oct 2024 17:16:45 -0500 Message-ID: <20241008221657.1130181-4-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241008221657.1130181-1-terry.bowman@amd.com> References: <20241008221657.1130181-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B072:EE_|DS0PR12MB7631:EE_ X-MS-Office365-Filtering-Correlation-Id: 4b04c59c-d6fa-4eb6-dab5-08dce7e7042d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|82310400026|7416014|36860700013|1800799024|921020; X-Microsoft-Antispam-Message-Info: 92+ywI60a9IBg63an+fu9jwmtD+AaXrnzl9YXN6B+Pd1u8Dz97wi1oBn3BxrmEWVK6oI9d6eJwefa9yBzqzVUCUoVskGmAWqZ1CbY4na2gux8B6faFZOWg51q8r3qIa9lo+8HV3SzJly2dCXpkRvE++CSxoweg0cKpQ9TD6gwonHi7Z/kN8iNnVHhq0wv3E6JcRe4jbYTTYDqsQ8E5ZGcPd8i5eti9uZGsprpJWyGPm3g2whLGzXpkD+ojjLuHjy/A+UbfgSDdCluRQilyjsFGE21bYnSa3PqOvq2KHq2gJySmyndaxH5L+v8P/tutBrjc8vzwJV7U1MJgIBbK9vKTlmbO+vRIuHSrZUFdEYQNjhJqMT5ijue3LogpC2hBPJLyQ81CJ900JdY15eYJ0NV0trx2q28YfM9U143IZs3oLLqmvmKA4EZ1kvvfAgpBbNrXuy8E0wWlOkJgeiUherGvXuVGDgl7qf82KA1LH2T61+u87E6GIQX2TRFAWRqpFFTz4AmrIC0WZpAfYNDVXQ8bp4QaKjYtyXhdFi+ZGI/NpsDifD5BbGM8eKY6Uc+G88JNlssWYtLXvNBNjkkm2kd9KObv7kMyQdZGaRhZs79gcUDu5GNSuaN7qG2WzI+m7kQair4364x3nYFuYBJ6xzCZ76juDsBCfEykBU3nAxredDratlTP+oV54r8Pvl6HXz3QoaKu+j6D5PNnKdaCnvYxzHr46HO+K8IOUUniHcpXZH6yteVu7TA9B84Dedg1BNZqwe6bWzcSdipCE5DvppBe2/ALkr3ldpijNLdFephlNxy5je9Kn2xOxLMOHnck6MWGspkSvbT4EvYOiI9akJlbVSQmbnL09ztq3s+OyVtUCqfuC2DXUVxFfXZy9z5Q6zrJeIqxgZ3ZrsJatYlNdZtot2W6Gi2wugdZzkQvFJKWoaJ3kY4+9yZU36Pa6szaQpTiQYQ6tf9ouhs2nSDG8b2XdTYYuzYwpDv7HZXbjhXHE78VYSCXNIju+HXLwp8Qgolu+E8RvYob9O5gRozX1yHe6u5/SWK/rC6oW4s8gdiaREwBV32NgTpbr1DR7jqgc7MKEixj7WVCXXtOVLm9QfTHs0VN85ROYXcv5k78u1MAEbWkKuKiR3C0YDm4/s06XIYRL0OLQO4P+SDbZshQ3BESveWb29VHb/uvhz5TVAENyICT/YC0QZysZAszn+m6oZxzzqclfSYnMubY99KE+kObUb/z0EX+DozbheN36X+DGH4IKt8CyhhBL9gNDMHClHi831KMARd3GGA12AIF6/gvtYpps44i4cSOGeRI2xj7mbuyzVkqtCc9mnI0+vvMRXIx28o1pm6aNNpoihTVup0GJPgULRi/zWcJHFIeE6//RyYB7eVOze/bUN5vWr1cLB 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)(82310400026)(7416014)(36860700013)(1800799024)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 22:17:37.2562 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4b04c59c-d6fa-4eb6-dab5-08dce7e7042d 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: BN3PEPF0000B072.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7631 The AER service driver already includes support for CXL restricted host (RCH) downstream port error handling. The current implementation is based CXl1.1 using a root complex event collector. Update the function interfaces and parameters where necessary to add virtual hierarchy (VH) mode CXL PCIe port error handling alongside the RCH handling. The CXL PCIe port error handling will be added in a future patch. Limit changes to refactoring variable and function names. No functional changes are added. Signed-off-by: Terry Bowman --- 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 1e72829a249f..dc8b17999001 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -1030,7 +1030,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 @@ -1053,30 +1053,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 void register_cxl_port_hndlrs(struct cxl_port_err_hndlrs *_cxl_port_hndlrs) @@ -1134,7 +1134,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); } @@ -1512,7 +1512,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 Tue Oct 8 22:16:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 13826982 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2088.outbound.protection.outlook.com [40.107.243.88]) (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 549FA14A82; Tue, 8 Oct 2024 22:17:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.88 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425874; cv=fail; b=Qa5ZwTL3TDQby7tnyTi5Civ/ImzCISDLVir7LLsoXgUV/yLorTBARYfgvaHUabKyXWM5ljPlOkW/dwyIxCjKJPaLF0v3xBjlukcPt+qanW/woAqIK6maEJ2J2lovSxIcAkyrNjlQ1ogGSYKyQWOhz29Df53dhtkcJlruzzD7E0E= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425874; c=relaxed/simple; bh=QbiLpf1nxlmgh3430zRD8OWfiRaabwpPK/jw9ikl7y4=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FE31vkiM+wAnaomry6N5yysHqLwLd7P3abmu0GwVyDP0wEUQo9OlNSX6Z+Snpr5XrpWQhPL0I0UbLusnCtmK0eAzjU6ymklcWJlV1x2u+CikmfEXcut36IH/a4oWhYFJIxAZKE78YAaeBc0aI+HvVumFoCLPm72qxRYGGeVtDVk= 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=qe/rSks0; arc=fail smtp.client-ip=40.107.243.88 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="qe/rSks0" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hDuacETvcGN2s2MxQDKMz0wjdmJ6oNrvvJOjStuhqgtGhu7mcNwcLD/2kVoUasYXXJ/Hl6v5LrCckSm1DanvlPQUOAcbUFlKlE+N876eTkIaSJCqRpPuR7g34/sawmFoB/Hlqsxigmme4cCCkPW0iQL2JjvIsG6aYYw7OGY1y1RhBT5JdC/+VWIjs+SwebM3WVG+WVRkMu2CHH6kPoDVtzkCy3ZmRjHzhP6VyLON4KL4WYrY9Bk7tsbMggH8VYYB8DCegpXzBW1UupU2C4zEznsRgLkHk4+ZoWJwHQ4UnuZDBrZ5u42ZKdWRdbThys7u9Askc8V8QX2K+XpH0fBnxQ== 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=U4NymEgzEbnfYrhvaxAPu5Q4T9jwhLX9jJl+5ih2zss=; b=QIjGN/C4YACZb/DD7bg7VjWUO6Je04rb7BCSbK+wRUEwWKtloq4vwWE1PZ7K0iT3eFoSgEdl2wk72XU4RL9qu6NH/szSDw03PHOuIfWLs7HT74+xn9iGd3+PBAXjsRmNJHCTtl8PuieJWjm2wtuSP0tMGG2t2G1C6484SVBNb5ZRcy50TP0sEkTtqvX51YqUH7YWBT3HbEu48mSP1s769T+SXfi9HDBXwsRdYjfCyv8yJpELMtnB4GR4+MgsuMzl/Ef2C8f1rSPejlwjCAhwG64H47BgO/9babHtX+f+L/W9UgvALcmtayq5brO9MvhfMhTzjBHQFBoaYjSYwJ8QMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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=U4NymEgzEbnfYrhvaxAPu5Q4T9jwhLX9jJl+5ih2zss=; b=qe/rSks07o4ZF0hYFVyWrdcFWsIzUuLBaNOOD8zWu/GVbBwMLaYR6qbiEHR3VBqwA2IE6gsCJnUQuy4R+zIlX/A8n4cFcERLrUnkwFazx7WVnXzbgJxlEtPMCcy3bt35CKC9iAz5YgO+qRR0G7x6g5nmDkQL3JavZUNrzS+EPts= Received: from BN8PR04CA0040.namprd04.prod.outlook.com (2603:10b6:408:d4::14) by IA0PR12MB7577.namprd12.prod.outlook.com (2603:10b6:208:43e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.22; Tue, 8 Oct 2024 22:17:49 +0000 Received: from BN3PEPF0000B074.namprd04.prod.outlook.com (2603:10b6:408:d4:cafe::44) by BN8PR04CA0040.outlook.office365.com (2603:10b6:408:d4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.17 via Frontend Transport; Tue, 8 Oct 2024 22:17: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 BN3PEPF0000B074.mail.protection.outlook.com (10.167.243.119) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Tue, 8 Oct 2024 22:17: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; Tue, 8 Oct 2024 17:17:47 -0500 From: Terry Bowman To: , , , , , , , , , , , , , , , , , Subject: [PATCH 04/15] cxl/aer/pci: Add CXL PCIe port correctable error support in AER service driver Date: Tue, 8 Oct 2024 17:16:46 -0500 Message-ID: <20241008221657.1130181-5-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241008221657.1130181-1-terry.bowman@amd.com> References: <20241008221657.1130181-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B074:EE_|IA0PR12MB7577:EE_ X-MS-Office365-Filtering-Correlation-Id: 9cc0c316-2105-4fe0-9291-08dce7e70ace X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|82310400026|1800799024|7416014|921020; X-Microsoft-Antispam-Message-Info: ptiPZ+PGN7KbxApiYVHw6Zy26jB34QOIO6ZO/v13fZdN6ZUz2U0xiv49JO7y06KNqWrr5osipkeujnG8sONl+gZqs/EdMtDv4vTz0R6dPZpR38ikJTElWZPqqxE8Tknik8+/MdNocr45dYGg9dLJFT0PmkEL6S8Wym+yNm7vwpTZ4QSj5c4rpSMy0sdFkNeo7EtNFoE2xNgwbJRwEg+2N32WEe8C06zVC9euHhsP0Y3TzxHWqidjwRFuUomBUK/2bcV/9nOKmJoo2ACEXDmnlbrJWup5RMHf5rj+RvwkJ6SVbfNrjMc+EXUJIr08e5O91gNT2FEUkqHCbFd673cZLVQ7f5En+utnEPcwEB33/X/zLhDqiK+7y3g7No49oZxNnztXazW6iFM4zY7BOl6q+rrqW48gMpryWd+mzpCJFTno9I+Z0dnVd2p0V+awrdPA/D2DnitEjZgvdxhYog6+jPrOc4X9kRdh+3UunEyQSfhM1+m/1eii4hiGaS8Ey/toMiOPAe0g84TPbJiWI7/D89OIUgTnFrMPhRtT153zFe2zQakS/g1Cr3uV5bo+XBMTo5/i3v1WiSE0maxBdHQP2zUOKP2cDqIarenoehXo/m/0aBQHRe9NdnQ30JUilCtUB2sSjDqyvCNssmw9kJssNRQhwAz5RLuUnGQXbOp0A9JQOjcV8b4+PWQQZk0pitpsQ1mro5/It0NZmQg3l4GIAN5V1VRU/jpJCirERFC+shvJRm10PQ532deXmF7JqKYOtOeSlXEwHGrruZ05KdRfIlhzts3RYCWM+yeFHowhn0YEttUlJk0q7fV5ipW3BHxZpO81X2LUdw1dbZAD9f1YYJTx9hEJshjsTWHkktXqW1br3n97Rwne0zK54L0Z4UOo+MM11xIfOtDuYSCNoCmOMXRV/KAuJEoJrOgnsf9FT5aA8Z3TurWMqstYK4+7SmCA4vEw0kotHPLRjZhPY9AZ4qYZKV6swD8BNKnqpxE//2VspTCaLg+C3eRnfZTmgL7YoNAPOfLsWun/NY6BjCkP/BaMH67aUuj9YhZ14fO/bYQdaXHPS79OAfolSh5KRByPi5cL7pPkBep2splmPPH71TY692z4UkD+Je8ZTw44Qj1x1fGuhoJw7sKNQRt4eSqPfNwxF9qhxB17HSowOazRtAYlg2ooqXXNy8jRZIvMdAGbYpKOgrEbwbXdBOiA65ORXzcCz97c/viC5vZpBM5CmqPaZZ77PrttGzoc0HkaQvtyB2Y/S0S5PrRIvUNbVNGJFVzc6GDHqeTl9KO+YPRlAeZorBxiWeL3CJyeC+egd4KIovOqTOIdlBTFlkH+ZLNPbYl0BuLtsU5Z2qmHPxr+RJXo7SVTzSNj78U8tAzIS6Hnb0uSasv/UY+AE9NboC0D 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)(36860700013)(82310400026)(1800799024)(7416014)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 22:17:48.3758 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9cc0c316-2105-4fe0-9291-08dce7e70ace 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: BN3PEPF0000B074.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7577 The AER service driver currently does not manage CXL PCIe port protocol errors reported by CXL root ports, CXL upstream switch ports, and CXL downstream switch ports. Consequently, RAS protocol errors from CXL PCIe port devices are not properly logged or handled. These errors are reported to the OS via the root port's AER correctable and uncorrectable internal error fields. While the AER driver supports handling downstream port protocol errors in restricted CXL host (RCH) mode also known as CXL1.1, it lacks the same functionality for CXL PCIe ports operating in virtual hierarchy (VH) mode, introduced in CXL2.0. To address this gap, update the AER driver to handle CXL PCIe port device protocol correctable errors (CE). The uncorrectable error handling (UCE) will be added in a future patch. Make this update alongside the existing downstream port RCH error handling logic, extending support to CXL PCIe ports in VH. Signed-off-by: Terry Bowman --- drivers/pci/pcie/aer.c | 54 +++++++++++++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 11 deletions(-) diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index dc8b17999001..1c996287d4ce 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -40,6 +40,8 @@ #define AER_MAX_TYPEOF_COR_ERRS 16 /* as per PCI_ERR_COR_STATUS */ #define AER_MAX_TYPEOF_UNCOR_ERRS 27 /* as per PCI_ERR_UNCOR_STATUS*/ +#define CXL_DVSEC_PORT_EXTENSIONS 3 + struct aer_err_source { u32 status; /* PCI_ERR_ROOT_STATUS */ u32 id; /* PCI_ERR_ROOT_ERR_SRC */ @@ -941,6 +943,17 @@ static bool find_source_device(struct pci_dev *parent, return true; } +static bool is_pcie_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 (!!pci_find_dvsec_capability(dev, PCI_VENDOR_ID_CXL, + CXL_DVSEC_PORT_EXTENSIONS)); +} + static bool is_internal_error(struct aer_err_info *info) { if (info->severity == AER_CORRECTABLE) @@ -1032,14 +1045,22 @@ 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)) + if (pci_pcie_type(dev) == PCI_EXP_TYPE_RC_EC) pcie_walk_rcec(dev, cxl_rch_handle_error_iter, info); + + if (info->severity == AER_CORRECTABLE) { + struct cxl_port_err_hndlrs *cxl_port_hndlrs = + find_cxl_port_hndlrs(); + int aer = dev->aer_cap; + + if (aer) + pci_write_config_dword(dev, aer + PCI_ERR_COR_STATUS, + info->status); + + if (cxl_port_hndlrs && cxl_port_hndlrs->cor_error_detected) + cxl_port_hndlrs->cor_error_detected(dev); + pcie_clear_device_status(dev); + } } static int handles_cxl_error_iter(struct pci_dev *dev, void *data) @@ -1057,9 +1078,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 = is_pcie_cxl_port(dev); return handles_cxl; } @@ -1077,6 +1102,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 void register_cxl_port_hndlrs(struct cxl_port_err_hndlrs *_cxl_port_hndlrs) @@ -1134,8 +1163,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 Tue Oct 8 22:16:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 13826983 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2082.outbound.protection.outlook.com [40.107.243.82]) (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 0AD4221503B; Tue, 8 Oct 2024 22:18:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.82 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425884; cv=fail; b=ZOpgxBufhq8Ky/Ina/CaXC1XY2Pqa8VUXk/S5EBs5nTahu1sPVJdnsIw+JDl1pDDfmYrd3to8RMRzYdTKRNvvg0qv2+ZZ5mzro6I7wiapOofTrDCzDw11xUDP6I5V+FUa8M5h+bICmKXM7jbykDswVdSvB0RYXzfNLpQemKvKkc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425884; c=relaxed/simple; bh=OJYtZWQw6f669aGAjML3ycJHL7HsB6Al3dA3n8GFPFA=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HBLiVzm6kjikWcGIrgUpO8oI6cjutuBc0d8fmn0fiwgKpo8Wdian+Fwk+pU2teiIXT808aCZ2wQuW6RpgnoTAeIfRbVRRhs7cBYQE4GgkUZe+XMFsjxS2GNBPN1vuIvr7UxncBFCPbt6LqweiNePUouW6E9i+WEBb8udG7dAa/o= 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=XXtZrCRV; arc=fail smtp.client-ip=40.107.243.82 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="XXtZrCRV" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SqRftEEs0ls9d4I0lwfAiBFesQ9KgV8tJd1WENIN48pEsIkRbZ4WQ8sJ+E2ROxTZ3gRByMoSBPrNMBFjTXQKX1TdUD8o8x8Ffoix2pgYM/AOnEa95cudz+VjKXf7XsErDZ4vG4QujYZmW+uKTbNNbZn8/jEcN13F078JxgNRWKg3uWxX70p5uoCPb24r8PHHpxmi1Ok0LBVh9vcQNFapyg+jb2CFpkudzQ4ggQg7E893IVHJvj3Aa33XYQKEED06rsH+XIx1oLqu16M9Kb+PXx6A59RtthxFEXd9hFBiG/R9CZbXmh/QRMRp5vEFSLbTLbYfAUT0hHM15BfuKZ759w== 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=wCdctbVVHEMmR1KiD1vViPKiykyG3dlIPIy2SfUwEEc=; b=fDgBwRUl0hxpy0kNT5HmJJsdjHF6bhRZmQtO9J1QLDrg4uw9i+6IFZBDNQOwPhGwiztDwBRiNu+AofbGMATSCCeAjywaA7kDAnY2rIHpM+gS0AJXwQCcHchlk0imeP39Cw0+RSCuIxnpDxBB4C8DWNdXzU2S7gdqk2QMey8MGbSPfIRDMONd7kCi6OZfMuVu3wAZ6KZz4rPEA6kii/Qsg5GU9JzcRB8mZl16ITV91H6i929WwYO/zSCyLWsuJ/HWAxrqgc5MgOv0HKuFsVHTBFaWiS9EMuGA0pfzmquIsFLtyxrjgXiLPjwMExUa80kxcAmbIDWl8gLlLzh8KY8qEA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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=wCdctbVVHEMmR1KiD1vViPKiykyG3dlIPIy2SfUwEEc=; b=XXtZrCRVrIjvuxQnc4nXUQWAye+cWbwpWEkpR8sBlwDeBvcSTWbW/607XhuwSHcWpBmhzswpUODoj8O6glEYBWfk1TKoTd3RF0PYdEBND66YKT55pFwgQE0TmV1aUDalL3V0f4cLafa49V0BwljTc7CwmOr2kAxf3W/KTHVFn2g= Received: from MN2PR15CA0051.namprd15.prod.outlook.com (2603:10b6:208:237::20) by SA1PR12MB8844.namprd12.prod.outlook.com (2603:10b6:806:378::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23; Tue, 8 Oct 2024 22:17:59 +0000 Received: from BN3PEPF0000B075.namprd04.prod.outlook.com (2603:10b6:208:237:cafe::b1) by MN2PR15CA0051.outlook.office365.com (2603:10b6:208:237::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23 via Frontend Transport; Tue, 8 Oct 2024 22:17: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 BN3PEPF0000B075.mail.protection.outlook.com (10.167.243.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Tue, 8 Oct 2024 22:17: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; Tue, 8 Oct 2024 17:17:58 -0500 From: Terry Bowman To: , , , , , , , , , , , , , , , , , Subject: [PATCH 05/15] cxl/aer/pci: Update AER driver to read UCE fatal status for all CXL PCIe port devices Date: Tue, 8 Oct 2024 17:16:47 -0500 Message-ID: <20241008221657.1130181-6-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241008221657.1130181-1-terry.bowman@amd.com> References: <20241008221657.1130181-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B075:EE_|SA1PR12MB8844:EE_ X-MS-Office365-Filtering-Correlation-Id: de3be1b9-fcf7-41bf-2728-08dce7e7115f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|376014|7416014|36860700013|921020; X-Microsoft-Antispam-Message-Info: WTiO3jqrs4ZounpFYTxDDgg3VyPdDme86DBPliozFj2CUuMeVcuU89QLvRJ/NL/mKocD012Xeoy/y8x/4MUjjZ7ewLsVuAlm1s3bfxu7pP/qqnIxf2hruENQKZm3qRt6e9RTuw2mm8qpPKDnyLt64SII0s+cAA4r1IKIfzHZ84n0WfbHn21T1RPqwQop2GFTpsOKyaXe3oWmjEIx/RzQFRMyq3w8XWzgD7NX41sIci+AXxm00ij+xGWK3SlG23HH8u7HZdDzpZo1BIItzf5IGt+i4yRcsJujhUDa4LrEESsb3lPFgmIJDdWgxYljvKprST2UK/MKoxB+jTRdV2zgtCyDDMrboOuyiGPhs1QTtdKwAiyZOHYGECd0lifBVf8KppJR8TuPZDiFVeGtKQ75OqihncRZausff5uLCCYaqw7sxVVgvGFPUgWDgjYjw9v/9gXNjjvYwEbhQzXtbCrp+C6er+POfWpe22S+Shp0bxew7ik83xScGltHY1LYApCENWFUkEXiASG87bBWN20x5LXVCb7/Ru07Sndqcgh62nIFNJulBOlMOKFu1KAe4Yj0btvyF+Sqgy/tnV/GbI4zB0kCkZHlu38J0Y3FchGajD2GmcN3l/Zw/9ORq/TJcgX2nZ4nmbre9ncnEnYGdpatwkmIFFRBXJ3u05FSCBj2fvRh5jt//S0p96kAyc9UJipKBgpdVSGNZDQFftVr9hLGIo4KbIaBKELmaMfy2QNLGE0fP8305eyhFesecR/bQOEYhB0XeW6k5Gklo94E2a+nA1/cUCs/uJ3f5GIiwaeleXM304WC9ztB74gTgwVnDp9GFGdMTJGDQ62TldvmrqlgWNlyMMIBiMdCYT22BuqijjY5h0naFpjTCXN8SeSDexbpMBVft5AYjuOrsgiJJLDN0GkbBictXlZignpR8h+54J0yTKFJJnUxNlX2GS8UWThAVQS33vu7I4SW8HXogjSbP5bgoq7aIMMkLXXiM48BygwgoU4QVAttgfPgjwI/ZzGg6BM4wuq3eGdL7EIbH5KZfMlBQ5tXhoCpFR5RVucIr0Yb97PSxH/HoXmKpFp/xd//kBOiEF2nABGCaL5UE9HZb5loUryUh25FYXnkwH2lFYD30nEVJTEJZF5KRQsU/G82rw26AecA7E1eRg4BzaIb5Aay6YT8nGIikSEqoD3FBFjvWqnWlDEoVekc3hmRLfWDadXEouN/+dfX9RdPDED4PXRLIaQLPntX/Q346K6Otumsram13SF+IbE2BwG6V37LTxIdc/Y0VE2vNRPHr4FwIW5j+Zq2+tZqiAETrlnWMJXLQwgWGHfzY7sbAL4vHxAGVy6yroJu+MmkNBvCmZuzNxXK2GZhHM3NymOhyfWbi8MwJhtyz28QuLh44752l9TL 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)(376014)(7416014)(36860700013)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 22:17:59.3896 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: de3be1b9-fcf7-41bf-2728-08dce7e7115f 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: BN3PEPF0000B075.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8844 The AER service driver's aer_get_device_err_info() function does not read uncorrectable (UCE) fatal error status from PCIe upstream port devices. As a result, fatal errors are not logged or handled as needed for CXL PCIe upstream switch port devices. Update the aer_get_device_err_info() function to read the UCE fatal status for all CXL PCIe port devices. The fatal error status will be used in future patches implementing CXL PCIe port error handling and logging. Signed-off-by: Terry Bowman --- drivers/pci/pcie/aer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index 1c996287d4ce..9b2872c8e20d 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -1282,6 +1282,7 @@ 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 || + type == PCI_EXP_TYPE_UPSTREAM || info->severity == AER_NONFATAL) { /* Link is still healthy for IO reads */ From patchwork Tue Oct 8 22:16: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: 13826984 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2084.outbound.protection.outlook.com [40.107.92.84]) (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 D97A22C859; Tue, 8 Oct 2024 22:18:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.84 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425896; cv=fail; b=e2em9O/gtMA29ao90h5LGnF6W0rdkmvyfwCnej0Q2G2SqnN4DH7ABdzlmaqwes8oL1PiY6Pm+JfnZgyh4JLEw9LRLVoBTgsijZn21vMs5xTN5nyPVhclBJLNphpRXsH3rvTWITUu1QWMfp8xq22T5oPYdTD56B1pM2HIoWJJ+KA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425896; c=relaxed/simple; bh=oSF/mO9ozQg+8p1WxFakCsc6TjWo/KZyLNz/4smXDDk=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ViLl4gO+m+MI2oL28gGqfgduFfZp8JgKPAfkf6at6e1xJuQi0kBQp/W7UaRK5V1NKG3c1BGSHHeaxRl95ajgGCpN1pH+TzUFu+HpPQ+jx3DHTpAv+JfeHDuNIjQin5oIXiauxSMhXeJJ7HYieGOtJc/728KAHIKGPheWNNSKxSQ= 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=3iHEssXJ; arc=fail smtp.client-ip=40.107.92.84 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="3iHEssXJ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pkfBy+E2wAav+3jK52t5EJw1EGrPoyy57TALPyvLnGJmmgaZu0wqkirh5StSdDIxUAVfs3gUA4xXP/aYseERkGlToyZOntV3TBA287L3oDDD9eXazekXDx/I2l/BmH41RB5zt5Q1re/yG16eoqFebhPprAWidpcllejimqsj6G6kMUb9/yHmIPrVIC2GMRkTw6kiFPnmh3UzWKj0eAmJ5rUGOZJRdmZufTYaNhtAZQvQbM0L1ljoWcXPhxBK2C026txpxQzpYDSiImSITritCuG3J8ZjzAtIwdHhE1RJ5h43Drbti0V/KIEXwwuJu6Z1Boild64KiSeLTNu+UJCfxA== 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=Fh3w6rWrpDOlzXz+HhUx6VpM4tEKXEvGv4KWMNEaqQA=; b=HYOix/uMT5sKIyBdZiKRifN+jHtQrMyNKQAG5uFo8GoDGj7T8KCXwWgpe4NuJQJ23ONcftpyS3K3jTKVpKYKnxikq9MMDfl6/MnfpGzE4mlEJLnpcJ3v21Ea6Msuo4YKbwB8HXMevCay8IlhHbeDYP8fwzGR3zd6rxQsJYX/M4XBJrpfPnPWY97aIqvthyD5lncwtxvUdUyPJc+HEN1p7t9nH51j0Gdr10M4Bcnq1XkUE37OL5JZuFSqoF1JHf9NdOYshxbAqapS7Xr/SxcizdEG6cBj9A/WO+9XPjYJwNdWfqvAmy84O6tHwPhZbSor46k2IuwAVHoQXsZsioSFXQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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=Fh3w6rWrpDOlzXz+HhUx6VpM4tEKXEvGv4KWMNEaqQA=; b=3iHEssXJwwgYEW338qx4GNlk9v7TkTwwJRuYE1A3UxPeP5TqyXsQIFXx1fdqCUbJ0iyCDF67wXgcKNsL20S6wjR0x/RGxYORiaN5lE64iwDacG98sbYSTMe2+CGokOqbgaZUlNiUbpAkR6bIvPJx1pR4fCXZrKdcXZHybljY6cI= Received: from BN9PR03CA0604.namprd03.prod.outlook.com (2603:10b6:408:106::9) by DM4PR12MB5986.namprd12.prod.outlook.com (2603:10b6:8:69::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23; Tue, 8 Oct 2024 22:18:11 +0000 Received: from BN3PEPF0000B076.namprd04.prod.outlook.com (2603:10b6:408:106:cafe::9f) by BN9PR03CA0604.outlook.office365.com (2603:10b6:408:106::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23 via Frontend Transport; Tue, 8 Oct 2024 22:18: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 BN3PEPF0000B076.mail.protection.outlook.com (10.167.243.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Tue, 8 Oct 2024 22:18: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; Tue, 8 Oct 2024 17:18:09 -0500 From: Terry Bowman To: , , , , , , , , , , , , , , , , , Subject: [PATCH 06/15] cxl/aer/pci: Introduce PCI_ERS_RESULT_PANIC to pci_ers_result type Date: Tue, 8 Oct 2024 17:16:48 -0500 Message-ID: <20241008221657.1130181-7-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241008221657.1130181-1-terry.bowman@amd.com> References: <20241008221657.1130181-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B076:EE_|DM4PR12MB5986:EE_ X-MS-Office365-Filtering-Correlation-Id: 2e317adf-bcf2-40e7-be25-08dce7e717e8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|376014|7416014|82310400026|921020; X-Microsoft-Antispam-Message-Info: yim4jDO0NDqNypTDyB4mW4ZJa+6icWidsJd3+Lw2eDO4szcqSsmOvEqWKfOfA+sEi+MSGjkGGe3fHu0gweca10qmAShDUBulBq1tP0kT5aPXSCKTB7EKS2KVeDyAMFsFZBbxFVWB3dEjGLoJbcujTvo87mrkstN6PUKmVNWdLHBxEObFUvMehlZInOLMCYXOcR4CMrZd5jaPsrkkcYiVJfoReWAl02hnLpwlxRdXrrsXFnEOQ+283+cbF1FQcHw3o5xsLQDNpunhWiwMyM37YJU2uh0RATn7MBV+UXbhfvsfbqjOuXd0N7xdvN24+o0Do3YQcBXJRE1EDH90qhflO1l5Pu8kmFvzvM7F1ufP9xIqhNX1wq9N0dsxiIJUXqOTljg8g7q14mrKHoYxNWifSu3lXstbgIjgnDJoHUOeHVUnFiSJ2kWrhuAP8kjvHZxTfuYveHqLN48ac2wFyaynYHv34Qu7L2Q6iAqB9M3k1AhS1TT0Vx0VaG8+DUbK9u8l/SZzYFY+Owh0RATSQBPcRPd/WJwVbdd5UdACANJDax8xpSCP3T9uYAaM9b1SmkRvCklNsbHMxkS5ZRqQWWmqfLKEaX46lw0iM269jbtz3ptrMOlXHfwPZDLeVcrj+KrvNDGf61yonGnC2Avcao06qvlxG921l4yUAAqR4h2EOo8hw0nOns1QoWx9QesbtyzjQBNKDoaJp9o0TTjSPsJBAfhGR7+E4VhA9kn9pM27eZa1AQW+LupBS5Tjt1YdrpR6dymNM+obiBzYHJvB0B1n2kxqCEFM0g0msR9bnGeg+Pv+rOZeokXS2U9ZEJDA9VjJNOBxjVRHOynYLYmxMF4N4fzuSq61lLsSQGoFcPEBlt66D1c6RKX+06NPX9vK86pSb/5xnlWkPo4Es7KVThDpZ3w1I7dr8eiy1cqyv/GbkxitDYycRfboM/n2dx8IonjWSMXZPjRvnNsYs+z+bKQVVA41OJi+Z4gydfLH7RM3AI53DUdqkWLESTbB4qcZDs9a0jYvf3v+E7q1avM9nsdfBbdeAR5M9wEHbks+C2VdqJh8YR+++pYCMRSc1/FiJfXxdeL7vRzbp8FP+EwbW8u79+NtX5quHMtmGOeqo4XMQyoiJXwt2awrl+CQ8RAGsjsNkIALvSgtqGDYW6OFI+8DouwiLg/EW9cahTw15H06u2BXO6/W+TrbxA4sw69XMejE2FuZzm3Ztk5nh1X+NjbrVtJRElJA1HPbQEUqfiRE9iqJ1eXJOqpm1StYs/k4rtL+NNi+nETzmXBK8OwmOeWZnOLzVD5SMCuAPlANi15QK9Qr2lWxrM5NtAgpxK7nhumy8UkkKdC9yJmEYZzLrLrlIf6Wk4OCU+VlUloU8NKqMJllZ712pz/rkj3jZ/qNRnpT 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)(376014)(7416014)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 22:18:10.3733 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2e317adf-bcf2-40e7-be25-08dce7e717e8 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: BN3PEPF0000B076.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5986 The CXL AER service will be updated to support CXL PCIe port error handling in the future. These devices will use a system panic during recovery handling. Add PCI_ERS_RESULT_PANIC enumeration to pci_ers_result type. Signed-off-by: Terry Bowman Reviewed-by: Jonathan Cameron --- include/linux/pci.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/pci.h b/include/linux/pci.h index 4cf89a4b4cbc..6f7e7371161d 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -857,6 +857,9 @@ enum pci_ers_result { /* No AER capabilities registered for the driver */ PCI_ERS_RESULT_NO_AER_DRIVER = (__force pci_ers_result_t) 6, + + /* Device state requires system panic */ + PCI_ERS_RESULT_PANIC = (__force pci_ers_result_t) 7, }; /* PCI bus error event callbacks */ From patchwork Tue Oct 8 22:16: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: 13826985 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2047.outbound.protection.outlook.com [40.107.94.47]) (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 B2A31215029; Tue, 8 Oct 2024 22:18:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.47 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425908; cv=fail; b=gMs0RWgIKZLgDaG1sxQfmxqNZbZp0kla4iRgMtaNLX1PVBTQflahrPHd6xNYDvwfjkf44MKWYaA7S/GgFuGWkqNqmCKegaYQDKF6V78xzF3rlXQt14sdcVOB4IVYdaZrPTDfHmKOy052bh5hCcK2gAhi5BlMAgpcX2TP7WGShRs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425908; c=relaxed/simple; bh=Kkn8mC2FDHoj+bh80mhCXIfMEzekjwKBPe42FzZ3mzQ=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uGtEGcXt8LELdqT/NbHIktdSGgwIj/Kfob7QEqF0QkUd76YNyWFk9iud9A8LMzDShh4ozwfxZcbKK8CA53R2+epdTT6J44KLawRDDCBMIC4VOBMx8ij7ReOcxeDzPtEWe1o4f7+GK8yZ4JdsGoukX55zxFMiEwt5RddI0+wN0Ek= 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=ZtVHY6yW; arc=fail smtp.client-ip=40.107.94.47 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="ZtVHY6yW" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Xblk+eptCqKPPIkknDX/4BPMyXttFssdQAlMFdiIUWhVIqnZYrDZYFsDQJ2NIQFCYxUKthIb7oqgd27LxKcvy6y69Pm/fI+nJWdZ6STX2BPo4A73bmHxGS14gHyE5FHiEUQ55MyUVf/98gFASIkSQEqWqDnp92uPUq9+blT0SrVtn19xduikxV2k2zqvhhmteTbCX5nD9ndkXmKa9fzdvjEcPpGlp6bIXAOso+JQjpZfxTp3gYVxQZurncMEQyh2rUWmyt+fdNlxxac/fUpboTPCftoVa2qSY4FGw5HWU+oMiCy4tCWy9YuZMjxfM6NIcFn0f/0K4XQPDA9W6gC2yQ== 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=AZfNXx/wbIYcbDTbyhbPWoMTc4wLgREmLHj6HiSJI50=; b=QuVY0o4I0grWXgHMhmv92DaM8/NauU8r6PkSHVRHKMY4st5vzd6jto4WCysJ4el/hro7FOBMC7UOjsxpxglSB+Qec8FAyFtbs7M6Ku57p6/pAAl8xs2mK0C2IvJ9MeqEbaNaS+fFfjqF0gpoDuHiSwlbeBse2RIb5AkFChF1438XXkHek94e2WP+4HWqLT2+zC3TcMRdjqxCEjkFwrxSISp+zgl1ARz1eaj56njJZ0xzHNYE35vo1iUrK7YDa5G9jbYbL5y3oSY+1xlSNfdrz3/NNBeNFuy8iXToyfrFm8sB+Kdvd4HKVvn/t+IaGidcp/qBI/lFf1ejsRtf9F/NyA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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=AZfNXx/wbIYcbDTbyhbPWoMTc4wLgREmLHj6HiSJI50=; b=ZtVHY6yWaD3rMeiLsIr5j1I7vaW6Ugdu8N8GLkafIhyjj25WK06TefzSt1V75dOeGLDpWE6dTtD+IW/hJh3dNEZ8o4+ZB+rBLxIux7YR5Z4AiFILYhBvDZVRosB99tnYbqm6ejHg8CcexjofnOqvCOHfg6eKIO9sb8XE6OeRE8E= Received: from BLAPR03CA0081.namprd03.prod.outlook.com (2603:10b6:208:329::26) by SA1PR12MB7269.namprd12.prod.outlook.com (2603:10b6:806:2be::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18; Tue, 8 Oct 2024 22:18:21 +0000 Received: from BN3PEPF0000B078.namprd04.prod.outlook.com (2603:10b6:208:329:cafe::32) by BLAPR03CA0081.outlook.office365.com (2603:10b6:208:329::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23 via Frontend Transport; Tue, 8 Oct 2024 22:18: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 BN3PEPF0000B078.mail.protection.outlook.com (10.167.243.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Tue, 8 Oct 2024 22:18: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; Tue, 8 Oct 2024 17:18:20 -0500 From: Terry Bowman To: , , , , , , , , , , , , , , , , , Subject: [PATCH 07/15] cxl/aer/pci: Add CXL PCIe port uncorrectable error recovery in AER service driver Date: Tue, 8 Oct 2024 17:16:49 -0500 Message-ID: <20241008221657.1130181-8-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241008221657.1130181-1-terry.bowman@amd.com> References: <20241008221657.1130181-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B078:EE_|SA1PR12MB7269:EE_ X-MS-Office365-Filtering-Correlation-Id: e71c4f5c-825e-4a2c-f40c-08dce7e71e86 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|82310400026|36860700013|1800799024|921020; X-Microsoft-Antispam-Message-Info: YpElI/AzMKmrd5q60FXs6QWsCnrjNQ4UagVjpVuNkPYj9p1MHOp3V15wAQQNew+HJHNlZqyRzHoNNrvK+WJqXP3YlJjrM1GTPlVC1igoQGg7N1DApNvUAoinnv8fUCDN6wiak88klOiEXOjG7A7doCk4eFgqTy/Olyx1dRvFddt+Qrydl7qKs1OkuO1PI8TQfXM295zqS4FNKbRvKHEQ2kzaYVlilrl0/+AxaSyA5dhWvE0VCM00e4sCQRPvHQg2jJjcyEcU9ahnqgp8/Dx2bWxwnNbDvcYco2Yf7WKXFDxjVBPzouHx1pLb5EGHzi4HpxlCDemjAwq1rqATiJQ9QHXxIFd/XyTFB2/gunenMj5dx/IXYhiQT1CXEB0TzJdo4TjaIn83+ZgI3n7mB4imupW30HraPwos5sdKZT/EugddHZiAFIeoVNCwwfHSPNqTB7aISz7JaN9IARP4Ja/qIrN1FnF1UfQJKTzOUjL7qKJHo2czOSoDIfU/QqLS5WpC6ybiiG3jROUmzEEDHfNQV4/LqM2nFhD/wu4GTicZvV396YL0vcubt8lfN6oJiXfRC8RvM67D84fmZW41c+tur3XVrke3in2mFcx+HAtHLuwl3GLrdbSLrcwfTT+7NE8B8tN3dKcBsWPkR4pc+iS7x/zscLoYsCGFI1ot62KNhs1ygzCT8MYySpIV824ZnHCYRjwzLYTMUcRp0+kP320U3VK8l7DyLV/xpbtBeJOpSd+/a9bl33GhGSu2LQo++12SRQxjUwkdXuTCzNjp8FvGTEJTxFiJ7IJXAyIzlAsVALEVDVIQdtPqnbQOCUPbJOLMt5aaFTkXXo2YDEWNJZxuNSYsHf0Us7/PP/L3pRSgLhAECp4wDnOoy5oJVYSPU56Rg/ACClvGEgF7b5qDCk2LPa39UdnvaeqPvBPkAyVQqAgL/J+LuUG3v9NZJhvKga4k0sTac0tgMrxgTNj92f2Bmo+7GM12kR3s68lfrT3PtrODxlQmf4DcwYFNLcBJyyJKD89LGcSkAzRuqdGednrSgkpdXc1uMnLW4PwIFgRBZJcu/M9pwmwRBptPQOHhn2DXZNIZRPk0c6FCaVkyGct2uAjeikU9RId769lZ8D5dfAAUhh/wdm4ud2UI2i6cPGTzjyN/2n4IufAcTomfJyzS54wetIEIJ1x/YfTQjW7X4bemAkMfjOoc0DRgWd7JNsDONQ06Y+OdFvkgHVQ9j/djMhcWN1ge0Wzsh/FHbD4z4M3xI6kbh+r1R7yBAlSJsCnjxapfti+V+zPIapYaQZUIKZuVjY5J0vWfrzD3Sh3a2uD1rgV6yDZOmKKlKsLZWqB9G52iQf/eBxfL+X+gTyVCCysp+8P326CtxHSSUGTdxvDpDfQUrJaNbT1Q17/XkVsA 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)(82310400026)(36860700013)(1800799024)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 22:18:21.4608 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e71c4f5c-825e-4a2c-f40c-08dce7e71e86 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: BN3PEPF0000B078.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7269 The current pcie_do_recovery() handles device recovery as result of uncorrectable errors (UCE). But, CXL port devices require unique recovery handling. Create a cxl_do_recovery() function parallel to pcie_do_recovery(). Add CXL specific handling to the new recovery function. The CXL port UCE recovery must invoke the AER service driver's CXL port UCE callback. This is different than the standard pcie_do_recovery() recovery that calls the pci_driver::err_handler UCE handler instead. Treat all CXL PCIe port UCE errors as fatal and call kernel panic to "recover" the error. A panic is called instead of attempting recovery to avoid potential system corruption. The uncorrectable support added here will be used to complete CXL PCIe port error handling in the future. Signed-off-by: Terry Bowman --- drivers/pci/pci.h | 5 ++ drivers/pci/pcie/aer.c | 5 +- drivers/pci/pcie/err.c | 150 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 159 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 79c8398f3938..d1f5b42fa48d 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -632,6 +632,11 @@ 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 recovery */ +pci_ers_result_t cxl_do_recovery(struct pci_dev *dev, + pci_channel_state_t state, + pci_ers_result_t (*reset_subordinates)(struct pci_dev *pdev)); + 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 9b2872c8e20d..81a19028c4e7 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -1060,7 +1060,10 @@ static void cxl_handle_error(struct pci_dev *dev, struct aer_err_info *info) if (cxl_port_hndlrs && cxl_port_hndlrs->cor_error_detected) cxl_port_hndlrs->cor_error_detected(dev); pcie_clear_device_status(dev); - } + } else if (info->severity == AER_NONFATAL) + cxl_do_recovery(dev, pci_channel_io_normal, aer_root_reset); + else if (info->severity == AER_FATAL) + cxl_do_recovery(dev, pci_channel_io_frozen, aer_root_reset); } static int handles_cxl_error_iter(struct pci_dev *dev, void *data) diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c index 31090770fffc..de12f2eb19ef 100644 --- a/drivers/pci/pcie/err.c +++ b/drivers/pci/pcie/err.c @@ -86,6 +86,63 @@ static int report_error_detected(struct pci_dev *dev, return 0; } +static int cxl_report_error_detected(struct pci_dev *dev, + pci_channel_state_t state, + enum pci_ers_result *result) +{ + struct cxl_port_err_hndlrs *cxl_port_hndlrs; + struct pci_driver *pdrv; + pci_ers_result_t vote; + + device_lock(&dev->dev); + cxl_port_hndlrs = find_cxl_port_hndlrs(); + pdrv = dev->driver; + if (pci_dev_is_disconnected(dev)) { + vote = PCI_ERS_RESULT_DISCONNECT; + } else if (!pci_dev_set_io_state(dev, state)) { + pci_info(dev, "can't recover (state transition %u -> %u invalid)\n", + dev->error_state, state); + vote = PCI_ERS_RESULT_NONE; + } else if (!cxl_port_hndlrs || !cxl_port_hndlrs->error_detected) { + if (dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) { + vote = PCI_ERS_RESULT_NO_AER_DRIVER; + pci_info(dev, "can't recover (no error_detected callback)\n"); + } else { + vote = PCI_ERS_RESULT_NONE; + } + } else { + vote = cxl_port_hndlrs->error_detected(dev, state); + } + pci_uevent_ers(dev, vote); + *result = merge_result(*result, vote); + device_unlock(&dev->dev); + return 0; +} + +static int cxl_report_frozen_detected(struct pci_dev *dev, void *data) +{ + /* + * CXL endpoints report using pci_dev::err_handlers. + * CXL PCIe ports report using aer_rpc::cxl_port_err_handlers. + */ + if (pci_pcie_type(dev) == PCI_EXP_TYPE_ENDPOINT) + return report_error_detected(dev, pci_channel_io_frozen, data); + else + return cxl_report_error_detected(dev, pci_channel_io_frozen, data); +} + +static int cxl_report_normal_detected(struct pci_dev *dev, void *data) +{ + /* + * CXL endpoints report using pci_dev::err_handlers. + * CXL PCIe ports report using aer_rpc::cxl_port_err_handlers. + */ + if (pci_pcie_type(dev) == PCI_EXP_TYPE_ENDPOINT) + return report_error_detected(dev, pci_channel_io_normal, data); + else + return cxl_report_error_detected(dev, pci_channel_io_normal, data); +} + static int pci_pm_runtime_get_sync(struct pci_dev *pdev, void *data) { pm_runtime_get_sync(&pdev->dev); @@ -188,6 +245,28 @@ static void pci_walk_bridge(struct pci_dev *bridge, cb(bridge, userdata); } +/** + * cxl_walk_bridge - walk bridges potentially AER affected + * @bridge: bridge which may be a Port, an RCEC, or an RCiEP + * @cb: callback to be called for each device found + * @userdata: arbitrary pointer to be passed to callback + * + * If the device provided is a bridge, walk the subordinate bus, including + * the device itself and any bridged devices on buses under this bus. Call + * the provided callback on each device found. + * + * If the device provided has no subordinate bus, e.g., an RCEC or RCiEP, + * call the callback on the device itself. + */ +static void cxl_walk_bridge(struct pci_dev *bridge, + int (*cb)(struct pci_dev *, void *), + void *userdata) +{ + cb(bridge, userdata); + if (bridge->subordinate) + pci_walk_bus(bridge->subordinate, cb, userdata); +} + 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)) @@ -276,3 +355,74 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev, return status; } + +pci_ers_result_t cxl_do_recovery(struct pci_dev *bridge, + pci_channel_state_t state, + pci_ers_result_t (*reset_subordinates)(struct pci_dev *pdev)) +{ + struct pci_host_bridge *host = pci_find_host_bridge(bridge->bus); + pci_ers_result_t status = PCI_ERS_RESULT_CAN_RECOVER; + int type = pci_pcie_type(bridge); + + if ((type != PCI_EXP_TYPE_ROOT_PORT) && + (type != PCI_EXP_TYPE_RC_EC) && + (type != PCI_EXP_TYPE_DOWNSTREAM) && + (type != PCI_EXP_TYPE_UPSTREAM)) { + pci_dbg(bridge, "Unsupported device type (%x)\n", type); + return status; + } + + cxl_walk_bridge(bridge, pci_pm_runtime_get_sync, NULL); + + pci_dbg(bridge, "broadcast error_detected message\n"); + if (state == pci_channel_io_frozen) { + cxl_walk_bridge(bridge, cxl_report_frozen_detected, &status); + if (reset_subordinates(bridge) != PCI_ERS_RESULT_RECOVERED) { + pci_warn(bridge, "subordinate device reset failed\n"); + goto failed; + } + } else { + cxl_walk_bridge(bridge, cxl_report_normal_detected, &status); + } + + if (status == PCI_ERS_RESULT_PANIC) + panic("CXL cachemem error. Invoking panic"); + + if (status == PCI_ERS_RESULT_CAN_RECOVER) { + status = PCI_ERS_RESULT_RECOVERED; + pci_dbg(bridge, "broadcast mmio_enabled message\n"); + cxl_walk_bridge(bridge, report_mmio_enabled, &status); + } + + if (status == PCI_ERS_RESULT_NEED_RESET) { + status = PCI_ERS_RESULT_RECOVERED; + pci_dbg(bridge, "broadcast slot_reset message\n"); + report_slot_reset(bridge, &status); + pci_walk_bridge(bridge, report_slot_reset, &status); + } + + if (status != PCI_ERS_RESULT_RECOVERED) + goto failed; + + pci_dbg(bridge, "broadcast resume message\n"); + cxl_walk_bridge(bridge, report_resume, &status); + + if (host->native_aer || pcie_ports_native) { + pcie_clear_device_status(bridge); + pci_aer_clear_nonfatal_status(bridge); + } + + cxl_walk_bridge(bridge, pci_pm_runtime_put, NULL); + + pci_info(bridge, "device recovery successful\n"); + return status; + +failed: + cxl_walk_bridge(bridge, pci_pm_runtime_put, NULL); + + pci_uevent_ers(bridge, PCI_ERS_RESULT_DISCONNECT); + + pci_info(bridge, "device recovery failed\n"); + + return status; +} From patchwork Tue Oct 8 22:16: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: 13826986 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2077.outbound.protection.outlook.com [40.107.92.77]) (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 C3A69216434; Tue, 8 Oct 2024 22:18:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.77 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425919; cv=fail; b=uK+rbaBW2XoZNQTRgHvgtVNFsDzRzI2Gg0hWwhW5PS7wK/tDB7iD6XWUmUDtuc2amtF/BRWUOhRtlu/6Zb31tTbFUcBTaFLdONtYyrTwJG2s5hDUTDdKFR1Ld+6c9lwoANJ/OlR/T1fepirstdpj5+8wXGade0wDfDg1ir7LTQo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425919; c=relaxed/simple; bh=tWXbjlwIM9qNFbbcPhA4yhkUdCvK7+WU0BYTLWYNYWE=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HVcDK9PMtTyXJo0RfdT2dviyz1DajBXtUudpx9Bf5fm5mEF4qpDK/y/Cf2SADdRlLKokAQQjuVUOGYEFaBL73U0smoSYptObcxmDcnavVXF77nUSVqiQozu427lh/nmzUlipK8Mf/uLVRUR5vbEwpFrbmegU8PjRLhQ16bgb7lY= 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=qHkAVQNJ; arc=fail smtp.client-ip=40.107.92.77 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="qHkAVQNJ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qnOgsgtHwIMdgFt9UAHe9r9yq2BvoS6I3K/Iodj8cfKjFoHA9ByEgHtijADvetmhIBz2UibkeKi0AqlT9HdrTYfA59DbiDkNBOvB8coBb6seUqYnhACwwwedJ8z85L05PXblK0Wi2KgundwrBm/0XP7CPa5IXCL+utQ5HiGHAjjiTlKl8sozP3sQZPN4JbRKCPoqKQwt3bS5TBRplq4+d40gX9tdpPRxqKJgyMwOG8/TqgV/8qFlEJoEX3SMi8TAuLvZESzcsVYSRj8BBzujiqbUHINY0ZykVGwtLuJErgO6gdcqaIP3w8xuo/ta+qi1tgp/IZrMjubd4WF15hjDQA== 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=7C0kM8b0VZECq7tQOLeCsFwAlc0hBQXp/54ZKhCpVQ8=; b=D3Fa/0Ejr75IagB3ZfzNnN591tKrXdpTjpPoG2ASP8pwMOYPA/WLP9MBQWD4/WI271fCKJesbHXFfQWNlbgY8qhdDgjntO8KucX7yJt3ihAGbM222WQWkVA1wk/prAJAnfAVwTvBNqcN9fZY7XXBUaTBlWnZ3p6CNfzaBo3bd/8GQTcu32a2/Aqqngd0i6aBVbdBfmLLHJ1Equ2kAh3gBXXxQRnlovpZMtvOT1CGLE24StZE/JiGKJol+SHLQewcb8oQT5Y6ZzZT5bHUBJY6+KG2Q1TvoAFc48lHF+HHIdzW+XWLOaTWtqNPJyHJMLXpf/WkvqjzGJV7gZKJ7HGaLA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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=7C0kM8b0VZECq7tQOLeCsFwAlc0hBQXp/54ZKhCpVQ8=; b=qHkAVQNJRzSEjIfOUUgiyzuif4BjrBvKWCtDrLrSPofYonqg1z+jDS1exdjI5tAMdWht5YSYg3/BNQU5mXSXRwWkHrtGrgXynL28PrAAkWbiDUNoUqdzgVTGj6xcjxFN9Db34uENUoNywetdQ26ccMQVbGqcl5vmSPU1gHdIm3Y= Received: from BN8PR04CA0058.namprd04.prod.outlook.com (2603:10b6:408:d4::32) by SJ0PR12MB8138.namprd12.prod.outlook.com (2603:10b6:a03:4e0::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.16; Tue, 8 Oct 2024 22:18:33 +0000 Received: from BN3PEPF0000B074.namprd04.prod.outlook.com (2603:10b6:408:d4:cafe::ce) by BN8PR04CA0058.outlook.office365.com (2603:10b6:408:d4::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23 via Frontend Transport; Tue, 8 Oct 2024 22:18: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 BN3PEPF0000B074.mail.protection.outlook.com (10.167.243.119) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Tue, 8 Oct 2024 22:18: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; Tue, 8 Oct 2024 17:18:31 -0500 From: Terry Bowman To: , , , , , , , , , , , , , , , , , Subject: [PATCH 08/15] cxl/pci: Change find_cxl_ports() to be non-static Date: Tue, 8 Oct 2024 17:16:50 -0500 Message-ID: <20241008221657.1130181-9-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241008221657.1130181-1-terry.bowman@amd.com> References: <20241008221657.1130181-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B074:EE_|SJ0PR12MB8138:EE_ X-MS-Office365-Filtering-Correlation-Id: 4e84dd3a-8117-492c-7f87-08dce7e72527 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|82310400026|36860700013|1800799024|921020; X-Microsoft-Antispam-Message-Info: AcFAKhBEICG4bYHq8PgXcHnsEYDkzstZkAokTIUYQPGxdOm8SK2UBKcGAfmTd+FbNrQouKORs1XaBi4gmpPLvg/ZD1FPmMLx/Uo9U6RlomNCbgs6gZGD8hFtRE1mtFTUNvSFl3eCcX2xM07ayOCX+snmY3VCsD8lv66mOFeZdYueQRZVsq4omjPwKU55CrbWDVZZUENPEFfEI2SvcmEf7VpMraWLYkbM5I2Q30lFPy4w5lfuO7/tH8RhMK6tsNXX1GnnrW35MW5Kq5me8eISEbLBZBJbtFemNO7v0I8r3uVqTMPgL8fvilR71XTQ+H+6Z5jgpyU3auDw6qPUe744gtEupq8NgiaufnDARgAdqZ6u5/LdReyxMgOYB0eRT8Ob3NPaiO7Eu2eSqwFKYf0ToM2i4/bW+W3F+qlQUxaq09YCWgmAz0cy7BM5AVTuX8iirHZ70waBsQAgafq9yB0TCssA7MqVZVUpiPzaE7gnXDIilCrrsh3bjRuHWfF23G2iItmqnPf/Ug5MzXRrxVfBTng3AcYasX9SyFlLIaTVZWgjWwaC6Gn1+X5ABZRpW9CzDi8Bj/DB6JIEbhvXXwRo4Vjc9svS42NFRv1hv06ZG/83FMywMtiTkh1w2WCiCmJU5ywtke/VnDEZHxIGTZX0LTpdOSkVDTh3d06L3vxWPytffSYxVft6zi3EInppgZN8KPR6oJx5Xk2WUazh+f3SiXT1mEXxdDGuQWG2Y4GlV0+CUDSOyffbTOBdjHOmVInHMMkuGn0hrO1Q5Fo3h2BW893vXxxybB8NytfGLuJd/f2VEkoEs6OKF35G4+M4viEHkb1e1BN0VdKCqmznTu+6V/703AsMamFdnerN5lzDLPTXMBGn9n+ExXjYh1BcB/4leQAmfC1tmBwTX02CpKuLmQ8ClFu9g5AGhRpCetYxlGMhpif0f/gCpdxFcpWBRwQNlO7vlpwzr8YvGfG0gFRYuJXpcNeVqaemkirfFFpRGH+CcwYPkMhIjQT1XcHqhS++VutA3sgu/TbpqXBvD26/fvWCi73BJOvrlA2VXfTLgEC+HiXZzhDqukZ9r4DifqvPzQwHm3idaOwZeZoWLJfSsxooQ7neH6m5mDf04Zaj96TY1k7SMOEZqOC8/jNNXMk/bAAWcchHSGAB04Zqu5JuL1cn7WlJboYIPMw+ieZBtQl2OkNsPR0K85iIlnazQMiWfmXoXYTgS7YMU+FS24jgr8rQx7tD/qHj3ijPdAEzsRrESyemcDdNVhhe8Gk9L79AZjhw5NL1XKVRnr01a9F8rJJMpN5+ShMFw9QBvddYivDn61t7WNgSmsTc8Li0slrJASqnzTWBL8DW57mitSy+kWI6jraVxG32Jg7teNmYf4T2DxZ01pU+TuCSgaQbkrMz 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)(82310400026)(36860700013)(1800799024)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 22:18:32.5949 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4e84dd3a-8117-492c-7f87-08dce7e72527 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: BN3PEPF0000B074.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB8138 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 --- 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 72a506c9dbd0..14a8b4d14af6 100644 --- a/drivers/cxl/core/core.h +++ b/drivers/cxl/core/core.h @@ -108,4 +108,7 @@ int cxl_update_hmat_access_coordinates(int nid, struct cxl_region *cxlr, enum access_coordinate_class access); bool cxl_need_node_perf_attrs_update(int nid); +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 1d5007e3795a..089a1f4535c1 100644 --- a/drivers/cxl/core/port.c +++ b/drivers/cxl/core/port.c @@ -1336,8 +1336,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 Tue Oct 8 22:16: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: 13826987 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2086.outbound.protection.outlook.com [40.107.96.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 A8D53215039; Tue, 8 Oct 2024 22:18:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425929; cv=fail; b=tbmhJ/8U2Pc66r4Ac1NqSl0ialPEjtv+h8FiExqNykA/cGm9HVcr57IRLhtw1XSbX8QJ7Veu4iSwZg+Yb90wS71XlYPcmRPEtEbposjq27OlnpR+hLdkWf/wB3ONunu9YjnEemIu69jbZgebA/GN+WYQkv4ZQlymdxOIO7DhO48= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425929; c=relaxed/simple; bh=FO3SwhHWq8DD2fjZrIXlGQzQqK+orFXfoHefumruETw=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BCzY6BsqglUF7FjILesrNcARNQhUCXYQE1v408xbnP8dFgvjMPPNkiZiHVTrBeid+x2tzzA2kQ8R2zXRleboQfQpigKTDebqLBRlEyHK+JvGvCMv67M4d7LWmxB3A62V+uavDo5pKSMVeocYvhwS5y6uy3rvGDayneUP+hyIlh0= 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=jUw5JxKF; arc=fail smtp.client-ip=40.107.96.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="jUw5JxKF" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aFXmRxHenhQ4XJeSkW4Z71ElZFYX16k5L+NYkYpvPlGsONQ0xEXfu0blqXQoiTz+U9ZDWluWGKBg7gMOjpxHgCLgLws8zAxMRfEYcoy3No5Ddw7+3uuS+cUIEzhQXwex4FFjRJivcXKmud1iI6uGQLGHRojuKTj0lVPrfuZFp+MGqVxJ3e7kJGFIQz0VOt+XCs3ymQ1IzfpyTlu0J/TEhL7sNe+jVGbsxiwFT0SakljBhP+YE3svkbARgyQoRTTeCXBX3GpF6HWgMPOiF+D3X4OS3F8roK90WLoeylVxwFn3LZTsRunqsAHws7Nle8BbZ/HZVxW76oyu6xC0yTivSA== 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=/wfs9/9pGlrUYcE94dso+MM24VISuqUkE3p3AVyJ/aA=; b=OIzF/6xoHcR5yu+HYWsoYpNumysj3ziYlOMC2NC7RuksOhKUtGmx11zG5eltLsZYucQmFBZ6UiLKWiST+wBc/0UEBtldg9178RrTW+26uC98PEqKwLMir/I0tBMWnOcQjkU4v9LHpwnFIiyV4gBU56oN1WQZABiOLj1K7LUg2SPCQKx4cTTOKOHNGumrjoZ3y6wUdFCzd+IJ83LHm+3xRsWqdW23t/5cWUmCPnyyQHvCul2+zBsqUrWRlMImcgdu0HQXGw4wTprOaQf0D6xyblIl9B5iZbEE1Qngx4CUMnkd3rrGrrfbMRcHCizLlskL730V8vvG7chOLR5V08sG6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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=/wfs9/9pGlrUYcE94dso+MM24VISuqUkE3p3AVyJ/aA=; b=jUw5JxKFJLHbDL/HgwmmeG5ruZS5yjzvt8+ZlQJYY26wP5ezZKwaWqzP4/9/lJjzKzw7t72CvzjilJ4gFHzD98ta202U8sEnSDMMWyZhDjZVJtZB5oO3euszHcgA6jR9TcNz9IPWj2NBd9yJ6fmURfZrq+DIQ4v1zPVcLRtRSy8= Received: from BL0PR0102CA0066.prod.exchangelabs.com (2603:10b6:208:25::43) by PH7PR12MB6860.namprd12.prod.outlook.com (2603:10b6:510:1b6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.24; Tue, 8 Oct 2024 22:18:44 +0000 Received: from BN3PEPF0000B071.namprd04.prod.outlook.com (2603:10b6:208:25:cafe::d4) by BL0PR0102CA0066.outlook.office365.com (2603:10b6:208:25::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.34 via Frontend Transport; Tue, 8 Oct 2024 22:18:44 +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 BN3PEPF0000B071.mail.protection.outlook.com (10.167.243.116) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Tue, 8 Oct 2024 22:18: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; Tue, 8 Oct 2024 17:18:42 -0500 From: Terry Bowman To: , , , , , , , , , , , , , , , , , Subject: [PATCH 09/15] cxl/pci: Map CXL PCIe downstream port RAS registers Date: Tue, 8 Oct 2024 17:16:51 -0500 Message-ID: <20241008221657.1130181-10-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241008221657.1130181-1-terry.bowman@amd.com> References: <20241008221657.1130181-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B071:EE_|PH7PR12MB6860:EE_ X-MS-Office365-Filtering-Correlation-Id: 004e4685-5204-4c26-6379-08dce7e72bd9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|376014|82310400026|7416014|921020; X-Microsoft-Antispam-Message-Info: Fb33BIcssvSNssrpz7cXCP8qlAtXKXaJobKFdezBNMY5UAeQvWqZY90zysCemctO1Zh0NenKbF6/tYz/2W5tOl9dzgrRWXv1BO5g77v7IPcEYFdULsLXZtP+F6JOeZkIR8ghs1cNhQ22fDixOWF+NOdvfS4LZ27QeQswKgC5eZeZ8DhKDhayQ6JBO4FKqaEAHtjcljUAW4zoaELVTsnFuKJHJbfXjnsyxix/jevpmaTU9FMfcpCYM4DmkfUB+ewhopIssOmIHd5MB0iZVurfmH8weqMQsUAspNBxchjmyNXyv//6GQSQACR5oQ9eLmkG6/82enBgNE7HV8M3jqe+22e183jbWAw4ijaLvxg+us0dpnExbHnfco/qbmV1vkwM1hsGD5hbvhzIGtNLSUsUNGqwso33eMgpMSoOKtV1KMguhZpX5sMGkdRRZ3/6e4n896BJmFOFGtbtI5sCqPv3qMdQ3mBmgHt7EsMJz6BJFtNd/Tdq9mhljSB5y1GkNqMjHFqxoAQn/QsSbXt7PlXMXhCrMaOoN3GDJyl2bDd2ObUpaU91rKGe3TAqpUae+24JjvuLEA1S5L2x81zthGSMv6fXOd3rYugRZVgQztY3GMKbXiHsyvo4oPmdVp1UKdd6s/BM9fYdqU2ZSs3qzA/3koQO4F5Xr1yhykdOVetOjPDk/vnE8VByiNVnBvgZkrd9NxPoBoGauJ0eQApa0ZqgUp1Go6N7zXMKIlGVvMPq+XN5uKWZ+i1a2r6WBmxJAF+d1egiV/xsKzAHbUX4MtqanmvNibP3hYc0Oxy85MzLg5aWYz+23aazbMQVB5ob5cyD0VXIwI3yGC6tdoEVsSTIJ3AvxOwUAjrCK9wR1gSsd2jYTZKyZr3tivKQ6eBmhqLGj4g/MBRyjoS/AmmY4oFJpN8uJp+j1A7Fk9TxDnm9iwuRRLshZxPlNE11EWqlTVo6w4DdDgd2VdaU6cX82ULayY2QvM8hl4oqhLX4zgwEgrCIUjt9q2jI8PpLD1y127qjEpAyVXK0jrpMdzP3hD7ikAdeW+xMlUHX+p5y72LVHMp+xWmk4FhqC+5buBQtfutRz5fOF3qYcti1/cjpmpjjuIkwC5zVhQB6nD+UZeAZ1nlGz1mIozZF12qrEP25Nsoa6agXJ72vU+RJqlb8jq8DAqSLJ0dTnFyD1ihiP35Io7X32WZl3uXd4ysF8Iju9dmNK9gRAsyg9ATmGQFMlS3BA5LdgaYBE+KJTgH2y7YHuT/YXCleH/w9Wevj2HjngN1/6ufOYorSC26bJzglj4MS8ExyGOWLOHJlpvKp4YHplVbusuU0M55dE2tFfqVMvREg2UilMrNFNWTbPeMkrWIQrlJw6VlMHNVtf2VGiTrq4p6JgEdmBGJyG0kdHBuLnR2e 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)(376014)(82310400026)(7416014)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 22:18:43.8271 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 004e4685-5204-4c26-6379-08dce7e72bd9 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: BN3PEPF0000B071.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6860 RAS registers are not mapped for CXL root ports, CXL downstream switch ports, or CXL upstream switch ports. To prepare for future RAS logging and handling, the driver needs updating to map PCIe port RAS registers. Refactor and rename cxl_setup_parent_dport() to be cxl_init_ep_ports_aer(). Update the function such that it will iterate an endpoint's dports to map the RAS registers. Rename cxl_dport_map_regs() to be cxl_dport_init_aer(). The new function name is a more accurate description of the function's work. This update should also include checking for previously mapped registers within the topology, particularly with CXL switches. Endpoints under a CXL switch may share a common downstream and upstream port, ensure that the registers are only mapped once. Signed-off-by: Terry Bowman --- drivers/cxl/core/pci.c | 37 ++++++++++++++++--------------------- drivers/cxl/cxl.h | 7 ++++--- drivers/cxl/mem.c | 27 +++++++++++++++++++++++++-- 3 files changed, 45 insertions(+), 26 deletions(-) diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index 51132a575b27..6f7bcdb389bf 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -787,21 +787,6 @@ static void cxl_dport_map_rch_aer(struct cxl_dport *dport) dport->regs.dport_aer = dport_aer; } -static void cxl_dport_map_regs(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"); - - if (dport->rch) - cxl_dport_map_rch_aer(dport); -} - static void cxl_disable_rch_root_ints(struct cxl_dport *dport) { void __iomem *aer_base = dport->regs.dport_aer; @@ -831,7 +816,7 @@ static void cxl_disable_rch_root_ints(struct cxl_dport *dport) } } -void cxl_setup_parent_dport(struct device *host, struct cxl_dport *dport) +void cxl_dport_init_aer(struct cxl_dport *dport) { struct device *dport_dev = dport->dport_dev; @@ -840,15 +825,25 @@ void cxl_setup_parent_dport(struct device *host, struct cxl_dport *dport) if (host_bridge->native_aer) dport->rcrb.aer_cap = cxl_rcrb_to_aer(dport_dev, dport->rcrb.base); + + cxl_dport_map_rch_aer(dport); + cxl_disable_rch_root_ints(dport); } - dport->reg_map.host = host; - cxl_dport_map_regs(dport); + /* dport may have more than 1 downstream EP. Check if already mapped. */ + if (dport->regs.ras) { + dev_warn(dport_dev, "RAS is already mapped\n"); + return; + } - if (dport->rch) - cxl_disable_rch_root_ints(dport); + dport->reg_map.host = dport_dev; + 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_setup_parent_dport, CXL); +EXPORT_SYMBOL_NS_GPL(cxl_dport_init_aer, CXL); static void cxl_handle_rdport_cor_ras(struct cxl_dev_state *cxlds, struct cxl_dport *dport) diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h index 9afb407d438f..cb9e05e2912b 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; @@ -761,10 +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_aer(struct cxl_dport *dport); #else -static inline void cxl_setup_parent_dport(struct device *host, - struct cxl_dport *dport) { } +static inline void cxl_dport_init_aer(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 7de232eaeb17..b7204f010785 100644 --- a/drivers/cxl/mem.c +++ b/drivers/cxl/mem.c @@ -45,6 +45,30 @@ 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_is_pci(dev)) + return false; + + pdev = to_pci_dev(dev); + if (pci_pcie_type(pdev) != pcie_type) + return false; + + return pci_find_dvsec_capability(pdev, PCI_VENDOR_ID_CXL, + CXL_DVSEC_REG_LOCATOR); +} + +static void cxl_init_ep_ports_aer(struct cxl_ep *ep) +{ + struct cxl_dport *dport = ep->dport; + + if (dev_is_cxl_pci(dport->dport_dev, PCI_EXP_TYPE_DOWNSTREAM) || + dev_is_cxl_pci(dport->dport_dev, PCI_EXP_TYPE_ROOT_PORT)) + cxl_dport_init_aer(dport); +} + static int devm_cxl_add_endpoint(struct device *host, struct cxl_memdev *cxlmd, struct cxl_dport *parent_dport) { @@ -62,6 +86,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 +191,6 @@ static int cxl_mem_probe(struct device *dev) else endpoint_parent = &parent_port->dev; - cxl_setup_parent_dport(dev, dport); - device_lock(endpoint_parent); if (!endpoint_parent->driver) { dev_err(dev, "CXL port topology %s not enabled\n", From patchwork Tue Oct 8 22:16: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: 13826988 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2085.outbound.protection.outlook.com [40.107.244.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 8E6E0216444; Tue, 8 Oct 2024 22:18:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425940; cv=fail; b=BJA/EG5msZUWw7QdRV7FKtk1Bn2xAlYTnTfnrExYxZSe8eqj927kUqDw6+ZT8w0zB5Z9pT9ctMxn1XmCuDGFRzBoOaRpb5RuTUCxF3GMRVRMBD2EqfN7OyuybftN0FXatkWbycYnQrwSfWzdmr0CFX5VsngOrJ+UGa7/Zk7qKOA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425940; c=relaxed/simple; bh=n5mqW6CK7reIo+symxOB7Nj8fQWA3uZeEg0DoAwiUd0=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JlMaj1LxSxXU4xuDqFUnIpsXjNeGrMS9Becbmg3n0MROdRRqa/jYThQXA/A219q9heMSclJQhabdNJL7+Sq5NNJ/e+hK7yLhhknW0cDeexI4OZVLa72fFlTbePoGxhfkf/k/Q/cIDJI3/BMInpAixrpc2bvjDvNPBHH5e/JXhBE= 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=QoDa0OzB; arc=fail smtp.client-ip=40.107.244.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="QoDa0OzB" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FO7Z5XxBDkz1SziWX0b+bQe3v2HUHaBiM6EzXcDNT3d1Y175spPgRPwiEZpg7e6glVm1NncN44Kiq051U1HqB4n5bi0f1xXcm/kbpg3vIxEI8q/+XWdkywtxpKxp6nAH976rZvb06RFuWDvg5fMCTC2YYb4kK99zTztZEgXfvFgYUuefsxCRUKQavFylTXU+7BpuVZoZyehbHFqvFq3erzPnPw+P6lvRJiHxLB5j6dzi+SGZzbPNQTRm+4J/Hw4F+1rSNmDIHZYzOXkA29Gku2/RXkqVjhJdDzsyXd4+Tv8FJx/1eOXqHyuaxraxwy2T58+OkXwf50tIm7FpUTbuTQ== 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=8Sbn5U87PdCbAESrXUHWXyxwIM6nvnNs9Q/IwaG2h14=; b=FXg7SS7MrB56mzZkIBn8JGvNRw33emN3HPu2vONVspkEgj/FYoSGDGfB+H+27KXBGsGWqKVyn4hEn0jmmXwZIVKuz8M/+vFS9tPqzor8VGU1HPrfPCRHzgNMiShICAvxXja1SIK5gy/VqfLnZ6YWo+3r6AtusfepJR7yKFdvhV7OUf7cn/6Aew+8CB5owsA9FA6gWCbGlFiTOA+OinhGEQ5hW2CCCwwAws0iF6dLKTOdQuIAjMeUbH/ORxCbcr5BrGYPthaz1NLSXikJnuuIpmkaz4VO29A1B8OrBBCnmGdWkSMEbFKAmFPO1B28ZTxDIYXjmoYBiCiKuYT0sarnig== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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=8Sbn5U87PdCbAESrXUHWXyxwIM6nvnNs9Q/IwaG2h14=; b=QoDa0OzB2PYQntwEaIs6WD/zZKGaUih99Sho8AjEIDz2tsFPL2CqMwMckV7I+n2SMwgiomOf2LnLLNfs/J8SwUp+ZsSSOHKAn+kyD/yifPAt2/JVuA/PE1QUV/ydTGAFh4fy7JjpbPefWPyHsrAdQWmieO1aYmAcH+3RbYxrrJI= Received: from BLAP220CA0028.NAMP220.PROD.OUTLOOK.COM (2603:10b6:208:32c::33) by PH8PR12MB7277.namprd12.prod.outlook.com (2603:10b6:510:223::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.20; Tue, 8 Oct 2024 22:18:55 +0000 Received: from BN3PEPF0000B073.namprd04.prod.outlook.com (2603:10b6:208:32c:cafe::ea) by BLAP220CA0028.outlook.office365.com (2603:10b6:208:32c::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23 via Frontend Transport; Tue, 8 Oct 2024 22:18:55 +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 BN3PEPF0000B073.mail.protection.outlook.com (10.167.243.118) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Tue, 8 Oct 2024 22:18:55 +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; Tue, 8 Oct 2024 17:18:54 -0500 From: Terry Bowman To: , , , , , , , , , , , , , , , , , Subject: [PATCH 10/15] cxl/pci: Map CXL PCIe upstream port RAS registers Date: Tue, 8 Oct 2024 17:16:52 -0500 Message-ID: <20241008221657.1130181-11-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241008221657.1130181-1-terry.bowman@amd.com> References: <20241008221657.1130181-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B073:EE_|PH8PR12MB7277:EE_ X-MS-Office365-Filtering-Correlation-Id: a757d139-0184-4cdc-8283-08dce7e7328b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|7416014|376014|1800799024|921020; X-Microsoft-Antispam-Message-Info: NRsdfgPeU/+uDInpyGa+Wn/K/9wPfSjxmzuG3xLnHMERqTeTZNx30uzys4FCcBCt/A4HYKiroACafEgdF3fSbs/rNpqyJiYuXyvIoPmsYETPbSbQNHHwYqBri8cjnMx1UmmHc09CPChRhl1YO890oJ6xFre9VAKo7PBRS4eu/tpRaccRl8x6AEtwVEjzg8dcMvdBlwY9aSCdMuRrWdS92gN4Kl0MuhFvDfKH62GqvEfUhEz/wJew5scpoEWLIO2JlxOujOk05sDtllbJ2zpMepmVqh9+koGpuxBe9hW5YAxfec8mb5ECI4iZAMGwSjGR98QwPWgHDLYDD4Sry1HB3CV6b9jliJqB2lLJeTbLWyQyGj0HDojA4EFTca6eSG9RTeO6bpmwB35aS0Gu6U8fyADzGXHjCUX0TKFeLYBa48COLtnjJ2nw107jSXpImi/TaL0BBbXCDeHySEg6uvXazNebiilNWUlNl+6Q2r2WhYz74UKr5XTbt3wlsdzQOvbh5Bahe6A6SyC4zAwXyrBvhZQLMr02xmKvZ5C/K3JHemKEN7nLDmoXHC4nw5hy1e1NHjgfnl3rCZBAQ+nKXzvS1Q4C0KUldZmdEcGzych04NMbDW7kthLKvegOg+9hgC+YrjIJd24kj17EzaQdmZKRaMkdU/voLmcDZ8ZI98dPCjV2xs5YlZ3M5A0H/Q10AWRH59hH6MiBjLOP3k/FpURdrkde9/+L3761qx20k/LXLGGs8xgnN20WgeXLOTtNvh6YnnaUWS8YoD/JsvFXtqHmC+oyBhC7NO7UqQxl+NqSvicT2G4FShSvl2RQdkFnsyEviH1f9K4quk+bj8FNJtUyztsgw2Rmr4EhXrsePj83u2ZRyZMU7pTAdgL+HjO2QC6msB8TQBFXlP/FFDzZwbLTV6ps6UU31xOSILAsscHKaZQ9O45GBX/kLwh5Bc0s/8E15Ce6j0npnJuh1y5qRR9Fay2sMcGYPY0lJdORNUnC0X7svqhAqHK6IhQx494SLh3DzfQLEG1BpIR9xF0DFEYlnXIM0kr0mJlhUanN0akRcqR8Es/DKNfoEUBfrgRvm1WbOLZhq4InGBROrvp1SRI1MOXbsE4RX3VgFLn69qqZaCPfEmw614bWgv0P7i2StjkVV7ereJVm7WMjS2rFrjImrfZutmnlxobmYC26Xuk9H7Rr7yf1C3GoUr80tXEcF8FOx/0vp7hPo/Rnz75bP0is0Y9gAclH/xfCeRIZQ0U4b0ojyoijMc0w1jhK4Tp6411eMtwqRvMILE1gXSNgqhZmf9QP5zR7/C8lnQ5F2Rhunkiois7M3yvwLxj42V7XiAMOmokyWf5ELYEn0CtXf7xmcLGgoIhlM9kReCH7eYd3NEUkR1NVSJbGMO1lTZyKvfL0 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)(36860700013)(7416014)(376014)(1800799024)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 22:18:55.0608 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a757d139-0184-4cdc-8283-08dce7e7328b 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: BN3PEPF0000B073.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7277 RAS registers are mapped for CXL root ports and CXL downstream but not for CXL upstream switch ports. CXL upstream switch ports' mapped RAS registers are required for handling and logging protocol errors. Introduce 'struct cxl_regs' member into 'struct cxl_port' to store a pointer to the upstream port's mapped RAS registers. Map the the CXL upstream switch port's RAS register block. The upstream port may be 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 | 17 +++++++++++++++++ drivers/cxl/cxl.h | 2 ++ drivers/cxl/mem.c | 3 +++ 3 files changed, 22 insertions(+) diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index 6f7bcdb389bf..be181358a775 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -816,6 +816,23 @@ static void cxl_disable_rch_root_ints(struct cxl_dport *dport) } } +void cxl_uport_init_aer(struct cxl_port *port) +{ + /* uport may have more than 1 downstream EP. Check if already mapped. */ + if (port->uport_regs.ras) { + dev_warn(&port->dev, "RAS is already mapped\n"); + 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_aer, CXL); + void cxl_dport_init_aer(struct cxl_dport *dport) { struct device *dport_dev = dport->dport_dev; diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h index cb9e05e2912b..7a5f2c33223e 100644 --- a/drivers/cxl/cxl.h +++ b/drivers/cxl/cxl.h @@ -764,8 +764,10 @@ struct cxl_dport *devm_cxl_add_rch_dport(struct cxl_port *port, #ifdef CONFIG_PCIEAER_CXL void cxl_dport_init_aer(struct cxl_dport *dport); +void cxl_uport_init_aer(struct cxl_port *port); #else static inline void cxl_dport_init_aer(struct cxl_dport *dport) { } +static inline void cxl_uport_init_aer(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 b7204f010785..82b1383fb6f3 100644 --- a/drivers/cxl/mem.c +++ b/drivers/cxl/mem.c @@ -67,6 +67,9 @@ static void cxl_init_ep_ports_aer(struct cxl_ep *ep) if (dev_is_cxl_pci(dport->dport_dev, PCI_EXP_TYPE_DOWNSTREAM) || dev_is_cxl_pci(dport->dport_dev, PCI_EXP_TYPE_ROOT_PORT)) cxl_dport_init_aer(dport); + + if (dev_is_cxl_pci(dport->port->uport_dev, PCI_EXP_TYPE_UPSTREAM)) + cxl_uport_init_aer(dport->port); } static int devm_cxl_add_endpoint(struct device *host, struct cxl_memdev *cxlmd, From patchwork Tue Oct 8 22:16: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: 13826989 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2087.outbound.protection.outlook.com [40.107.237.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 EFE3218C34D; Tue, 8 Oct 2024 22:19:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.87 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425952; cv=fail; b=flm8D5hfFJ8Mkoho//5+h7Iu30WxYUWZMVs+/hajglbCbsJ1JoRTBPFYhNkceDizT1boJyCqYln0s2qqLEihOABeIwltZL79jhMeaG2XpPsBeESuczHG3bl5RhRcK0EkOySRVhTOFtWIm0LTWqzfhvtS4LoJYQvekUK/fcJHNdg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425952; c=relaxed/simple; bh=x+j0Tkc+Y9G58y00iX85dCYxisy/ach7mi79EWt181w=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RUvLwBxECzYHh8vhU2CBU68hi1XerOzvqqB0gX0Vsg8sW3xHsR4K/huaciFTC6+Bi0jIybq78nHmE1Rterr4sD2kZvAPKM2C7UVC48qQhJyGeNyxwrIz5yBpUq5a2eOIejghQ+17yuYzjUbkdKc26w9GALPR2/j8zVZ7ksRNHZ4= 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=l4SH0v4M; arc=fail smtp.client-ip=40.107.237.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="l4SH0v4M" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qY4Yo9rzAFc4cAq2o4VKMs4sOQ/hZiyEVY0qSbChirYQQUAz8zWreAYisacagcJKse3hnNJp1/zeN0BUOiU1dlIc1Hzc5Ufgcsh/p3XQPrD2bMgqMcEYSrb8mSwUA0jvBHLzLq1WEWbUto/pjkKArwy9pVoHKH8sgXuvaT8LzNkdu0OAOkQQLe45ZjVvVlN66oQSCGIBZFcZA7QpnDx+BSxQAJN+3P8Hr8G9rFOlv2QhtnzfUOUqGUgnFiDmAjZNX9JVDb5SLd4ylrOfMzyjpURVkuMO4c+7cNIYzIjvE8vEoqq+XSfiFKondDBn/R31qgDV+ye0SqwPZpjJ6RtcWg== 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=gGAOPC69NGgnNbFIIELRp/hMlB8yj3IgPCUzsuTIMnE=; b=XxOjj5TFnNbnjxgkKisAa/BSG5b/Y1qdJMzjevIkUvgkKJT4vh5bDu0rQ3+MVpX4Kyp/0lz19RSFzzRVvBZUqDGDYeTxi8Snzi+7Lxh7njso558y/URdLRIScsut6tGa/qU2zJgVldFs43/Iz+XlSo3aBH7ZvU+B6LW+cab81UMeH0gHBhA92lDCz5tKQ6+LrEZoY8kUYmi7JpEN/p8ZQlVNNU5XOGKIKakal+nQsfIum9cQOYeeb/DMfmH5C1CtxPNVKK7qWyH4evzzXUD8nFuk8449dgtwDMrKTZ6ffIKAOaX/7t6+4E3m/HqEm+qN/9H8LSUPXqic9t1YiiB64A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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=gGAOPC69NGgnNbFIIELRp/hMlB8yj3IgPCUzsuTIMnE=; b=l4SH0v4MCSRG3bVjVe057p/NZ/QHScfDyZyhIVs7ePchXC3BtoqU1y3EExX4N942GHSVpBA+0lU5dutVv5hDW9pAks38J1Rz7DD7Keo18gVmW5GDCkd1VDIbkRCaJkSbRr53tpUs9KqMlt3EP31GVVxX9bCNWzSSzLM7YUAAMVc= Received: from BN8PR04CA0013.namprd04.prod.outlook.com (2603:10b6:408:70::26) by CH3PR12MB9145.namprd12.prod.outlook.com (2603:10b6:610:19b::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.22; Tue, 8 Oct 2024 22:19:06 +0000 Received: from BN3PEPF0000B077.namprd04.prod.outlook.com (2603:10b6:408:70:cafe::94) by BN8PR04CA0013.outlook.office365.com (2603:10b6:408:70::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23 via Frontend Transport; Tue, 8 Oct 2024 22:19:06 +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 BN3PEPF0000B077.mail.protection.outlook.com (10.167.243.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Tue, 8 Oct 2024 22:19:06 +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; Tue, 8 Oct 2024 17:19:05 -0500 From: Terry Bowman To: , , , , , , , , , , , , , , , , , Subject: [PATCH 11/15] cxl/pci: Update RAS handler interfaces to support CXL PCIe ports Date: Tue, 8 Oct 2024 17:16:53 -0500 Message-ID: <20241008221657.1130181-12-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241008221657.1130181-1-terry.bowman@amd.com> References: <20241008221657.1130181-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B077:EE_|CH3PR12MB9145:EE_ X-MS-Office365-Filtering-Correlation-Id: e635509d-a781-405c-b0ca-08dce7e73933 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|82310400026|36860700013|7416014|921020; X-Microsoft-Antispam-Message-Info: gmtzKOkiyuDktIdt054PnfpaIiIi2zSky2X5tHqIAzdTr2wXfMH09ivSY952kytKA9IgcPwn1TX4+47eGGaI23ZEHWLnbmXprsb3cYtc9Zh4eEIrCcUy+D/bXL+YWpJjOAdduLn38zPC4g11cUplyzH8FcH25nqH6/hrUII5iTldRMO0ItInXXr8nBkEGKV5urbkiMoPcesyhbhcJUEP+O09t9of42JJS8EEXNlMxkfUEH43fx8607lsMqkGhtB6QtHqPG17DEZ+6kFU18Nj5FwW/a6aJyAmAqHNxkTV6JjiUf4jCXDyQwTu6dFvkhly7iXbjHT/wfkjyNe89TTKyBrEsYXeR6EPOSivKEDloisY350uQ8RqAgr2DFJOW6HT4DHhjM+A0MjK4og2Idjm8f9g46Aywjkcf+2Pe4/uKub8xleGEegsVEs0dtA7azGgkUcbKwuTiM0dMdMvx4ZI4szDn+RDraJgz/MtN8GxIWFlqIL3TseiX05DrgYf+/nnUCydci9JFj2PcXv3kJVEfzW+eWhrHLRm2oIH9a5Yhj4+yn7PXr/bI4WLlwfqdfwkKK0PCb8EqgY0LNotV8d4gytKWKPNKZHrGQT0XXbi6ZTvAwFW4GSmkbNwGxzhkHitrKneoYWZcUtQMOV2pLpI9yrbJ686JlRDBbGD2NzjVQrmzuY3FRXfMffc61MJhA0qK1V14/VndJsY2sigr5OX0aR0nO/TzzW0UpJ1pQ/IRWHEv+V1oYkc78HVzsaOOXZ55K9ShRrTy5L4V0Gov5p6jx6iVrhnxe232fpYUc0yWD2hgBBjBxgsptNUauNkblbTvOlYKHfnQNcH+gylxB25wld+pJ6v6Z57MZUTsEjnpaUMeW1VESFZN7h9hguf1n5UpPnLGZZ1afgLS614KAgEUQHngH5Ci5dn465R9CrWmnqD73Sd2osg+0aGmFc9EP4CGM4AO4SZ/k4bNuoDHx+cE33UkrpqRW83PqrmqjyhrXLo/0Q4X2wDXHmwjhaL7yWIovlH3XezkyTtN8fhFya3s+VDgmM1HMCmHsVwyZ8GG963zpARTqPJwc7ARe9BpnzietXdHcLWOToeOqvtgygehZeaJiluLIrQGCJVeRSxki+iqk210oRYlrrJyaE1LPeLc6B275vifX4Y+eQZfkYvfCYSI1ziUIgYD6/P5VmfWVEOpn/+eZlsh3ZVWv0Sfr3C04TvXLiMcfdzW92RlzKTwEZgWzqzSCE9pHhrmSBObSfMQbyf+BRgA7avgBqCoLMIYTUd148zTW7S5tn3Bj1k9JM9CmRviPj/VstVjeB5U62WwEUavV7aWOLV12/7xRzhZ2mXlCRgA0LTWfQksSXND8S+pXLgLaEYmrZA01Ob8bwcfbCo9a2/V3w0YzQ1z0FT 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)(82310400026)(36860700013)(7416014)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 22:19:06.2137 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e635509d-a781-405c-b0ca-08dce7e73933 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: BN3PEPF0000B077.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB9145 CXL PCIe port protocol error handling support will be added to the CXL drivers in the future. In preparation, refactor 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] CXL3.1 - 8.2.4 CXL.cache and CXL.mem Registers Signed-off-by: Terry Bowman --- 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 be181358a775..c3c82c051d73 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -686,7 +686,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; @@ -699,13 +699,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 */ @@ -729,8 +729,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; @@ -757,7 +756,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; @@ -765,7 +764,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 @@ -865,13 +864,13 @@ EXPORT_SYMBOL_NS_GPL(cxl_dport_init_aer, 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 Tue Oct 8 22:16: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: 13826990 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2060.outbound.protection.outlook.com [40.107.94.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 013E121503B; Tue, 8 Oct 2024 22:19:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425963; cv=fail; b=uaqWCzU3xPL463tS3iobfw+I7+Upd+sgNouKSa/pjzVCVF+GmOctEZX3nYB4Tq1B5CQHeVGJsCMu4duZMyrNxYzlyEg9YN/ATQTIxZMc+hYwOTLunmMdkJCkHtZQum9IFGArNmhZs9IAxAPjn9VwddvMP1Xpf40qtUiI/fZ5M3M= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425963; c=relaxed/simple; bh=GINvX/OHL84YEe4kS7yrZoMXhd5D0jOEt5jDC/9Ml/M=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jNZeSwP7/j2WwGek15AwV+gSa3C55mEfOqm+DShLuhawOmSgsti1OFvy8aSDUcM3+q9gbNTpwfS3qL2RCwzAcCxwEDEdysqX9pDfnvqi78wHJE/nHVk4D/9YcJydASlyEcT6lBC6Le0eSF4KA87RnO2M9V4bXllnMWq5qXxL63U= 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=DWoZWGwl; arc=fail smtp.client-ip=40.107.94.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="DWoZWGwl" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yFKDY/dFGyRQZ+leCVbtEZnA5roK8JrmydzhPmzJYA87P0QqOYbDvURV7IkPyMiHC3rxJ8KLk75SszR8LSFmLLloWzbJlPNt+9IU/7sZMfT/Frpx7tkqwaYgY4uByrAAUfl4MuTpB/2ch+89iqQ/uoY8YXkueqFuejqQ+/I5pETTfUUb3MHub0Irp8p6uzcpwv36JBktCwYuSKBcKsoHhPA/SjSXyGeaAj6tYDIsUyWmKJm36BlHApkthDPktx1xVtsPcjmPLkYmrprqtTc71LBPr1xCpmcKb/qh13xnKFTwv6iFNYbh08RihgILLBU8VzOIJVAw9z1P0+kvllnzYA== 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=qyYdsHelXD/nU7DKZRelNExa46da8MbLvFPrf/G15TQ=; b=Uz5JiOeqBjwS9yOwdjGNqzJW/BggPJfKZpsjk2FUWvKyXCe1VK7RCIfgf3NjTU7lHJVmjCkCVZMzv8TEsNzQ7ZNpV7+ybRQr8qbnqk+MsA+ZIMajnflFU872v/wI6n3hK8bw/eD42WjwOXrfumMmnEjl541xvmYgFAAhyKetO8hz9ey1aQLDTpjOvto+xS+gu6Xq52SPGGB1v551CZPDKXFror2mc14kRme5w1BFqtXWEYsa5wYYCdEXrbPACR/X8NaMEBDRaYQhWMHc77ojTqLSIfIESEsoG7LJ+eh9wkpOKDCz/KeSpKmRNnVfgbobE0dLOPcfPItKmO9ee77qGw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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=qyYdsHelXD/nU7DKZRelNExa46da8MbLvFPrf/G15TQ=; b=DWoZWGwlyjl3Y39hGgxyAvsmOWNtIB/6kpGDEqaYb1tnueM1caopvH6porglPUAsoIgh0SVctrV1xQOWUGeGsuRN80EyHj5WMpEt3aDhXENoONWZBMpUF1XwtqmyI2Ac2PZYzvn7grl8FNj6LrNspkEO4Fn+vW7Nr7VSBgC0D9s= Received: from BLAPR03CA0085.namprd03.prod.outlook.com (2603:10b6:208:329::30) by BY5PR12MB4084.namprd12.prod.outlook.com (2603:10b6:a03:205::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23; Tue, 8 Oct 2024 22:19:18 +0000 Received: from BN3PEPF0000B078.namprd04.prod.outlook.com (2603:10b6:208:329:cafe::d8) by BLAPR03CA0085.outlook.office365.com (2603:10b6:208:329::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23 via Frontend Transport; Tue, 8 Oct 2024 22:19:17 +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 BN3PEPF0000B078.mail.protection.outlook.com (10.167.243.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Tue, 8 Oct 2024 22:19:17 +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; Tue, 8 Oct 2024 17:19:16 -0500 From: Terry Bowman To: , , , , , , , , , , , , , , , , , Subject: [PATCH 12/15] cxl/pci: Add error handler for CXL PCIe port RAS errors Date: Tue, 8 Oct 2024 17:16:54 -0500 Message-ID: <20241008221657.1130181-13-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241008221657.1130181-1-terry.bowman@amd.com> References: <20241008221657.1130181-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B078:EE_|BY5PR12MB4084:EE_ X-MS-Office365-Filtering-Correlation-Id: 29edf4d0-e21d-4360-a11e-08dce7e73fd9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|82310400026|7416014|921020; X-Microsoft-Antispam-Message-Info: sGFna7S+qN0f4pLFP/AQs776cXUZQPYWYoWCv3OPz1CkLjuemzNAAGD/3ArDAaLlcqZorWWACxEl05AthGMERoDEUIVEisj6DwSxIgEn7ALPW+oC5gmjwGNUZmfCJsoMwkzfi5tpI0hz4RU1HMuwVp2cXvuZ/mjP4DN/ikbtmSL37Gb2AVNM3qvMgSXy/hy232MX7tz8OKBIZ9Zaq/0s0RHo3KXpAZjr9Uz4OyWDs7lMiVgzpOOY9I2+EEpbQlqkrlfDiR2bib+tSG/hfQu+/xYEM8swDvhIfweIQPGtN7EEV9XiZrUahA5/WjOA60ocOoRT6QXjq+biJBpykV5maWtHFGXJgb4C0i+M0fZQwJRjzk3N3iSIHyDtR3MP0ePdR2uhdqQyiCFP8dPT0nWnAGHMPC6rjNQVsSzrp2AxVb8l2uPuMj8kea5rn3Yorw99yrTTc5mjIMWYdXr9yIf4K8D9gHrhhukqO93NtFByi1NEv9AeQEOtLgdRUBiRl0u1m4pp/K0GodVJnqlVC22KcPeFn5QLaZzHBSvfkIEztqWTMu3hiuwthE2vO5woF5/yk1VXalk5KxMVnlVegpiU6iTB9BadPv4mzxv/5vU3Taqd17wWrDP2RqfWpAH4eBYCYvu43TGJ5F9uzaeh3/1aMLWen64FanGRrYRdt6eaU6/ekdLa/1xWf6g7+nNbMJ8OGk7PQ64C3egxsQD1bQnz+leEbYubECn+AyNxzG0/qGIVSersUWZIVo62Eh2HmIxeFacbtrxOQfvMCf050eUsxHQ8SueiXem6/5tpVD5zvz974L9OXl6jnXNJDrKUjY5tagQhULtdTTSAlrywfmqpi4v61Ei2feZ4VhA6TQJOY8RjY0K6RfB9XoCeCV4WH2SFHAhqwjUXgaU5T0/r3Syif7bK6Qy2qYVDX/2GmKBFsznuRiGSQhRo5b0qg9KyT7EFu3o6m8HJ5VpdiAOjqjtkvHkAfYa38BgL3rhOfpBwdDQzEwuwfWritbdPt6bVu+h/oOLHMGZU+Q1982nPJaaMWPG5By4QlFFTsPbyEtO5FVimy+H+m4uBoVrwkVNNWcmZwnA4GaSzflOxCDNwNHk6qD3q0rH4ifPnm22oOQSdPXhLT0B8G30AjecTUe3p+KprIuEjiCpC8gZcqreCQwFQHFuPaFxLg7KLEvLOAyWBqqgfgKOtJ10CSIjyG5PD2D9xnfZuX4C6dbjFats8OIHYCvWfwaCQdHhjX5kJP1Gq4CmaB/qjoemADyZ7eTlvjXPayg/oLwFqlN6mHK5GLreQJMG7CbbvBehnSBHKxjy3QVMaKDfNm23A6jTDMerTqMGtIsQ/6G6rA0r2Q3eOkbvHoPk5ny2XuggGN/wqLp+xPJYYKkZm4rMKfnAZNpUitkJr 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)(82310400026)(7416014)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 22:19:17.3675 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 29edf4d0-e21d-4360-a11e-08dce7e73fd9 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: BN3PEPF0000B078.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4084 The CXL drivers do not contain error handlers for CXL PCIe port device protocol errors. These are needed in order to handle and log RAS protocol errors. Add CXL PCIe port protocol error handlers to the CXL driver. Provide access to RAS registers for the specific CXL PCIe port types: root port, upstream switch port, and downstream switch port. Also, register and unregister the CXL PCIe port error handlers with the AER service driver using register_cxl_port_err_hndlrs() and unregister_cxl_port_err_hndlrs(). Invoke the registration from cxl_pci_driver_init() and the unregistration from cxl_pci_driver_exit(). [1] CXL3.1 - 12.2.2 CXL Root Ports, Downstream Switch Ports, and Upstream Switch Ports Signed-off-by: Terry Bowman --- drivers/cxl/core/pci.c | 83 ++++++++++++++++++++++++++++++++++++++++++ drivers/cxl/cxl.h | 5 +++ drivers/cxl/pci.c | 8 ++++ 3 files changed, 96 insertions(+) diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index c3c82c051d73..7e3770f7a955 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -815,6 +815,89 @@ static void cxl_disable_rch_root_ints(struct cxl_dport *dport) } } +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; + put_device(&port->dev); + return ras_base; + } else if (pci_pcie_type(pdev) == PCI_EXP_TYPE_UPSTREAM) { + struct device *port_dev __free(put_device); + + port_dev = bus_find_device(&cxl_bus_type, NULL, &pdev->dev, match_uport); + if (!port_dev) + return NULL; + + port = to_cxl_port(port_dev); + if (!port) + return NULL; + + ras_base = port ? port->uport_regs.ras : NULL; + return ras_base; + } + + return NULL; +} + +void cxl_cor_port_err_detected(struct pci_dev *pdev) +{ + void __iomem *ras_base = cxl_pci_port_ras(pdev); + + __cxl_handle_cor_ras(&pdev->dev, ras_base); +} +EXPORT_SYMBOL_NS_GPL(cxl_cor_port_err_detected, CXL); + +pci_ers_result_t cxl_port_err_detected(struct pci_dev *pdev, pci_channel_state_t state) +{ + void __iomem *ras_base = cxl_pci_port_ras(pdev); + bool ue; + + ue = __cxl_handle_ras(&pdev->dev, ras_base); + if (ue) + return PCI_ERS_RESULT_PANIC; + + switch (state) { + case pci_channel_io_normal: + dev_err(&pdev->dev, "%s():%d: pci_channel_io_normal\n", + __func__, __LINE__); + return PCI_ERS_RESULT_CAN_RECOVER; + case pci_channel_io_frozen: + dev_err(&pdev->dev, "%s():%d: pci_channel_io_frozen\n", + __func__, __LINE__); + return PCI_ERS_RESULT_NEED_RESET; + case pci_channel_io_perm_failure: + dev_err(&pdev->dev, "%s():%d: pci_channel_io_perm_failure\n", + __func__, __LINE__); + return PCI_ERS_RESULT_DISCONNECT; + } + + return PCI_ERS_RESULT_NEED_RESET; +} +EXPORT_SYMBOL_NS_GPL(cxl_port_err_detected, CXL); + void cxl_uport_init_aer(struct cxl_port *port) { /* uport may have more than 1 downstream EP. Check if already mapped. */ diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h index 7a5f2c33223e..06fcde4b88b5 100644 --- a/drivers/cxl/cxl.h +++ b/drivers/cxl/cxl.h @@ -10,6 +10,7 @@ #include #include #include +#include #include extern const struct nvdimm_security_ops *cxl_security_ops; @@ -901,6 +902,10 @@ void cxl_coordinates_combine(struct access_coordinate *out, bool cxl_endpoint_decoder_reset_detected(struct cxl_port *port); +pci_ers_result_t cxl_port_err_detected(struct pci_dev *pdev, + pci_channel_state_t state); +void cxl_cor_port_err_detected(struct pci_dev *pdev); + /* * Unit test builds overrides this to __weak, find the 'strong' version * of these symbols in tools/testing/cxl/. diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c index 4be35dc22202..9179b34c35bb 100644 --- a/drivers/cxl/pci.c +++ b/drivers/cxl/pci.c @@ -978,6 +978,11 @@ static void cxl_reset_done(struct pci_dev *pdev) } } +static struct cxl_port_err_hndlrs cxl_port_hndlrs = { + .error_detected = cxl_port_err_detected, + .cor_error_detected = cxl_cor_port_err_detected +}; + static const struct pci_error_handlers cxl_error_handlers = { .error_detected = cxl_error_detected, .slot_reset = cxl_slot_reset, @@ -1054,11 +1059,14 @@ static int __init cxl_pci_driver_init(void) if (rc) pci_unregister_driver(&cxl_pci_driver); + register_cxl_port_hndlrs(&cxl_port_hndlrs); + return rc; } static void __exit cxl_pci_driver_exit(void) { + unregister_cxl_port_hndlrs(); cxl_cper_unregister_work(&cxl_cper_work); cancel_work_sync(&cxl_cper_work); pci_unregister_driver(&cxl_pci_driver); From patchwork Tue Oct 8 22:16: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: 13826991 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2081.outbound.protection.outlook.com [40.107.243.81]) (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 31DD921503B; Tue, 8 Oct 2024 22:19:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.81 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425972; cv=fail; b=h8BRGJuXjlWILfXbtxINbfIcUo13vYNpK1gQLaLsTSjZNNF3wO7h+FtzjboJTDvLGJekADZxaegL4Jr5ZoWR5zoygkBgmxOXFrTvGpvZFt8Kj1FpnSg3grgczvSglS9vfK2Myi7i2Qc1A2KZa6xaArhcRCPIi+HyDMlCzq6uSGc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425972; c=relaxed/simple; bh=JrXreU8bAVYSLae02dgo+C2Q1O9B1VPtNz8E5rdCVF8=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=aw0k3qMDVMgcJUq2TxYTR2CS2SUu/0AzHwjzPWGoSd9TrZtNaZZGKcru5gthrgbTgl0C3lYZo5Nnr/Ka9fWfppfbU00yMl0drTfgz+auHWlRfnNymVihzCqh0rBMPom/dzWJCEtCJX15x6DVZ+LXOvxJRiXseCF+JckVwJlIwXQ= 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=vwR3gW7A; arc=fail smtp.client-ip=40.107.243.81 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="vwR3gW7A" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tKoYwWnTN0fsoiq8xs/j2/TcnLeJ7GQQpRxd0iJJrt63W8foqXQ/BZV/Kb98EEPWm2Zm0UbnOhnBgi2pGIWrqQ3zqpcNht5Dghg7bu4LkYVxdaQJVghguAxpQnOurKuD+zSwRuAWZRLKOtl/w879unsLbqwN58aqQuVV+891UvAeE5h+ed/WUoE9WPV1HZ38uTAujZPAasixg5ZLKl1P0aajB8RasfiqQV9ldNsIYLfH/ZgLkia+RyXX8RMxg5MNJAofe0qJTc6J4aOUHqFVf9hsRgLCqg0IJTc66DorobQkiJzwZlslNXilzV7t/8wKdGeagIRqbLTL1BOf1A5k4g== 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=baLU/8n16ZjbbGjYZ9V333EBUkQ5W1UUAvVlCOa2Jhs=; b=oV+7JGyiugbtOOs6mFifMEbncgbGHHjFQfgQyR4yzcSJznMIgs+sGwansmDCkQpK8U8As5p4H7LGqTvpWfX6tWnLi0zYAERh28a/SwWcFGhBZCTGaygtcb3wbs64ckR5G5Ya/FNaD66Qv4ceHBF2LAj5edfUH0Tbx5Zc0n1t82EZzKR1oaUmd0GmK9YcrQCPq8DJ7pZnRruTFoUTOJBjuN21LS36diydDZSb4drnzQk089Fn7/wLDoTagRoI7D2b/y7zjQAyT9xDEvNl4HAhFj9Czb2CmZkB5KTjE7BpTC+OBGPpdzFG/Q27JWFWlOzjslPwzhlmxjAQ9pUrXQXbCA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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=baLU/8n16ZjbbGjYZ9V333EBUkQ5W1UUAvVlCOa2Jhs=; b=vwR3gW7AHzEw2HpIVo0KjECJ9CZrU98Rtzlp53K9Xju6Dyf90q2MHxwH4G1UU1Obr8w9YeLb4rInpnLu2LwlOVO5L3TZNywvB8bb9gnx1DW/QvR94y7337Z9kdBice1UeU0HwOagBrCAIPfwAMz/9R3IVy32Vpjp3SNQO3F3DJs= Received: from BLAPR05CA0042.namprd05.prod.outlook.com (2603:10b6:208:335::22) by IA0PR12MB8326.namprd12.prod.outlook.com (2603:10b6:208:40d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.16; Tue, 8 Oct 2024 22:19:28 +0000 Received: from BN3PEPF0000B074.namprd04.prod.outlook.com (2603:10b6:208:335:cafe::2) by BLAPR05CA0042.outlook.office365.com (2603:10b6:208:335::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.17 via Frontend Transport; Tue, 8 Oct 2024 22:19:28 +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 BN3PEPF0000B074.mail.protection.outlook.com (10.167.243.119) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Tue, 8 Oct 2024 22:19:28 +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; Tue, 8 Oct 2024 17:19:27 -0500 From: Terry Bowman To: , , , , , , , , , , , , , , , , , Subject: [PATCH 13/15] cxl/pci: Add trace logging for CXL PCIe port RAS errors Date: Tue, 8 Oct 2024 17:16:55 -0500 Message-ID: <20241008221657.1130181-14-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241008221657.1130181-1-terry.bowman@amd.com> References: <20241008221657.1130181-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B074:EE_|IA0PR12MB8326:EE_ X-MS-Office365-Filtering-Correlation-Id: 2d056cbb-ef32-4b20-31ea-08dce7e7467a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|82310400026|7416014|376014|921020; X-Microsoft-Antispam-Message-Info: SSCA244ozanzgReeL6O0rNBuh8byD/8n4GSCm+hylyU2I7nGbcuxvGeAYR6NhD9NL0nZ1SSdo8uO5CrHiI+YBx7on5FQHI7eAfRoOTYQhweHLquR8oZRX0zjZ/64Qulfw/yhbW+sETyFtRwxOByKBqkf98yOuWu+kjOT17kj856MdY1g3CUBQSuRI7B61YS8yw0qW2J5vSBVQCJDDmjaX+2gTzslNqQZGThfpJo7vejVSIPD55W8+wlrzXXa1K+fs2u+xY6n2HBHb5UWLakBxrLEvviCmDJ6QBns64EIVvZ5bEjsl3Tlx5byBI4cjr9os86sA3TiOLu8c4c158SNXtdEQVqsE8RchwAZgaKp4CHZIQ4hSgZLRukFUHEOcBsQ4v8J0EJeMI9ErTQemNwG1mH1P06vTHs6RMuuTTGnP9dnFosIH66JgMU5Fjj5ApiNfhErs9IxxZ6/JxeC0Gc/nsG6lw98P0dCoDVg/Tx3g4qOIGhH3q5DqLUktyE0eO39zw1fMoIk6UfMFtvYAIgH505D8Otn9uh1wPBFkUfyxMwQJcScblpV6lyYHlt6BVovk0xS0MkJ6ESzDtx2pkZCOvjlJdDzMiGMYFWmUOfnnS7YfUwGMX0QKwgP8x1918jD+eZEaHiFa6BCciTp1qu6kM3pqGFrqMJF2zie7ZQaH6KgLrJNJC8D3vadmNZFqVv5lx7M4wGzqRhAl3nCKUOYxBt/qmyNh+tbKMCuvM8V5p2LzyCu8hLgq4qLtCynQ8dmJYLY4fpS2zJRMuxFye/Ci+zKh/Em3OCQ9PMgWyet7Cc+bsJQcuVSmhzv/UpdtK8tjunT+KfgRQJk0ZV/zOjRWJTK/HIBF4qqf/PUOPS+wkeREBYwfHtdIybuWCidUW6q8iupCWm+/wXg1T6/rcgmpAqU0wTRHZAalty2Mr3nuuGOzroQTASA5w6qZxjiBfiqobwldmzU0QiJajO1qhYqnGfYLaVF8E1Gq5eLiSmOrtuJLCjvlpkXLP2w1yWkHZt654DZ7QyH9X5AewE6FlZhfFwBI6pVjL4r8uCDyo7JZnqnfvuQDh/EZ0edndu6xGcEE8yu4Mkua2Q//zAlPLpjtk4CTmWIeMZF3XfS/3XfyjIwpnUVDSJ9hSINA+nfAuhBF6gHvxDFiBS3tYH7rve+9zxGGkxyFVD6KklGb+vbGs736pQipIZQKCJGUthdd5kvzIik7XxH7Bl2/NuXyqB5zZS90D1PSWYw8GNVds73lWRjpfYySzBawTjVPbSngokvaGwNe7wVgAp7U8Ggcopb77b7aJVnu2rVNy5EzyZQ3Q/2BOIrJSYVJcLIWu13pH5bowRCmFaShdjbSPXh/nmpI4QyoLtFtVcOBfJFMxDawJZQinOFS7+ksY6i5QyG5a5w 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)(82310400026)(7416014)(376014)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 22:19:28.4861 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2d056cbb-ef32-4b20-31ea-08dce7e7467a 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: BN3PEPF0000B074.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8326 The CXL drivers use kernel trace functions for logging endpoint and RCH downstream port RAS errors. However, 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 --- 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 7e3770f7a955..4706113d2582 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -697,10 +697,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 if (dev_is_pci(dev)) + trace_cxl_port_aer_correctable_error(dev, status); } static void cxl_handle_endpoint_cor_ras(struct cxl_dev_state *cxlds) @@ -756,7 +760,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 if (dev_is_pci(dev)) + 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 9167cfba7f59..6305c0eea627 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 Tue Oct 8 22:16: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: 13826992 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2045.outbound.protection.outlook.com [40.107.236.45]) (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 253FF216429; Tue, 8 Oct 2024 22:19:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425986; cv=fail; b=fAMbJcnqPhYLHQ6DFnYxyulxElIrdNLzCMTmFJ90F46AZ5d+YEAj5M0nABONDpeFRlOx+++/v6KEKkFkfZFIJSSgXsxSiRicp0uiWpbOl9Oe7mdHDRfRSReBZNvIhcS17kIhK53xhJycDrs/okyDD8/1jVV6llmfFsJCvJ4uArI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425986; c=relaxed/simple; bh=WnI9cftdckMCCfAB/cCAoK83Qqfp8hCPGKlp157JaRo=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NDU60jubb4x23vFR6HEWIbZ7NJ6w4n9xSAszzWzFaO+j+yF+0s4kxy+tcWGuzFQiCYwx+sp1GvFqqvjhH7VezNohWI1ETFhERbTQ9eRhYvjzr0r0M2azvtTdMBxAUkyf0irwZ7+twYdlM5a83FKFwEPaT4JKJ0CXOOo1FsGWeg8= 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=C4T6F4yA; arc=fail smtp.client-ip=40.107.236.45 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="C4T6F4yA" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YCLPIrZrq6aJk244w7JyaMtCO+7eWsAVCPFvn77ZEHLuzJ0DjReMj2RLXotOW0GKRGWVcgPtdLRAX2NWRipi5IfSn199nEOkP9oReF0l/jPO6bNQpjQcM2F6ug3iqtH4S3jLyl6xBQKIBhwtH6bgyvHu2RRwwa5nMhrXSG4YWftfKowbFuEJjwZvCRZXViqTSb2ZRUEhqPmO5um96VLTdBC9FmQxmBzl9l47WPTNfqNwBRIOm4BD0uMFYco7IzRuS2DWiWUAEx3gFtgiuQbIXa6UNBJlm2+uIxjuQI3iZt7lzqn0KMjOuIKO+KZCjJBowFqZYcbigwR1E6zWFOPyhg== 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=5IJezya7VDFnthrpvmaJErquhXQmSEGt3pjALQGFDAE=; b=qZgbUB0hIhoKFfZc946OszK/mi8qCMjcBEy0VK/Fw3mXVseJUOx9tWy4EZ32xidlB1ypVQOpgKkcygH9JcMdV1oiXEiFmwcG9+3UxUB4RtROlEK99JvTl8T34EvhBVfOHs3cK0v+/oaj0TsfCSfFE9ZJSHW1QxdiXXanmfAW82+en8+vCM1PE7UdJQDWH/GqXWN4573L6KT6AxveEJku5Ulo0W4VHSagnsBf7xnOdJg/5WxF0ZwLi9HoqVDzLGxqpYjyFEeFMql2x0G8EMkKvrdMgzwo/GtHe4kW5Yk/ZXUk4sXRSC1QAJQ9mVQ1Gh2LMC9tKc2InK4vJZUhcsasHQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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=5IJezya7VDFnthrpvmaJErquhXQmSEGt3pjALQGFDAE=; b=C4T6F4yAJbXGBcpxSAS3HoRoQnFMzoEeVRJwsTuhUAu5OVdN9FnLw7hVYdAOSGmfHwFoJaZb6T4fOAYEkRkF5Iz0evx9CT0jPziy8a97srHP5E7fm3SBXKbN4wJqgwr2nqKPJVFk4Febrk9cVYoMhCdtYQ3NSD4+am4T5JSxrho= Received: from BL0PR02CA0023.namprd02.prod.outlook.com (2603:10b6:207:3c::36) by DS7PR12MB5933.namprd12.prod.outlook.com (2603:10b6:8:7c::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.24; Tue, 8 Oct 2024 22:19:39 +0000 Received: from BN3PEPF0000B071.namprd04.prod.outlook.com (2603:10b6:207:3c:cafe::37) by BL0PR02CA0023.outlook.office365.com (2603:10b6:207:3c::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.24 via Frontend Transport; Tue, 8 Oct 2024 22:19:39 +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 BN3PEPF0000B071.mail.protection.outlook.com (10.167.243.116) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Tue, 8 Oct 2024 22:19:39 +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; Tue, 8 Oct 2024 17:19:38 -0500 From: Terry Bowman To: , , , , , , , , , , , , , , , , , Subject: [PATCH 14/15] cxl/aer/pci: Export pci_aer_unmask_internal_errors() Date: Tue, 8 Oct 2024 17:16:56 -0500 Message-ID: <20241008221657.1130181-15-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241008221657.1130181-1-terry.bowman@amd.com> References: <20241008221657.1130181-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B071:EE_|DS7PR12MB5933:EE_ X-MS-Office365-Filtering-Correlation-Id: eb7182a3-222b-4b78-d284-08dce7e74d11 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|82310400026|36860700013|1800799024|921020; X-Microsoft-Antispam-Message-Info: l6vLoN211EEYs94sDCyQeu7KrVVX+Ls2CQGHvfMAavxPDFS8EYlD0gyvEzLAeypAZ82NVp1lRgJ59W0vVIhhAFUNW3PAp618PSTjYhup20BtL7VUdB4yzF+Ej3aRiYkYSs3oBHTqQUEx1JA8zoz4rvZ4cCAWUt/KgnzgRoLgsQu9ZZ/4SuRbR6+9jWBRWQQOTM3PQjFgvwVHZkQSUoi6U4wGwTtzG3HEp2ckxsWtqR/jXlq7thjfVNbjqINogGlBAwhJP1J09OY5f+BPYsFXuNJk4DknpXgYExg25OTGxK9r7Dmag3VuLMUNXU4t1PuTZeL7HSr9JdDn4XOP2fl9yidEbX5WaQDf8dllzoggcdBC6Rnm9SR8VHuhW0z2LVlP942ReGl6D3ZFn8QRdkSI5UaOtZ7v3JyUf4Pi4uw33X5edTSz3QDWnzPz5MPQZAO6F3Z+awq6HQlqWmmWk5ax1qU1mtr+Lrwf6HtpJUcFrgOdMPJrgpjm03KcqxvYoWkZRgei+2MSL9AITzKpRVlzd4vNl8j1VxAQDHXjnl1cINBnkKBbp0Py/a/DWsyGtVgXykIB0cupBBSdWRjzmy3PK0NwAhU1Dif0cKA7KbgvQ6BX0WTA1kTLDhYyRyim53fMJvwsabf5PSEi/bu8zps4nlGSmQM83THJj4sZb2RlLfk+KhYgm4BJv1DEFQWw3q/hCrktPUq9AeJVXFJguOog3q1SVmyBMa6lFNr7/JsQqH9nh4aefR7K4RL3Jm61tRrKDqKZZimF/8gJqfzlbhRvR6X0vHCXbOijKFAvpuXnbNqEeJMdFVlfbhZ1fYdGjpfBUHCb5KzApK0BKXG9T0dNyHR7YfjHkvisPi1DNXlBhglJYuf3TuJcIFaRH13aVODTV+fSqqYjVVoYNdTBtGia1F+sBwjhLBtDYP1x4mFTo0RMO4rTvecGof8lIaBv/a7TioLFVjfF20S/0/osKhRfBRSR0EFphgO0BHhTJAMFJPHW54MtdK23MCn6f++AT8/PiVk8R4+dYbr0Qi49UbEQNF/LNjavdqeA8NCGzVwKtakS0lCAeuGRG2Aa5IqRG4WoldEoATrTXxhY+0tQPF3+qvkRz5iLBal1NZP6TMRqMovTbP64Dk+EjmwxfLo7YNi68IWGMQr/JWmZRYyAFlqZtI+JIX85e9CPJZLdrQSQ+a1X4dqWpz/MNC9ysgE9pSuDx/GQ4w4MVNCj0Ak0cUUOpMUC/4IdXqreO89r6g6C149JWy7Qm5Jmv12xfcttSsWeSofqwuI1yhOQU++tMF3/uPFht7R09lYn2Pa1Cy3lymGeh04FXm6Pqj7uTIUzfSIz2fDgLipfUDeQiyF3NdnvhyAPbcl0cxm1uPZM8xRn1wsgbVRkBfxXS71HNF32zy3F 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)(82310400026)(36860700013)(1800799024)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 22:19:39.5618 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eb7182a3-222b-4b78-d284-08dce7e74d11 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: BN3PEPF0000B071.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5933 The CXL driver needs to enable AER correctable and uncorrectable internal errors in order to receive notification of protocol errors. pci_aer_unmask_internal_errors() is currently defined as 'static' in the AER service driver. Update the AER service driver, exporting pci_aer_unmask_internal_errors() to CXL namespace. Signed-off-by: Terry Bowman Reviewed-by: Jonathan Cameron --- drivers/pci/pcie/aer.c | 6 ++++-- include/linux/aer.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index 81a19028c4e7..1b4004932084 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -962,7 +962,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 @@ -973,7 +972,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; @@ -986,6 +985,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 67fd04c5ae2b..c43d2b60b992 100644 --- a/include/linux/aer.h +++ b/include/linux/aer.h @@ -69,5 +69,7 @@ struct cxl_port_err_hndlrs { void register_cxl_port_hndlrs(struct cxl_port_err_hndlrs *_cxl_port_hndlrs); void unregister_cxl_port_hndlrs(void); struct cxl_port_err_hndlrs *find_cxl_port_hndlrs(void); + +void pci_aer_unmask_internal_errors(struct pci_dev *dev); #endif //_AER_H_ From patchwork Tue Oct 8 22:16: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: 13827009 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2087.outbound.protection.outlook.com [40.107.223.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 9D78521791F; Tue, 8 Oct 2024 22:19:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.87 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425997; cv=fail; b=c+bjKzPRym+imnbE5liUAeKpPR4oEPx4dvO7H59jHkVmwuvzk3cfq2g5m/Gt8gRXpEfqZFG11lniK6qERKskA6AZAmssqqLnH+8LLgEI3Q0jIugrXwM8ff6URrTSO0ibNT38KEpCjK2OpxLas59ZjlwiKdAsnUoqdFRytdeL138= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728425997; c=relaxed/simple; bh=fHzw/BDXIHn7QLS7ZvIgVVhno6Co1TBG8mEbhXsLOaI=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oheVOLcbqgb8KI+W+KuoEaBsVaksOJhgR9eRnThB2THVfJ6wBC7yTqMQ6a2xE90h7X3tvHdZIj1o6EdMBMyYWNz1b1qfJnLu+mx34WQCu25rJovP7aY3830F9AFKn8Oqui5zfk4J/jCAAsUIx3WgzEaHtXuEpR74N4WSJAI34LQ= 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=A60qVngN; arc=fail smtp.client-ip=40.107.223.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="A60qVngN" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TXUa+onA4IVTY6gtlsFa3HgP5AeFxatMhSiqfA5zjFJB6BFiGme+IsSZjVqmLWrTR5ugARcXOV8nKfazrqe3O6NrPD+IYgLR3Rt4ooxc5B9Hzj53i7C+60OEdKo/tGKDYW04WkLgVzIpL1iLPs1LGSyR7qE02sz39zdxIOx31T1i7M31+4juOIynWy1FGX3B95NwCJd9nfCrovjZZtUvRVgyCckBsV6dDbhRwiLShgUQ0QVT2UfJsUO8MuhFoRyvS7WaqjFYuuKPcHQVQEAvQ7ju8jE48b+pzWAzDwDYTGXC9vpC7661p89ZyZkBAyWFLpxBc1WdIMgJ6JpS/qZhPA== 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=r/1JBAXKH0wP+1tCXCRUlm5/st9vbuvv0hE9F+lBIso=; b=Z/eKYX6ySIVA37VQuOIaNPvDPBH97dVVJAZR185YycxOsqo8ZkZGovZlAE+dH+zKO32QHmlEy7rT0P5CLSCd0a4yIDdNkYsmwRmeeMoPWKRrT2O2CTrOrIz7dJD+D4jdq9f09CemQv2keFU3TIyGiR2Uhmt86CrZ07EmI1Dg80+9pl1c06MLwmEIijVZZGGzfUTfSdhSSzES4przc/KyNbHTdUnsei3MKaM1s6qsi0sjZ2vi1H6NeE2KwXZEIIkDlzY8Xdrt3FxvTbeNKEvwC3TzpvqUOzqfoUCReuBw2Yu226yhvqBMtTU1EbqW+fS3JV1Y/5CKt/5kC9A6YmYKxQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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=r/1JBAXKH0wP+1tCXCRUlm5/st9vbuvv0hE9F+lBIso=; b=A60qVngNorjbQ3Sx/tFGdtTQoOPZf8bmVZSl/UlAECIW8blw1xdBHLGOXgp1KWGUR4IN1wwzdK/SFOQpyXLOlJo1fVOwwvCL4EUydqGDq+ESxtFJwv9DBA9WZfSmF9YDIcUZxVixH2qHf7kvowCsjepcLIkoAWfYwbFdF7kTjwA= Received: from BLAPR05CA0048.namprd05.prod.outlook.com (2603:10b6:208:335::29) by SJ2PR12MB7920.namprd12.prod.outlook.com (2603:10b6:a03:4c6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23; Tue, 8 Oct 2024 22:19:51 +0000 Received: from BN3PEPF0000B074.namprd04.prod.outlook.com (2603:10b6:208:335:cafe::d6) by BLAPR05CA0048.outlook.office365.com (2603:10b6:208:335::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.17 via Frontend Transport; Tue, 8 Oct 2024 22:19:50 +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 BN3PEPF0000B074.mail.protection.outlook.com (10.167.243.119) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Tue, 8 Oct 2024 22:19:50 +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; Tue, 8 Oct 2024 17:19:49 -0500 From: Terry Bowman To: , , , , , , , , , , , , , , , , , Subject: [PATCH 15/15] cxl/pci: Enable internal CE/UCE interrupts for CXL PCIe port devices Date: Tue, 8 Oct 2024 17:16:57 -0500 Message-ID: <20241008221657.1130181-16-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241008221657.1130181-1-terry.bowman@amd.com> References: <20241008221657.1130181-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B074:EE_|SJ2PR12MB7920:EE_ X-MS-Office365-Filtering-Correlation-Id: 8607cf10-952b-4600-14af-08dce7e753a3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|7416014|1800799024|376014|921020; X-Microsoft-Antispam-Message-Info: ICJNj2fPAQfGWJ5wbJsDtJNj8g5xycv1ZPPPIzvFKJBaK9Ceu3hTHPQnxITtcM0ZXPrYSO6KdkkEPzyuCoPTCgE5BnkWzHwqx/oHvWiPYCpriWrtUXDFkb1oUdU1ufrGWAS4nZoDzaW4myY08w/5SCLyI1HFsz3xnE/OD8SKf6eRgCaaCHCjiBfxDrtz7G0bbUKAXOm45elNm0quraDEBaCBFAYQ4S1ZHs5iwqGHzLPVuITCG9DgRcQayf8yO1RI2JCeP617jv3+ddRNMlP/BGT6dwJWrVqPpEHB4N0AWzReB/lJnNsC7Veqy4naHm4KAj34tIaF346j+VpHtMMnU3Zl69whW+t3wHYlQCvwDjpslGYSceE54USiynzMu/Qo82SKr4yL0VtMmWwuXL5/cwUITCJd+YseeF0ady/LjIiBYh9tLx0Rw49pieK7uOGB432BCs3VNUiLno7t70Ca7ic2WvN8Mnnxg9ZaS1cE595EcF3W1MniFEqINhoGJlIC8WJ1ndjUShqMNwEElUhCYGapuzYdYuKl0XOmQATM0odSJ7Ep6rV75E3KSAJSwRq8lL1gDNbntZ+4IXzHp6XgCpUqFmoq0xLXSiEfAGJbfrLgxcWFCLvwx4/ARfNPyYkjn4hm0T2QxAUgRl6fpNlHxhXSqYid7uyvv41IrRJBianeyWoUq9nQ8tNn7yh1HGVyNtL+PQ3kPBwKEvuwaDu4NLQ44274GgOp/koMozekDiwkkMVbQ4c6SJ2X40xB0JXmKziEI8qcuxthOROuZUQARlME5EKqEjH7+VXako1VLB2mJ+ESNeIdvC54Sw9xmoLh2iA3RYhK8FTIvbjmlubVNpA/HaiYvcPA7nxD5S10qkb9YJtUhGK62lgLXSef9iScfc+Mqdis72FaUdFrK9v7PXKkFDDUN5GBFaKuI+dPwsg9uM3is7ii/HUSJo2wrktOLEj9zTgP6eLgPmkOrKi46oJ9DKpUPk12xj1JydfyTe9oxtPWXwgL9cvvf5GjpTYFljrfMieSqmfvo2+XjIosnDR0US19wMPvMDyjFNJpYsxqaMhRlINkQ/pTm/ROE2WcJxBe6xgBP8S8Ar+SezbNZjgU0I3AGMACt2ATUfDwjNuvxuDQ9P12I5f1vZhGj/PxFQKDIQLOmEGh1RHpijsFjJ7trsk8/Zev+y6VsfpecGFD0qs9g0tXMcTGdONXHYVyZ0EfWtcFASUvgGl4nQbbjINst4MyDWRFPw1P2ibZBO223jwPkrSDbYxhnyAf9sD1HmKqCoJR2MKXC4Ti+WLVAUJcS5EHDWHrPm90HRz7M0hVOq3GnReYaJTeUxfyVnAhpAGHHsCTlxC4dl4ZFH2kAHoJDuZ8ZIqjqsXzrudqcvt3mVQAyrtTOv3HfpEqlIDk 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)(36860700013)(7416014)(1800799024)(376014)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 22:19:50.5644 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8607cf10-952b-4600-14af-08dce7e753a3 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: BN3PEPF0000B074.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB7920 The AER service drivers and CXL drivers are updated to handle PCIe port protocol errors. But, the PCIe AER correctable and uncorrectable internal errors are mask disabled for the PCIe port devices. Enable the AER internal errors for CXL PCIe port devices. Signed-off-by: Terry Bowman Reviewed-by: Jonathan Cameron --- drivers/cxl/core/pci.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index 4706113d2582..1d84a7022c4d 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -908,6 +908,7 @@ EXPORT_SYMBOL_NS_GPL(cxl_port_err_detected, CXL); void cxl_uport_init_aer(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) { dev_warn(&port->dev, "RAS is already mapped\n"); @@ -920,12 +921,14 @@ void cxl_uport_init_aer(struct cxl_port *port) dev_err(&port->dev, "Failed to map RAS capability.\n"); return; } + pci_aer_unmask_internal_errors(pdev); } EXPORT_SYMBOL_NS_GPL(cxl_uport_init_aer, CXL); void cxl_dport_init_aer(struct cxl_dport *dport) { struct device *dport_dev = dport->dport_dev; + struct pci_dev *pdev = to_pci_dev(dport_dev); if (dport->rch) { struct pci_host_bridge *host_bridge = to_pci_host_bridge(dport_dev); @@ -949,6 +952,7 @@ void cxl_dport_init_aer(struct cxl_dport *dport) dev_err(dport_dev, "Failed to map RAS capability.\n"); return; } + pci_aer_unmask_internal_errors(pdev); } EXPORT_SYMBOL_NS_GPL(cxl_dport_init_aer, CXL);