Skip to content

Commit 1f9d4ba

Browse files
brooniectmarinas
authored andcommitted
arm64/esr: Add decode of ISS2 to data abort reporting
The architecture has added more information about faults to ISS2 within ESR. Add decode of this to our data abort fault decode to aid diagnostics. Features that are not currently enabled are included here for completeness. Since the architecture specifies the values of bits within ISS2 in terms of ISS2 rather than in terms of the register as a whole we do so for our definitions as well, this makes it easier to review bitfield definitions. Signed-off-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent de84727 commit 1f9d4ba

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

arch/arm64/include/asm/esr.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@
7777
#define ESR_ELx_IL (UL(1) << ESR_ELx_IL_SHIFT)
7878
#define ESR_ELx_ISS_MASK (GENMASK(24, 0))
7979
#define ESR_ELx_ISS(esr) ((esr) & ESR_ELx_ISS_MASK)
80+
#define ESR_ELx_ISS2_SHIFT (32)
81+
#define ESR_ELx_ISS2_MASK (GENMASK_ULL(55, 32))
82+
#define ESR_ELx_ISS2(esr) (((esr) & ESR_ELx_ISS2_MASK) >> ESR_ELx_ISS2_SHIFT)
8083

8184
/* ISS field definitions shared by different classes */
8285
#define ESR_ELx_WNR_SHIFT (6)
@@ -140,6 +143,20 @@
140143
#define ESR_ELx_CM_SHIFT (8)
141144
#define ESR_ELx_CM (UL(1) << ESR_ELx_CM_SHIFT)
142145

146+
/* ISS2 field definitions for Data Aborts */
147+
#define ESR_ELx_TnD_SHIFT (10)
148+
#define ESR_ELx_TnD (UL(1) << ESR_ELx_TnD_SHIFT)
149+
#define ESR_ELx_TagAccess_SHIFT (9)
150+
#define ESR_ELx_TagAccess (UL(1) << ESR_ELx_TagAccess_SHIFT)
151+
#define ESR_ELx_GCS_SHIFT (8)
152+
#define ESR_ELx_GCS (UL(1) << ESR_ELx_GCS_SHIFT)
153+
#define ESR_ELx_Overlay_SHIFT (6)
154+
#define ESR_ELx_Overlay (UL(1) << ESR_ELx_Overlay_SHIFT)
155+
#define ESR_ELx_DirtyBit_SHIFT (5)
156+
#define ESR_ELx_DirtyBit (UL(1) << ESR_ELx_DirtyBit_SHIFT)
157+
#define ESR_ELx_Xs_SHIFT (0)
158+
#define ESR_ELx_Xs_MASK (GENMASK_ULL(4, 0))
159+
143160
/* ISS field definitions for exceptions taken in to Hyp */
144161
#define ESR_ELx_CV (UL(1) << 24)
145162
#define ESR_ELx_COND_SHIFT (20)

arch/arm64/mm/fault.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ static inline const struct fault_info *esr_to_debug_fault_info(unsigned long esr
6666

6767
static void data_abort_decode(unsigned long esr)
6868
{
69+
unsigned long iss2 = ESR_ELx_ISS2(esr);
70+
6971
pr_alert("Data abort info:\n");
7072

7173
if (esr & ESR_ELx_ISV) {
@@ -78,12 +80,21 @@ static void data_abort_decode(unsigned long esr)
7880
(esr & ESR_ELx_SF) >> ESR_ELx_SF_SHIFT,
7981
(esr & ESR_ELx_AR) >> ESR_ELx_AR_SHIFT);
8082
} else {
81-
pr_alert(" ISV = 0, ISS = 0x%08lx\n", esr & ESR_ELx_ISS_MASK);
83+
pr_alert(" ISV = 0, ISS = 0x%08lx, ISS2 = 0x%08lx\n",
84+
esr & ESR_ELx_ISS_MASK, iss2);
8285
}
8386

84-
pr_alert(" CM = %lu, WnR = %lu\n",
87+
pr_alert(" CM = %lu, WnR = %lu, TnD = %lu, TagAccess = %lu\n",
8588
(esr & ESR_ELx_CM) >> ESR_ELx_CM_SHIFT,
86-
(esr & ESR_ELx_WNR) >> ESR_ELx_WNR_SHIFT);
89+
(esr & ESR_ELx_WNR) >> ESR_ELx_WNR_SHIFT,
90+
(iss2 & ESR_ELx_TnD) >> ESR_ELx_TnD_SHIFT,
91+
(iss2 & ESR_ELx_TagAccess) >> ESR_ELx_TagAccess_SHIFT);
92+
93+
pr_alert(" GCS = %ld, Overlay = %lu, DirtyBit = %lu, Xs = %llu\n",
94+
(iss2 & ESR_ELx_GCS) >> ESR_ELx_GCS_SHIFT,
95+
(iss2 & ESR_ELx_Overlay) >> ESR_ELx_Overlay_SHIFT,
96+
(iss2 & ESR_ELx_DirtyBit) >> ESR_ELx_DirtyBit_SHIFT,
97+
(iss2 & ESR_ELx_Xs_MASK) >> ESR_ELx_Xs_SHIFT);
8798
}
8899

89100
static void mem_abort_decode(unsigned long esr)

0 commit comments

Comments
 (0)