s390: make sure vmemmap is top region table entry aligned
authorVasily Gorbik <gor@linux.ibm.com>
Thu, 15 Oct 2020 08:20:08 +0000 (10:20 +0200)
committerHeiko Carstens <hca@linux.ibm.com>
Mon, 9 Nov 2020 10:20:58 +0000 (11:20 +0100)
Since commit 29d37e5b82f3 ("s390/protvirt: add ultravisor initialization")
vmax is adjusted to the ultravisor secure storage limit. This limit is
currently applied when 4-level paging is used. Later vmax is also used
to align vmemmap address to the top region table entry border. When vmax
is set to the ultravisor secure storage limit this is no longer the case.

Instead of changing vmax, make only MODULES_END be affected by the
secure storage limit, so that vmax stays intact for further vmemmap
address alignment.

Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/kernel/setup.c

index 2076415aee4b667f5e8a38b04d9914a1290830e7..02bccee5ee85bf26ef0ee1bf1e6e80f808acc0ff 100644 (file)
@@ -568,13 +568,14 @@ static void __init setup_memory_end(void)
                vmax = _REGION2_SIZE; /* 3-level kernel page table */
        else
                vmax = _REGION1_SIZE; /* 4-level kernel page table */
+       /* module area is at the end of the kernel address space. */
+       MODULES_END = vmax;
        if (is_prot_virt_host())
-               adjust_to_uv_max(&vmax);
+               adjust_to_uv_max(&MODULES_END);
 #ifdef CONFIG_KASAN
-       vmax = kasan_vmax;
+       vmax = _REGION1_SIZE;
+       MODULES_END = kasan_vmax;
 #endif
-       /* module area is at the end of the kernel address space. */
-       MODULES_END = vmax;
        MODULES_VADDR = MODULES_END - MODULES_LEN;
        VMALLOC_END = MODULES_VADDR;
        VMALLOC_START = VMALLOC_END - vmalloc_size;