s390/mem_detect: add get_mem_detect_online_total()

Add a function to get online memory in total. It is supposed to be used
in the decompressor as well as during early kernel startup.

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>
This commit is contained in:
Vasily Gorbik 2023-01-30 00:57:12 +01:00 committed by Heiko Carstens
parent bf64f0517e
commit 3615d01114

View File

@ -66,6 +66,17 @@ static inline int __get_mem_detect_block(u32 n, unsigned long *start,
i < mem_detect.count; \
i++, __get_mem_detect_block(i, p_start, p_end))
static inline unsigned long get_mem_detect_online_total(void)
{
unsigned long start, end, total = 0;
int i;
for_each_mem_detect_block(i, &start, &end)
total += end - start;
return total;
}
static inline void get_mem_detect_reserved(unsigned long *start,
unsigned long *size)
{