summaryrefslogtreecommitdiff
path: root/arch/s390/include
diff options
context:
space:
mode:
authorVasily Gorbik <gor@linux.ibm.com>2023-01-30 00:57:12 +0100
committerHeiko Carstens <hca@linux.ibm.com>2023-02-06 11:13:54 +0100
commit3615d01114047ffce3a0942c21e6402c7b49bb3f (patch)
tree375013583ebfa21be3f04e41f625028601130af8 /arch/s390/include
parentbf64f0517e5d0d8f3248143fc49535c1d1594b4f (diff)
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>
Diffstat (limited to 'arch/s390/include')
-rw-r--r--arch/s390/include/asm/mem_detect.h11
1 files changed, 11 insertions, 0 deletions
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)
{