Commit afb6d064 authored by Michael Ellerman's avatar Michael Ellerman

powerpc/mm/radix: Display if mappings are exec or not

At boot we print the ranges we've mapped for the linear mapping and
what page size we've used. Also track whether the range is mapped
executable or not and display that as well.
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 232aa407
...@@ -241,9 +241,8 @@ void radix__mark_initmem_nx(void) ...@@ -241,9 +241,8 @@ void radix__mark_initmem_nx(void)
} }
#endif /* CONFIG_STRICT_KERNEL_RWX */ #endif /* CONFIG_STRICT_KERNEL_RWX */
static inline void __meminit print_mapping(unsigned long start, static inline void __meminit
unsigned long end, print_mapping(unsigned long start, unsigned long end, unsigned long size, bool exec)
unsigned long size)
{ {
char buf[10]; char buf[10];
...@@ -252,7 +251,8 @@ static inline void __meminit print_mapping(unsigned long start, ...@@ -252,7 +251,8 @@ static inline void __meminit print_mapping(unsigned long start,
string_get_size(size, 1, STRING_UNITS_2, buf, sizeof(buf)); string_get_size(size, 1, STRING_UNITS_2, buf, sizeof(buf));
pr_info("Mapped 0x%016lx-0x%016lx with %s pages\n", start, end, buf); pr_info("Mapped 0x%016lx-0x%016lx with %s pages%s\n", start, end, buf,
exec ? " (exec)" : "");
} }
static unsigned long next_boundary(unsigned long addr, unsigned long end) static unsigned long next_boundary(unsigned long addr, unsigned long end)
...@@ -269,6 +269,7 @@ static int __meminit create_physical_mapping(unsigned long start, ...@@ -269,6 +269,7 @@ static int __meminit create_physical_mapping(unsigned long start,
int nid) int nid)
{ {
unsigned long vaddr, addr, mapping_size = 0; unsigned long vaddr, addr, mapping_size = 0;
bool prev_exec, exec = false;
pgprot_t prot; pgprot_t prot;
int psize; int psize;
...@@ -279,6 +280,7 @@ static int __meminit create_physical_mapping(unsigned long start, ...@@ -279,6 +280,7 @@ static int __meminit create_physical_mapping(unsigned long start,
gap = next_boundary(addr, end) - addr; gap = next_boundary(addr, end) - addr;
previous_size = mapping_size; previous_size = mapping_size;
prev_exec = exec;
if (IS_ALIGNED(addr, PUD_SIZE) && gap >= PUD_SIZE && if (IS_ALIGNED(addr, PUD_SIZE) && gap >= PUD_SIZE &&
mmu_psize_defs[MMU_PAGE_1G].shift) { mmu_psize_defs[MMU_PAGE_1G].shift) {
...@@ -293,18 +295,21 @@ static int __meminit create_physical_mapping(unsigned long start, ...@@ -293,18 +295,21 @@ static int __meminit create_physical_mapping(unsigned long start,
psize = mmu_virtual_psize; psize = mmu_virtual_psize;
} }
if (mapping_size != previous_size) {
print_mapping(start, addr, previous_size);
start = addr;
}
vaddr = (unsigned long)__va(addr); vaddr = (unsigned long)__va(addr);
if (overlaps_kernel_text(vaddr, vaddr + mapping_size) || if (overlaps_kernel_text(vaddr, vaddr + mapping_size) ||
overlaps_interrupt_vector_text(vaddr, vaddr + mapping_size)) overlaps_interrupt_vector_text(vaddr, vaddr + mapping_size)) {
prot = PAGE_KERNEL_X; prot = PAGE_KERNEL_X;
else exec = true;
} else {
prot = PAGE_KERNEL; prot = PAGE_KERNEL;
exec = false;
}
if (mapping_size != previous_size || exec != prev_exec) {
print_mapping(start, addr, previous_size, prev_exec);
start = addr;
}
rc = __map_kernel_page(vaddr, addr, prot, mapping_size, nid, start, end); rc = __map_kernel_page(vaddr, addr, prot, mapping_size, nid, start, end);
if (rc) if (rc)
...@@ -313,7 +318,7 @@ static int __meminit create_physical_mapping(unsigned long start, ...@@ -313,7 +318,7 @@ static int __meminit create_physical_mapping(unsigned long start,
update_page_count(psize, 1); update_page_count(psize, 1);
} }
print_mapping(start, addr, mapping_size); print_mapping(start, addr, mapping_size, exec);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment