Path: blob/master/drivers/gpu/drm/amd/include/amd_cper.h
26517 views
/* SPDX-License-Identifier: GPL-2.0 */1/*2* Copyright 2025 Advanced Micro Devices, Inc.3*4* Permission is hereby granted, free of charge, to any person obtaining a5* copy of this software and associated documentation files (the "Software"),6* to deal in the Software without restriction, including without limitation7* the rights to use, copy, modify, merge, publish, distribute, sublicense,8* and/or sell copies of the Software, and to permit persons to whom the9* Software is furnished to do so, subject to the following conditions:10*11* The above copyright notice and this permission notice shall be included in12* all copies or substantial portions of the Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR18* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,19* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR20* OTHER DEALINGS IN THE SOFTWARE.21*22*/23#ifndef __AMD_CPER_H__24#define __AMD_CPER_H__2526#include <linux/uuid.h>2728#define CPER_HDR_REV_1 (0x100)29#define CPER_SEC_MINOR_REV_1 (0x01)30#define CPER_SEC_MAJOR_REV_22 (0x22)31#define CPER_MAX_OAM_COUNT (8)3233#define CPER_CTX_TYPE_CRASH (1)34#define CPER_CTX_TYPE_BOOT (9)3536#define CPER_CREATOR_ID_AMDGPU "amdgpu"3738#define CPER_NOTIFY_MCE \39GUID_INIT(0xE8F56FFE, 0x919C, 0x4cc5, 0xBA, 0x88, 0x65, 0xAB, \400xE1, 0x49, 0x13, 0xBB)41#define CPER_NOTIFY_CMC \42GUID_INIT(0x2DCE8BB1, 0xBDD7, 0x450e, 0xB9, 0xAD, 0x9C, 0xF4, \430xEB, 0xD4, 0xF8, 0x90)44#define BOOT_TYPE \45GUID_INIT(0x3D61A466, 0xAB40, 0x409a, 0xA6, 0x98, 0xF3, 0x62, \460xD4, 0x64, 0xB3, 0x8F)4748#define AMD_CRASHDUMP \49GUID_INIT(0x32AC0C78, 0x2623, 0x48F6, 0xB0, 0xD0, 0x73, 0x65, \500x72, 0x5F, 0xD6, 0xAE)51#define AMD_GPU_NONSTANDARD_ERROR \52GUID_INIT(0x32AC0C78, 0x2623, 0x48F6, 0x81, 0xA2, 0xAC, 0x69, \530x17, 0x80, 0x55, 0x1D)54#define PROC_ERR_SECTION_TYPE \55GUID_INIT(0xDC3EA0B0, 0xA144, 0x4797, 0xB9, 0x5B, 0x53, 0xFA, \560x24, 0x2B, 0x6E, 0x1D)5758enum cper_error_severity {59CPER_SEV_NON_FATAL_UNCORRECTED = 0,60CPER_SEV_FATAL = 1,61CPER_SEV_NON_FATAL_CORRECTED = 2,62CPER_SEV_NUM = 3,6364CPER_SEV_UNUSED = 10,65};6667enum cper_aca_reg {68CPER_ACA_REG_CTL_LO = 0,69CPER_ACA_REG_CTL_HI = 1,70CPER_ACA_REG_STATUS_LO = 2,71CPER_ACA_REG_STATUS_HI = 3,72CPER_ACA_REG_ADDR_LO = 4,73CPER_ACA_REG_ADDR_HI = 5,74CPER_ACA_REG_MISC0_LO = 6,75CPER_ACA_REG_MISC0_HI = 7,76CPER_ACA_REG_CONFIG_LO = 8,77CPER_ACA_REG_CONFIG_HI = 9,78CPER_ACA_REG_IPID_LO = 10,79CPER_ACA_REG_IPID_HI = 11,80CPER_ACA_REG_SYND_LO = 12,81CPER_ACA_REG_SYND_HI = 13,8283CPER_ACA_REG_COUNT = 32,84};8586#pragma pack(push, 1)8788struct cper_timestamp {89uint8_t seconds;90uint8_t minutes;91uint8_t hours;92uint8_t flag;93uint8_t day;94uint8_t month;95uint8_t year;96uint8_t century;97};9899struct cper_hdr {100char signature[4]; /* "CPER" */101uint16_t revision;102uint32_t signature_end; /* 0xFFFFFFFF */103uint16_t sec_cnt;104enum cper_error_severity error_severity;105union {106struct {107uint32_t platform_id : 1;108uint32_t timestamp : 1;109uint32_t partition_id : 1;110uint32_t reserved : 29;111} valid_bits;112uint32_t valid_mask;113};114uint32_t record_length; /* Total size of CPER Entry */115struct cper_timestamp timestamp;116char platform_id[16];117guid_t partition_id; /* Reserved */118char creator_id[16];119guid_t notify_type; /* CMC, MCE */120char record_id[8]; /* Unique CPER Entry ID */121uint32_t flags; /* Reserved */122uint64_t persistence_info; /* Reserved */123uint8_t reserved[12]; /* Reserved */124};125126struct cper_sec_desc {127uint32_t sec_offset; /* Offset from the start of CPER entry */128uint32_t sec_length;129uint8_t revision_minor; /* CPER_SEC_MINOR_REV_1 */130uint8_t revision_major; /* CPER_SEC_MAJOR_REV_22 */131union {132struct {133uint8_t fru_id : 1;134uint8_t fru_text : 1;135uint8_t reserved : 6;136} valid_bits;137uint8_t valid_mask;138};139uint8_t reserved;140union {141struct {142uint32_t primary : 1;143uint32_t reserved1 : 2;144uint32_t exceed_err_threshold : 1;145uint32_t latent_err : 1;146uint32_t reserved2 : 27;147} flag_bits;148uint32_t flag_mask;149};150guid_t sec_type;151char fru_id[16];152enum cper_error_severity severity;153char fru_text[20];154};155156struct cper_sec_nonstd_err_hdr {157union {158struct {159uint64_t apic_id : 1;160uint64_t fw_id : 1;161uint64_t err_info_cnt : 6;162uint64_t err_context_cnt : 6;163} valid_bits;164uint64_t valid_mask;165};166uint64_t apic_id;167char fw_id[48];168};169170struct cper_sec_nonstd_err_info {171guid_t error_type;172union {173struct {174uint64_t ms_chk : 1;175uint64_t target_addr_id : 1;176uint64_t req_id : 1;177uint64_t resp_id : 1;178uint64_t instr_ptr : 1;179uint64_t reserved : 59;180} valid_bits;181uint64_t valid_mask;182};183union {184struct {185uint64_t err_type_valid : 1;186uint64_t pcc_valid : 1;187uint64_t uncorr_valid : 1;188uint64_t precise_ip_valid : 1;189uint64_t restartable_ip_valid : 1;190uint64_t overflow_valid : 1;191uint64_t reserved1 : 10;192uint64_t err_type : 2;193uint64_t pcc : 1;194uint64_t uncorr : 1;195uint64_t precised_ip : 1;196uint64_t restartable_ip : 1;197uint64_t overflow : 1;198uint64_t reserved2 : 41;199} ms_chk_bits;200uint64_t ms_chk_mask;201};202uint64_t target_addr_id;203uint64_t req_id;204uint64_t resp_id;205uint64_t instr_ptr;206};207208struct cper_sec_nonstd_err_ctx {209uint16_t reg_ctx_type;210uint16_t reg_arr_size;211uint32_t msr_addr;212uint64_t mm_reg_addr;213uint32_t reg_dump[CPER_ACA_REG_COUNT];214};215216struct cper_sec_nonstd_err {217struct cper_sec_nonstd_err_hdr hdr;218struct cper_sec_nonstd_err_info info;219struct cper_sec_nonstd_err_ctx ctx;220};221222struct cper_sec_crashdump_hdr {223uint64_t reserved1;224uint64_t reserved2;225char fw_id[48];226uint64_t reserved3[8];227};228229struct cper_sec_crashdump_reg_data {230uint32_t status_lo;231uint32_t status_hi;232uint32_t addr_lo;233uint32_t addr_hi;234uint32_t ipid_lo;235uint32_t ipid_hi;236uint32_t synd_lo;237uint32_t synd_hi;238};239240struct cper_sec_crashdump_body_fatal {241uint16_t reg_ctx_type;242uint16_t reg_arr_size;243uint32_t reserved1;244uint64_t reserved2;245struct cper_sec_crashdump_reg_data data;246};247248struct cper_sec_crashdump_body_boot {249uint16_t reg_ctx_type;250uint16_t reg_arr_size;251uint32_t reserved1;252uint64_t reserved2;253uint64_t msg[CPER_MAX_OAM_COUNT];254};255256struct cper_sec_crashdump_fatal {257struct cper_sec_crashdump_hdr hdr;258struct cper_sec_crashdump_body_fatal body;259};260261struct cper_sec_crashdump_boot {262struct cper_sec_crashdump_hdr hdr;263struct cper_sec_crashdump_body_boot body;264};265266#pragma pack(pop)267268#endif269270271