hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/arch/powerpc/include/asm/book3s/32/mmu-hash.h
....@@ -1,6 +1,7 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
22 #ifndef _ASM_POWERPC_BOOK3S_32_MMU_HASH_H_
33 #define _ASM_POWERPC_BOOK3S_32_MMU_HASH_H_
4
+
45 /*
56 * 32-bit hash table MMU support
67 */
....@@ -34,8 +35,12 @@
3435 #define BAT_PHYS_ADDR(x) ((u32)((x & 0x00000000fffe0000ULL) | \
3536 ((x & 0x0000000e00000000ULL) >> 24) | \
3637 ((x & 0x0000000100000000ULL) >> 30)))
38
+#define PHYS_BAT_ADDR(x) (((u64)(x) & 0x00000000fffe0000ULL) | \
39
+ (((u64)(x) << 24) & 0x0000000e00000000ULL) | \
40
+ (((u64)(x) << 30) & 0x0000000100000000ULL))
3741 #else
3842 #define BAT_PHYS_ADDR(x) (x)
43
+#define PHYS_BAT_ADDR(x) ((x) & 0xfffe0000)
3944 #endif
4045
4146 struct ppc_bat {
....@@ -53,6 +58,11 @@
5358 #define PP_RWRX 1 /* Supervisor read/write, User read */
5459 #define PP_RWRW 2 /* Supervisor read/write, User read/write */
5560 #define PP_RXRX 3 /* Supervisor read, User read */
61
+
62
+/* Values for Segment Registers */
63
+#define SR_NX 0x10000000 /* No Execute */
64
+#define SR_KP 0x20000000 /* User key */
65
+#define SR_KS 0x40000000 /* Supervisor key */
5666
5767 #ifndef __ASSEMBLY__
5868
....@@ -83,6 +93,17 @@
8393 unsigned long vdso_base;
8494 } mm_context_t;
8595
96
+void update_bats(void);
97
+static inline void cleanup_cpu_mmu_context(void) { };
98
+
99
+/* patch sites */
100
+extern s32 patch__hash_page_A0, patch__hash_page_A1, patch__hash_page_A2;
101
+extern s32 patch__hash_page_B, patch__hash_page_C;
102
+extern s32 patch__flush_hash_A0, patch__flush_hash_A1, patch__flush_hash_A2;
103
+extern s32 patch__flush_hash_B;
104
+
105
+int __init find_free_bat(void);
106
+unsigned int bat_block_size(unsigned long base, unsigned long top);
86107 #endif /* !__ASSEMBLY__ */
87108
88109 /* We happily ignore the smaller BATs on 601, we don't actually use