Skip to content

Commit 3fbb96c

Browse files
author
Marc Zyngier
committed
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 parent 541ad01 commit 3fbb96c

8 files changed

Lines changed: 1 addition & 93 deletions

File tree

‎arch/arm/include/asm/pgtable-3level.h‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -104,26 +104,6 @@
104104
*/
105105
#define L_PGD_SWAPPER (_AT(pgdval_t, 1) << 55) /* swapper_pg_dir entry */
106106

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-
127107
#ifndef __ASSEMBLY__
128108

129109
#define pud_none(pud) (!pud_val(pud))

‎arch/arm/include/asm/pgtable.h‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@ extern void __pgd_error(const char *file, int line, pgd_t);
8080

8181
extern pgprot_t pgprot_user;
8282
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;
8683

8784
#define _MOD_PROT(p, b) __pgprot(pgprot_val(p) | (b))
8885

@@ -95,12 +92,6 @@ extern pgprot_t pgprot_s2_device;
9592
#define PAGE_READONLY_EXEC _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_RDONLY)
9693
#define PAGE_KERNEL _MOD_PROT(pgprot_kernel, L_PTE_XN)
9794
#define PAGE_KERNEL_EXEC pgprot_kernel
98-
#define PAGE_HYP _MOD_PROT(pgprot_kernel, L_PTE_HYP | L_PTE_XN)
99-
#define PAGE_HYP_EXEC _MOD_PROT(pgprot_kernel, L_PTE_HYP | L_PTE_RDONLY)
100-
#define PAGE_HYP_RO _MOD_PROT(pgprot_kernel, L_PTE_HYP | L_PTE_RDONLY | L_PTE_XN)
101-
#define PAGE_HYP_DEVICE _MOD_PROT(pgprot_hyp_device, L_PTE_HYP)
102-
#define PAGE_S2 _MOD_PROT(pgprot_s2, L_PTE_S2_RDONLY | L_PTE_XN)
103-
#define PAGE_S2_DEVICE _MOD_PROT(pgprot_s2_device, L_PTE_S2_RDONLY | L_PTE_XN)
10495

10596
#define __PAGE_NONE __pgprot(_L_PTE_DEFAULT | L_PTE_RDONLY | L_PTE_XN | L_PTE_NONE)
10697
#define __PAGE_SHARED __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_XN)

‎arch/arm/include/asm/sections.h‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ extern char __idmap_text_start[];
1010
extern char __idmap_text_end[];
1111
extern char __entry_text_start[];
1212
extern char __entry_text_end[];
13-
extern char __hyp_idmap_text_start[];
14-
extern char __hyp_idmap_text_end[];
1513

1614
static inline bool in_entry_text(unsigned long addr)
1715
{
@@ -22,9 +20,7 @@ static inline bool in_entry_text(unsigned long addr)
2220
static inline bool in_idmap_text(unsigned long addr)
2321
{
2422
void *a = (void *)addr;
25-
return memory_contains(__idmap_text_start, __idmap_text_end, a, 1) ||
26-
memory_contains(__hyp_idmap_text_start, __hyp_idmap_text_end,
27-
a, 1);
23+
return memory_contains(__idmap_text_start, __idmap_text_end, a, 1);
2824
}
2925

3026
#endif /* _ASM_ARM_SECTIONS_H */

‎arch/arm/include/asm/virt.h‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,6 @@ static inline bool is_kernel_in_hyp_mode(void)
6767
return false;
6868
}
6969

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[];
7770
#endif
7871

7972
#else

‎arch/arm/kernel/vmlinux-xip.lds.S‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,6 @@ SECTIONS
162162
ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support")
163163
ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined")
164164

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-
173165
#ifdef CONFIG_XIP_DEFLATED_DATA
174166
/*
175167
* The .bss is used as a stack area for __inflate_kernel_data() whose stack

‎arch/arm/kernel/vmlinux.lds.S‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,4 @@ __start_rodata_section_aligned = ALIGN(__start_rodata, 1 << SECTION_SHIFT);
170170
ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support")
171171
ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined")
172172

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-
181173
#endif /* CONFIG_XIP_KERNEL */

‎arch/arm/kernel/vmlinux.lds.h‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,11 @@
3131
*(.proc.info.init) \
3232
__proc_info_end = .;
3333

34-
#define HYPERVISOR_TEXT \
35-
__hyp_text_start = .; \
36-
*(.hyp.text) \
37-
__hyp_text_end = .;
38-
3934
#define IDMAP_TEXT \
4035
ALIGN_FUNCTION(); \
4136
__idmap_text_start = .; \
4237
*(.idmap.text) \
4338
__idmap_text_end = .; \
44-
. = ALIGN(PAGE_SIZE); \
45-
__hyp_idmap_text_start = .; \
46-
*(.hyp.idmap.text) \
47-
__hyp_idmap_text_end = .;
4839

4940
#define ARM_DISCARD \
5041
*(.ARM.exidx.exit.text) \
@@ -72,7 +63,6 @@
7263
SCHED_TEXT \
7364
CPUIDLE_TEXT \
7465
LOCK_TEXT \
75-
HYPERVISOR_TEXT \
7666
KPROBES_TEXT \
7767
*(.gnu.warning) \
7868
*(.glue_7) \

‎arch/arm/mm/mmu.c‎

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ static unsigned int cachepolicy __initdata = CPOLICY_WRITEBACK;
6363
static unsigned int ecc_mask __initdata = 0;
6464
pgprot_t pgprot_user;
6565
pgprot_t pgprot_kernel;
66-
pgprot_t pgprot_hyp_device;
67-
pgprot_t pgprot_s2;
68-
pgprot_t pgprot_s2_device;
6966

