From patchwork Thu Oct 12 23:02:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Smita Koralahalli X-Patchwork-Id: 13419963 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 BDFB03D03E for ; Thu, 12 Oct 2023 23:03:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="u2OFOlVS" Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2041.outbound.protection.outlook.com [40.107.244.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0831112; Thu, 12 Oct 2023 16:03:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gCeQAInqGiXd/ibG5n6qWtT4qIU5XuBobKyD2CZic/9ZBeRopngaFHqkc+JSP+Xc9kLSn44id01LiXcmSfRpx0SpJot83lO5n5T0VxGnxfQiyl4A42caqPgqC0rjGWXTaXov7bltmcOawi9aN9HCc2f0JXF+rnU1wD4Zg5O5UHmmAXLOHkbej8luFaMvH8XJs6aMiqtcMrg4zf2BwCUQYNpgqYgxutqyeW1Z+4IPox/DpYONEuzLyvmeQS3NfmP3hm7kpw5IzFU88GoF64tQuCueiyaA4/XErKRF5TWTRwIJgrVGGk6ZEbi0Dkx57A2IKmgR7Hvg/6Cu4HUCa+spXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=BpAULVGxNk/AEj6PFj4uEc4Ap8fwDpyq9CBXKrh30PY=; b=F61+8k63s4QrOIIqlnSdwPOSoVH7T/jDwgjrHz6MEg6/GHL3A5lUwpbX4uQnnbNE6fNzsOtKwljFEFh6/XJCYDVkHNYkXvChJNCAQ2lxJE/hjLrgSQPz/0vqduLN60fdu3GgS2Jo64Vs/bwdeIFO/z78eYxbDjCKDYBdbmmt1IT7QQ30+2B3zqvcoltmHXhSJECR2/B11FRRVsdR4X37RtMEgASkWeccX9FvKARaHnGe6a9R4ImdB8Uua4ckNnCpwgu+bLSkWJr1dKVRMlj+shkFYfaMxC5ShFmWFyZ2P2j3JL3irQRR21//O1CKFtbQ8JTNLs9AWw4bMdPIkWmUWg== 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 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=BpAULVGxNk/AEj6PFj4uEc4Ap8fwDpyq9CBXKrh30PY=; b=u2OFOlVSqosUsDOZkeGlAecUjRFPARw0rBl900p9E9N8fKxdjofvIBd2mi6d62g9fU/jrpusSv0ZR/D5I5KJWkyWGwJuf+ualbkJkFjPEShgoEMP+thXh/tZXyWAa8XOG7w7Cmqa06WvOwPCH/kNA9KXW6DrVrCSkWqY8kpRwTI= Received: from CY5PR15CA0066.namprd15.prod.outlook.com (2603:10b6:930:18::10) by PH0PR12MB5468.namprd12.prod.outlook.com (2603:10b6:510:ea::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38; Thu, 12 Oct 2023 23:03:18 +0000 Received: from CY4PEPF0000EE3D.namprd03.prod.outlook.com (2603:10b6:930:18:cafe::9d) by CY5PR15CA0066.outlook.office365.com (2603:10b6:930:18::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.27 via Frontend Transport; Thu, 12 Oct 2023 23:03:18 +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 CY4PEPF0000EE3D.mail.protection.outlook.com (10.167.242.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Thu, 12 Oct 2023 23:03:18 +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.27; Thu, 12 Oct 2023 18:03:14 -0500 From: Smita Koralahalli To: , , CC: Ard Biesheuvel , Alison Schofield , Vishal Verma , "Ira Weiny" , Dan Williams , Jonathan Cameron , Yazen Ghannam , Smita Koralahalli Subject: [PATCH 1/3] efi/cper, cxl: Decode CXL Component Events General Media Event Record Date: Thu, 12 Oct 2023 23:02:59 +0000 Message-ID: <20231012230301.58500-2-Smita.KoralahalliChannabasappa@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231012230301.58500-1-Smita.KoralahalliChannabasappa@amd.com> References: <20231012230301.58500-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-Originating-IP: [10.180.168.240] 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: CY4PEPF0000EE3D:EE_|PH0PR12MB5468:EE_ X-MS-Office365-Filtering-Correlation-Id: dedf88b9-ed82-4cc3-6d51-08dbcb776c48 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Bzrnhm4M3r/kZKz6NERV8gXNHRReqBL7m/D6dAbHykY9sOTSvL6SD3szb6C692Jysf7asfpdsgr//zwEqCDimHcgU96cUZC35t4MYkjAJ+IoXKaxVRi7fm75LvH66zq+kyNAJNEhDNFJrrT3tC0qkZosKBYWyJBjyZbwW5s/9OgLQuINV66Pw5fVOJteK+ty3S6vV6NcagQv+3RxW80KRJYTOnt8bKqu+7a13ungcGoOtj4De5egdOGd4T4iU3zkUPtnB7YOhlj8zxmukutiKOLEJGbk9tjzxjOMKG14MMHABjX/Xwkn4KKjBXYautmq/Tojb/USySnvJFz0zADu1tdpNEMviqHD8Avmfkb3LBHPCBR5SwNG2NnfUEcF2DfbWz0Xl7aC/OQUMbGj4hLW39IQ5cQCUVo/pbeGvOEq/SXhBwww5GiDG4qtQ+Xh1YMvunJevJ3jCTDb+Z2xlnyjuBEsI/9MlCbkktKzatcKA4RjEx85iOIE189p31Vob8OU0GeikzwUnk+SKHqpbrYSApy+vjg+dvnb8UHZCerVui1prxUSufwRNhwFAQLsc0gcge9u7aUYyeLs34qQOa875Mdg7SOBevvex50PDYRgO+07UHbn4s+EPP1ZjdSzhFZwZiO6jAST1ytGjWGsN7gPWZWPqck20Uq6Cu7ygIxa7SHyHbVdu1kmJ1LF5x4RBCEI1pMm6rCIo6JLjFsG4gfhpdZL3TP8JnyBRlHQ9K+0ifaZs5toWbEbUW5CllmzB16eGTmH4BU6sKNGxxSTOU7S6A== 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:(13230031)(4636009)(396003)(39860400002)(346002)(136003)(376002)(230922051799003)(186009)(64100799003)(82310400011)(451199024)(1800799009)(46966006)(36840700001)(40470700004)(478600001)(26005)(36756003)(40480700001)(16526019)(316002)(70206006)(70586007)(54906003)(7696005)(110136005)(2616005)(8936002)(4326008)(5660300002)(336012)(83380400001)(8676002)(426003)(6666004)(1076003)(41300700001)(86362001)(36860700001)(47076005)(2906002)(40460700003)(356005)(81166007)(82740400003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2023 23:03:18.0196 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dedf88b9-ed82-4cc3-6d51-08dbcb776c48 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: CY4PEPF0000EE3D.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5468 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Add support for decoding CXL Component Events General Media Event Record as defined in CXL rev 3.0 section 8.2.9.2.1.1. All the event records as defined in Event Record Identifier field of the Common Event Record Format in CXL rev 3.0 section 8.2.9.2.1 follow the CPER format for representing the hardware errors if reported by a platform. According to the CPER format, each event record including the General Media is logged as a CXL Component Event as defined in UEFI 2.10 Section N.2.14 and is identified by a UUID as defined by Event Record Identifier field in Common Event Record Format of CXL rev 3.0 section 8.2.9.2.1. CXL Component Event Log field in Component Events Section corresponds to the component/event specified by the section type UUID. Add support for decoding CXL Component Events as defined in UEFI 2.10 Section N.2.14 and decoding Common Event Record as defined in CXL rev 3.0 section 8.2.9.2.1. Signed-off-by: Smita Koralahalli --- drivers/firmware/efi/cper.c | 8 ++ drivers/firmware/efi/cper_cxl.c | 143 ++++++++++++++++++++++++++++++++ drivers/firmware/efi/cper_cxl.h | 62 ++++++++++++++ 3 files changed, 213 insertions(+) diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c index 35c37f667781..b911b1f574db 100644 --- a/drivers/firmware/efi/cper.c +++ b/drivers/firmware/efi/cper.c @@ -607,6 +607,14 @@ cper_estatus_print_section(const char *pfx, struct acpi_hest_generic_data *gdata cper_print_prot_err(newpfx, prot_err); else goto err_section_too_small; + } else if (guid_equal(sec_type, &CPER_SEC_CXL_GEN_MEDIA)) { + struct cper_sec_comp_event *gmer = acpi_hest_get_payload(gdata); + + printk("%ssection_type: CXL General Media Event\n", newpfx); + if (gdata->error_data_length >= sizeof(*gmer)) + cper_print_gen_media(newpfx, gmer); + else + goto err_section_too_small; } else { const void *err = acpi_hest_get_payload(gdata); diff --git a/drivers/firmware/efi/cper_cxl.c b/drivers/firmware/efi/cper_cxl.c index a55771b99a97..8f7b88cc574b 100644 --- a/drivers/firmware/efi/cper_cxl.c +++ b/drivers/firmware/efi/cper_cxl.c @@ -18,6 +18,18 @@ #define PROT_ERR_VALID_DVSEC BIT_ULL(5) #define PROT_ERR_VALID_ERROR_LOG BIT_ULL(6) +#define COMP_EVENT_VALID_DEVICE_ID BIT_ULL(0) +#define COMP_EVENT_VALID_SERIAL_NUMBER BIT_ULL(1) +#define COMP_EVENT_VALID_EVENT_LOG BIT_ULL(2) + +#define EVENT_RECORD_SEVERITY_MASK GENMASK(1, 0) +#define EVENT_RECORD_FLAGS_SHIFT 2 + +#define GMER_VALID_CHANNEL BIT_ULL(0) +#define GMER_VALID_RANK BIT_ULL(1) +#define GMER_VALID_DEVICE BIT_ULL(2) +#define GMER_VALID_COMP_ID BIT_ULL(3) + /* CXL RAS Capability Structure, CXL v3.0 sec 8.2.4.16 */ struct cxl_ras_capability_regs { u32 uncor_status; @@ -55,6 +67,42 @@ enum { USP, /* CXL Upstream Switch Port */ }; +static const char * const cxl_evt_severity_strs[] = { + "informational", + "warning", + "failure", + "fatal", +}; + +static const char * const cxl_evt_flags_strs[] = { + "permanent condition", + "maintenance needed", + "performance degraded", + "hardware replacement needed", +}; + +static const char * const mem_evt_descriptor_strs[] = { + "uncorrectable", + "threshold", + "poison list overflow", +}; + +static const char * const gmer_mem_type_strs[] = { + "media ECC error", + "invalid address", + "data path error", +}; + +static const char * const transaction_type_strs[] = { + "unknown/unreported", + "host read", + "host write", + "host scan media", + "host inject poison", + "internal media scrub", + "internal media management", +}; + void cper_print_prot_err(const char *pfx, const struct cper_sec_prot_err *prot_err) { if (prot_err->valid_bits & PROT_ERR_VALID_AGENT_TYPE) @@ -187,3 +235,98 @@ void cper_print_prot_err(const char *pfx, const struct cper_sec_prot_err *prot_e sizeof(cxl_ras->header_log), 0); } } + +static void cper_print_comp_event(const char *pfx, const struct cper_sec_comp_event *event) +{ + pr_info("%s length of entire structure: 0x%08x\n", pfx, event->length); + + if (event->valid_bits & COMP_EVENT_VALID_DEVICE_ID) { + pr_info("%s device_id: %04x:%02x:%02x.%x\n", + pfx, event->device_id.segment, event->device_id.bus, + event->device_id.device, event->device_id.function); + pr_info("%s slot: %d\n", pfx, + event->device_id.slot >> CPER_PCIE_SLOT_SHIFT); + pr_info("%s vendor_id: 0x%04x, device_id: 0x%04x\n", pfx, + event->device_id.vendor_id, event->device_id.device_id); + } + + if (event->valid_bits & COMP_EVENT_VALID_SERIAL_NUMBER) { + pr_info("%s lower_dw: 0x%08x, upper_dw: 0x%08x\n", pfx, + event->dev_serial_num.lower_dw, + event->dev_serial_num.upper_dw); + } +} + +static void cper_print_event_record(const char *pfx, + const struct common_event_record *record) +{ + const __u8 *flags = record->flags; + u8 severity, event_flag; + + pr_info("%s event record length: 0x%02x\n", pfx, record->length); + + severity = flags[0] & EVENT_RECORD_SEVERITY_MASK; + pr_info("%s event record severity: %s\n", pfx, + severity < ARRAY_SIZE(cxl_evt_severity_strs) + ? cxl_evt_severity_strs[severity] : "unknown"); + + event_flag = flags[0] >> EVENT_RECORD_FLAGS_SHIFT; + pr_info("%s event record flags: 0x%02x\n", pfx, event_flag); + cper_print_bits(pfx, event_flag, cxl_evt_flags_strs, + ARRAY_SIZE(cxl_evt_flags_strs)); + + pr_info("%s event record handle: 0x%04x\n", pfx, record->handle); + pr_info("%s related event record handle: 0x%04x\n", pfx, + record->related_handle); + pr_info("%s event record timestamp: 0x%016llx\n", pfx, record->timestamp); + pr_info("%s maintenance operation class: 0x%02x\n", pfx, + record->maint_op_class); +} + +void cper_print_gen_media(const char *pfx, const struct cper_sec_comp_event *event) +{ + struct cper_sec_gen_media *gmer; + + cper_print_comp_event(pfx, event); + + if (!(event->valid_bits & COMP_EVENT_VALID_EVENT_LOG)) + return; + + gmer = (struct cper_sec_gen_media *)(event + 1); + + cper_print_event_record(pfx, &gmer->record); + + pr_info("%s device physical address: 0x%016llx\n", pfx, gmer->dpa); + pr_info("%s memory event descriptor: 0x%02x\n", pfx, gmer->descriptor); + cper_print_bits(pfx, gmer->descriptor, mem_evt_descriptor_strs, + ARRAY_SIZE(mem_evt_descriptor_strs)); + + pr_info("%s memory event type: %d, %s\n", pfx, gmer->type, + gmer->type < ARRAY_SIZE(gmer_mem_type_strs) + ? gmer_mem_type_strs[gmer->type] : "unknown"); + + pr_info("%s transaction type: %d, %s\n", pfx, gmer->transaction_type, + gmer->transaction_type < ARRAY_SIZE(transaction_type_strs) + ? transaction_type_strs[gmer->transaction_type] + : "unknown"); + + if (gmer->validity_flags & GMER_VALID_CHANNEL) + pr_info("%s channel: 0x%02x\n", pfx, gmer->channel); + + if (gmer->validity_flags & GMER_VALID_RANK) + pr_info("%s rank: 0x%02x\n", pfx, gmer->rank); + + if (gmer->validity_flags & GMER_VALID_DEVICE) { + const __u8 *device; + + device = gmer->device; + pr_info("%s device: %02x%02x%02x\n", pfx, device[2], device[1], + device[0]); + } + + if (gmer->validity_flags & GMER_VALID_COMP_ID) { + pr_info("%s component identifer :\n", pfx); + print_hex_dump(pfx, "", DUMP_PREFIX_OFFSET, 16, 4, gmer->comp_id, + sizeof(gmer->comp_id), 0); + } +} diff --git a/drivers/firmware/efi/cper_cxl.h b/drivers/firmware/efi/cper_cxl.h index 86bfcf7909ec..94528db208de 100644 --- a/drivers/firmware/efi/cper_cxl.h +++ b/drivers/firmware/efi/cper_cxl.h @@ -15,6 +15,11 @@ GUID_INIT(0x80B9EFB4, 0x52B5, 0x4DE3, 0xA7, 0x77, 0x68, 0x78, \ 0x4B, 0x77, 0x10, 0x48) +/* CXL General Media Section */ +#define CPER_SEC_CXL_GEN_MEDIA \ + GUID_INIT(0xFBCD0A77, 0xC260, 0x417F, 0x85, 0xA9, 0x08, 0x8B, \ + 0x16, 0x21, 0xEB, 0xA6) + #pragma pack(1) /* Compute Express Link Protocol Error Section, UEFI v2.10 sec N.2.13 */ @@ -59,8 +64,65 @@ struct cper_sec_prot_err { u8 reserved_2[4]; }; +/* Compute Express Link Component Events Section, UEFI v2.10 sec N.2.14 */ +struct cper_sec_comp_event { + u32 length; + u64 valid_bits; + + struct { + u16 vendor_id; + u16 device_id; + u8 function; + u8 device; + u8 bus; + u16 segment; + u16 slot; + u8 reserved_1; + } device_id; + + struct { + u32 lower_dw; + u32 upper_dw; + } dev_serial_num; + +}; + +/* + * Compute Express Link Common Event Record + * CXL rev 3.0 section 8.2.9.2.1; Table 8-42 + */ +struct common_event_record { + u8 identifier[16]; + u8 length; + u8 flags[3]; + u16 handle; + u16 related_handle; + u64 timestamp; + u8 maint_op_class; + u8 reserved[15]; +}; + +/* + * CXL General Media Event Record - GMER + * CXL rev 3.0 section 8.2.9.2.1.1; Table 8-43 + */ +struct cper_sec_gen_media { + struct common_event_record record; + u64 dpa; + u8 descriptor; + u8 type; + u8 transaction_type; + u16 validity_flags; + u8 channel; + u8 rank; + u8 device[3]; + u8 comp_id[16]; + u8 reserved[46]; +}; + #pragma pack() void cper_print_prot_err(const char *pfx, const struct cper_sec_prot_err *prot_err); +void cper_print_gen_media(const char *pfx, const struct cper_sec_comp_event *event); #endif //__CPER_CXL_ From patchwork Thu Oct 12 23:03:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Smita Koralahalli X-Patchwork-Id: 13419979 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 3662C3D008 for ; Thu, 12 Oct 2023 23:04:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="sX7mZkdP" Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2056.outbound.protection.outlook.com [40.107.102.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60151170A; Thu, 12 Oct 2023 16:03:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LJcC/iR9pCqClblhi7LbB/eAR80kMJtS97nIZMxVPQ8Uyes3pRWo+FDU7e7VK+PUFAI0fNk2xdcDFGA4EIfRCwq2C12NRojonMr+K0+EnFI0alXTOABVwFKLJy1EJJdI1IFVK2w9f41SvrlNGcMjRAhGjmxmQkXBzZ+/D1L27fVzEVPrpT4338bbyhuroQNCY8yK3USI4Rpz7uxMmcWY8KOjtUYLJUUHnUzzZT82yHneqYrNCBNZN26/ODKchg4SrlG687V1RNXgumStj3Nb0b1CjJ/0fZa7inMEVZT8CHuVLc2odmzbXvhATu3fFWbXzDyRSyiUA2HGyQ/aimZ+2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=T1ERuo4skm/jdK4N58q7YPYG4HzE31AGFrq1qdtQv0I=; b=Q/r4+kKZeonR9p657bSdoeE+c0Pg/Jq0ELOi97MefIwgFU98N5eGLgnoILj4ZFVByuK6FD5wPFTYfPOtnWUOnn3gCgaCD4EK8kN3dCI8abtD9Sxv7fjzN6M8o6pHLEcSu6Rm7EZxv9ooyj5cGHsDpInh7fKVNULpp1KcNF+t0lYGLoykvzUduLnn7FTqmiidk7Qd6gnViwCG/8u6Jdqm2kQr1kaUO5y9HUrfOm+FAtvrRz5zE+BqfAHBay+mSy2Swjb1WpH1PIeQ7PkBngyYqNBZnMgm8LHUJ+VeSxqyRhaqIyGfdsRh2vwWfuy42iFEod0w28EnJz4bxPXA063SoQ== 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 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=T1ERuo4skm/jdK4N58q7YPYG4HzE31AGFrq1qdtQv0I=; b=sX7mZkdPyBWctlul47QQRv7y3lnlnDqTnsSrM09b709dHmTj97F2NEAlyPOOv1KlZLHJdQ9XLNhDeyWCwoK7QA8KJK6g4n650nhDXHk14io4cF21/Fw0RtZorl3d32bw2TMMX51yPtRfSBNmxY4l8yf4qNeZ2JFxACcMxt2XMZk= Received: from DS7PR03CA0183.namprd03.prod.outlook.com (2603:10b6:5:3b6::8) by PH8PR12MB8608.namprd12.prod.outlook.com (2603:10b6:510:1bc::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.45; Thu, 12 Oct 2023 23:03:42 +0000 Received: from CY4PEPF0000EE3B.namprd03.prod.outlook.com (2603:10b6:5:3b6:cafe::40) by DS7PR03CA0183.outlook.office365.com (2603:10b6:5:3b6::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.30 via Frontend Transport; Thu, 12 Oct 2023 23:03:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000EE3B.mail.protection.outlook.com (10.167.242.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Thu, 12 Oct 2023 23:03:42 +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.27; Thu, 12 Oct 2023 18:03:15 -0500 From: Smita Koralahalli To: , , CC: Ard Biesheuvel , Alison Schofield , Vishal Verma , "Ira Weiny" , Dan Williams , Jonathan Cameron , Yazen Ghannam , Smita Koralahalli Subject: [PATCH 2/3] efi/cper, cxl: Decode CXL Component Events DRAM Event Record Date: Thu, 12 Oct 2023 23:03:00 +0000 Message-ID: <20231012230301.58500-3-Smita.KoralahalliChannabasappa@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231012230301.58500-1-Smita.KoralahalliChannabasappa@amd.com> References: <20231012230301.58500-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-Originating-IP: [10.180.168.240] 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: CY4PEPF0000EE3B:EE_|PH8PR12MB8608:EE_ X-MS-Office365-Filtering-Correlation-Id: 650cde7e-2f6f-4ea0-24f2-08dbcb777ac7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yuh2TLG3doPrF9j/WOI0G3tDEJzOj2Ua44E63dvDVqTB7x0bFYjUWCoSMqBR8V0pNYUUJU4LF/TLveS2E6C55DaCw9g/K1pUw2UXKM3+prWimLTARaNjz6CJmh5seqi8C8MFfXcZu3wqWTMBUwb/oSI+8zBHPVc8TLMZu7i/uX3sp2z0kCMaekve2Ud/0Bch/931KyYossZZPXVliKTzT40VjxGTSpUKT/s9UQfw/EzuUE2J+z4M8mw1F0z+E6dL4ixZ1F2mH6/RKfwsf5rWj/IgDDQG6XKY6Hj5EFjoPX4U4ggZ5Las0LgmfEVLn0B2BzvOOzPL/T92yTHPQZIzhToORQz/Q0XmFmXldcJBhKnfvPHHN95uyoMQzSRL/NBjjvbCwEyIG6+LKop/WLl4FQXNVQNTtOvnT6mge2ichTqWlCdYQWBGzm2NbtFlaOePd/G3wLAJ56EpmbxHTzqoQi/S+tVGBg0C3aDiaLELLPr5dEkhya/DQfVpIjdYbNNCOV4O1oZuAvNTZBdotxm/BKIWL0tDZHlzaUHpsXxl6WRUyx0v5csc++kJ0Y8NGI/ktOuAS+ZgSWbzfTN/PB6MYfqqmMw8TTuXUA3cH38ppvmMOLAq8UtjwLIMa1+YXWWMwBxZiPXTMqbosi8oD4axS2kIcnxa7cB0el0C2IJ1BkCWmHhRUQjDytbf9DuFllWgfoT4r15OzIS4smmLD421GZenbu3sLjS2nLGMpr0QfK3I+kTjJs/IIjPhoKbmrlpR4BgEqdgO+oX4JbNDoQS8Eg== 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:(13230031)(4636009)(376002)(346002)(396003)(136003)(39860400002)(230922051799003)(82310400011)(1800799009)(186009)(64100799003)(451199024)(40470700004)(36840700001)(46966006)(7696005)(2616005)(6666004)(41300700001)(2906002)(4326008)(426003)(336012)(26005)(478600001)(16526019)(5660300002)(1076003)(83380400001)(316002)(40460700003)(47076005)(36756003)(36860700001)(40480700001)(54906003)(70206006)(8676002)(110136005)(81166007)(356005)(82740400003)(86362001)(8936002)(70586007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2023 23:03:42.3381 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 650cde7e-2f6f-4ea0-24f2-08dbcb777ac7 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: CY4PEPF0000EE3B.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB8608 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Add support for decoding CXL Component Events DRAM Event Record as defined in CXL rev 3.0 section 8.2.9.2.1.2. Signed-off-by: Smita Koralahalli --- drivers/firmware/efi/cper.c | 8 ++++ drivers/firmware/efi/cper_cxl.c | 79 +++++++++++++++++++++++++++++++++ drivers/firmware/efi/cper_cxl.h | 28 ++++++++++++ 3 files changed, 115 insertions(+) diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c index b911b1f574db..1d182487fa13 100644 --- a/drivers/firmware/efi/cper.c +++ b/drivers/firmware/efi/cper.c @@ -615,6 +615,14 @@ cper_estatus_print_section(const char *pfx, struct acpi_hest_generic_data *gdata cper_print_gen_media(newpfx, gmer); else goto err_section_too_small; + } else if (guid_equal(sec_type, &CPER_SEC_CXL_DRAM)) { + struct cper_sec_comp_event *dram = acpi_hest_get_payload(gdata); + + printk("%ssection_type: CXL DRAM Event\n", newpfx); + if (gdata->error_data_length >= sizeof(*dram)) + cper_print_dram(newpfx, dram); + else + goto err_section_too_small; } else { const void *err = acpi_hest_get_payload(gdata); diff --git a/drivers/firmware/efi/cper_cxl.c b/drivers/firmware/efi/cper_cxl.c index 8f7b88cc574b..3fba360b7dc6 100644 --- a/drivers/firmware/efi/cper_cxl.c +++ b/drivers/firmware/efi/cper_cxl.c @@ -30,6 +30,15 @@ #define GMER_VALID_DEVICE BIT_ULL(2) #define GMER_VALID_COMP_ID BIT_ULL(3) +#define DRAM_VALID_CHANNEL BIT_ULL(0) +#define DRAM_VALID_RANK BIT_ULL(1) +#define DRAM_VALID_NIBBLE_MASK BIT_ULL(2) +#define DRAM_VALID_BANK_GROUP BIT_ULL(3) +#define DRAM_VALID_BANK BIT_ULL(4) +#define DRAM_VALID_ROW BIT_ULL(5) +#define DRAM_VALID_COLUMN BIT_ULL(6) +#define DRAM_VALID_CORRECTION_MASK BIT_ULL(7) + /* CXL RAS Capability Structure, CXL v3.0 sec 8.2.4.16 */ struct cxl_ras_capability_regs { u32 uncor_status; @@ -103,6 +112,13 @@ static const char * const transaction_type_strs[] = { "internal media management", }; +static const char * const dram_mem_type_strs[] = { + "media ECC error", + "scrub media ECC error", + "invalid address", + "data path error", +}; + void cper_print_prot_err(const char *pfx, const struct cper_sec_prot_err *prot_err) { if (prot_err->valid_bits & PROT_ERR_VALID_AGENT_TYPE) @@ -330,3 +346,66 @@ void cper_print_gen_media(const char *pfx, const struct cper_sec_comp_event *eve sizeof(gmer->comp_id), 0); } } + +void cper_print_dram(const char *pfx, const struct cper_sec_comp_event *event) +{ + struct cper_sec_dram *dram; + + cper_print_comp_event(pfx, event); + + if (!(event->valid_bits & COMP_EVENT_VALID_EVENT_LOG)) + return; + + dram = (struct cper_sec_dram *)(event + 1); + + cper_print_event_record(pfx, &dram->record); + + pr_info("%s device physical address: 0x%016llx\n", pfx, dram->dpa); + pr_info("%s memory event descriptor: 0x%02x\n", pfx, dram->descriptor); + cper_print_bits(pfx, dram->descriptor, mem_evt_descriptor_strs, + ARRAY_SIZE(mem_evt_descriptor_strs)); + + pr_info("%s memory event type: %d, %s\n", pfx, dram->type, + dram->type < ARRAY_SIZE(dram_mem_type_strs) + ? dram_mem_type_strs[dram->type] : "unknown"); + + pr_info("%s transaction type: %d, %s\n", pfx, dram->transaction_type, + dram->transaction_type < ARRAY_SIZE(transaction_type_strs) + ? transaction_type_strs[dram->transaction_type] : "unknown"); + + if (dram->validity_flags & DRAM_VALID_CHANNEL) + pr_info("%s channel: 0x%02x\n", pfx, dram->channel); + + if (dram->validity_flags & DRAM_VALID_RANK) + pr_info("%s rank: 0x%02x\n", pfx, dram->rank); + + if (dram->validity_flags & DRAM_VALID_NIBBLE_MASK) { + const __u8 *nibble; + + nibble = dram->nibble_mask; + pr_info("%s nibble mask: %02x%02x%02x\n", pfx, nibble[2], + nibble[1], nibble[0]); + } + + if (dram->validity_flags & DRAM_VALID_BANK_GROUP) + pr_info("%s bank group: 0x%02x\n", pfx, dram->bank_group); + + if (dram->validity_flags & DRAM_VALID_BANK) + pr_info("%s bank: 0x%02x\n", pfx, dram->bank); + + if (dram->validity_flags & DRAM_VALID_ROW) { + const __u8 *row; + + row = dram->row; + pr_info("%s row: %02x%02x%02x\n", pfx, row[2], row[1], row[0]); + } + + if (dram->validity_flags & DRAM_VALID_COLUMN) + pr_info("%s column: 0x%04x\n", pfx, dram->column); + + if (dram->validity_flags & DRAM_VALID_CORRECTION_MASK) { + pr_info("%s correction mask :\n", pfx); + print_hex_dump(pfx, "", DUMP_PREFIX_OFFSET, 16, 4, + dram->cor_mask, sizeof(dram->cor_mask), 0); + } +} diff --git a/drivers/firmware/efi/cper_cxl.h b/drivers/firmware/efi/cper_cxl.h index 94528db208de..967847b571cb 100644 --- a/drivers/firmware/efi/cper_cxl.h +++ b/drivers/firmware/efi/cper_cxl.h @@ -20,6 +20,11 @@ GUID_INIT(0xFBCD0A77, 0xC260, 0x417F, 0x85, 0xA9, 0x08, 0x8B, \ 0x16, 0x21, 0xEB, 0xA6) +/* CXL DRAM Section */ +#define CPER_SEC_CXL_DRAM \ + GUID_INIT(0x601DCBB3, 0x9C06, 0x4EAB, 0xB8, 0xAF, 0x4E, 0x9B, \ + 0xFB, 0x5C, 0x96, 0x24) + #pragma pack(1) /* Compute Express Link Protocol Error Section, UEFI v2.10 sec N.2.13 */ @@ -120,9 +125,32 @@ struct cper_sec_gen_media { u8 reserved[46]; }; +/* + * CXL DRAM Event Record + * CXL rev 3.0 sec 8.2.9.2.1.2; Table 8-44 + */ +struct cper_sec_dram { + struct common_event_record record; + u64 dpa; + u8 descriptor; + u8 type; + u8 transaction_type; + u16 validity_flags; + u8 channel; + u8 rank; + u8 nibble_mask[3]; + u8 bank_group; + u8 bank; + u8 row[3]; + u16 column; + u8 cor_mask[32]; + u8 reserved[23]; +}; + #pragma pack() void cper_print_prot_err(const char *pfx, const struct cper_sec_prot_err *prot_err); void cper_print_gen_media(const char *pfx, const struct cper_sec_comp_event *event); +void cper_print_dram(const char *pfx, const struct cper_sec_comp_event *event); #endif //__CPER_CXL_ From patchwork Thu Oct 12 23:03:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Smita Koralahalli X-Patchwork-Id: 13419980 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 9D1443D008 for ; Thu, 12 Oct 2023 23:04:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="LQ0Jp9g2" Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2058.outbound.protection.outlook.com [40.107.100.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EF90171B; Thu, 12 Oct 2023 16:03:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NTgerzICCs93yO1IYEkVm9CQfyE+zrEVq/jK811n1M4Q4BuZDoHoyhINN3xpjjzTSnjxSi1bzzyBWmTcz+HxOaC6GuUVFdjlSdzIn9pGN/XpO8EYOlf2Bhq7obqzjVfqaL5BWkN5Y33oqX5coVlIdhZTptP5wiRRAYCGAI88dFmQjuHyDgYlb6SfRrmQOUVeshnv9poucgO0HkdH/OZFepD0KodRZqLA61gCBK+AXMq/60sP8WVPhsyTFxO7oNQ9P/J6ECnjUj2Jhr8qwCmtJ4A4KodSwODHtxqg8jO4ez8DsvAfwcRnPXJOx5ob1bhl50KhUNW4Al5l2t4kqfyZLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=/GHDMaRekfkY5tn+h3X1v2GJ834yQWjhhkO9TDmiY9Q=; b=ft4vnNBKF/Zo6ZBPLyfel0Tq+CtNW7slFgWV64VRmegYq8m14OK/R4HM38wcnzgx3cmGyIZho0Ap82GH9TRp2bSi6klTqRxbj0G6pA+s3I16pQJZ8LedAWrhMkl+SKrMAxgPwszgj22uPoNkF2HuoG+1oH2/wu/7UawjWr6LaPN0Tz6WbOhMcxEsAK4zWkG2oCK7asERVK01adhWbdP9h9MwnoKo65xxzujeOCsVKGlJluxd+Jsf4NH+jLkaS9KjXCPuuWB62Q+lTV/EcR2LTvHGJiQd2yrfyllL/ejq7gBpPIm/bAJx2R6l+pi13/fZkELkrCg+sd6PrVycaylrfg== 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 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=/GHDMaRekfkY5tn+h3X1v2GJ834yQWjhhkO9TDmiY9Q=; b=LQ0Jp9g2MMJmcY0mywq93JHwA/u/i9ExCgluqFYW0gTEMwzkhPhnUsLlog1jH0yw08PAviIT656pRqvzGHMdsOMtxVWscwsZDhre4if3S3foxtitHwk0XAQ+YMVR0zydt3FUvluNYB9L1Cq+KQYv1d16XK6M5Ko2AZdhs94PSg0= Received: from DS7PR03CA0200.namprd03.prod.outlook.com (2603:10b6:5:3b6::25) by DM4PR12MB5376.namprd12.prod.outlook.com (2603:10b6:5:39f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.45; Thu, 12 Oct 2023 23:03:43 +0000 Received: from CY4PEPF0000EE3B.namprd03.prod.outlook.com (2603:10b6:5:3b6:cafe::90) by DS7PR03CA0200.outlook.office365.com (2603:10b6:5:3b6::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.29 via Frontend Transport; Thu, 12 Oct 2023 23:03: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 CY4PEPF0000EE3B.mail.protection.outlook.com (10.167.242.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Thu, 12 Oct 2023 23:03: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.27; Thu, 12 Oct 2023 18:03:41 -0500 From: Smita Koralahalli To: , , CC: Ard Biesheuvel , Alison Schofield , Vishal Verma , "Ira Weiny" , Dan Williams , Jonathan Cameron , Yazen Ghannam , Smita Koralahalli Subject: [PATCH 3/3] efi/cper, cxl: Decode CXL Component Events Memory Module Event Record Date: Thu, 12 Oct 2023 23:03:01 +0000 Message-ID: <20231012230301.58500-4-Smita.KoralahalliChannabasappa@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231012230301.58500-1-Smita.KoralahalliChannabasappa@amd.com> References: <20231012230301.58500-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-Originating-IP: [10.180.168.240] 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: CY4PEPF0000EE3B:EE_|DM4PR12MB5376:EE_ X-MS-Office365-Filtering-Correlation-Id: c98d8329-53d3-4e54-d13b-08dbcb777b34 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MyodAyKVBbZWthb1sU0DSN2957D+9jS4Y+A3Vqv9TitK5po/Zv7SwANRv7doen+Z6KsS8W5ab2CiZNvop6jGF3CjASRktl5vCjLL2IJ52hZ899QIEB9nmUKz+AZhBmfGj6H2IlnlvEOhcxvAUTQtZ37Pw0HLFBGG/5VwRDpIV6yd1/PoL4ftFTAamBM58OV9eC4agIaB1P62Di5nXlhTzkrm7v6vHWZkyjfLfrxUc6gPJRC6ymSQXZDKmSz3uUo01J5nWpLph5EPPZ4cGpSc/D73IrbLawV/0p/LnJ9mARvtcVr5zAlkd93LoAddOP3FhP7kbyWe/DCUjqZW1QIEyiQLheMIWM3DV0yQzGSXi4z/3meiL3ADQ8IX8y4TTNRznOttm7XGmFe8+LG6uucBLfjTixkWA0gX1Ynq1xUx+wWn0oOaX8mJkx6tWu3GMxt2vHWvaVaXo6CQtrMUiHLm2tjg18y5PP41Tl9dRyC1U6Ra4nwSrYKH8JdKruoMSTcEpfNkA7xuZ+wB/kBXsRqj8MCGcE5ZACpBGhh98mbKde4sDDBLYGDYrsUjoyBIvV//03Xe7g2pJ6eetdHP8algBFjgVxkntRvtGSngIOMFpXUeNGeLmSRCPfNHpJnTRLBwKW6efloyrOTFCHDldLrwVL/IjjP94ZF+jA0JB7uXkPBLOu6+oDyI52v3D9uxiLIVAGSPfEY8/1rxRGoY66ISLPG0d5gyww+lZWCvzsv4zps6dBTaiu0uAqj35bedwiBhbBrZknVSXEeSbygP1rSsoA== 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:(13230031)(4636009)(136003)(39860400002)(376002)(396003)(346002)(230922051799003)(1800799009)(186009)(82310400011)(451199024)(64100799003)(40470700004)(36840700001)(46966006)(6666004)(2906002)(40460700003)(478600001)(41300700001)(4326008)(8676002)(8936002)(5660300002)(40480700001)(70586007)(54906003)(70206006)(110136005)(316002)(7696005)(36756003)(83380400001)(47076005)(16526019)(26005)(82740400003)(336012)(426003)(36860700001)(81166007)(2616005)(86362001)(1076003)(356005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2023 23:03:43.0569 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c98d8329-53d3-4e54-d13b-08dbcb777b34 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: CY4PEPF0000EE3B.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5376 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Add support for decoding CXL Component Events Memory Module Event Record as defined in CXL rev 3.0 section 8.2.9.2.1.3. Signed-off-by: Smita Koralahalli --- drivers/firmware/efi/cper.c | 8 +++ drivers/firmware/efi/cper_cxl.c | 110 ++++++++++++++++++++++++++++++++ drivers/firmware/efi/cper_cxl.h | 32 ++++++++++ 3 files changed, 150 insertions(+) diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c index 1d182487fa13..5b45bf513512 100644 --- a/drivers/firmware/efi/cper.c +++ b/drivers/firmware/efi/cper.c @@ -623,6 +623,14 @@ cper_estatus_print_section(const char *pfx, struct acpi_hest_generic_data *gdata cper_print_dram(newpfx, dram); else goto err_section_too_small; + } else if (guid_equal(sec_type, &CPER_SEC_CXL_MM_MODULE)) { + struct cper_sec_comp_event *mm_module = acpi_hest_get_payload(gdata); + + printk("%ssection_type: CXL Memory Module Event\n", newpfx); + if (gdata->error_data_length >= sizeof(*mm_module)) + cper_print_mm_module(newpfx, mm_module); + else + goto err_section_too_small; } else { const void *err = acpi_hest_get_payload(gdata); diff --git a/drivers/firmware/efi/cper_cxl.c b/drivers/firmware/efi/cper_cxl.c index 3fba360b7dc6..5be10ca20c7c 100644 --- a/drivers/firmware/efi/cper_cxl.c +++ b/drivers/firmware/efi/cper_cxl.c @@ -39,6 +39,11 @@ #define DRAM_VALID_COLUMN BIT_ULL(6) #define DRAM_VALID_CORRECTION_MASK BIT_ULL(7) +#define DHI_AS_LIFE_USED(as) (as & GENMASK(1, 0)) +#define DHI_AS_DEV_TEMP(as) (((as) & GENMASK(3, 2)) >> 2) +#define DHI_AS_COR_VOL_ERR_CNT(as) (((as) & GENMASK(4, 4)) >> 4) +#define DHI_AS_COR_PER_ERR_CNT(as) (((as) & GENMASK(5, 5)) >> 5) + /* CXL RAS Capability Structure, CXL v3.0 sec 8.2.4.16 */ struct cxl_ras_capability_regs { u32 uncor_status; @@ -119,6 +124,45 @@ static const char * const dram_mem_type_strs[] = { "data path error", }; +static const char * const mm_module_event_type_strs[] = { + "health status change", + "media status change", + "life used change", + "temperature change", + "data path error", + "lsa error", +}; + +static const char * const dhi_health_status_strs[] = { + "maintenance needed", + "performance degraded", + "hardware replacement needed", +}; + +static const char * const dhi_media_status_strs[] = { + "normal", + "not ready", + "write persistency lost", + "all data lost", + "write persistency loss in the event of power loss", + "write persistency loss in event of shutdown", + "write persistency loss imminent", + "all data loss in the event of power loss", + "all data loss in the event of shutdown", + "all data loss imminent", +}; + +static const char * const dhi_two_bit_status_strs[] = { + "normal", + "warning", + "critical", +}; + +static const char * const dhi_one_bit_status_strs[] = { + "normal", + "warning", +}; + void cper_print_prot_err(const char *pfx, const struct cper_sec_prot_err *prot_err) { if (prot_err->valid_bits & PROT_ERR_VALID_AGENT_TYPE) @@ -409,3 +453,69 @@ void cper_print_dram(const char *pfx, const struct cper_sec_comp_event *event) dram->cor_mask, sizeof(dram->cor_mask), 0); } } + +static void cper_print_mm_module_dhi(const char *pfx, const struct dev_health_info *dhi) +{ + pr_info("%s health status: 0x%02x\n", pfx, dhi->health_status); + cper_print_bits(pfx, dhi->health_status, dhi_health_status_strs, + ARRAY_SIZE(dhi_health_status_strs)); + + pr_info("%s media status: %d, %s\n", pfx, dhi->media_status, + dhi->media_status < ARRAY_SIZE(dhi_media_status_strs) + ? dhi_media_status_strs[dhi->media_status] : "unknown"); + + pr_info("%s current life used: %ld, %s\n", pfx, + DHI_AS_LIFE_USED(dhi->add_status), + DHI_AS_LIFE_USED(dhi->add_status) < ARRAY_SIZE(dhi_two_bit_status_strs) + ? dhi_two_bit_status_strs[DHI_AS_LIFE_USED(dhi->add_status)] + : "unknown"); + + pr_info("%s current device temperature: %ld, %s\n", pfx, + DHI_AS_DEV_TEMP(dhi->add_status), + DHI_AS_DEV_TEMP(dhi->add_status) < ARRAY_SIZE(dhi_two_bit_status_strs) + ? dhi_two_bit_status_strs[DHI_AS_DEV_TEMP(dhi->add_status)] + : "unknown"); + + pr_info("%s current corrected volatile err count: %ld, %s\n", pfx, + DHI_AS_COR_VOL_ERR_CNT(dhi->add_status), + DHI_AS_COR_VOL_ERR_CNT(dhi->add_status) < ARRAY_SIZE(dhi_one_bit_status_strs) + ? dhi_one_bit_status_strs[DHI_AS_COR_VOL_ERR_CNT(dhi->add_status)] + : "unknown"); + + pr_info("%s current corrected persistent err count: %ld, %s\n", pfx, + DHI_AS_COR_PER_ERR_CNT(dhi->add_status), + DHI_AS_COR_PER_ERR_CNT(dhi->add_status) < ARRAY_SIZE(dhi_one_bit_status_strs) + ? dhi_one_bit_status_strs[DHI_AS_COR_PER_ERR_CNT(dhi->add_status)] + : "unknown"); + + pr_info("%s life used percent: 0x%02x\n", pfx, dhi->life_used); + pr_info("%s device temperature degree celsius: 0x%04x\n", pfx, + dhi->device_temp); + pr_info("%s dirty shutdown count: 0x%08x\n", pfx, + dhi->dirty_shutdown_cnt); + pr_info("%s total corrected volatile error count: 0x%08x\n", pfx, + dhi->cor_vol_err_cnt); + pr_info("%s total corrected persistent error count: 0x%08x\n", pfx, + dhi->cor_per_err_cnt); +} + +void cper_print_mm_module(const char *pfx, const struct cper_sec_comp_event *event) +{ + struct cper_sec_mm_module *mm_module; + + cper_print_comp_event(pfx, event); + + if (!(event->valid_bits & COMP_EVENT_VALID_EVENT_LOG)) + return; + + mm_module = (struct cper_sec_mm_module *)(event + 1); + + cper_print_event_record(pfx, &mm_module->record); + + pr_info("%s device event type: %d, %s\n", pfx, mm_module->event_type, + mm_module->event_type < ARRAY_SIZE(mm_module_event_type_strs) + ? mm_module_event_type_strs[mm_module->event_type] + : "unknown"); + + cper_print_mm_module_dhi(pfx, &mm_module->dhi); +} diff --git a/drivers/firmware/efi/cper_cxl.h b/drivers/firmware/efi/cper_cxl.h index 967847b571cb..c37dd624a522 100644 --- a/drivers/firmware/efi/cper_cxl.h +++ b/drivers/firmware/efi/cper_cxl.h @@ -25,6 +25,11 @@ GUID_INIT(0x601DCBB3, 0x9C06, 0x4EAB, 0xB8, 0xAF, 0x4E, 0x9B, \ 0xFB, 0x5C, 0x96, 0x24) +/* CXL Memory Module Event Section */ +#define CPER_SEC_CXL_MM_MODULE \ + GUID_INIT(0xFE927475, 0xDD59, 0x4339, 0xA5, 0x86, 0x79, 0xBA, \ + 0xB1, 0x13, 0xB7, 0x74) + #pragma pack(1) /* Compute Express Link Protocol Error Section, UEFI v2.10 sec N.2.13 */ @@ -147,10 +152,37 @@ struct cper_sec_dram { u8 reserved[23]; }; +/* + * CXL Memory Module Event + * Device Health Information - DHI + * CXL rev 3.0 sec 8.2.9.8.3.1; Table 8-100 + */ +struct dev_health_info { + u8 health_status; + u8 media_status; + u8 add_status; + u8 life_used; + u16 device_temp; + u32 dirty_shutdown_cnt; + u32 cor_vol_err_cnt; + u32 cor_per_err_cnt; +}; + +/* CXL Memory Module Event Record + * CXL rev 3.0 sec 8.2.9.2.1.3; Table 8-45 + */ +struct cper_sec_mm_module { + struct common_event_record record; + u8 event_type; + struct dev_health_info dhi; + u8 reserved[61]; +}; + #pragma pack() void cper_print_prot_err(const char *pfx, const struct cper_sec_prot_err *prot_err); void cper_print_gen_media(const char *pfx, const struct cper_sec_comp_event *event); void cper_print_dram(const char *pfx, const struct cper_sec_comp_event *event); +void cper_print_mm_module(const char *pfx, const struct cper_sec_comp_event *event); #endif //__CPER_CXL_