ARM: mm: Get rid of L_PTE_USER ref from PAGE_S2_DEVICE
PATCH 1/1 ARM: mm: Get rid of L_PTE_USER ref from PAGE_S2_DEVICE
THe L_PTE_USER actually has nothing to do with stage 2 mappings and the L_PTE_S2_RDONLY value sets the readable bit, which was what L_PTE_USER was used for before proper handling of stage 2 memory defines.
--- arch/arm/include/asm/pgtable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/include/asm/pgtable.h +1 -1
@@ -88,7 +88,7 @@ extern pgprot_t pgprot_s2_device;#define PAGE_HYP _MOD_PROT(pgprot_kernel, L_PTE_HYP)#define PAGE_HYP_DEVICE _MOD_PROT(pgprot_hyp_device, L_PTE_HYP)#define PAGE_S2 _MOD_PROT(pgprot_s2, L_PTE_S2_RDONLY) -#define PAGE_S2_DEVICE _MOD_PROT(pgprot_s2_device, L_PTE_USER | L_PTE_S2_RDONLY) +#define PAGE_S2_DEVICE _MOD_PROT(pgprot_s2_device, L_PTE_S2_RDONLY)#define __PAGE_NONE __pgprot(_L_PTE_DEFAULT | L_PTE_RDONLY | L_PTE_XN | L_PTE_NONE)#define __PAGE_SHARED __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_XN)
Signature · 1 line
1.7.10.4
PATCH 1/1 ARM: mm: Get rid of L_PTE_USER ref from PAGE_S2_DEVICE
Quoted 15 lines · Christoffer Dall
THe
L_PTE_USERactually has nothing to do with stage 2 mappings and theL_PTE_S2_RDONLYvalue sets the readable bit, which was whatL_PTE_USERwas used for before proper handling of stage 2 memory defines.Signed-off-by Christoffer Dall <[email protected]>--- arch/arm/include/asm/pgtable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/include/asm/pgtable.h +0
-0
arch/arm/include/asm/pgtable.h extern pgprot_t pgprot_s2_device; · line 94
Quoted 8 lines
arch/arm/include/asm/pgtable.h +1
-1@@ -88,7 +88,7 @@ extern pgprot_t pgprot_s2_device;#define PAGE_HYP _MOD_PROT(pgprot_kernel, L_PTE_HYP)#define PAGE_HYP_DEVICE _MOD_PROT(pgprot_hyp_device, L_PTE_HYP)#define PAGE_S2 _MOD_PROT(pgprot_s2, L_PTE_S2_RDONLY) -#define PAGE_S2_DEVICE _MOD_PROT(pgprot_s2_device, L_PTE_USER | L_PTE_S2_RDONLY) +#define PAGE_S2_DEVICE _MOD_PROT(pgprot_s2_device, L_PTE_S2_RDONLY)#define __PAGE_NONE __pgprot(_L_PTE_DEFAULT | L_PTE_RDONLY | L_PTE_XN
|
Quoted 2 lines
L_PTE_NONE)
#define__PAGE_SHARED__pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_XN)
Good catch.
While we're at it, why not directly set it to be RW instead of RO? The only use of PAGE_S2_DEVICE immediately sets the writeable bit anyway.
M.
Signature · 1 line
Fast, cheap, reliable. Pick two.
PATCH 1/1 ARM: mm: Get rid of L_PTE_USER ref from PAGE_S2_DEVICE
Quoted 26 lines · Marc Zyngier
Quoted 15 lines · Christoffer Dall
THe
L_PTE_USERactually has nothing to do with stage 2 mappings and theL_PTE_S2_RDONLYvalue sets the readable bit, which was whatL_PTE_USERwas used for before proper handling of stage 2 memory defines.Signed-off-by Christoffer Dall <[email protected]>--- arch/arm/include/asm/pgtable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/include/asm/pgtable.h +0
-0arch/arm/include/asm/pgtable.h extern pgprot_t pgprot_s2_device; · line 94
Quoted 8 lines
arch/arm/include/asm/pgtable.h +1
-1@@ -88,7 +88,7 @@ extern pgprot_t pgprot_s2_device;#define PAGE_HYP _MOD_PROT(pgprot_kernel, L_PTE_HYP)#define PAGE_HYP_DEVICE _MOD_PROT(pgprot_hyp_device, L_PTE_HYP)#define PAGE_S2 _MOD_PROT(pgprot_s2, L_PTE_S2_RDONLY) -#define PAGE_S2_DEVICE _MOD_PROT(pgprot_s2_device, L_PTE_USER | L_PTE_S2_RDONLY) +#define PAGE_S2_DEVICE _MOD_PROT(pgprot_s2_device, L_PTE_S2_RDONLY)#define __PAGE_NONE __pgprot(_L_PTE_DEFAULT | L_PTE_RDONLY | L_PTE_XN|
Quoted 8 lines
Quoted 2 lines
L_PTE_NONE)
#define__PAGE_SHARED__pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_XN)Good catch.
While we're at it, why not directly set it to be RW instead of RO? The only use of
PAGE_S2_DEVICEimmediately sets the writeable bit anyway.
hmm, any potential future uses of read-only device mappings? It seems "easier" to or on write permissions than remove them, or maybe I'm imagining things...