7067
EXPORT_SYMBOL(pgprot_user);
7168
EXPORT_SYMBOL(pgprot_kernel);
@@ -75,15 +72,8 @@ struct cachepolicy {
7572
unsigned int cr_mask;
7673
pmdval_t pmd;
7774
pteval_t pte;
78-
pteval_t pte_s2;
7975
};
8076

81-
#ifdef CONFIG_ARM_LPAE
82-
#define s2_policy(policy) policy
83-
#else
84-
#define s2_policy(policy) 0
85-
#endif
86-
8777
unsigned long kimage_voffset __ro_after_init;
8878

8979
static struct cachepolicy cache_policies[] __initdata = {
@@ -92,31 +82,26 @@ static struct cachepolicy cache_policies[] __initdata = {
9282
.cr_mask = CR_W|CR_C,
9383
.pmd = PMD_SECT_UNCACHED,
9484
.pte = L_PTE_MT_UNCACHED,
95-
.pte_s2 = s2_policy(L_PTE_S2_MT_UNCACHED),
9685
}, {
9786
.policy = "buffered",
9887
.cr_mask = CR_C,
9988
.pmd = PMD_SECT_BUFFERED,
10089
.pte = L_PTE_MT_BUFFERABLE,
101-
.pte_s2 = s2_policy(L_PTE_S2_MT_UNCACHED),
10290
}, {
10391
.policy = "writethrough",
10492
.cr_mask = 0,
10593
.pmd = PMD_SECT_WT,
10694
.pte = L_PTE_MT_WRITETHROUGH,
107-
.pte_s2 = s2_policy(L_PTE_S2_MT_WRITETHROUGH),
10895
}, {
10996
.policy = "writeback",
11097
.cr_mask = 0,
11198
.pmd = PMD_SECT_WB,
11299
.pte = L_PTE_MT_WRITEBACK,
113-
.pte_s2 = s2_policy(L_PTE_S2_MT_WRITEBACK),
114100
}, {
115101
.policy = "writealloc",
116102
.cr_mask = 0,
117103
.pmd = PMD_SECT_WBWA,
118104
.pte = L_PTE_MT_WRITEALLOC,
119-
.pte_s2 = s2_policy(L_PTE_S2_MT_WRITEBACK),
120105
}
121106
};
122107

@@ -246,9 +231,6 @@ static struct mem_type mem_types[] __ro_after_init = {
246231
[MT_DEVICE] = { /* Strongly ordered / ARMv6 shared device */
247232
.prot_pte = PROT_PTE_DEVICE | L_PTE_MT_DEV_SHARED |
248233
L_PTE_SHARED,
249-
.prot_pte_s2 = s2_policy(PROT_PTE_S2_DEVICE) |
250-
s2_policy(L_PTE_S2_MT_DEV_SHARED) |
251-
L_PTE_SHARED,
252234
.prot_l1 = PMD_TYPE_TABLE,
253235
.prot_sect = PROT_SECT_DEVICE | PMD_SECT_S,
254236
.domain = DOMAIN_IO,
@@ -434,7 +416,6 @@ static void __init build_mem_type_table(void)
434416
struct cachepolicy *cp;
435417
unsigned int cr = get_cr();
436418
pteval_t user_pgprot, kern_pgprot, vecs_pgprot;
437-
pteval_t hyp_device_pgprot, s2_pgprot, s2_device_pgprot;
438419
int cpu_arch = cpu_architecture();
439420
int i;
440421

@@ -558,9 +539,6 @@ static void __init build_mem_type_table(void)
558539
*/
559540
cp = &cache_policies[cachepolicy];
560541
vecs_pgprot = kern_pgprot = user_pgprot = cp->pte;
561-
s2_pgprot = cp->pte_s2;
562-
hyp_device_pgprot = mem_types[MT_DEVICE].prot_pte;
563-
s2_device_pgprot = mem_types[MT_DEVICE].prot_pte_s2;
564542

565543
#ifndef CONFIG_ARM_LPAE
566544
/*
@@ -604,7 +582,6 @@ static void __init build_mem_type_table(void)
604582
user_pgprot |= L_PTE_SHARED;
605583
kern_pgprot |= L_PTE_SHARED;
606584
vecs_pgprot |= L_PTE_SHARED;
607-
s2_pgprot |= L_PTE_SHARED;
608585
mem_types[MT_DEVICE_WC].prot_sect |= PMD_SECT_S;
609586
mem_types[MT_DEVICE_WC].prot_pte |= L_PTE_SHARED;
610587
mem_types[MT_DEVICE_CACHED].prot_sect |= PMD_SECT_S;
@@ -666,9 +643,6 @@ static void __init build_mem_type_table(void)
666643
pgprot_user = __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | user_pgprot);
667644
pgprot_kernel = __pgprot(L_PTE_PRESENT | L_PTE_YOUNG |
668645
L_PTE_DIRTY | kern_pgprot);
669-
pgprot_s2 = __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | s2_pgprot);
670-
pgprot_s2_device = __pgprot(s2_device_pgprot);
671-
pgprot_hyp_device = __pgprot(hyp_device_pgprot);
672646

673647
mem_types[MT_LOW_VECTORS].prot_l1 |= ecc_mask;
674648
mem_types[MT_HIGH_VECTORS].prot_l1 |= ecc_mask;

0 commit comments

Comments
 (0)