Skip to content

Commit d1fed2d

Browse files
author
Russell King (Oracle)
committed
ARM: provide individual is_translation_fault() and is_permission_fault()
Provide individual LPAE and non-LPAE definitions for both these functions, rather than having ifdefs inside the function body. This places the functions closer to their associated definitions. Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
1 parent a542de4 commit d1fed2d

1 file changed

Lines changed: 19 additions & 17 deletions

File tree

arch/arm/mm/fault.h

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,20 @@ static inline int fsr_fs(unsigned int fsr)
2121
{
2222
return fsr & FSR_FS5_0;
2323
}
24+
25+
static inline bool is_translation_fault(unsigned int fsr)
26+
{
27+
int fs = fsr_fs(fsr);
28+
29+
return (fs & FS_MMU_NOLL_MASK) == FS_TRANS_NOLL;
30+
}
31+
32+
static inline bool is_permission_fault(unsigned int fsr)
33+
{
34+
int fs = fsr_fs(fsr);
35+
36+
return (fs & FS_MMU_NOLL_MASK) == FS_PERM_NOLL;
37+
}
2438
#else
2539
#define FSR_FS_AEA 22
2640
#define FS_L1_TRANS 0x5
@@ -35,33 +49,21 @@ static inline int fsr_fs(unsigned int fsr)
3549
{
3650
return (fsr & FSR_FS3_0) | (fsr & FSR_FS4) >> 6;
3751
}
38-
#endif
3952

4053
static inline bool is_translation_fault(unsigned int fsr)
4154
{
4255
int fs = fsr_fs(fsr);
43-
#ifdef CONFIG_ARM_LPAE
44-
if ((fs & FS_MMU_NOLL_MASK) == FS_TRANS_NOLL)
45-
return true;
46-
#else
47-
if (fs == FS_L1_TRANS || fs == FS_L2_TRANS)
48-
return true;
49-
#endif
50-
return false;
56+
57+
return fs == FS_L1_TRANS || fs == FS_L2_TRANS;
5158
}
5259

5360
static inline bool is_permission_fault(unsigned int fsr)
5461
{
5562
int fs = fsr_fs(fsr);
56-
#ifdef CONFIG_ARM_LPAE
57-
if ((fs & FS_MMU_NOLL_MASK) == FS_PERM_NOLL)
58-
return true;
59-
#else
60-
if (fs == FS_L1_PERM || fs == FS_L2_PERM)
61-
return true;
62-
#endif
63-
return false;
63+
64+
return fs == FS_L1_PERM || fs == FS_L2_PERM;
6465
}
66+
#endif
6567

6668
void do_bad_area(unsigned long addr, unsigned int fsr, struct pt_regs *regs);
6769
void early_abt_enable(void);

0 commit comments

Comments
 (0)