Commit f9b2d96c authored by Heiko Carstens's avatar Heiko Carstens Committed by Vasily Gorbik

s390/mm: use set_memory_*() helpers instead of open coding

Given that set_memory_rox() and set_memory_rwnx() exist, it is possible
to get rid of all open coded __set_memory() usages and replace them with
proper helper calls everywhere.
Reviewed-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parent f0a2a7c5
......@@ -41,7 +41,7 @@ void *alloc_insn_page(void)
page = module_alloc(PAGE_SIZE);
if (!page)
return NULL;
__set_memory((unsigned long) page, 1, SET_MEMORY_RO | SET_MEMORY_X);
set_memory_rox((unsigned long)page, 1);
return page;
}
......
......@@ -176,9 +176,8 @@ void __init mem_init(void)
void free_initmem(void)
{
__set_memory((unsigned long)_sinittext,
(unsigned long)(_einittext - _sinittext) >> PAGE_SHIFT,
SET_MEMORY_RW | SET_MEMORY_NX);
set_memory_rwnx((unsigned long)_sinittext,
(unsigned long)(_einittext - _sinittext) >> PAGE_SHIFT);
free_initmem_default(POISON_FREE_INITMEM);
}
......
......@@ -732,30 +732,24 @@ void __init vmem_map_init(void)
memblock_region_cmp, memblock_region_swap);
__for_each_mem_range(i, &memblock.memory, &memory_rwx,
NUMA_NO_NODE, MEMBLOCK_NONE, &base, &end, NULL) {
__set_memory((unsigned long)__va(base),
(end - base) >> PAGE_SHIFT,
SET_MEMORY_RW | SET_MEMORY_NX);
set_memory_rwnx((unsigned long)__va(base),
(end - base) >> PAGE_SHIFT);
}
#ifdef CONFIG_KASAN
for_each_mem_range(i, &base, &end)
__set_memory(__sha(base),
(__sha(end) - __sha(base)) >> PAGE_SHIFT,
SET_MEMORY_RW | SET_MEMORY_NX);
for_each_mem_range(i, &base, &end) {
set_memory_rwnx(__sha(base),
(__sha(end) - __sha(base)) >> PAGE_SHIFT);
}
#endif
__set_memory((unsigned long)_stext,
(unsigned long)(_etext - _stext) >> PAGE_SHIFT,
SET_MEMORY_RO | SET_MEMORY_X);
__set_memory((unsigned long)_etext,
(unsigned long)(__end_rodata - _etext) >> PAGE_SHIFT,
SET_MEMORY_RO);
__set_memory((unsigned long)_sinittext,
(unsigned long)(_einittext - _sinittext) >> PAGE_SHIFT,
SET_MEMORY_RO | SET_MEMORY_X);
__set_memory(__stext_amode31,
(__etext_amode31 - __stext_amode31) >> PAGE_SHIFT,
SET_MEMORY_RO | SET_MEMORY_X);
set_memory_rox((unsigned long)_stext,
(unsigned long)(_etext - _stext) >> PAGE_SHIFT);
set_memory_ro((unsigned long)_etext,
(unsigned long)(__end_rodata - _etext) >> PAGE_SHIFT);
set_memory_rox((unsigned long)_sinittext,
(unsigned long)(_einittext - _sinittext) >> PAGE_SHIFT);
set_memory_rox(__stext_amode31,
(__etext_amode31 - __stext_amode31) >> PAGE_SHIFT);
/* lowcore must be executable for LPSWE */
if (static_key_enabled(&cpu_has_bear))
......
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