summaryrefslogtreecommitdiff
path: root/arch/arm/include/asm/armv8
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@arm.com>2022-06-14 02:11:10 +0300
committerTom Rini <trini@konsulko.com>2022-06-16 22:22:55 +0300
commitce9c579e2b7c877684d0140dd34b881e12fe5c59 (patch)
tree7dadbe8363b988822669a3da7e5d367c8f1bd518 /arch/arm/include/asm/armv8
parentb11b5afa6a17a2aedf174d4d4ee5d70b04e245c6 (diff)
downloadu-boot-ce9c579e2b7c877684d0140dd34b881e12fe5c59.tar.xz
armv8: always use current exception level for TCR_ELx access
Currently get_tcr() takes an "el" parameter, to select the proper version of the TCR_ELx system register. This is problematic in case of the Apple M1, since it runs with HCR_EL2.E2H fixed to 1, so TCR_EL2 is actually using the TCR_EL1 layout, and we get the wrong version. For U-Boot's purposes the only sensible choice here is the current exception level, and indeed most callers treat it like that, so let's remove that parameter and read the current EL inside the function. This allows us to check for the E2H bit, and pretend it's EL1 in this case. There are two callers which don't care about the EL, and they pass 0, which looks wrong, but is irrelevant in these two cases, since we don't use the return value there. So the change cannot affect those two. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Mark Kettenis <kettenis@openbsd.org> Tested-by: Mark Kettenis <kettenis@openbsd.org>
Diffstat (limited to 'arch/arm/include/asm/armv8')
-rw-r--r--arch/arm/include/asm/armv8/mmu.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/arm/include/asm/armv8/mmu.h b/arch/arm/include/asm/armv8/mmu.h
index c36b2cf5a5..9f58cedb65 100644
--- a/arch/arm/include/asm/armv8/mmu.h
+++ b/arch/arm/include/asm/armv8/mmu.h
@@ -103,6 +103,8 @@
#define TCR_EL2_RSVD (1U << 31 | 1 << 23)
#define TCR_EL3_RSVD (1U << 31 | 1 << 23)
+#define HCR_EL2_E2H_BIT 34
+
#ifndef __ASSEMBLY__
static inline void set_ttbr_tcr_mair(int el, u64 table, u64 tcr, u64 attr)
{
@@ -134,7 +136,7 @@ struct mm_region {
extern struct mm_region *mem_map;
void setup_pgtables(void);
-u64 get_tcr(int el, u64 *pips, u64 *pva_bits);
+u64 get_tcr(u64 *pips, u64 *pva_bits);
#endif
#endif /* _ASM_ARMV8_MMU_H_ */