1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2f5daba1dSHeiko Carstens /* 3f5daba1dSHeiko Carstens * Machine check handler definitions 4f5daba1dSHeiko Carstens * 5f5daba1dSHeiko Carstens * Copyright IBM Corp. 2000, 2009 6f5daba1dSHeiko Carstens * Author(s): Ingo Adlung <adlung@de.ibm.com>, 7f5daba1dSHeiko Carstens * Martin Schwidefsky <schwidefsky@de.ibm.com>, 8f5daba1dSHeiko Carstens * Cornelia Huck <cornelia.huck@de.ibm.com>, 9f5daba1dSHeiko Carstens */ 10f5daba1dSHeiko Carstens 11f5daba1dSHeiko Carstens #ifndef _ASM_S390_NMI_H 12f5daba1dSHeiko Carstens #define _ASM_S390_NMI_H 13f5daba1dSHeiko Carstens 14fe6ba88bSMasahiro Yamada #include <linux/bits.h> 15f5daba1dSHeiko Carstens #include <linux/types.h> 16f5daba1dSHeiko Carstens 17c929500dSQingFeng Hao #define MCIC_SUBCLASS_MASK (1ULL<<63 | 1ULL<<62 | 1ULL<<61 | \ 18c929500dSQingFeng Hao 1ULL<<59 | 1ULL<<58 | 1ULL<<56 | \ 19c929500dSQingFeng Hao 1ULL<<55 | 1ULL<<54 | 1ULL<<53 | \ 20c929500dSQingFeng Hao 1ULL<<52 | 1ULL<<47 | 1ULL<<46 | \ 21c929500dSQingFeng Hao 1ULL<<45 | 1ULL<<44) 22fe6ba88bSMasahiro Yamada #define MCCK_CODE_SYSTEM_DAMAGE BIT(63) 23fe6ba88bSMasahiro Yamada #define MCCK_CODE_EXT_DAMAGE BIT(63 - 5) 24fe6ba88bSMasahiro Yamada #define MCCK_CODE_CP BIT(63 - 9) 25d35925b3SAlexander Gordeev #define MCCK_CODE_STG_ERROR BIT(63 - 16) 26d35925b3SAlexander Gordeev #define MCCK_CODE_STG_KEY_ERROR BIT(63 - 18) 27d35925b3SAlexander Gordeev #define MCCK_CODE_STG_DEGRAD BIT(63 - 19) 28fe6ba88bSMasahiro Yamada #define MCCK_CODE_PSW_MWP_VALID BIT(63 - 20) 29fe6ba88bSMasahiro Yamada #define MCCK_CODE_PSW_IA_VALID BIT(63 - 23) 30d35925b3SAlexander Gordeev #define MCCK_CODE_STG_FAIL_ADDR BIT(63 - 24) 31fe6ba88bSMasahiro Yamada #define MCCK_CODE_CR_VALID BIT(63 - 29) 32fe6ba88bSMasahiro Yamada #define MCCK_CODE_GS_VALID BIT(63 - 36) 33fe6ba88bSMasahiro Yamada #define MCCK_CODE_FC_VALID BIT(63 - 43) 34549abb7fSAlexander Gordeev #define MCCK_CODE_CPU_TIMER_VALID BIT(63 - 46) 354d62fcc0SQingFeng Hao 3683abeffbSHendrik Brueckner #ifndef __ASSEMBLY__ 3783abeffbSHendrik Brueckner 38dc6e1555SHeiko Carstens union mci { 39dc6e1555SHeiko Carstens unsigned long val; 40dc6e1555SHeiko Carstens struct { 41dc6e1555SHeiko Carstens u64 sd : 1; /* 00 system damage */ 42dc6e1555SHeiko Carstens u64 pd : 1; /* 01 instruction-processing damage */ 43dc6e1555SHeiko Carstens u64 sr : 1; /* 02 system recovery */ 44dc6e1555SHeiko Carstens u64 : 1; /* 03 */ 45dc6e1555SHeiko Carstens u64 cd : 1; /* 04 timing-facility damage */ 46dc6e1555SHeiko Carstens u64 ed : 1; /* 05 external damage */ 47dc6e1555SHeiko Carstens u64 : 1; /* 06 */ 48dc6e1555SHeiko Carstens u64 dg : 1; /* 07 degradation */ 49dc6e1555SHeiko Carstens u64 w : 1; /* 08 warning pending */ 50dc6e1555SHeiko Carstens u64 cp : 1; /* 09 channel-report pending */ 51dc6e1555SHeiko Carstens u64 sp : 1; /* 10 service-processor damage */ 52dc6e1555SHeiko Carstens u64 ck : 1; /* 11 channel-subsystem damage */ 53dc6e1555SHeiko Carstens u64 : 2; /* 12-13 */ 54dc6e1555SHeiko Carstens u64 b : 1; /* 14 backed up */ 55dc6e1555SHeiko Carstens u64 : 1; /* 15 */ 56dc6e1555SHeiko Carstens u64 se : 1; /* 16 storage error uncorrected */ 57dc6e1555SHeiko Carstens u64 sc : 1; /* 17 storage error corrected */ 58dc6e1555SHeiko Carstens u64 ke : 1; /* 18 storage-key error uncorrected */ 59dc6e1555SHeiko Carstens u64 ds : 1; /* 19 storage degradation */ 60dc6e1555SHeiko Carstens u64 wp : 1; /* 20 psw mwp validity */ 61dc6e1555SHeiko Carstens u64 ms : 1; /* 21 psw mask and key validity */ 62dc6e1555SHeiko Carstens u64 pm : 1; /* 22 psw program mask and cc validity */ 63dc6e1555SHeiko Carstens u64 ia : 1; /* 23 psw instruction address validity */ 64dc6e1555SHeiko Carstens u64 fa : 1; /* 24 failing storage address validity */ 65dc6e1555SHeiko Carstens u64 vr : 1; /* 25 vector register validity */ 66dc6e1555SHeiko Carstens u64 ec : 1; /* 26 external damage code validity */ 67dc6e1555SHeiko Carstens u64 fp : 1; /* 27 floating point register validity */ 68dc6e1555SHeiko Carstens u64 gr : 1; /* 28 general register validity */ 69dc6e1555SHeiko Carstens u64 cr : 1; /* 29 control register validity */ 70dc6e1555SHeiko Carstens u64 : 1; /* 30 */ 71dc6e1555SHeiko Carstens u64 st : 1; /* 31 storage logical validity */ 72dc6e1555SHeiko Carstens u64 ie : 1; /* 32 indirect storage error */ 73dc6e1555SHeiko Carstens u64 ar : 1; /* 33 access register validity */ 74dc6e1555SHeiko Carstens u64 da : 1; /* 34 delayed access exception */ 75916cda1aSMartin Schwidefsky u64 : 1; /* 35 */ 7665a6d0c5SHeiko Carstens u64 gs : 1; /* 36 guarded storage registers validity */ 77916cda1aSMartin Schwidefsky u64 : 5; /* 37-41 */ 78dc6e1555SHeiko Carstens u64 pr : 1; /* 42 tod programmable register validity */ 79dc6e1555SHeiko Carstens u64 fc : 1; /* 43 fp control register validity */ 80dc6e1555SHeiko Carstens u64 ap : 1; /* 44 ancillary report */ 81dc6e1555SHeiko Carstens u64 : 1; /* 45 */ 82dc6e1555SHeiko Carstens u64 ct : 1; /* 46 cpu timer validity */ 83dc6e1555SHeiko Carstens u64 cc : 1; /* 47 clock comparator validity */ 84dc6e1555SHeiko Carstens u64 : 16; /* 47-63 */ 85dc6e1555SHeiko Carstens }; 86f5daba1dSHeiko Carstens }; 87f5daba1dSHeiko Carstens 88916cda1aSMartin Schwidefsky #define MCESA_ORIGIN_MASK (~0x3ffUL) 89916cda1aSMartin Schwidefsky #define MCESA_LC_MASK (0xfUL) 906c81511cSMartin Schwidefsky #define MCESA_MIN_SIZE (1024) 916c81511cSMartin Schwidefsky #define MCESA_MAX_SIZE (2048) 92916cda1aSMartin Schwidefsky 93916cda1aSMartin Schwidefsky struct mcesa { 94916cda1aSMartin Schwidefsky u8 vector_save_area[1024]; 95916cda1aSMartin Schwidefsky u8 guarded_storage_save_area[32]; 96916cda1aSMartin Schwidefsky }; 97916cda1aSMartin Schwidefsky 98f5daba1dSHeiko Carstens struct pt_regs; 99f5daba1dSHeiko Carstens 100c7ed509bSAlexander Gordeev void nmi_alloc_mcesa_early(u64 *mcesad); 101c7ed509bSAlexander Gordeev int nmi_alloc_mcesa(u64 *mcesad); 102c7ed509bSAlexander Gordeev void nmi_free_mcesa(u64 *mcesad); 1036c81511cSMartin Schwidefsky 104*e7ec1d2eSAlexander Gordeev void s390_handle_mcck(void); 105*e7ec1d2eSAlexander Gordeev void s390_do_machine_check(struct pt_regs *regs); 106f5daba1dSHeiko Carstens 10783abeffbSHendrik Brueckner #endif /* __ASSEMBLY__ */ 108f5daba1dSHeiko Carstens #endif /* _ASM_S390_NMI_H */ 109