From patchwork Tue Jan 14 12:04:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Smita Koralahalli X-Patchwork-Id: 857318 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2042.outbound.protection.outlook.com [40.107.223.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 7F75522DC44; Tue, 14 Jan 2025 12:04:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.42 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736856289; cv=fail; b=k0BWEcWMedjpjQ8YlY+xuj/8SQE4KxTO5ehqfUqlW0puxaBfOxQ9d+Fy3TI4ge6Dqib0g0131fTNEsUH+ze5z+XEzV6ir3hik0dgKnvdsLGizXhJ1gTibRWA9zVKBUgsrjXtPyz3giVgXtmAvYjDewlB3cSbrY3wbOtgolQ9qzc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736856289; c=relaxed/simple; bh=0zYf+p5E5MaAANPYbPkfLFP2MEfoK1RjU4uL3W7M5cA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dkMXCQOKPp2WFmf2x9cNGO0rjZkwxvS1gLpQh9RbEgoNFB+CbkFMwIH3jgH0ec5zZi238vUlbO4h6CiKpOhyStaupwAfqDo0kUXcApx+7PR6qHIONEWU19K91F3BoGFjbsRaNSR7lAmgUsojFbk8or6DvQmEddg1s357nVj3Cc8= 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=ZsQww/Nd; arc=fail smtp.client-ip=40.107.223.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="ZsQww/Nd" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=w4t0dmyFM8a97bhbAwHXUi+5ayAeNs1u7EtTZACvoKQ2Gavgu35ZXx11Cf0aASQfrl8pU9WfSa9WrySiRoLYCW5EZ3U368hAw3t0Cz8ifMH/S05qpKd+ytR1wt+qMgd9drZbXg/ZaPuQjtVUx7Vxmw+gRkjFgVp6UTIrE2b4n7FPyD/x4ZKyD2VMGwhYY//fQp3Szqfh+0EM00rPACa7QKE3XH6EH4uzqeeVdhf/DexNjF7gPyt0J/6RWxZKbhal/wDMlGLM7dCVk9sNqe3bhNF8hNWPvRPdv/gliLsPKu0c2EUclGpmhu6XnO1QgDcUjKLmxuoPvVa6XzHJ+6PRQw== 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=tD0gCUsFFRpF+TsySguR3r4p2K15EJa82yhn0whSggk=; b=xPdkMt5Yt2gwQrsDJZagMsCeGHj7oWvOHlForwDl0P/JlLzkHrwA5M+ZFAkT/tT4Qpxb59BPt8TK1lYmkbdQObMPAxQySac7KFCDaShJb/0WzI2x+VR0d/W4dR/gJRSDDpUp0detS3xkI/Rz0P/45OQlT0aMeaGm7XYcIzp0FfjnnYuPhWapgDCK4TNmXkhtJuaVT8f/bZ7rG1yiCrz+70lBu4PzzS7rpRXa5aKBXKVK9Ba6xscL8zLh0cXjeK2DFvGUuZpdCuCVOnJATL/fQDF0y/eTcWcfKky4IetH4iNOOaQtAuDK++K8TeOjDzzSpJTb13y37nzvTzXRblCFLQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tD0gCUsFFRpF+TsySguR3r4p2K15EJa82yhn0whSggk=; b=ZsQww/Ndzqf2BJplMQXBzhEvfYEnYxDAes3VjNfcqlsdyzUzWjZW4VN3UIom7tLozHk1wyvkEj56r7n3vYh5QlWXzBWOwrfzunWPSAcOvndcrkCfwW5zQDnEQRV66MNEyugCNcetrhFT909NDSujUTI3NRAzuxGR0hCT38ZuLR4= Received: from SA1P222CA0120.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:3c5::16) by LV8PR12MB9081.namprd12.prod.outlook.com (2603:10b6:408:188::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.13; Tue, 14 Jan 2025 12:04:44 +0000 Received: from SN1PEPF00026369.namprd02.prod.outlook.com (2603:10b6:806:3c5:cafe::28) by SA1P222CA0120.outlook.office365.com (2603:10b6:806:3c5::16) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8356.12 via Frontend Transport; Tue, 14 Jan 2025 12:04:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SN1PEPF00026369.mail.protection.outlook.com (10.167.241.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8356.11 via Frontend Transport; Tue, 14 Jan 2025 12:04:43 +0000 Received: from ethanolx50f7host.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, 14 Jan 2025 06:04:41 -0600 From: Smita Koralahalli To: , , CC: Ard Biesheuvel , Alison Schofield , Vishal Verma , "Ira Weiny" , Dan Williams , Jonathan Cameron , Yazen Ghannam , Terry Bowman , "Smita Koralahalli" Subject: [PATCH v5 4/5] acpi/ghes, cper: Recognize and cache CXL Protocol errors Date: Tue, 14 Jan 2025 12:04:26 +0000 Message-ID: <20250114120427.149260-5-Smita.KoralahalliChannabasappa@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20250114120427.149260-1-Smita.KoralahalliChannabasappa@amd.com> References: <20250114120427.149260-1-Smita.KoralahalliChannabasappa@amd.com> Precedence: bulk X-Mailing-List: linux-efi@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: SN1PEPF00026369:EE_|LV8PR12MB9081:EE_ X-MS-Office365-Filtering-Correlation-Id: 13a34184-8f81-4a4a-0ad5-08dd3493a1ff X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|82310400026|1800799024|376014; X-Microsoft-Antispam-Message-Info: OE7ti6QlgNP0HoEqhytdOB3l7BM4nH2WFivHXWtCQBUuIpK7D7JW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GRxwMk2+PoYGZDSJbtNVUcet4ET4wdK9xPbG+GXXU9/jGuQSmHraoi+OS+qvB6JZeEcA+tRBpBlRBPyd2QxkwrRZMwWxM9glXdbn21r4Mknj7I+CA2BsIjoc3N0eif6zEneQicVfJNQWE3i5q3sV6mfNofR0WwpU6rDVsULXIYdsPbH/+kGiMhRRQlYBZTxTSHLLAzTmwPdmhS+F/Ysf+vD73Gvr8iVAyp2V7PJxKoDrW7G1a2DG28RnrXgtJ8F/SCpQlT6frgThxO3hM06Mor5eWTt7+ruTg3Wn9jCfwmz2TmWNpjd7iyena3rt612GXVAEBjNpOqmlwSR7wF/qb/VNUaLm1rRfp0VCzI+rxYHctz78kPb1PsEpc8boWhG1u0= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(36860700013)(82310400026)(1800799024)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jan 2025 12:04:43.8224 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 13a34184-8f81-4a4a-0ad5-08dd3493a1ff 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: SN1PEPF00026369.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9081 Add support in GHES to detect and process CXL CPER Protocol errors, as defined in UEFI v2.10, section N.2.13. Define struct cxl_cper_prot_err_work_data to cache CXL protocol error information, including RAS capabilities and severity, for further handling. These cached CXL CPER records will later be processed by workqueues within the CXL subsystem. Signed-off-by: Smita Koralahalli Reviewed-by: Jonathan Cameron --- drivers/acpi/apei/ghes.c | 54 ++++++++++++++++++++++++++++++++++++++++ include/cxl/event.h | 6 +++++ 2 files changed, 60 insertions(+) diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index 07789f0b59bc..4ab3c8ae1360 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -676,6 +676,56 @@ static void ghes_defer_non_standard_event(struct acpi_hest_generic_data *gdata, schedule_work(&entry->work); } +static void cxl_cper_post_prot_err(struct cxl_cper_sec_prot_err *prot_err, + int severity) +{ +#ifdef CONFIG_ACPI_APEI_PCIEAER + struct cxl_cper_prot_err_work_data wd; + u8 *dvsec_start, *cap_start; + + if (!(prot_err->valid_bits & PROT_ERR_VALID_AGENT_ADDRESS)) { + pr_err_ratelimited("CXL CPER invalid agent type\n"); + return; + } + + if (!(prot_err->valid_bits & PROT_ERR_VALID_ERROR_LOG)) { + pr_err_ratelimited("CXL CPER invalid protocol error log\n"); + return; + } + + if (prot_err->err_len != sizeof(struct cxl_ras_capability_regs)) { + pr_err_ratelimited("CXL CPER invalid RAS Cap size (%u)\n", + prot_err->err_len); + return; + } + + if (!(prot_err->valid_bits & PROT_ERR_VALID_SERIAL_NUMBER)) + pr_warn(FW_WARN "CXL CPER no device serial number\n"); + + switch (prot_err->agent_type) { + case RCD: + case DEVICE: + case LD: + case FMLD: + case RP: + case DSP: + case USP: + memcpy(&wd.prot_err, prot_err, sizeof(wd.prot_err)); + + dvsec_start = (u8 *)(prot_err + 1); + cap_start = dvsec_start + prot_err->dvsec_len; + + memcpy(&wd.ras_cap, cap_start, sizeof(wd.ras_cap)); + wd.severity = cper_severity_to_aer(severity); + break; + default: + pr_err_ratelimited("CXL CPER invalid agent type: %d\n", + prot_err->agent_type); + return; + } +#endif +} + /* Room for 8 entries for each of the 4 event log queues */ #define CXL_CPER_FIFO_DEPTH 32 DEFINE_KFIFO(cxl_cper_fifo, struct cxl_cper_work_data, CXL_CPER_FIFO_DEPTH); @@ -779,6 +829,10 @@ static bool ghes_do_proc(struct ghes *ghes, } else if (guid_equal(sec_type, &CPER_SEC_PROC_ARM)) { queued = ghes_handle_arm_hw_error(gdata, sev, sync); + } else if (guid_equal(sec_type, &CPER_SEC_CXL_PROT_ERR)) { + struct cxl_cper_sec_prot_err *prot_err = acpi_hest_get_payload(gdata); + + cxl_cper_post_prot_err(prot_err, gdata->error_severity); } else if (guid_equal(sec_type, &CPER_SEC_CXL_GEN_MEDIA_GUID)) { struct cxl_cper_event_rec *rec = acpi_hest_get_payload(gdata); diff --git a/include/cxl/event.h b/include/cxl/event.h index 66d85fc87701..ee1c3dec62fa 100644 --- a/include/cxl/event.h +++ b/include/cxl/event.h @@ -232,6 +232,12 @@ struct cxl_ras_capability_regs { u32 header_log[16]; }; +struct cxl_cper_prot_err_work_data { + struct cxl_cper_sec_prot_err prot_err; + struct cxl_ras_capability_regs ras_cap; + int severity; +}; + #ifdef CONFIG_ACPI_APEI_GHES int cxl_cper_register_work(struct work_struct *work); int cxl_cper_unregister_work(struct work_struct *work);