From patchwork Tue Dec 17 02:20:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Smita Koralahalli X-Patchwork-Id: 13910896 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2073.outbound.protection.outlook.com [40.107.223.73]) (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 52C7813B2BB; Tue, 17 Dec 2024 02:22:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.73 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734402147; cv=fail; b=KOB7tNY2iRufRpTOGID9CEU5pqfWgyo/K2gUlCpQqmbUacZKop9LhgfOhYgFx8ZdzFQpHMGvA4A1xavU9uP63UqL9EfQPRg8C9wXnZ9NER74Cy2oHamX2iOZVVSCagX7VNa9ZZSd3BB4hFu4omOxsOFW+hAtYGQ/dkKPASaonBo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734402147; c=relaxed/simple; bh=PS4lUV9NFxkqDWJZUQ+BaHlnOzKZAlMaalb7vtI/Wzk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=aDETrrIns7oGsT5WIddvhU8o/Ss+CEmXEFOdP6Y/taLwW5QoFlmNstSJ7M5jUfVFMpsc01m7/jM1QFfhsfIb4bgRhKjs1IQjGuK7muGA6NeaaFWn90hBlm1QyXPjyk2Toiq4sphjm0RDcwXNs6vyoykbv/Ia9p3eZ4HACvNFMqs= 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=x7Vz7HHl; arc=fail smtp.client-ip=40.107.223.73 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="x7Vz7HHl" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Q5i68bD6Q1XOlnWZoDNRZuHRXYH+TPzDB1R/FcI6lthxd44mHmVHuMnPyIc6r26CL3mjUgObai97ADdWV9sjhNNFxL6UuZJFPv119cZDbidxf0d/R6fMoepm5gwiB24KXjRKr9DQGKe6Nw/GiA7/I6kw0TtSdEKVpCwja2kTefjFF7W9plvyG1084dIuC0u4cqn1biL170Z2QHApR8OZ8bSuW6+gGtvQyPx5gOL+LSfFgHKxr7RI7bmigHalsyCcEERNRfGM4aZ5AdrtI9ycogKN2pgLk4KFFVygngyQstsu2uSXAIv9hKEanlQTNU+NQVEtv5h6Xwgk5RSLKI206g== 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=Vwh0Y8h7Qi5kZU+4PJgSGPvhFoQkZ/QQrgLMuEw+DPc=; b=CH+TkcVeU8c0JSBUq9KJUVkDypTvvW9R0EtWXQkMUoQaNaMAD+ybIfew5Qx97ceXARlxOFAbyAlLbVYugzT28k9dxiba8ryyVU/+A//Fkrs5dMvWJRJzJGl6zfFXc/ukj92tGUkgZb+gV3eOce3dnxcy92zb6RhIWB5qd/WemzfKP74jYen91VW1H7waojqValwqUYWu2AbYuMamNr3/MfS4ggJO+E859w+bnMLuO0KhdwD3X63ugCih2a8UES7fojLNC0blyOzF6HTiic2TPIhpHzUU74Y23ht4TDdwp6FJwOzHr+P82rP26nCvrzj9Yw5+bngrf6nCq1qTpt5Xzw== 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=Vwh0Y8h7Qi5kZU+4PJgSGPvhFoQkZ/QQrgLMuEw+DPc=; b=x7Vz7HHl6Rm6JDonPm0WqxaMsUp1X4sA62dkUPztHaoJyZH9rt5MrKrGRZ8ojmdFXNgnJOeHORfessGluSBryS6BD4UhL0EUX2q9DpkUFmgIUv/3rq5u9mHIM1GG0WBXWYCo7HHU2f137yNsW4a8h/CHJg347AjhAAISYfrOVgE= Received: from MW2PR2101CA0034.namprd21.prod.outlook.com (2603:10b6:302:1::47) by MW3PR12MB4362.namprd12.prod.outlook.com (2603:10b6:303:5d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.19; Tue, 17 Dec 2024 02:22:22 +0000 Received: from CO1PEPF000044F8.namprd21.prod.outlook.com (2603:10b6:302:1:cafe::89) by MW2PR2101CA0034.outlook.office365.com (2603:10b6:302:1::47) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8272.5 via Frontend Transport; Tue, 17 Dec 2024 02:22:22 +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 CO1PEPF000044F8.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8272.0 via Frontend Transport; Tue, 17 Dec 2024 02:22:22 +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; Mon, 16 Dec 2024 20:20:49 -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 v4 1/5] efi/cper, cxl: Prefix protocol error struct and function names with cxl_ Date: Tue, 17 Dec 2024 02:20:28 +0000 Message-ID: <20241217022032.87298-2-Smita.KoralahalliChannabasappa@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20241217022032.87298-1-Smita.KoralahalliChannabasappa@amd.com> References: <20241217022032.87298-1-Smita.KoralahalliChannabasappa@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F8:EE_|MW3PR12MB4362:EE_ X-MS-Office365-Filtering-Correlation-Id: f5eda74b-ed6b-4e2a-411e-08dd1e41a38a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: 24TI8Pm1Kwzu4mrNnIJ36V1nUd/JctPNPGv4p/U8BQ+SBBZLmynePpYgtLqtHMtKqKySNU1r6kCJwV0L7pKB66+DN53XCXpeZOj5cBo+hlb9hxuw16ePR7xWdQEhk8o2tVyuoS8GVEVFwk0Tx9fVaIveb8nA5k8vPFAVmSOciTLgE/B/wFT8fSbY/DlyNzW0JLtxNRE4eD4puvTLz+s0NlQ2sciOQQPUO79SAp/PPTE6HLRoIsAIslPus2CK+zeXpBQwZShpMJ/axhTFpfLLG36AA02rgNps7xl8DhMbJjcGzwl1514713dCO5IRKog12oLvqo90vcWiDSLHy2Fr/25uVoqV1NqvRUSyDtftrmER3x2IgjYDdLrIT6H7CtHYu4OJWdfvOP/AZwdq6PzLgaatgAP/Ydd5mSeiWbGYhXTKovi7eOrR6oiaQGcdx/4bS/zinMc6IEeRA/2ZgwGdTusZs8nEebWG3TMh1lTNaaRz+PHLawlgAnsbosxKhAaQQC/QYyFLgiepPpwDJ7GtnD9PS4kngQ2S6GPkcVGHuZLvnC7kqtCSe1mleFATyJu3SDeBqwgQ/ccxK2aDJ40zcchJNVkbbWpKLoGaOty/DKcj6ekev3lI5S8PDW0g1AuSSdS7PgIlbJyB+MUDvRBZLmjm68xS/ysSWEefp8U4G9SDeAOxD//tcmVZWiaxrEyiwUliZ6GEom4kut0uXfPSq5UA18isXT5TBH4dZ29n8o1i4ljtDG26ymzsKquTsnjefTqVTS8p8BgI4pLyR+oWUtTF5ub7CgdEBZljBYSt5SPhaWobEffsuEk/+jubSN6kF4L96D4aECDjjjFxzkBmECzLZyJss8NuCaKPxRfZ8+L0XG0hpEBf30w5zrg3PwfptA7dWTpHhYWoE/wDOpoPjENIuqR08phixj5aZG+3KadP/fM/mnTnlVbLKLQhnFh58Y3ny3QbF3bpuwTAk25Zx/y2JQaUjDgo+eke1dbOl2xDJJiqmTDddgQV1sZpbkwrYlhFUoXwoZztwJqVCbf3FfGp/HSEQLDi+5u3MQmQZl45rzViA0lcpJ93RB2vaR14pUZdRKHgDkLjpHo688prVYVDSD4x1OJMjGxTPFvMrupigKi/A3LVrfEm3AmvmhftgEaVxyGr031fBGMMfhwu3IrBj8Ke7gkszovnRd9rNpxaOhE6We8b7aSQiZ+2ag1vz6EEPm/hAD3uubeF++aKBgFalTPD9WN1zW444eSLqsoF6Sx/l7x4ix13StnaSx4tKzTVWrlnFBwN0o3qMx6PXm+ibAcbngQtOvgvWc92vbi2DySjrrouRvCu86U5YbBIupKQ0yxFD6vLAG7NrROQFrmpodJV+DjFwO56DNF2nD63Pn81YaWpbHslFgj9jHOQmhcZGDrlj0swXVnezw9WyC47a1ZTM7VUrPQ6TM8Q0lsB2ZRnPn1QquigbWbJuGQVT4U0orBhEQIQnPTpEgyvtQ== 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);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Dec 2024 02:22:22.0370 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f5eda74b-ed6b-4e2a-411e-08dd1e41a38a 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: CO1PEPF000044F8.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4362 Rename the protocol error struct from struct cper_sec_prot_err to struct cxl_cper_sec_prot_err and cper_print_prot_err() to cxl_cper_print_prot_err() to maintain naming consistency. No functional changes. Signed-off-by: Smita Koralahalli Reviewed-by: Jonathan Cameron Reviewed-by: Ira Weiny --- drivers/firmware/efi/cper.c | 4 ++-- drivers/firmware/efi/cper_cxl.c | 3 ++- drivers/firmware/efi/cper_cxl.h | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c index b69e68ef3f02..8e5762f7ef2e 100644 --- a/drivers/firmware/efi/cper.c +++ b/drivers/firmware/efi/cper.c @@ -624,11 +624,11 @@ cper_estatus_print_section(const char *pfx, struct acpi_hest_generic_data *gdata else goto err_section_too_small; } else if (guid_equal(sec_type, &CPER_SEC_CXL_PROT_ERR)) { - struct cper_sec_prot_err *prot_err = acpi_hest_get_payload(gdata); + struct cxl_cper_sec_prot_err *prot_err = acpi_hest_get_payload(gdata); printk("%ssection_type: CXL Protocol Error\n", newpfx); if (gdata->error_data_length >= sizeof(*prot_err)) - cper_print_prot_err(newpfx, prot_err); + cxl_cper_print_prot_err(newpfx, prot_err); else goto err_section_too_small; } else { diff --git a/drivers/firmware/efi/cper_cxl.c b/drivers/firmware/efi/cper_cxl.c index a55771b99a97..cbaabcb7382d 100644 --- a/drivers/firmware/efi/cper_cxl.c +++ b/drivers/firmware/efi/cper_cxl.c @@ -55,7 +55,8 @@ enum { USP, /* CXL Upstream Switch Port */ }; -void cper_print_prot_err(const char *pfx, const struct cper_sec_prot_err *prot_err) +void cxl_cper_print_prot_err(const char *pfx, + const struct cxl_cper_sec_prot_err *prot_err) { if (prot_err->valid_bits & PROT_ERR_VALID_AGENT_TYPE) pr_info("%s agent_type: %d, %s\n", pfx, prot_err->agent_type, diff --git a/drivers/firmware/efi/cper_cxl.h b/drivers/firmware/efi/cper_cxl.h index 86bfcf7909ec..0e3ab0ba17c3 100644 --- a/drivers/firmware/efi/cper_cxl.h +++ b/drivers/firmware/efi/cper_cxl.h @@ -18,7 +18,7 @@ #pragma pack(1) /* Compute Express Link Protocol Error Section, UEFI v2.10 sec N.2.13 */ -struct cper_sec_prot_err { +struct cxl_cper_sec_prot_err { u64 valid_bits; u8 agent_type; u8 reserved[7]; @@ -61,6 +61,7 @@ struct cper_sec_prot_err { #pragma pack() -void cper_print_prot_err(const char *pfx, const struct cper_sec_prot_err *prot_err); +void cxl_cper_print_prot_err(const char *pfx, + const struct cxl_cper_sec_prot_err *prot_err); #endif //__CPER_CXL_ From patchwork Tue Dec 17 02:20:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Smita Koralahalli X-Patchwork-Id: 13910898 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2050.outbound.protection.outlook.com [40.107.92.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 988C614659D; Tue, 17 Dec 2024 02:22:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.50 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734402150; cv=fail; b=lGMo6bRKZIJ7/gQTF0+tCErvnB+7wvF6fzMtboOjVIZ9fZuy5xP95ooOw6mPxHwnjkF0FyB4KW2TW3W05ah9as5PjOiLiFFILciLA4+SRflBaKaWZy7L6LYOD1KhQkcZBHdedGf41Cp/jLIU/VXuCD3KmNVkq7UD03gDCXbvYvY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734402150; c=relaxed/simple; bh=v1HSg/IjluuiQfmkb7ZR4gFsi84bUBoiij58rQE8MJE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hwwcs/7Z9xkGdJB2VvcZcDXzj5I6ULDEsCbJweGrQBz/hNe4QR/uzrwBx189zRutq5RYVV0dxo7IP24nORaMMyPGZX3Bl/w0fUMJlPaDBBm4BbVvpNABQ30eb65s+TUYKPbEJNpQo9vgmv2ud1xgkSd01Nt2scEzMtvG0KeK7a8= 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=lHbbz+eM; arc=fail smtp.client-ip=40.107.92.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="lHbbz+eM" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=y6N4ZBzmuXJ1n+12JntfqfWiVavhGkE3kxkBacYUrLXoExia169dExviadicXT3ECNHHEyAMzHEQSxy2Cw1SXMIZe0Z4LEiisOGIXQJR3hN/XOJTUCwgc9eEpQ+jojR2DfUfAx9pD9sfeGMK9GYyOpfGOyUTmk4f5Odwl0SUs58luUS/sXsjqV87vYWj6+F61ybFtd1B1y8H+VfVnzITpOoVhPF434kG9clhE+3VxAh/Xnz19Y27DcjZa8+TZQK9L7Nbnvfbw+7z1uUbpuxYFS2LPsgsN9xBEsAHqjeTN4niagbcuUwuGOkl06ktJBxYql+v93lpxLDYaS2ftwT7hg== 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=p9AZaeaHdtOY4ctdgehghhCStUx24YtBQBefI/xZtDc=; b=htLwC1h0MfX3lvRkpAz1RKyzVqzuBiFp5AgJvur9uYVMvrj/Rlvh017kXjUXYMgdOCtt88RGffzVhCN9tv3ONueKT7vJNhrbb5EoGCWyhmcXi736BLkTaQ29pMwE7dktIxLitsvZjQ9VicO9NpnlBRYnSIUg71ohGBTH9nSlo90M8kMsIMPWYWlPr7/i1yrSa/qgD+ZvVdkr/dxEOEIF5Pi2xbdk5tfi0YZb84OG6VRBR8e+L6zcADyQEffqYA2rSjzJwAnDTjegaAwxLHYOWg6Vc11Pa462580KNRHAJ7tTC9vm5dLIOd+cpfl3VgWB0GKclAbkXKAhfmzC+Ca3Pw== 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=p9AZaeaHdtOY4ctdgehghhCStUx24YtBQBefI/xZtDc=; b=lHbbz+eMgHoVuQREqRlRQ3GSHjrs6e20suNgnPS01Hs6WUmHid+ZSam02NxyhtH5jMkLD9bO9LYGHkG4tASttjbgpf8m83okMm0rNP2l7oBRToK7IDaq8cRaFaxHGbQMuvZYVf9+m1M969Z9rq8PRRUyXfbPVt5tBqBbNa27oes= Received: from MW2PR2101CA0008.namprd21.prod.outlook.com (2603:10b6:302:1::21) by MW4PR12MB7381.namprd12.prod.outlook.com (2603:10b6:303:223::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.20; Tue, 17 Dec 2024 02:22:22 +0000 Received: from CO1PEPF000044F8.namprd21.prod.outlook.com (2603:10b6:302:1:cafe::c7) by MW2PR2101CA0008.outlook.office365.com (2603:10b6:302:1::21) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8272.5 via Frontend Transport; Tue, 17 Dec 2024 02:22:22 +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 CO1PEPF000044F8.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8272.0 via Frontend Transport; Tue, 17 Dec 2024 02:22:22 +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; Mon, 16 Dec 2024 20:21:20 -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 v4 2/5] efi/cper, cxl: Make definitions and structures global Date: Tue, 17 Dec 2024 02:20:29 +0000 Message-ID: <20241217022032.87298-3-Smita.KoralahalliChannabasappa@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20241217022032.87298-1-Smita.KoralahalliChannabasappa@amd.com> References: <20241217022032.87298-1-Smita.KoralahalliChannabasappa@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F8:EE_|MW4PR12MB7381:EE_ X-MS-Office365-Filtering-Correlation-Id: 0c7314bc-5524-4035-c7c5-08dd1e41a3d1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|376014|1800799024; X-Microsoft-Antispam-Message-Info: POi1uCbNjYbaaK2yEKXP8C3LtKvao9TNf0ZKYdQTz+SRtXbrOsCjEn2MIEEWvTfmdpeCgeTo1L7xeABN9Wj+2uJWj8hDkPfkkmeipc3LiR68/OrL+zXzOoT5UfdKrclqd5UeASIUeped1v43jvp1UBKeshlZ/+vKI9sVV6NhOhn5l6S2XWDexdTRLehCtCC42iKU0KRSgEgCI7kMKZqoU3XBeaSpBzUtQe7QqP3o5tnovpn1U3/i/2s1wBk7TcQrt1VoPY8TQX1Roe6wxMj48xz952as1bRptrQb00SpQ5Coo6x1fYBrnTO1peIqI8cWaK2u52I9vnbvuJzJQY0ItTRbI7wBZRQN0BeTjGNbidiTeRZdGVCYj3gtB5iP3P6CKe2V0th2a7dwnU2RPQszsCGGL4gFQH191YA19jno/s0emJdhUq3Oe/RMzPPT/5CxQ5z9TWzATNuj5XZHkHElru98tNApp5N84IPR0sujapFYFtsIVS2d/1pfaA1vMFm88NChw+vi7iWySnIN0p3pdcZLwDgMvAU3hCoirGp0O1vK/r0q//O9Ylu0Ba6RC+tX3m0NyP57ZzRGDTVJ51z+B8fo6xOe2wAL+teiZmfXtrYTisJ3HqHrvcsLuFwvB+vzgbjxDULo6/TJ61dY9NKCybAf9+KOgA20XYIf+DyqxbbClyYakfLFyG2XRpKWD4O3+WJS0PmCt33ryuXgB/9e4Z8ovnNlXSeFfOSoz8NuFsD4LEIRxOtKP3Bvc/YNc8k+LcQWJYp3RcujGH1WpioajYb1Ae/TRWFkZTCTW8IkdswwQrt18KIMSM4vPzTS7mcK5mX7RGpCnudaJeoFp6Fpf06XfktSB4zRM4TTDhtTz3cHxPzMFVRcdnTYCpjkxbH5NsQ+UKVLsluUrpephjQgG52rVtTZWpaK3Vj68IY4hprHuo54fLDNlqsI+CXB4e4as/ZibrnuD83g215M8KKuMp9MPiH0KYajPOzgy2LV0eTC2Meuz82p7meN/Yd4H/6gOKi7Tb8xQv8pMU8C7cGRSWZj/nw/RCxIBuLLfB1PDlU6swV4Kds/bJZslSK14VB1Xs+Bjq3+UQAwm0VNvM/FKVLYWcwcFqNm0iFQ8/j425cPzOJzUKTjamHnuybJKdo0N0L4cozUg3ru3vVDfV+9Icjq3K937kB/PWaGRcxUarZtepfe+lSSJIC3P/fR5TuqE5fhlciBHLAh+p6FfzKFKoUs3ntCS92/wIcQ9vkMm1etSVm3MSbVE2iN3RZq5Cto0nhmlKwiNpa6nh9uDeM22aclgT7MjhxoHFIt+Ieqg7FZXCnmCu+5nspl1EOotA+fquJyIbYlNlxzdOMqvy8ybgpvcrGkWNqhC665TAIOO7XgS191I5tDC6A53EfsV0ECcab+03rLxzUrqA+VYi7pW/gLABgVfgNa6VW1+AvAerqIxSa2Ffb/nsQnN/lJOxigFEgyxz+CV+cLaVO4175dhA== 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)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Dec 2024 02:22:22.5059 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0c7314bc-5524-4035-c7c5-08dd1e41a3d1 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: CO1PEPF000044F8.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7381 In preparation to add tracepoint support, move protocol error UUID definition to a common location, Also, make struct CXL RAS capability, cxl_cper_sec_prot_err and CPER validation flags global for use across different modules. Signed-off-by: Smita Koralahalli Reviewed-by: Jonathan Cameron Reviewed-by: Ira Weiny --- drivers/firmware/efi/cper.c | 1 + drivers/firmware/efi/cper_cxl.c | 35 +-------------- drivers/firmware/efi/cper_cxl.h | 51 --------------------- include/cxl/event.h | 80 +++++++++++++++++++++++++++++++++ include/linux/cper.h | 4 ++ 5 files changed, 86 insertions(+), 85 deletions(-) diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c index 8e5762f7ef2e..ae1953e2b214 100644 --- a/drivers/firmware/efi/cper.c +++ b/drivers/firmware/efi/cper.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "cper_cxl.h" /* diff --git a/drivers/firmware/efi/cper_cxl.c b/drivers/firmware/efi/cper_cxl.c index cbaabcb7382d..64c0dd27be6e 100644 --- a/drivers/firmware/efi/cper_cxl.c +++ b/drivers/firmware/efi/cper_cxl.c @@ -8,27 +8,9 @@ */ #include +#include #include "cper_cxl.h" -#define PROT_ERR_VALID_AGENT_TYPE BIT_ULL(0) -#define PROT_ERR_VALID_AGENT_ADDRESS BIT_ULL(1) -#define PROT_ERR_VALID_DEVICE_ID BIT_ULL(2) -#define PROT_ERR_VALID_SERIAL_NUMBER BIT_ULL(3) -#define PROT_ERR_VALID_CAPABILITY BIT_ULL(4) -#define PROT_ERR_VALID_DVSEC BIT_ULL(5) -#define PROT_ERR_VALID_ERROR_LOG BIT_ULL(6) - -/* CXL RAS Capability Structure, CXL v3.0 sec 8.2.4.16 */ -struct cxl_ras_capability_regs { - u32 uncor_status; - u32 uncor_mask; - u32 uncor_severity; - u32 cor_status; - u32 cor_mask; - u32 cap_control; - u32 header_log[16]; -}; - static const char * const prot_err_agent_type_strs[] = { "Restricted CXL Device", "Restricted CXL Host Downstream Port", @@ -40,21 +22,6 @@ static const char * const prot_err_agent_type_strs[] = { "CXL Upstream Switch Port", }; -/* - * The layout of the enumeration and the values matches CXL Agent Type - * field in the UEFI 2.10 Section N.2.13, - */ -enum { - RCD, /* Restricted CXL Device */ - RCH_DP, /* Restricted CXL Host Downstream Port */ - DEVICE, /* CXL Device */ - LD, /* CXL Logical Device */ - FMLD, /* CXL Fabric Manager managed Logical Device */ - RP, /* CXL Root Port */ - DSP, /* CXL Downstream Switch Port */ - USP, /* CXL Upstream Switch Port */ -}; - void cxl_cper_print_prot_err(const char *pfx, const struct cxl_cper_sec_prot_err *prot_err) { diff --git a/drivers/firmware/efi/cper_cxl.h b/drivers/firmware/efi/cper_cxl.h index 0e3ab0ba17c3..5ce1401ee17a 100644 --- a/drivers/firmware/efi/cper_cxl.h +++ b/drivers/firmware/efi/cper_cxl.h @@ -10,57 +10,6 @@ #ifndef LINUX_CPER_CXL_H #define LINUX_CPER_CXL_H -/* CXL Protocol Error Section */ -#define CPER_SEC_CXL_PROT_ERR \ - GUID_INIT(0x80B9EFB4, 0x52B5, 0x4DE3, 0xA7, 0x77, 0x68, 0x78, \ - 0x4B, 0x77, 0x10, 0x48) - -#pragma pack(1) - -/* Compute Express Link Protocol Error Section, UEFI v2.10 sec N.2.13 */ -struct cxl_cper_sec_prot_err { - u64 valid_bits; - u8 agent_type; - u8 reserved[7]; - - /* - * Except for RCH Downstream Port, all the remaining CXL Agent - * types are uniquely identified by the PCIe compatible SBDF number. - */ - union { - u64 rcrb_base_addr; - struct { - u8 function; - u8 device; - u8 bus; - u16 segment; - u8 reserved_1[3]; - }; - } agent_addr; - - struct { - u16 vendor_id; - u16 device_id; - u16 subsystem_vendor_id; - u16 subsystem_id; - u8 class_code[2]; - u16 slot; - u8 reserved_1[4]; - } device_id; - - struct { - u32 lower_dw; - u32 upper_dw; - } dev_serial_num; - - u8 capability[60]; - u16 dvsec_len; - u16 err_len; - u8 reserved_2[4]; -}; - -#pragma pack() - void cxl_cper_print_prot_err(const char *pfx, const struct cxl_cper_sec_prot_err *prot_err); diff --git a/include/cxl/event.h b/include/cxl/event.h index 0bea1afbd747..66d85fc87701 100644 --- a/include/cxl/event.h +++ b/include/cxl/event.h @@ -152,6 +152,86 @@ struct cxl_cper_work_data { struct cxl_cper_event_rec rec; }; +#define PROT_ERR_VALID_AGENT_TYPE BIT_ULL(0) +#define PROT_ERR_VALID_AGENT_ADDRESS BIT_ULL(1) +#define PROT_ERR_VALID_DEVICE_ID BIT_ULL(2) +#define PROT_ERR_VALID_SERIAL_NUMBER BIT_ULL(3) +#define PROT_ERR_VALID_CAPABILITY BIT_ULL(4) +#define PROT_ERR_VALID_DVSEC BIT_ULL(5) +#define PROT_ERR_VALID_ERROR_LOG BIT_ULL(6) + +/* + * The layout of the enumeration and the values matches CXL Agent Type + * field in the UEFI 2.10 Section N.2.13, + */ +enum { + RCD, /* Restricted CXL Device */ + RCH_DP, /* Restricted CXL Host Downstream Port */ + DEVICE, /* CXL Device */ + LD, /* CXL Logical Device */ + FMLD, /* CXL Fabric Manager managed Logical Device */ + RP, /* CXL Root Port */ + DSP, /* CXL Downstream Switch Port */ + USP, /* CXL Upstream Switch Port */ +}; + +#pragma pack(1) + +/* Compute Express Link Protocol Error Section, UEFI v2.10 sec N.2.13 */ +struct cxl_cper_sec_prot_err { + u64 valid_bits; + u8 agent_type; + u8 reserved[7]; + + /* + * Except for RCH Downstream Port, all the remaining CXL Agent + * types are uniquely identified by the PCIe compatible SBDF number. + */ + union { + u64 rcrb_base_addr; + struct { + u8 function; + u8 device; + u8 bus; + u16 segment; + u8 reserved_1[3]; + }; + } agent_addr; + + struct { + u16 vendor_id; + u16 device_id; + u16 subsystem_vendor_id; + u16 subsystem_id; + u8 class_code[2]; + u16 slot; + u8 reserved_1[4]; + } device_id; + + struct { + u32 lower_dw; + u32 upper_dw; + } dev_serial_num; + + u8 capability[60]; + u16 dvsec_len; + u16 err_len; + u8 reserved_2[4]; +}; + +#pragma pack() + +/* CXL RAS Capability Structure, CXL v3.0 sec 8.2.4.16 */ +struct cxl_ras_capability_regs { + u32 uncor_status; + u32 uncor_mask; + u32 uncor_severity; + u32 cor_status; + u32 cor_mask; + u32 cap_control; + u32 header_log[16]; +}; + #ifdef CONFIG_ACPI_APEI_GHES int cxl_cper_register_work(struct work_struct *work); int cxl_cper_unregister_work(struct work_struct *work); diff --git a/include/linux/cper.h b/include/linux/cper.h index 265b0f8fc0b3..5c6d4d5b9975 100644 --- a/include/linux/cper.h +++ b/include/linux/cper.h @@ -89,6 +89,10 @@ enum { #define CPER_NOTIFY_DMAR \ GUID_INIT(0x667DD791, 0xC6B3, 0x4c27, 0x8A, 0x6B, 0x0F, 0x8E, \ 0x72, 0x2D, 0xEB, 0x41) +/* CXL Protocol Error Section */ +#define CPER_SEC_CXL_PROT_ERR \ + GUID_INIT(0x80B9EFB4, 0x52B5, 0x4DE3, 0xA7, 0x77, 0x68, 0x78, \ + 0x4B, 0x77, 0x10, 0x48) /* CXL Event record UUIDs are formatted as GUIDs and reported in section type */ /* From patchwork Tue Dec 17 02:20:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Smita Koralahalli X-Patchwork-Id: 13910897 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2046.outbound.protection.outlook.com [40.107.102.46]) (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 9A79C146A7A; Tue, 17 Dec 2024 02:22:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.102.46 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734402150; cv=fail; b=nJuYTBPxzNNNGFc53cwd7Sl35phKU6zLpSS481V05XUxdiYTgD2GaUafkDxbkjnScMRmx7RgtBDVZ5tqvihzMeHXX3TTYdzz1lt3KdzjAQE6iA7Yt5wLWUbkulLlBjzrbX3Penp6ijQdb5LR3pdv668sI77jfjoG8DGbexQoauk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734402150; c=relaxed/simple; bh=GWo/9DorJaPod4+gw1rGeKNaSSlTI1JWKV8qbVseAys=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Stj8fxjmFlB/xrEBhQe3Hck/A3kzUsIXC5y6ypFvglF5ihC146CF9K3pSUmbR2l1a/RPuEycJR5sJQD5LMO1GglvbSlG97Uq7yZ+ADeZw3iO866QkRNxhwMBciNEbs5lFxItlzRyJmbvvWE2OasVNXgP8yYPmjIiEVL0uGIeh/I= 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=1IyFOz72; arc=fail smtp.client-ip=40.107.102.46 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="1IyFOz72" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tHG0JxSvMpVIagaEzht1yzr13fy/UNSVrrktI5Z/q0z3wX1q9AhnC7W9NDU5Cbf4NtO9IMeSXCSxzUA+idueeJh0+t+xg8H8YrUGy1pLqhSv88G1Pa4VVnw6u0/u8Cf2Sl0qLTnZb1JPTxTQLsXa9pKiZr4Bv4i99FOsTflZhd/pR8luTtWxdH2YN+L2ltylncVOpvBr6X+3Qux64JNCHwhk8/buOpReyH7WFLJ3+ObEhJegN9zz28zigT0MI9mNnYm73/LUv9bfDtQPlVnKLyKVct8Mii3rviUXr8LrT76iXBpoR96M/pLY3HzG7V8j5pVZxczXEskzaH6c5TSxGw== 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=TzdtfhU6WviOVSrFkLxh8vx/Oe7Cvz3BOMq4sII4rD8=; b=RZKSI2AZ0JRCdZ7Ajs9Xw/HxkDKB2Kj8t6MyUZ/8p3oMZCFRw9GEiFWXiEn8oiAOgsQENZZKYSPw6ZGHYr4hEdOanfv8p90D/ekVAI7V0iMQ/x4a8gpaQ2Um4evsKglFbKmiH/lN6ntdR4jDbiRI9VMzssuSkHY03AW72GFf06hQkKr9yYsFoBKXKJP54tksIZRRBhb5c+dWJyykwTfdgJJ7hDLmtK6Y2xNaNw/zqKcRW/vPn6Dg/QCmSqH9Di0BP+Gt5GoIqhpemCpCT7V5t7Gfx5Aq9qHS1+XE6dJArSgAlPT+aadoEoCLna4/2e5DUP/LPa9tD2GNuSLYOm+JDg== 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=TzdtfhU6WviOVSrFkLxh8vx/Oe7Cvz3BOMq4sII4rD8=; b=1IyFOz72cNr+aOs9SMgY928CqHHe9++ryeDipaPARNlQqrPpgkYpf75oHF8rMT+iP9P+YFkEUbV3T8aSp30P59AFtGxwr0c0M9H7RB2gNH1YeWVrnTLqw3hqBSLuKapZdZo3oj4SzylMKaqL/lWEeeYl8MjdNnTMUwR3gIlPBdE= Received: from MW4PR03CA0218.namprd03.prod.outlook.com (2603:10b6:303:b9::13) 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.8251.21; Tue, 17 Dec 2024 02:22:23 +0000 Received: from CO1PEPF000044FA.namprd21.prod.outlook.com (2603:10b6:303:b9:cafe::d0) by MW4PR03CA0218.outlook.office365.com (2603:10b6:303:b9::13) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.21 via Frontend Transport; Tue, 17 Dec 2024 02:22:23 +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 CO1PEPF000044FA.mail.protection.outlook.com (10.167.241.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8272.0 via Frontend Transport; Tue, 17 Dec 2024 02:22:23 +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; Mon, 16 Dec 2024 20:21:20 -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 v4 3/5] efi/cper, cxl: Remove cper_cxl.h Date: Tue, 17 Dec 2024 02:20:30 +0000 Message-ID: <20241217022032.87298-4-Smita.KoralahalliChannabasappa@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20241217022032.87298-1-Smita.KoralahalliChannabasappa@amd.com> References: <20241217022032.87298-1-Smita.KoralahalliChannabasappa@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044FA:EE_|SA1PR12MB8844:EE_ X-MS-Office365-Filtering-Correlation-Id: 3deb7628-41c2-4c9b-57b8-08dd1e41a451 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: AQQv0pkmvMt9WAg6exyiiBIlK5R8hrVNOwiVBq6KZ71SvlwCj62d5DQbm8nX1sgaOVKkUrnEJLWXjUenzPLrw2dm29C5o4nCzIq4h2QNblVETMkCdhH98f+eBvchI6x1aZuKeV2C6/kv7m0MiLiQ8c6fMfuu2o2M5xLOgKaefi3qxToTCWJ5X6Dn/GJyhdjvVCO2cgd7N/WlQIJiZd/wv873zCNBkZQmEROV9JzIDVY4+/BNxSPZpC9Ys2bMJVphueiSNVsQ5b+BS6rL+5eRzbwOBWwwBYY4nWXkHkl7J649AyJllm+ERw6yiHNL2iCZ7umhyYh1G/lWftCl6IWOAm/uSX0EuhfZZg9DIhMk2XORPVvWGkQQSGjvpLCbUYf+LgZmpqnjkc89vwCNS1y/+mmlvEwIDgrglatqkKQMhMR5d+rBeUHFzNjXHBcJHNcF4UF6x65+LjsvKZvHuyRtL/8Hzi9uMo7O9HxSvtDNFNvm+DKy0P3CI0NLoO10r3CQ/eI2NaNJrckjn/HenhtuAMZbrACMuEuUnNn8XsIxHWmJH9BEQF+z/MnSNKu4vEJFWx8V6qsOwKJUGcQ/AgztkA3ECoaWf4OPZ+LnalcZEhnLISD9WtpWK/QIbsCm0dUxu7ctKmRpp1Qi/DiYc46p26fan3TyXcAQgLLRpThVCUay8RlQC5C112411zN/8M/poLXmwBOon2WlNBWR8mNuMXdSbpkErNSjvcy5FrTJ0KwQKQN0U6L9QcU1GhYa4jsODsxe3ETn4iSl+alp/4N2PrMiiinw3ktGvje61XgdodjbvVS1HTNfYs6ceJKVSr2NWvDeDsJnfW3d63g5Thgio1toBfRiVM0YNqz3yM9iJsIduoNDF+/lL4MmfHKdYhQkDBSIqyU9AiAZBgagrEZiaBdFgqPQcM2eM9pUH/E341C1wL1AVN1847x8RbrMRRKxHxtXOx98BYx77m83BvhRWWAZTaccF8LuCn8+w9Sx1hcqidjf9jWsmUpQUjJGC8qAojA5H+bI49KqmqPzSxfIvMjIIuDapK+b4zlq7W317Sg6q96qjYXaY82/1krhmt/fGUIK5f0LkhJVVJzc+pQzyoGF8hP5TTUzqG8oirOZrczqGuQejfHNOdIP5FrR/da/ixBbN930B+yjCwkUf+2y8bWgVezNBoHutieeRw8/3HJtW+P+eh4MoX2BT4MkGnFcfshy2US4eDQlncLz0yBftOezC4JgtnZP08xqZX4+Fvu2DaqlLKfAsC5P0TUy/CIA1xyH/1YNxoMm1ivpabKfdHkAKLWm9a0wPEjxtiy80TWTmY08o4JtNOWSHdMSYdHOWx49o3lvf/qLN6ui7w+IUOkp8XGcaGqg3DLQYecGG94YIOVl3vbRFz63f6P9CZ6nn+RChPHZ4CyD5OjqMARrc6XXTVY90iXkr3psMrdhgafQ3Z5lzWZM8BDr187U4cPmQ3X+/dPqkVt//24KC+umTA== 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)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Dec 2024 02:22:23.3261 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3deb7628-41c2-4c9b-57b8-08dd1e41a451 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: CO1PEPF000044FA.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8844 Move the declaration of cxl_cper_print_prot_err() to include/linux/cper.h to avoid maintaining a separate header file just for this function declaration. Remove drivers/firmware/efi/cper_cxl.h as its contents have been reorganized. No functional changes. Signed-off-by: Smita Koralahalli Reviewed-by: Ira Weiny --- drivers/firmware/efi/cper.c | 1 - drivers/firmware/efi/cper_cxl.c | 1 - drivers/firmware/efi/cper_cxl.h | 16 ---------------- include/linux/cper.h | 4 ++++ 4 files changed, 4 insertions(+), 18 deletions(-) delete mode 100644 drivers/firmware/efi/cper_cxl.h diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c index ae1953e2b214..928409199a1a 100644 --- a/drivers/firmware/efi/cper.c +++ b/drivers/firmware/efi/cper.c @@ -25,7 +25,6 @@ #include #include #include -#include "cper_cxl.h" /* * CPER record ID need to be unique even after reboot, because record diff --git a/drivers/firmware/efi/cper_cxl.c b/drivers/firmware/efi/cper_cxl.c index 64c0dd27be6e..8a7667faf953 100644 --- a/drivers/firmware/efi/cper_cxl.c +++ b/drivers/firmware/efi/cper_cxl.c @@ -9,7 +9,6 @@ #include #include -#include "cper_cxl.h" static const char * const prot_err_agent_type_strs[] = { "Restricted CXL Device", diff --git a/drivers/firmware/efi/cper_cxl.h b/drivers/firmware/efi/cper_cxl.h deleted file mode 100644 index 5ce1401ee17a..000000000000 --- a/drivers/firmware/efi/cper_cxl.h +++ /dev/null @@ -1,16 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * UEFI Common Platform Error Record (CPER) support for CXL Section. - * - * Copyright (C) 2022 Advanced Micro Devices, Inc. - * - * Author: Smita Koralahalli - */ - -#ifndef LINUX_CPER_CXL_H -#define LINUX_CPER_CXL_H - -void cxl_cper_print_prot_err(const char *pfx, - const struct cxl_cper_sec_prot_err *prot_err); - -#endif //__CPER_CXL_ diff --git a/include/linux/cper.h b/include/linux/cper.h index 5c6d4d5b9975..0ed60a91eca9 100644 --- a/include/linux/cper.h +++ b/include/linux/cper.h @@ -605,4 +605,8 @@ void cper_estatus_print(const char *pfx, int cper_estatus_check_header(const struct acpi_hest_generic_status *estatus); int cper_estatus_check(const struct acpi_hest_generic_status *estatus); +struct cxl_cper_sec_prot_err; +void cxl_cper_print_prot_err(const char *pfx, + const struct cxl_cper_sec_prot_err *prot_err); + #endif From patchwork Tue Dec 17 02:20:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Smita Koralahalli X-Patchwork-Id: 13910899 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2076.outbound.protection.outlook.com [40.107.220.76]) (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 3F489F9FE; Tue, 17 Dec 2024 02:22:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734402177; cv=fail; b=XpnK7N8eabl12bgo0daMWMKdMkMfTdKujhltBxdH0SQxLFHHdUYNsZw+WlYR/X3Hv7pWmeK8OIZpwbY/XzY/HdByV06ffMfjzu6FS2gSJINFZEjPu/V1+jfijydVfrCb4DHGO6LfroM1ZjydOR0S7mz+ll9mH76qLK9r8ZZUcX4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734402177; c=relaxed/simple; bh=AwUFEUmowzR8btkjwtDvhAbzi4w4sBwwWsXOOgZTiWc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MGPMaSP+fc/JYpykUcORHMkkgnmWX1dBIC6DNgvd8qOXNugS44O78flQzVyNiPqVukHPeOa6mr8YCG7SsW1e+HCTUyEe4iviO1+io9VKMDUYC95dTUITYjwixqKpPytFFRDl5LQe61sdnSwz9nirMaSDcooO+HNSmO/NhxL2M7I= 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=JXRUUbLO; arc=fail smtp.client-ip=40.107.220.76 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="JXRUUbLO" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bRhpnpnflAlFuKeVoEBr249qtggrwOXrh49Wu2ixl4+e0nWY7lvTe/G43aUeKCExDrDJW7cLvG4kqmeH39BlLV4Wlt3eNTP/lGsXtyVzWMYLZwMjREd4MTZxtBpHH/LsKNregLY6PzhqEfe7SkWY0u36qG2lg/iqUqo7kvSMSHyeUpG9nvaxVVTJ/YWT7QwEn0Ch18gKXnWHBVNCSw8Cd/O6k6YhSDQgWi21NfdA4I8HrzCi+62hHU0y+YOqG8R6PEj4j1KxfIqaB/oRQMoKD+k48VXZGo83DCkmKkumJ1onIBjpNczXu5kr5vLSIItxQk8uUITDBiFlz7+BRrUmoA== 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=zhY/HUqghD0SefTIHTCXeks6zY/k46pDWh4sPMj61oA=; b=ojEHqJGRoEgBVqCEj6ymMN4GKQuudBep7hn/tdit5NHRJoWkV4PaxcjTpVDL63pOOBZIEXX1CDq3tZXddsfmOjDKDVl0YKSRM0t8xtS3UFlQUdPcW0QL7orv1LhMeiD5wR59WWenjdxrCemAlyp9t/LUlmUdobDyKQkXLzjsurOJjuMwI+b83g7QpHzGLcrO2ytlKR2lX3vtb5BCksqb7Y/Qq5IsX0aFzwaC6E4ZzPfdhLqiWPLULS5JsawTziS0KbHphOWEXlXUaa5WlvG0+1mzvcXkri5UCUzXnwcq07Rz/P1ok1sd3sT7p0qVypHZyMJ+RVKPkwpm888yfm4SFg== 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=zhY/HUqghD0SefTIHTCXeks6zY/k46pDWh4sPMj61oA=; b=JXRUUbLOS+D5xdpSzwzNI54WkmSxsHdLmWODUeEfxE7lYm66BzO8sxXSx2Tl3ppSdwlG3Kp+7/3K+jMuTODOmIGvrb0OVLrk5k4Nb4M9smiR+Zvz2tFJCEANMW4b0DNXaQG/rAdBAUCWhQQY9SmYXN7mP9+2ZvzRLba4GSt5Nl8= Received: from BYAPR01CA0034.prod.exchangelabs.com (2603:10b6:a02:80::47) by DS0PR12MB7948.namprd12.prod.outlook.com (2603:10b6:8:152::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.21; Tue, 17 Dec 2024 02:22:53 +0000 Received: from CO1PEPF000044FD.namprd21.prod.outlook.com (2603:10b6:a02:80:cafe::5e) by BYAPR01CA0034.outlook.office365.com (2603:10b6:a02:80::47) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.20 via Frontend Transport; Tue, 17 Dec 2024 02:22:57 +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 CO1PEPF000044FD.mail.protection.outlook.com (10.167.241.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8272.0 via Frontend Transport; Tue, 17 Dec 2024 02:22:52 +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; Mon, 16 Dec 2024 20:22:09 -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 v4 4/5] acpi/ghes, cper: Recognize and cache CXL Protocol errors Date: Tue, 17 Dec 2024 02:20:31 +0000 Message-ID: <20241217022032.87298-5-Smita.KoralahalliChannabasappa@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20241217022032.87298-1-Smita.KoralahalliChannabasappa@amd.com> References: <20241217022032.87298-1-Smita.KoralahalliChannabasappa@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044FD:EE_|DS0PR12MB7948:EE_ X-MS-Office365-Filtering-Correlation-Id: 9c86eeac-bd49-48d0-9e7c-08dd1e41b5cb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|376014|36860700013; X-Microsoft-Antispam-Message-Info: 51I+/NIE0xa6Xnao3pTEEtbqslbCohwre2VZVrsf3i77dqDZEXZn+RE6o5niXC3dDHufUt0gwlairJQzr4UmsFuEGW2w40hzFzmqtTIn3wIBq8wrNybBNY2hIiIhlTfrCWf/hH9h0kMhjHLU2zk0JP/qByjOGXeZm2eZXGtEeWPl6ap6HeWIIQzSQvbjacSMqYiHvWjpYP/IsWYV0AFPAGIz/iT/5jUGTBjEm9tIu4cd5bMJxZ2voxGekMGoVIP5Eg0bliRBzn64htuiUim1WRv2svAXUS8W4MIFGUpOoerFo0CuccyPsTDVkxfSUrb40zPouIQ2gvjl3XVPBOukaFfUPRugDFN4m7i1vYWydpcljlzy/sa32uakwlPygBDUBvk9VeqT+CbhTFeNc7Ni/eZCtzdI8V0evNuNd/vdV4cBPkrHUOhIkz80j5v9AkZxRk+Jrk+Ratj07wvJ/eQlYtp/f9nb5Zs3YMkmAebDO3WVYpOrbLig0E4BV+zz2GhlPFHa7oZTz3yfYIsAQLGDTBcJc13VJ9GVom/4S9wcWFnk1c5x/qy0KpObDI1BWg06vWNRiPNfVbpIublQDVORacet7uTLMjOACsxmk2rbZF0pgTBR2s7xp7ITZQmJhSYYoFaQGzpd71kNiy7RG1Gs0Gpi9J8CpVgrh9LyNhI/ROWa9hnDQow0JVcjn/5yXjxoO55FfKw82tzy3jYHh/JhxWxFZewgsC+EPva+I3P3p9ER54rGfXFqd8omvyznYKIpnKNOePoZx8sPe/fRq9KrC1atNQiQQB3SOUnf/X9LKhBe3rRhDcKt0JhEtPTqbO+n93caJUOPa1C+8Izkps7ef5uE+4FdFBL5XjIYuP++TQKfc56eN39/DnARbFxvVwnd3Tr06/67pBjK23Vq2Z/K0GQS/Sfq7kLpJBrxzzOsaQFKxavzoh8iPryx/ejzGOxncWJCuIz98Y1/hDkW8H7L8+hQvBjjhIjnn+fcAF8MX6WKD8YetWFdoIwYfRTwdsxW6gTM/RXdbGmP1C2nQor4nKDRGP3pGrXoWLSl5B1Ts9tdXwsvAHmPix87AtMw2DWAaRXotKX1nKL00b5bWaQQ74NI3UKJhYqlipjRZXC1kNR92vVP8CRAtBWtDVUGODz/Jd2+qmyY9GoUWRiif/iVGincDw7SSKapkcKp+r5zx8GQqer++THPFtmDINs2lFD7hP5Do4UtgZ40X1x43dzLJxfijf/M2fMd5SYCoKWbKiilXKtuW8/hEWgcf69xzBYO+4GsIvc9vdoYh7v5uSdAsYk55uIyFl2HYL5Rm5I5iJitJxtC/86iJI+D72Jvq4SQXMIq0d+VDh6GwOElLYsETVpPdne2kK3jt4gQiv9yUnf78Gvry45htxbyNI0n83oFvcAbKU/pLyWv/1QYb9eZTRPur6e+LjXCaoSnppa/Or1GETpLyVq4lFYq+9dKfUj7cov+thCezEl7TpqvQ+vYgBeMtdlRJ7yAsH2hmiWV0JA= 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)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Dec 2024 02:22:52.6800 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9c86eeac-bd49-48d0-9e7c-08dd1e41b5cb 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: CO1PEPF000044FD.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7948 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 | 52 ++++++++++++++++++++++++++++++++++++++++ include/cxl/event.h | 6 +++++ 2 files changed, 58 insertions(+) diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index ada93cfde9ba..63afef58b3b7 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -676,6 +676,54 @@ 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) +{ + 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; + } +} + /* 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 +827,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); From patchwork Tue Dec 17 02:20:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Smita Koralahalli X-Patchwork-Id: 13910900 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2079.outbound.protection.outlook.com [40.107.220.79]) (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 65A4614A0A4; Tue, 17 Dec 2024 02:22:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734402180; cv=fail; b=WEg6PT80AkYjb7Jnpx2aintT/kpannA5UG9r2CMshoTQXoxTnfdxiqYI1RSlbVk/0hwJuF9+xAnNJDrE0ViP9JCCXOyXThFWTNkfFNenvcBPl56zLn4jFG8CAsvJc+zYHBhJqmL0TIZuWp0HrJOGpVncBMQ///LZuVUeLqT42jo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734402180; c=relaxed/simple; bh=bWeYYyYsgcTfJqTz3qE91HmbHlQaiTcOVl+/r4aWC/4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Z55CPbXFFit9jeksgdu2daQN7D/gcI5QE9Ry+1PfiwWAOkQpPRAvCZf+l8RsP/H7ELtpAv3sV6JFSKFFMuJ9JZwsXOi/u1A3/k76qVpmVQCHSstV1T22B7W/3N36MWQxUWEW9hxI+rxr/HpszF7FaJANOLRQVwB4s68aDZgl0hg= 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=L1zSrk5B; arc=fail smtp.client-ip=40.107.220.79 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="L1zSrk5B" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=OLo9iOzuxPiwAeGkfNWq5n2Is2lr5EvnWTLuMQuE8Qhr7BCVAa+FYEZKxmVelMIv2kqNxGteUujuJwoZZGyG78pqo0gwoVGDH+4V7EpGJeZ1KK25AJw2sOnXllSLg4+cGep3EJn/oM6OEf9fqIaAH211y5GUjyLOH+6DGCI3MVPpXK/SwGGfPwWdy/Qn/7RyESIZec9KuviN015HK6u/858Ie0R9jRy/WCHcsfQsZjZVHRtpUlqtBZj44uJ4/o9GpzpcZKrFJoZJF+XqR7lyCcdDZL+7JX5A8vPNv6xSMg+ynLvyJxgzwqQd8pXR/+yCNGEAnyWMxm7VbGpQoEI2Xw== 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=dYmYVG+YAibn3eCiGUB8j1CTo8ulNxa7DWNAZmG7l9o=; b=xAMa4le31BOtqaZ80/ETQ7LsxscPa055cNxGECsu8fezN7bqflKSZ9+C0KmkZhTbQFnYLWsnrt6ECvHLoXBbZhlIuRqQsOcANcFtpP1FOR/1LcBsTHO+SNSvkBTgkjbHIdgjVYbLEzmjH7tzq7g8IzoO0xe7BBvalwYqvjpovXXG+MxRVxNR/s6fupuckWhu2w2NFtRsJG0bo0vVIGQ0m6QCdljFxeKmAsVJzgYokfQrM2fkgQlRJZX2UX5Nk3xF7wMnvV+alX4TtsJ1vvQl5iIzyBfImxKE6B2H1kkKPjWhVmRsflmKKzgO2d+QHMNR4OgOpVWcw1TLyPlDbhKEAQ== 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=dYmYVG+YAibn3eCiGUB8j1CTo8ulNxa7DWNAZmG7l9o=; b=L1zSrk5BVc/wnwjf5DuF47dNOzS6+2irG5jSTKCOX6w/NWFJcPTCPkAdI0qUTuKZvhkFdBf8TdaZjNDQmyeef1s6e8ecYZS7sktMNddFYaCcjPF5VDr2IiZDuQ+baQFPc8TvWuBDjUAOQfXgccfwylNQNcYY956G+8uzGAv9Icw= Received: from MW4PR03CA0161.namprd03.prod.outlook.com (2603:10b6:303:8d::16) by DM4PR12MB7742.namprd12.prod.outlook.com (2603:10b6:8:102::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.18; Tue, 17 Dec 2024 02:22:54 +0000 Received: from CO1PEPF000044F6.namprd21.prod.outlook.com (2603:10b6:303:8d:cafe::56) by MW4PR03CA0161.outlook.office365.com (2603:10b6:303:8d::16) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.20 via Frontend Transport; Tue, 17 Dec 2024 02:22:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000044F6.mail.protection.outlook.com (10.167.241.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8272.0 via Frontend Transport; Tue, 17 Dec 2024 02:22:54 +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; Mon, 16 Dec 2024 20:22:28 -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 v4 5/5] acpi/ghes, cxl/pci: Process CXL CPER Protocol Errors Date: Tue, 17 Dec 2024 02:20:32 +0000 Message-ID: <20241217022032.87298-6-Smita.KoralahalliChannabasappa@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20241217022032.87298-1-Smita.KoralahalliChannabasappa@amd.com> References: <20241217022032.87298-1-Smita.KoralahalliChannabasappa@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F6:EE_|DM4PR12MB7742:EE_ X-MS-Office365-Filtering-Correlation-Id: 4cac499b-ecca-4c98-ba95-08dd1e41b6f6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: fh5Z29dWOJbWj8hf2OJqWqdLmBgZljf4kqBBYEWkYpfL2Ue9pEos6tu4x6wGiPdKn0JAzTq62j6DIoHnCQFotUOOEYNAg5cciobQV6dlD7a4C7Tr8hvDdVOEGRgzpujFQRx4Xeqgl++uvPNd3V21FcP+rt1GDZunnGocoGmcoXBCc7AP1kXY8LFIYSJwNOxMKxCcIzKjW2E9E6b0WCnDFKMnLGCdvzu922kN4Pcd28QuDaHv0OJ5sT5xzoh1IGJXdGNTFzFLDwAL5cxd0pxgxh+w1rAaPDPKcyysP9MYOLGAgGOQFDoZ6d0vUntt53geaMCK4vh8EvZSXt+otSA5udARscY95Sz66QKrZErKc3TPEx8jar5dO30Z3qwokoQwCE16yg23AhYDg20ENkSFT1kTNOvqGN+dMnRQ7YtsF1U1F68v/aKFp4sVxgOKVZVSJjgxlI9/PrrD+mEJ34FSIB8Ph9aNCtjlh2I13CVhONqNifqazAQii+xlMLzgKOZeZLZ/hfb+EmAwi141ruaJA5qnWaa1DSIvXkR1qBmreeXTCPhbF1eY3TiUDgOO5SqHQddBSGZpOwoFitKekGg/YBubZyzmYXO83DZduHeWcp0+ktdSqE8KwLnSb+Io2D1TtfheszehuGWIuUFnqEupz0U1ZrYSMKjokmYVs6LeRCBULlLNZq59kg4IhBK0mJFKhicoCoxuT+3eHrKldyEX+4+e5qKKakBg8Xy2nvMDzeAy8zIgj+8wlQfKZy6OpaRitTk5zM3sgrgfjBoRH0AZGSSn7fAWqJm0l4pNUG4Vest2IFy0xWTc20DJYf8xgIlLLxaAt1q8/VFaMVNWGWRJVBNT2tRPb1lgvGEzPHWVxhkKEmRCBh3peZugEzjaWAl4vbJbudnwSWF1tVUmxS+gVMIxGU58+OqpNTeJLme+aSepyh56SUUR3PaoLUCy5FNDJ1iF2XzDpwRyGAfPpfTiDK/asxKnxJnbL5Wn/UHygm8DupXpXUGJ8MMKRkRaCm6nkDVK58UWoOMP0LzhwCIGQ/2dz3iOyH4qy5Kp3gjV5S9WD1bNZeDK6Xcx7gBRl7xt1pn/KJW54dlQCGqz9ZKWfIReAQVkR/V+iRUW3Ixb0n0Ct7Ym+AMttI6CXXzl3ETtd1ps+ShI+7PNk9qbjNIDumF5kIw5NDaBfXfaArbYqisvbn3CrlrMo1jK0UbL76nKHfUxmNpAaHT4wpF+IKmacXOTHeHSqDNEbN7LPxE6OkFaao0KsX0wnVBZvCPKFkO1L0skhrnjsdAv/XDt4Oq29nZs63H1ijZboIrFa6bBV3ghX1IRdYms3oYOwOjYMqIgq6+L/vEYHIbToBHGtTDlQvC3M0qBFBVE2jEFVvkbR99AFrCII7/PKCznNq4oQTXcNets70GcLkBGpRVeELkD7vEpNA1m+rW8UQNQzAVFHMOJXUBsSv8MZBRUwTHupJVGI32Pzwm2aAj6O+rX8H2lELXYUEmbPCdUbVnF1zo7c7o= 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)(376014)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Dec 2024 02:22:54.6090 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4cac499b-ecca-4c98-ba95-08dd1e41b6f6 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: CO1PEPF000044F6.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7742 When PCIe AER is in FW-First, OS should process CXL Protocol errors from CPER records. Introduce support for handling and logging CXL Protocol errors. The defined trace events cxl_aer_uncorrectable_error and cxl_aer_correctable_error trace native CXL AER endpoint errors, while cxl_cper_trace_corr_prot_err and cxl_cper_trace_uncorr_prot_err trace native CXL AER port errors. Reuse both sets to trace FW-First protocol errors. Since the CXL code is required to be called from process context and GHES is in interrupt context, use workqueues for processing. Similar to CXL CPER event handling, use kfifo to handle errors as it simplifies queue processing by providing lock free fifo operations. Add the ability for the CXL sub-system to register a workqueue to process CXL CPER protocol errors. Signed-off-by: Smita Koralahalli --- drivers/acpi/apei/ghes.c | 49 +++++++++++++++++++++++++++++++ drivers/cxl/core/pci.c | 62 ++++++++++++++++++++++++++++++++++++++++ drivers/cxl/cxlpci.h | 9 ++++++ drivers/cxl/pci.c | 60 +++++++++++++++++++++++++++++++++++++- include/cxl/event.h | 15 ++++++++++ 5 files changed, 194 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index 63afef58b3b7..635cd5fa284f 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -676,6 +676,15 @@ static void ghes_defer_non_standard_event(struct acpi_hest_generic_data *gdata, schedule_work(&entry->work); } +/* Room for 8 entries */ +#define CXL_CPER_PROT_ERR_FIFO_DEPTH 8 +static DEFINE_KFIFO(cxl_cper_prot_err_fifo, struct cxl_cper_prot_err_work_data, + CXL_CPER_PROT_ERR_FIFO_DEPTH); + +/* Synchronize schedule_work() with cxl_cper_prot_err_work changes */ +static DEFINE_SPINLOCK(cxl_cper_prot_err_work_lock); +struct work_struct *cxl_cper_prot_err_work; + static void cxl_cper_post_prot_err(struct cxl_cper_sec_prot_err *prot_err, int severity) { @@ -701,6 +710,11 @@ static void cxl_cper_post_prot_err(struct cxl_cper_sec_prot_err *prot_err, if (!(prot_err->valid_bits & PROT_ERR_VALID_SERIAL_NUMBER)) pr_warn(FW_WARN "CXL CPER no device serial number\n"); + guard(spinlock_irqsave)(&cxl_cper_prot_err_work_lock); + + if (!cxl_cper_prot_err_work) + return; + switch (prot_err->agent_type) { case RCD: case DEVICE: @@ -722,7 +736,42 @@ static void cxl_cper_post_prot_err(struct cxl_cper_sec_prot_err *prot_err, prot_err->agent_type); return; } + + if (!kfifo_put(&cxl_cper_prot_err_fifo, wd)) { + pr_err_ratelimited("CXL CPER kfifo overflow\n"); + return; + } + + schedule_work(cxl_cper_prot_err_work); +} + +int cxl_cper_register_prot_err_work(struct work_struct *work) +{ + if (cxl_cper_prot_err_work) + return -EINVAL; + + guard(spinlock)(&cxl_cper_prot_err_work_lock); + cxl_cper_prot_err_work = work; + return 0; +} +EXPORT_SYMBOL_NS_GPL(cxl_cper_register_prot_err_work, CXL); + +int cxl_cper_unregister_prot_err_work(struct work_struct *work) +{ + if (cxl_cper_prot_err_work != work) + return -EINVAL; + + guard(spinlock)(&cxl_cper_prot_err_work_lock); + cxl_cper_prot_err_work = NULL; + return 0; +} +EXPORT_SYMBOL_NS_GPL(cxl_cper_unregister_prot_err_work, CXL); + +int cxl_cper_prot_err_kfifo_get(struct cxl_cper_prot_err_work_data *wd) +{ + return kfifo_get(&cxl_cper_prot_err_fifo, wd); } +EXPORT_SYMBOL_NS_GPL(cxl_cper_prot_err_kfifo_get, CXL); /* Room for 8 entries for each of the 4 event log queues */ #define CXL_CPER_FIFO_DEPTH 32 diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index 740ac5d8809f..5bad24965e24 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -650,6 +650,68 @@ void read_cdat_data(struct cxl_port *port) } EXPORT_SYMBOL_NS_GPL(read_cdat_data, CXL); +void cxl_cper_trace_corr_prot_err(struct pci_dev *pdev, + struct cxl_ras_capability_regs ras_cap) +{ + u32 status = ras_cap.cor_status & ~ras_cap.cor_mask; + struct cxl_dev_state *cxlds; + + cxlds = pci_get_drvdata(pdev); + if (!cxlds) + return; + + trace_cxl_aer_correctable_error(cxlds->cxlmd, status); +} +EXPORT_SYMBOL_NS_GPL(cxl_cper_trace_corr_prot_err, CXL); + +void cxl_cper_trace_uncorr_prot_err(struct pci_dev *pdev, + struct cxl_ras_capability_regs ras_cap) +{ + u32 status = ras_cap.uncor_status & ~ras_cap.uncor_mask; + struct cxl_dev_state *cxlds; + u32 fe; + + if (hweight32(status) > 1) + fe = BIT(FIELD_GET(CXL_RAS_CAP_CONTROL_FE_MASK, + ras_cap.cap_control)); + else + fe = status; + + cxlds = pci_get_drvdata(pdev); + if (!cxlds) + return; + + trace_cxl_aer_uncorrectable_error(cxlds->cxlmd, status, fe, + ras_cap.header_log); +} +EXPORT_SYMBOL_NS_GPL(cxl_cper_trace_uncorr_prot_err, CXL); + +void cxl_cper_trace_corr_port_prot_err(struct pci_dev *pdev, + struct cxl_ras_capability_regs ras_cap) +{ + u32 status = ras_cap.cor_status & ~ras_cap.cor_mask; + + trace_cxl_port_aer_correctable_error(&pdev->dev, status); +} +EXPORT_SYMBOL_NS_GPL(cxl_cper_trace_corr_port_prot_err, CXL); + +void cxl_cper_trace_uncorr_port_prot_err(struct pci_dev *pdev, + struct cxl_ras_capability_regs ras_cap) +{ + u32 status = ras_cap.uncor_status & ~ras_cap.uncor_mask; + u32 fe; + + if (hweight32(status) > 1) + fe = BIT(FIELD_GET(CXL_RAS_CAP_CONTROL_FE_MASK, + ras_cap.cap_control)); + else + fe = status; + + trace_cxl_port_aer_uncorrectable_error(&pdev->dev, status, fe, + ras_cap.header_log); +} +EXPORT_SYMBOL_NS_GPL(cxl_cper_trace_uncorr_port_prot_err, CXL); + static void __cxl_handle_cor_ras(struct device *dev, void __iomem *ras_base) { diff --git a/drivers/cxl/cxlpci.h b/drivers/cxl/cxlpci.h index 4da07727ab9c..23f2b1c9bd13 100644 --- a/drivers/cxl/cxlpci.h +++ b/drivers/cxl/cxlpci.h @@ -129,4 +129,13 @@ void read_cdat_data(struct cxl_port *port); void cxl_cor_error_detected(struct pci_dev *pdev); pci_ers_result_t cxl_error_detected(struct pci_dev *pdev, pci_channel_state_t state); +struct cxl_ras_capability_regs; +void cxl_cper_trace_corr_prot_err(struct pci_dev *pdev, + struct cxl_ras_capability_regs ras_cap); +void cxl_cper_trace_uncorr_prot_err(struct pci_dev *pdev, + struct cxl_ras_capability_regs ras_cap); +void cxl_cper_trace_corr_port_prot_err(struct pci_dev *pdev, + struct cxl_ras_capability_regs ras_cap); +void cxl_cper_trace_uncorr_port_prot_err(struct pci_dev *pdev, + struct cxl_ras_capability_regs ras_cap); #endif /* __CXL_PCI_H__ */ diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c index 188412d45e0d..f6d467cd9232 100644 --- a/drivers/cxl/pci.c +++ b/drivers/cxl/pci.c @@ -1067,6 +1067,51 @@ static void cxl_cper_work_fn(struct work_struct *work) } static DECLARE_WORK(cxl_cper_work, cxl_cper_work_fn); +static void cxl_cper_handle_prot_err(struct cxl_cper_prot_err_work_data *data) +{ + unsigned int devfn = PCI_DEVFN(data->prot_err.agent_addr.device, + data->prot_err.agent_addr.function); + struct pci_dev *pdev __free(pci_dev_put) = + pci_get_domain_bus_and_slot(data->prot_err.agent_addr.segment, + data->prot_err.agent_addr.bus, + devfn); + int port_type; + + if (!pdev) + return; + + guard(device)(&pdev->dev); + if (pdev->driver != &cxl_pci_driver) + return; + + port_type = pci_pcie_type(pdev); + if (port_type == PCI_EXP_TYPE_ROOT_PORT || + port_type == PCI_EXP_TYPE_DOWNSTREAM || + port_type == PCI_EXP_TYPE_UPSTREAM) { + if (data->severity == AER_CORRECTABLE) + cxl_cper_trace_corr_port_prot_err(pdev, data->ras_cap); + else + cxl_cper_trace_uncorr_port_prot_err(pdev, data->ras_cap); + + return; + } + + if (data->severity == AER_CORRECTABLE) + cxl_cper_trace_corr_prot_err(pdev, data->ras_cap); + else + cxl_cper_trace_uncorr_prot_err(pdev, data->ras_cap); + +} + +static void cxl_cper_prot_err_work_fn(struct work_struct *work) +{ + struct cxl_cper_prot_err_work_data wd; + + while (cxl_cper_prot_err_kfifo_get(&wd)) + cxl_cper_handle_prot_err(&wd); +} +static DECLARE_WORK(cxl_cper_prot_err_work, cxl_cper_prot_err_work_fn); + static int __init cxl_pci_driver_init(void) { int rc; @@ -1077,7 +1122,18 @@ static int __init cxl_pci_driver_init(void) rc = cxl_cper_register_work(&cxl_cper_work); if (rc) - pci_unregister_driver(&cxl_pci_driver); + goto err_unreg; + + rc = cxl_cper_register_prot_err_work(&cxl_cper_prot_err_work); + if (rc) + goto err_unregister_work; + + return 0; + +err_unregister_work: + cxl_cper_unregister_work(&cxl_cper_work); +err_unreg: + pci_unregister_driver(&cxl_pci_driver); return rc; } @@ -1085,7 +1141,9 @@ static int __init cxl_pci_driver_init(void) static void __exit cxl_pci_driver_exit(void) { cxl_cper_unregister_work(&cxl_cper_work); + cxl_cper_unregister_prot_err_work(&cxl_cper_prot_err_work); cancel_work_sync(&cxl_cper_work); + cancel_work_sync(&cxl_cper_prot_err_work); pci_unregister_driver(&cxl_pci_driver); } diff --git a/include/cxl/event.h b/include/cxl/event.h index ee1c3dec62fa..359a8f44a2e0 100644 --- a/include/cxl/event.h +++ b/include/cxl/event.h @@ -242,6 +242,9 @@ struct cxl_cper_prot_err_work_data { int cxl_cper_register_work(struct work_struct *work); int cxl_cper_unregister_work(struct work_struct *work); int cxl_cper_kfifo_get(struct cxl_cper_work_data *wd); +int cxl_cper_register_prot_err_work(struct work_struct *work); +int cxl_cper_unregister_prot_err_work(struct work_struct *work); +int cxl_cper_prot_err_kfifo_get(struct cxl_cper_prot_err_work_data *wd); #else static inline int cxl_cper_register_work(struct work_struct *work) { @@ -256,6 +259,18 @@ static inline int cxl_cper_kfifo_get(struct cxl_cper_work_data *wd) { return 0; } +static inline int cxl_cper_register_prot_err_work(struct work_struct *work) +{ + return 0; +} +static inline int cxl_cper_unregister_prot_err_work(struct work_struct *work) +{ + return 0; +} +static inline int cxl_cper_prot_err_kfifo_get(struct cxl_cper_prot_err_work_data *wd) +{ + return 0; +} #endif #endif /* _LINUX_CXL_EVENT_H */