root/arch/powerpc/include/asm/mce.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* SPDX-License-Identifier: GPL-2.0-or-later */
   2 /*
   3  * Machine check exception header file.
   4  *
   5  * Copyright 2013 IBM Corporation
   6  * Author: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
   7  */
   8 
   9 #ifndef __ASM_PPC64_MCE_H__
  10 #define __ASM_PPC64_MCE_H__
  11 
  12 #include <linux/bitops.h>
  13 
  14 enum MCE_Version {
  15         MCE_V1 = 1,
  16 };
  17 
  18 enum MCE_Severity {
  19         MCE_SEV_NO_ERROR = 0,
  20         MCE_SEV_WARNING = 1,
  21         MCE_SEV_SEVERE = 2,
  22         MCE_SEV_FATAL = 3,
  23 };
  24 
  25 enum MCE_Disposition {
  26         MCE_DISPOSITION_RECOVERED = 0,
  27         MCE_DISPOSITION_NOT_RECOVERED = 1,
  28 };
  29 
  30 enum MCE_Initiator {
  31         MCE_INITIATOR_UNKNOWN = 0,
  32         MCE_INITIATOR_CPU = 1,
  33         MCE_INITIATOR_PCI = 2,
  34         MCE_INITIATOR_ISA = 3,
  35         MCE_INITIATOR_MEMORY= 4,
  36         MCE_INITIATOR_POWERMGM = 5,
  37 };
  38 
  39 enum MCE_ErrorType {
  40         MCE_ERROR_TYPE_UNKNOWN = 0,
  41         MCE_ERROR_TYPE_UE = 1,
  42         MCE_ERROR_TYPE_SLB = 2,
  43         MCE_ERROR_TYPE_ERAT = 3,
  44         MCE_ERROR_TYPE_TLB = 4,
  45         MCE_ERROR_TYPE_USER = 5,
  46         MCE_ERROR_TYPE_RA = 6,
  47         MCE_ERROR_TYPE_LINK = 7,
  48         MCE_ERROR_TYPE_DCACHE = 8,
  49         MCE_ERROR_TYPE_ICACHE = 9,
  50 };
  51 
  52 enum MCE_ErrorClass {
  53         MCE_ECLASS_UNKNOWN = 0,
  54         MCE_ECLASS_HARDWARE,
  55         MCE_ECLASS_HARD_INDETERMINATE,
  56         MCE_ECLASS_SOFTWARE,
  57         MCE_ECLASS_SOFT_INDETERMINATE,
  58 };
  59 
  60 enum MCE_UeErrorType {
  61         MCE_UE_ERROR_INDETERMINATE = 0,
  62         MCE_UE_ERROR_IFETCH = 1,
  63         MCE_UE_ERROR_PAGE_TABLE_WALK_IFETCH = 2,
  64         MCE_UE_ERROR_LOAD_STORE = 3,
  65         MCE_UE_ERROR_PAGE_TABLE_WALK_LOAD_STORE = 4,
  66 };
  67 
  68 enum MCE_SlbErrorType {
  69         MCE_SLB_ERROR_INDETERMINATE = 0,
  70         MCE_SLB_ERROR_PARITY = 1,
  71         MCE_SLB_ERROR_MULTIHIT = 2,
  72 };
  73 
  74 enum MCE_EratErrorType {
  75         MCE_ERAT_ERROR_INDETERMINATE = 0,
  76         MCE_ERAT_ERROR_PARITY = 1,
  77         MCE_ERAT_ERROR_MULTIHIT = 2,
  78 };
  79 
  80 enum MCE_TlbErrorType {
  81         MCE_TLB_ERROR_INDETERMINATE = 0,
  82         MCE_TLB_ERROR_PARITY = 1,
  83         MCE_TLB_ERROR_MULTIHIT = 2,
  84 };
  85 
  86 enum MCE_UserErrorType {
  87         MCE_USER_ERROR_INDETERMINATE = 0,
  88         MCE_USER_ERROR_TLBIE = 1,
  89 };
  90 
  91 enum MCE_RaErrorType {
  92         MCE_RA_ERROR_INDETERMINATE = 0,
  93         MCE_RA_ERROR_IFETCH = 1,
  94         MCE_RA_ERROR_IFETCH_FOREIGN = 2,
  95         MCE_RA_ERROR_PAGE_TABLE_WALK_IFETCH = 3,
  96         MCE_RA_ERROR_PAGE_TABLE_WALK_IFETCH_FOREIGN = 4,
  97         MCE_RA_ERROR_LOAD = 5,
  98         MCE_RA_ERROR_STORE = 6,
  99         MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE = 7,
 100         MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE_FOREIGN = 8,
 101         MCE_RA_ERROR_LOAD_STORE_FOREIGN = 9,
 102 };
 103 
 104 enum MCE_LinkErrorType {
 105         MCE_LINK_ERROR_INDETERMINATE = 0,
 106         MCE_LINK_ERROR_IFETCH_TIMEOUT = 1,
 107         MCE_LINK_ERROR_PAGE_TABLE_WALK_IFETCH_TIMEOUT = 2,
 108         MCE_LINK_ERROR_LOAD_TIMEOUT = 3,
 109         MCE_LINK_ERROR_STORE_TIMEOUT = 4,
 110         MCE_LINK_ERROR_PAGE_TABLE_WALK_LOAD_STORE_TIMEOUT = 5,
 111 };
 112 
 113 struct machine_check_event {
 114         enum MCE_Version        version:8;
 115         u8                      in_use;
 116         enum MCE_Severity       severity:8;
 117         enum MCE_Initiator      initiator:8;
 118         enum MCE_ErrorType      error_type:8;
 119         enum MCE_ErrorClass     error_class:8;
 120         enum MCE_Disposition    disposition:8;
 121         bool                    sync_error;
 122         u16                     cpu;
 123         u64                     gpr3;
 124         u64                     srr0;
 125         u64                     srr1;
 126         union {
 127                 struct {
 128                         enum MCE_UeErrorType ue_error_type:8;
 129                         u8              effective_address_provided;
 130                         u8              physical_address_provided;
 131                         u8              ignore_event;
 132                         u8              reserved_1[4];
 133                         u64             effective_address;
 134                         u64             physical_address;
 135                         u8              reserved_2[8];
 136                 } ue_error;
 137 
 138                 struct {
 139                         enum MCE_SlbErrorType slb_error_type:8;
 140                         u8              effective_address_provided;
 141                         u8              reserved_1[6];
 142                         u64             effective_address;
 143                         u8              reserved_2[16];
 144                 } slb_error;
 145 
 146                 struct {
 147                         enum MCE_EratErrorType erat_error_type:8;
 148                         u8              effective_address_provided;
 149                         u8              reserved_1[6];
 150                         u64             effective_address;
 151                         u8              reserved_2[16];
 152                 } erat_error;
 153 
 154                 struct {
 155                         enum MCE_TlbErrorType tlb_error_type:8;
 156                         u8              effective_address_provided;
 157                         u8              reserved_1[6];
 158                         u64             effective_address;
 159                         u8              reserved_2[16];
 160                 } tlb_error;
 161 
 162                 struct {
 163                         enum MCE_UserErrorType user_error_type:8;
 164                         u8              effective_address_provided;
 165                         u8              reserved_1[6];
 166                         u64             effective_address;
 167                         u8              reserved_2[16];
 168                 } user_error;
 169 
 170                 struct {
 171                         enum MCE_RaErrorType ra_error_type:8;
 172                         u8              effective_address_provided;
 173                         u8              reserved_1[6];
 174                         u64             effective_address;
 175                         u8              reserved_2[16];
 176                 } ra_error;
 177 
 178                 struct {
 179                         enum MCE_LinkErrorType link_error_type:8;
 180                         u8              effective_address_provided;
 181                         u8              reserved_1[6];
 182                         u64             effective_address;
 183                         u8              reserved_2[16];
 184                 } link_error;
 185         } u;
 186 };
 187 
 188 struct mce_error_info {
 189         enum MCE_ErrorType error_type:8;
 190         union {
 191                 enum MCE_UeErrorType ue_error_type:8;
 192                 enum MCE_SlbErrorType slb_error_type:8;
 193                 enum MCE_EratErrorType erat_error_type:8;
 194                 enum MCE_TlbErrorType tlb_error_type:8;
 195                 enum MCE_UserErrorType user_error_type:8;
 196                 enum MCE_RaErrorType ra_error_type:8;
 197                 enum MCE_LinkErrorType link_error_type:8;
 198         } u;
 199         enum MCE_Severity       severity:8;
 200         enum MCE_Initiator      initiator:8;
 201         enum MCE_ErrorClass     error_class:8;
 202         bool                    sync_error;
 203         bool                    ignore_event;
 204 };
 205 
 206 #define MAX_MC_EVT      100
 207 
 208 /* Release flags for get_mce_event() */
 209 #define MCE_EVENT_RELEASE       true
 210 #define MCE_EVENT_DONTRELEASE   false
 211 
 212 extern void save_mce_event(struct pt_regs *regs, long handled,
 213                            struct mce_error_info *mce_err, uint64_t nip,
 214                            uint64_t addr, uint64_t phys_addr);
 215 extern int get_mce_event(struct machine_check_event *mce, bool release);
 216 extern void release_mce_event(void);
 217 extern void machine_check_queue_event(void);
 218 extern void machine_check_print_event_info(struct machine_check_event *evt,
 219                                            bool user_mode, bool in_guest);
 220 unsigned long addr_to_pfn(struct pt_regs *regs, unsigned long addr);
 221 #ifdef CONFIG_PPC_BOOK3S_64
 222 void flush_and_reload_slb(void);
 223 #endif /* CONFIG_PPC_BOOK3S_64 */
 224 #endif /* __ASM_PPC64_MCE_H__ */

/* [<][>][^][v][top][bottom][index][help] */