Merge tag 's390-5.12-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
[platform/kernel/linux-rpi.git] / arch / s390 / mm / vmem.c
index 77afa28..96897fa 100644 (file)
@@ -4,6 +4,7 @@
  *    Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
  */
 
+#include <linux/memory_hotplug.h>
 #include <linux/memblock.h>
 #include <linux/pfn.h>
 #include <linux/mm.h>
@@ -532,11 +533,22 @@ void vmem_remove_mapping(unsigned long start, unsigned long size)
        mutex_unlock(&vmem_mutex);
 }
 
+struct range arch_get_mappable_range(void)
+{
+       struct range mhp_range;
+
+       mhp_range.start = 0;
+       mhp_range.end =  VMEM_MAX_PHYS - 1;
+       return mhp_range;
+}
+
 int vmem_add_mapping(unsigned long start, unsigned long size)
 {
+       struct range range = arch_get_mappable_range();
        int ret;
 
-       if (start + size > VMEM_MAX_PHYS ||
+       if (start < range.start ||
+           start + size > range.end + 1 ||
            start + size < start)
                return -ERANGE;