diff options
author | Vasily Gorbik <gor@linux.ibm.com> | 2023-01-28 23:55:04 +0100 |
---|---|---|
committer | Heiko Carstens <hca@linux.ibm.com> | 2023-02-06 11:13:54 +0100 |
commit | bf64f0517e5d0d8f3248143fc49535c1d1594b4f (patch) | |
tree | ccfc742dbf1f7d39fd3dbc308bcae23f938040ed /arch/s390/boot/mem_detect.c | |
parent | 22476f47b6b7fb7d066c71f67ebc11892adb0849 (diff) |
s390/mem_detect: handle online memory limit just once
Introduce mem_detect_truncate() to cut any online memory ranges above
established identity mapping size, so that mem_detect users wouldn't
have to do it over and over again.
Suggested-by: Alexander Gordeev <agordeev@linux.ibm.com>
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>
Diffstat (limited to 'arch/s390/boot/mem_detect.c')
-rw-r--r-- | arch/s390/boot/mem_detect.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/s390/boot/mem_detect.c b/arch/s390/boot/mem_detect.c index daa159317183..3058d397a9da 100644 --- a/arch/s390/boot/mem_detect.c +++ b/arch/s390/boot/mem_detect.c @@ -171,3 +171,21 @@ unsigned long detect_memory(unsigned long *safe_addr) return max_physmem_end; } + +void mem_detect_truncate(unsigned long limit) +{ + struct mem_detect_block *block; + int i; + + for (i = 0; i < mem_detect.count; i++) { + block = __get_mem_detect_block_ptr(i); + if (block->start >= limit) { + mem_detect.count = i; + break; + } else if (block->end > limit) { + block->end = (u64)limit; + mem_detect.count = i + 1; + break; + } + } +} |