From 3615d01114047ffce3a0942c21e6402c7b49bb3f Mon Sep 17 00:00:00 2001 From: Vasily Gorbik Date: Mon, 30 Jan 2023 00:57:12 +0100 Subject: [PATCH] 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 Signed-off-by: Vasily Gorbik Signed-off-by: Heiko Carstens --- arch/s390/include/asm/mem_detect.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/s390/include/asm/mem_detect.h b/arch/s390/include/asm/mem_detect.h index 058ac2647eb7..08798ddf5143 100644 --- a/arch/s390/include/asm/mem_detect.h +++ b/arch/s390/include/asm/mem_detect.h @@ -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) {