diff options
author | Heiko Carstens <hca@linux.ibm.com> | 2021-07-28 21:02:51 +0200 |
---|---|---|
committer | Heiko Carstens <hca@linux.ibm.com> | 2021-07-30 17:09:01 +0200 |
commit | b3e1a00c8fa41a80aa402e5ca7f8cc78efa4f50b (patch) | |
tree | ff8158a36df838adf6e21e35f9b880d3550762c5 /arch/s390/mm | |
parent | kfence, x86: only define helpers if !MODULE (diff) | |
download | linux-b3e1a00c8fa41a80aa402e5ca7f8cc78efa4f50b.tar.xz linux-b3e1a00c8fa41a80aa402e5ca7f8cc78efa4f50b.zip |
s390/mm: implement set_memory_4k()
Implement set_memory_4k() which will split any present large or huge
mapping in the given range to a 4k mapping.
Link: https://lore.kernel.org/r/20210728190254.3921642-2-hca@linux.ibm.com
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Diffstat (limited to 'arch/s390/mm')
-rw-r--r-- | arch/s390/mm/pageattr.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/arch/s390/mm/pageattr.c b/arch/s390/mm/pageattr.c index ed8e5b3575d5..2ad95e5c79c1 100644 --- a/arch/s390/mm/pageattr.c +++ b/arch/s390/mm/pageattr.c @@ -85,6 +85,8 @@ static int walk_pte_level(pmd_t *pmdp, unsigned long addr, unsigned long end, { pte_t *ptep, new; + if ((flags & SET_MEMORY_4K) == SET_MEMORY_4K) + return 0; ptep = pte_offset_kernel(pmdp, addr); do { new = *ptep; @@ -155,6 +157,7 @@ static int walk_pmd_level(pud_t *pudp, unsigned long addr, unsigned long end, unsigned long flags) { unsigned long next; + int need_split; pmd_t *pmdp; int rc = 0; @@ -164,7 +167,10 @@ static int walk_pmd_level(pud_t *pudp, unsigned long addr, unsigned long end, return -EINVAL; next = pmd_addr_end(addr, end); if (pmd_large(*pmdp)) { - if (addr & ~PMD_MASK || addr + PMD_SIZE > next) { + need_split = !!(flags & SET_MEMORY_4K); + need_split |= !!(addr & ~PMD_MASK); + need_split |= !!(addr + PMD_SIZE > next); + if (need_split) { rc = split_pmd_page(pmdp, addr); if (rc) return rc; @@ -232,6 +238,7 @@ static int walk_pud_level(p4d_t *p4d, unsigned long addr, unsigned long end, unsigned long flags) { unsigned long next; + int need_split; pud_t *pudp; int rc = 0; @@ -241,7 +248,10 @@ static int walk_pud_level(p4d_t *p4d, unsigned long addr, unsigned long end, return -EINVAL; next = pud_addr_end(addr, end); if (pud_large(*pudp)) { - if (addr & ~PUD_MASK || addr + PUD_SIZE > next) { + need_split = !!(flags & SET_MEMORY_4K); + need_split |= !!(addr & ~PUD_MASK); + need_split |= !!(addr + PUD_SIZE > next); + if (need_split) { rc = split_pud_page(pudp, addr); if (rc) break; |