From: Russell King (Oracle) Date: Fri, 5 Dec 2025 15:25:24 +0000 (+0000) Subject: ARM: move is_permission_fault() and is_translation_fault() to fault.h X-Git-Tag: v7.1-rc1~8^2~1^2~3 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=9c46fcaf2efa78e814e102c5828cf5c825a133ec;p=thirdparty%2Fkernel%2Flinux.git ARM: move is_permission_fault() and is_translation_fault() to fault.h is_permission_fault() and is_translation_fault() are both conditional on the FSR encodings, which are dependent on LPAE. We define the constants in fault.h. Move these inline functions to fault.h to be near the FSR definitions. Reviewed-by: Sebastian Andrzej Siewior Signed-off-by: Russell King (Oracle) --- diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c index 0f3b6cc516c1..e62cc4be5adf 100644 --- a/arch/arm/mm/fault.c +++ b/arch/arm/mm/fault.c @@ -115,32 +115,6 @@ static inline bool is_write_fault(unsigned int fsr) return (fsr & FSR_WRITE) && !(fsr & FSR_CM); } -static inline bool is_translation_fault(unsigned int fsr) -{ - int fs = fsr_fs(fsr); -#ifdef CONFIG_ARM_LPAE - if ((fs & FS_MMU_NOLL_MASK) == FS_TRANS_NOLL) - return true; -#else - if (fs == FS_L1_TRANS || fs == FS_L2_TRANS) - return true; -#endif - return false; -} - -static inline bool is_permission_fault(unsigned int fsr) -{ - int fs = fsr_fs(fsr); -#ifdef CONFIG_ARM_LPAE - if ((fs & FS_MMU_NOLL_MASK) == FS_PERM_NOLL) - return true; -#else - if (fs == FS_L1_PERM || fs == FS_L2_PERM) - return true; -#endif - return false; -} - static void die_kernel_fault(const char *msg, struct mm_struct *mm, unsigned long addr, unsigned int fsr, struct pt_regs *regs) diff --git a/arch/arm/mm/fault.h b/arch/arm/mm/fault.h index e8f8c1902544..e95f44757dc9 100644 --- a/arch/arm/mm/fault.h +++ b/arch/arm/mm/fault.h @@ -35,6 +35,32 @@ static inline int fsr_fs(unsigned int fsr) } #endif +static inline bool is_translation_fault(unsigned int fsr) +{ + int fs = fsr_fs(fsr); +#ifdef CONFIG_ARM_LPAE + if ((fs & FS_MMU_NOLL_MASK) == FS_TRANS_NOLL) + return true; +#else + if (fs == FS_L1_TRANS || fs == FS_L2_TRANS) + return true; +#endif + return false; +} + +static inline bool is_permission_fault(unsigned int fsr) +{ + int fs = fsr_fs(fsr); +#ifdef CONFIG_ARM_LPAE + if ((fs & FS_MMU_NOLL_MASK) == FS_PERM_NOLL) + return true; +#else + if (fs == FS_L1_PERM || fs == FS_L2_PERM) + return true; +#endif + return false; +} + void do_bad_area(unsigned long addr, unsigned int fsr, struct pt_regs *regs); void early_abt_enable(void); asmlinkage void do_DataAbort(unsigned long addr, unsigned int fsr,