Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

arm: Remove HYP/Stage-2 page-table support

Remove all traces of Stage-2 and HYP page table support.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Acked-by: Olof Johansson <olof@lixom.net>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Will Deacon <will@kernel.org>
Acked-by: Vladimir Murzin <vladimir.murzin@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Christoffer Dall <christoffer.dall@arm.com>

+1 -93
-20
arch/arm/include/asm/pgtable-3level.h
··· 104 104 */ 105 105 #define L_PGD_SWAPPER (_AT(pgdval_t, 1) << 55) /* swapper_pg_dir entry */ 106 106 107 - /* 108 - * 2nd stage PTE definitions for LPAE. 109 - */ 110 - #define L_PTE_S2_MT_UNCACHED (_AT(pteval_t, 0x0) << 2) /* strongly ordered */ 111 - #define L_PTE_S2_MT_WRITETHROUGH (_AT(pteval_t, 0xa) << 2) /* normal inner write-through */ 112 - #define L_PTE_S2_MT_WRITEBACK (_AT(pteval_t, 0xf) << 2) /* normal inner write-back */ 113 - #define L_PTE_S2_MT_DEV_SHARED (_AT(pteval_t, 0x1) << 2) /* device */ 114 - #define L_PTE_S2_MT_MASK (_AT(pteval_t, 0xf) << 2) 115 - 116 - #define L_PTE_S2_RDONLY (_AT(pteval_t, 1) << 6) /* HAP[1] */ 117 - #define L_PTE_S2_RDWR (_AT(pteval_t, 3) << 6) /* HAP[2:1] */ 118 - 119 - #define L_PMD_S2_RDONLY (_AT(pmdval_t, 1) << 6) /* HAP[1] */ 120 - #define L_PMD_S2_RDWR (_AT(pmdval_t, 3) << 6) /* HAP[2:1] */ 121 - 122 - /* 123 - * Hyp-mode PL2 PTE definitions for LPAE. 124 - */ 125 - #define L_PTE_HYP L_PTE_USER 126 - 127 107 #ifndef __ASSEMBLY__ 128 108 129 109 #define pud_none(pud) (!pud_val(pud))
-9
arch/arm/include/asm/pgtable.h
··· 80 80 81 81 extern pgprot_t pgprot_user; 82 82 extern pgprot_t pgprot_kernel; 83 - extern pgprot_t pgprot_hyp_device; 84 - extern pgprot_t pgprot_s2; 85 - extern pgprot_t pgprot_s2_device; 86 83 87 84 #define _MOD_PROT(p, b) __pgprot(pgprot_val(p) | (b)) 88 85 ··· 92 95 #define PAGE_READONLY_EXEC _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_RDONLY) 93 96 #define PAGE_KERNEL _MOD_PROT(pgprot_kernel, L_PTE_XN) 94 97 #define PAGE_KERNEL_EXEC pgprot_kernel 95 - #define PAGE_HYP _MOD_PROT(pgprot_kernel, L_PTE_HYP | L_PTE_XN) 96 - #define PAGE_HYP_EXEC _MOD_PROT(pgprot_kernel, L_PTE_HYP | L_PTE_RDONLY) 97 - #define PAGE_HYP_RO _MOD_PROT(pgprot_kernel, L_PTE_HYP | L_PTE_RDONLY | L_PTE_XN) 98 - #define PAGE_HYP_DEVICE _MOD_PROT(pgprot_hyp_device, L_PTE_HYP) 99 - #define PAGE_S2 _MOD_PROT(pgprot_s2, L_PTE_S2_RDONLY | L_PTE_XN) 100 - #define PAGE_S2_DEVICE _MOD_PROT(pgprot_s2_device, L_PTE_S2_RDONLY | L_PTE_XN) 101 98 102 99 #define __PAGE_NONE __pgprot(_L_PTE_DEFAULT | L_PTE_RDONLY | L_PTE_XN | L_PTE_NONE) 103 100 #define __PAGE_SHARED __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_XN)
+1 -5
arch/arm/include/asm/sections.h
··· 10 10 extern char __idmap_text_end[]; 11 11 extern char __entry_text_start[]; 12 12 extern char __entry_text_end[]; 13 - extern char __hyp_idmap_text_start[]; 14 - extern char __hyp_idmap_text_end[]; 15 13 16 14 static inline bool in_entry_text(unsigned long addr) 17 15 { ··· 20 22 static inline bool in_idmap_text(unsigned long addr) 21 23 { 22 24 void *a = (void *)addr; 23 - return memory_contains(__idmap_text_start, __idmap_text_end, a, 1) || 24 - memory_contains(__hyp_idmap_text_start, __hyp_idmap_text_end, 25 - a, 1); 25 + return memory_contains(__idmap_text_start, __idmap_text_end, a, 1); 26 26 } 27 27 28 28 #endif /* _ASM_ARM_SECTIONS_H */
-7
arch/arm/include/asm/virt.h
··· 67 67 return false; 68 68 } 69 69 70 - /* The section containing the hypervisor idmap text */ 71 - extern char __hyp_idmap_text_start[]; 72 - extern char __hyp_idmap_text_end[]; 73 - 74 - /* The section containing the hypervisor text */ 75 - extern char __hyp_text_start[]; 76 - extern char __hyp_text_end[]; 77 70 #endif 78 71 79 72 #else
-8
arch/arm/kernel/vmlinux-xip.lds.S
··· 162 162 ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support") 163 163 ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined") 164 164 165 - /* 166 - * The HYP init code can't be more than a page long, 167 - * and should not cross a page boundary. 168 - * The above comment applies as well. 169 - */ 170 - ASSERT(__hyp_idmap_text_end - (__hyp_idmap_text_start & PAGE_MASK) <= PAGE_SIZE, 171 - "HYP init code too big or misaligned") 172 - 173 165 #ifdef CONFIG_XIP_DEFLATED_DATA 174 166 /* 175 167 * The .bss is used as a stack area for __inflate_kernel_data() whose stack
-8
arch/arm/kernel/vmlinux.lds.S
··· 170 170 ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support") 171 171 ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined") 172 172 173 - /* 174 - * The HYP init code can't be more than a page long, 175 - * and should not cross a page boundary. 176 - * The above comment applies as well. 177 - */ 178 - ASSERT(__hyp_idmap_text_end - (__hyp_idmap_text_start & PAGE_MASK) <= PAGE_SIZE, 179 - "HYP init code too big or misaligned") 180 - 181 173 #endif /* CONFIG_XIP_KERNEL */
-10
arch/arm/kernel/vmlinux.lds.h
··· 31 31 *(.proc.info.init) \ 32 32 __proc_info_end = .; 33 33 34 - #define HYPERVISOR_TEXT \ 35 - __hyp_text_start = .; \ 36 - *(.hyp.text) \ 37 - __hyp_text_end = .; 38 - 39 34 #define IDMAP_TEXT \ 40 35 ALIGN_FUNCTION(); \ 41 36 __idmap_text_start = .; \ 42 37 *(.idmap.text) \ 43 38 __idmap_text_end = .; \ 44 - . = ALIGN(PAGE_SIZE); \ 45 - __hyp_idmap_text_start = .; \ 46 - *(.hyp.idmap.text) \ 47 - __hyp_idmap_text_end = .; 48 39 49 40 #define ARM_DISCARD \ 50 41 *(.ARM.exidx.exit.text) \ ··· 63 72 SCHED_TEXT \ 64 73 CPUIDLE_TEXT \ 65 74 LOCK_TEXT \ 66 - HYPERVISOR_TEXT \ 67 75 KPROBES_TEXT \ 68 76 *(.gnu.warning) \ 69 77 *(.glue_7) \
-26
arch/arm/mm/mmu.c
··· 63 63 static unsigned int ecc_mask __initdata = 0; 64 64 pgprot_t pgprot_user; 65 65 pgprot_t pgprot_kernel; 66 - pgprot_t pgprot_hyp_device; 67 - pgprot_t pgprot_s2; 68 - pgprot_t pgprot_s2_device; 69 66 70 67 EXPORT_SYMBOL(pgprot_user); 71 68 EXPORT_SYMBOL(pgprot_kernel); ··· 72 75 unsigned int cr_mask; 73 76 pmdval_t pmd; 74 77 pteval_t pte; 75 - pteval_t pte_s2; 76 78 }; 77 - 78 - #ifdef CONFIG_ARM_LPAE 79 - #define s2_policy(policy) policy 80 - #else 81 - #define s2_policy(policy) 0 82 - #endif 83 79 84 80 unsigned long kimage_voffset __ro_after_init; 85 81 ··· 82 92 .cr_mask = CR_W|CR_C, 83 93 .pmd = PMD_SECT_UNCACHED, 84 94 .pte = L_PTE_MT_UNCACHED, 85 - .pte_s2 = s2_policy(L_PTE_S2_MT_UNCACHED), 86 95 }, { 87 96 .policy = "buffered", 88 97 .cr_mask = CR_C, 89 98 .pmd = PMD_SECT_BUFFERED, 90 99 .pte = L_PTE_MT_BUFFERABLE, 91 - .pte_s2 = s2_policy(L_PTE_S2_MT_UNCACHED), 92 100 }, { 93 101 .policy = "writethrough", 94 102 .cr_mask = 0, 95 103 .pmd = PMD_SECT_WT, 96 104 .pte = L_PTE_MT_WRITETHROUGH, 97 - .pte_s2 = s2_policy(L_PTE_S2_MT_WRITETHROUGH), 98 105 }, { 99 106 .policy = "writeback", 100 107 .cr_mask = 0, 101 108 .pmd = PMD_SECT_WB, 102 109 .pte = L_PTE_MT_WRITEBACK, 103 - .pte_s2 = s2_policy(L_PTE_S2_MT_WRITEBACK), 104 110 }, { 105 111 .policy = "writealloc", 106 112 .cr_mask = 0, 107 113 .pmd = PMD_SECT_WBWA, 108 114 .pte = L_PTE_MT_WRITEALLOC, 109 - .pte_s2 = s2_policy(L_PTE_S2_MT_WRITEBACK), 110 115 } 111 116 }; 112 117 ··· 230 245 static struct mem_type mem_types[] __ro_after_init = { 231 246 [MT_DEVICE] = { /* Strongly ordered / ARMv6 shared device */ 232 247 .prot_pte = PROT_PTE_DEVICE | L_PTE_MT_DEV_SHARED | 233 - L_PTE_SHARED, 234 - .prot_pte_s2 = s2_policy(PROT_PTE_S2_DEVICE) | 235 - s2_policy(L_PTE_S2_MT_DEV_SHARED) | 236 248 L_PTE_SHARED, 237 249 .prot_l1 = PMD_TYPE_TABLE, 238 250 .prot_sect = PROT_SECT_DEVICE | PMD_SECT_S, ··· 416 434 struct cachepolicy *cp; 417 435 unsigned int cr = get_cr(); 418 436 pteval_t user_pgprot, kern_pgprot, vecs_pgprot; 419 - pteval_t hyp_device_pgprot, s2_pgprot, s2_device_pgprot; 420 437 int cpu_arch = cpu_architecture(); 421 438 int i; 422 439 ··· 539 558 */ 540 559 cp = &cache_policies[cachepolicy]; 541 560 vecs_pgprot = kern_pgprot = user_pgprot = cp->pte; 542 - s2_pgprot = cp->pte_s2; 543 - hyp_device_pgprot = mem_types[MT_DEVICE].prot_pte; 544 - s2_device_pgprot = mem_types[MT_DEVICE].prot_pte_s2; 545 561 546 562 #ifndef CONFIG_ARM_LPAE 547 563 /* ··· 582 604 user_pgprot |= L_PTE_SHARED; 583 605 kern_pgprot |= L_PTE_SHARED; 584 606 vecs_pgprot |= L_PTE_SHARED; 585 - s2_pgprot |= L_PTE_SHARED; 586 607 mem_types[MT_DEVICE_WC].prot_sect |= PMD_SECT_S; 587 608 mem_types[MT_DEVICE_WC].prot_pte |= L_PTE_SHARED; 588 609 mem_types[MT_DEVICE_CACHED].prot_sect |= PMD_SECT_S; ··· 643 666 pgprot_user = __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | user_pgprot); 644 667 pgprot_kernel = __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | 645 668 L_PTE_DIRTY | kern_pgprot); 646 - pgprot_s2 = __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | s2_pgprot); 647 - pgprot_s2_device = __pgprot(s2_device_pgprot); 648 - pgprot_hyp_device = __pgprot(hyp_device_pgprot); 649 669 650 670 mem_types[MT_LOW_VECTORS].prot_l1 |= ecc_mask; 651 671 mem_types[MT_HIGH_VECTORS].prot_l1 |= ecc_mask;