s390/mm: get rid of VMEM_MAX_PHYS macro
authorAlexander Gordeev <agordeev@linux.ibm.com>
Sat, 17 Jun 2023 18:58:18 +0000 (20:58 +0200)
committerAlexander Gordeev <agordeev@linux.ibm.com>
Wed, 28 Jun 2023 11:57:08 +0000 (13:57 +0200)
VMEM_MAX_PHYS is supposed to be the highest physical
address that can be added to the identity mapping.
It should match ident_map_size, which has the same
meaning. However, unlike ident_map_size it is not
adjusted against various limiting factors (see the
comment to setup_ident_map_size() function). That
renders all checks against VMEM_MAX_PHYS invalid.

Further, VMEM_MAX_PHYS is currently set to vmemmap,
which is an address in virtual memory space. However,
it gets compared against physical addresses in various
locations. That works, because both address spaces
are the same on s390, but otherwise it is wrong.

Instead of fixing VMEM_MAX_PHYS misuse and semantics
just remove it.

Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
arch/s390/boot/startup.c
arch/s390/include/asm/pgtable.h
arch/s390/mm/extmem.c
arch/s390/mm/vmem.c
drivers/s390/char/sclp_cmd.c

index 64bd7ac3e35d1beda4fa067b10e6f0828990bde1..de264a20b132b12aee58b5226082c21e07bd1929 100644 (file)
@@ -220,7 +220,6 @@ static unsigned long setup_kernel_memory_layout(void)
        pages = SECTION_ALIGN_UP(pages);
        /* keep vmemmap_start aligned to a top level region table entry */
        vmemmap_start = round_down(VMALLOC_START - pages * sizeof(struct page), rte_size);
-       /* vmemmap_start is the future VMEM_MAX_PHYS, make sure it is within MAX_PHYSMEM */
        vmemmap_start = min(vmemmap_start, 1UL << MAX_PHYSMEM_BITS);
        /* make sure identity map doesn't overlay with vmemmap */
        ident_map_size = min(ident_map_size, vmemmap_start);
index c55f3c3365af8eea424648cc9ba319a33ffdf367..30909fe27c24bb2f2acf5438cb27dbca8df7d1be 100644 (file)
@@ -89,8 +89,6 @@ extern unsigned long __bootdata_preserved(VMALLOC_END);
 extern struct page *__bootdata_preserved(vmemmap);
 extern unsigned long __bootdata_preserved(vmemmap_size);
 
-#define VMEM_MAX_PHYS ((unsigned long) vmemmap)
-
 extern unsigned long __bootdata_preserved(MODULES_VADDR);
 extern unsigned long __bootdata_preserved(MODULES_END);
 #define MODULES_VADDR  MODULES_VADDR
index 1bc42ce2659908778078528a67c169c4c719f6a0..f4d371901bf4ce96bbed5ed1f233b10a568848b5 100644 (file)
@@ -642,7 +642,7 @@ void segment_warning(int rc, char *seg_name)
                break;
        case -ERANGE:
                pr_err("DCSS %s exceeds the kernel mapping range (%lu) "
-                      "and cannot be loaded\n", seg_name, VMEM_MAX_PHYS);
+                      "and cannot be loaded\n", seg_name, ident_map_size);
                break;
        default:
                break;
index b9dcb4ae6c59aea5a9fdf5e52e4d49a09f4d0721..240950c12217753598adfe90941fc53e9d3e1fb5 100644 (file)
@@ -529,7 +529,7 @@ struct range arch_get_mappable_range(void)
        struct range mhp_range;
 
        mhp_range.start = 0;
-       mhp_range.end =  VMEM_MAX_PHYS - 1;
+       mhp_range.end = ident_map_size - 1;
        return mhp_range;
 }
 
index 3c87057436d5419fdd26eab16fbf3f927abea4d4..594b34cf1c2b390b5292632578d9857ecb68ccc5 100644 (file)
@@ -392,10 +392,10 @@ static void __init add_memory_merged(u16 rn)
                goto skip_add;
        start = rn2addr(first_rn);
        size = (unsigned long long) num * sclp.rzm;
-       if (start >= VMEM_MAX_PHYS)
+       if (start >= ident_map_size)
                goto skip_add;
-       if (start + size > VMEM_MAX_PHYS)
-               size = VMEM_MAX_PHYS - start;
+       if (start + size > ident_map_size)
+               size = ident_map_size - start;
        if (start >= ident_map_size)
                goto skip_add;
        if (start + size > ident_map_size)