Skip to content

Commit 54372cf

Browse files
author
Alexander Gordeev
committed
Revert "s390/mm: get rid of VMEM_MAX_PHYS macro"
This reverts commit 456be42. The assumption VMEM_MAX_PHYS should match ident_map_size is wrong. At least discontiguous saved segments (DCSS) could be loaded at addresses beyond ident_map_size and dcssblk device driver might fail as result. Reported-by: Gerald Schaefer <[email protected]> Signed-off-by: Alexander Gordeev <[email protected]>
1 parent 6aca56c commit 54372cf

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed

arch/s390/boot/startup.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ static unsigned long setup_kernel_memory_layout(void)
220220
pages = SECTION_ALIGN_UP(pages);
221221
/* keep vmemmap_start aligned to a top level region table entry */
222222
vmemmap_start = round_down(VMALLOC_START - pages * sizeof(struct page), rte_size);
223+
/* vmemmap_start is the future VMEM_MAX_PHYS, make sure it is within MAX_PHYSMEM */
223224
vmemmap_start = min(vmemmap_start, 1UL << MAX_PHYSMEM_BITS);
224225
/* make sure identity map doesn't overlay with vmemmap */
225226
ident_map_size = min(ident_map_size, vmemmap_start);

arch/s390/include/asm/pgtable.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ extern unsigned long __bootdata_preserved(VMALLOC_END);
8989
extern struct page *__bootdata_preserved(vmemmap);
9090
extern unsigned long __bootdata_preserved(vmemmap_size);
9191

92+
#define VMEM_MAX_PHYS ((unsigned long) vmemmap)
93+
9294
extern unsigned long __bootdata_preserved(MODULES_VADDR);
9395
extern unsigned long __bootdata_preserved(MODULES_END);
9496
#define MODULES_VADDR MODULES_VADDR

arch/s390/mm/extmem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ void segment_warning(int rc, char *seg_name)
642642
break;
643643
case -ERANGE:
644644
pr_err("DCSS %s exceeds the kernel mapping range (%lu) "
645-
"and cannot be loaded\n", seg_name, ident_map_size);
645+
"and cannot be loaded\n", seg_name, VMEM_MAX_PHYS);
646646
break;
647647
default:
648648
break;

arch/s390/mm/vmem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ struct range arch_get_mappable_range(void)
531531
struct range mhp_range;
532532

533533
mhp_range.start = 0;
534-
mhp_range.end = ident_map_size - 1;
534+
mhp_range.end = VMEM_MAX_PHYS - 1;
535535
return mhp_range;
536536
}
537537

drivers/s390/char/sclp_cmd.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,10 @@ static void __init add_memory_merged(u16 rn)
392392
goto skip_add;
393393
start = rn2addr(first_rn);
394394
size = (unsigned long long) num * sclp.rzm;
395-
if (start >= ident_map_size)
395+
if (start >= VMEM_MAX_PHYS)
396396
goto skip_add;
397-
if (start + size > ident_map_size)
398-
size = ident_map_size - start;
397+
if (start + size > VMEM_MAX_PHYS)
398+
size = VMEM_MAX_PHYS - start;
399399
if (start >= ident_map_size)
400400
goto skip_add;
401401
if (start + size > ident_map_size)

0 commit comments

Comments
 (0)