blob: 83b5ab32d7a488e9a16552f49bacc86c2f2b56c2 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Catalin Marinas136848d2011-11-22 17:30:28 +00002#ifndef __ARCH_ARM_FAULT_H
3#define __ARCH_ARM_FAULT_H
Linus Torvalds1da177e2005-04-16 15:20:36 -07004
Catalin Marinas136848d2011-11-22 17:30:28 +00005/*
6 * Fault status register encodings. We steal bit 31 for our own purposes.
7 */
8#define FSR_LNX_PF (1 << 31)
Will Deacon83402032019-08-08 16:51:00 +01009#define FSR_CM (1 << 13)
Catalin Marinas136848d2011-11-22 17:30:28 +000010#define FSR_WRITE (1 << 11)
11#define FSR_FS4 (1 << 10)
12#define FSR_FS3_0 (15)
Catalin Marinasf7b81562011-11-22 17:30:31 +000013#define FSR_FS5_0 (0x3f)
Catalin Marinas136848d2011-11-22 17:30:28 +000014
Catalin Marinasf7b81562011-11-22 17:30:31 +000015#ifdef CONFIG_ARM_LPAE
Alexander Sverdlin97a98ae2017-01-17 21:10:11 +010016#define FSR_FS_AEA 17
Wang Kefengabc25bb2021-09-22 14:56:32 +010017#define FS_PERM_NOLL 0xC
18#define FS_PERM_NOLL_MASK 0x3C
Alexander Sverdlin97a98ae2017-01-17 21:10:11 +010019
Catalin Marinasf7b81562011-11-22 17:30:31 +000020static inline int fsr_fs(unsigned int fsr)
21{
22 return fsr & FSR_FS5_0;
23}
24#else
Alexander Sverdlin97a98ae2017-01-17 21:10:11 +010025#define FSR_FS_AEA 22
Wang Kefengabc25bb2021-09-22 14:56:32 +010026#define FS_L1_PERM 0xD
27#define FS_L2_PERM 0xF
Alexander Sverdlin97a98ae2017-01-17 21:10:11 +010028
Catalin Marinas136848d2011-11-22 17:30:28 +000029static inline int fsr_fs(unsigned int fsr)
30{
31 return (fsr & FSR_FS3_0) | (fsr & FSR_FS4) >> 6;
32}
Catalin Marinasf7b81562011-11-22 17:30:31 +000033#endif
Catalin Marinas136848d2011-11-22 17:30:28 +000034
35void do_bad_area(unsigned long addr, unsigned int fsr, struct pt_regs *regs);
Lucas Stach92549702015-10-19 13:38:09 +010036void early_abt_enable(void);
Catalin Marinas136848d2011-11-22 17:30:28 +000037
38#endif /* __ARCH_ARM_FAULT_H */