memblock: add memblock_clear_nomap()
authorAKASHI Takahiro <takahiro.akashi@linaro.org>
Mon, 3 Apr 2017 02:23:54 +0000 (11:23 +0900)
committerAKASHI Takahiro <takahiro.akashi@linaro.org>
Mon, 19 Jun 2017 06:09:01 +0000 (15:09 +0900)
This function, with a combination of memblock_mark_nomap(), will be used
in a later kdump patch for arm64 when it temporarily isolates some range
of memory from the other memory blocks in order to create a specific
kernel mapping at boot time.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
include/linux/memblock.h
mm/memblock.c

index 86d411c6a1b5206b2fe1292ed2a34b6e23145684..da54a139e6f4eb2cc7da297e0ce9e4719646c2fc 100644 (file)
@@ -84,6 +84,7 @@ int memblock_mark_hotplug(phys_addr_t base, phys_addr_t size);
 int memblock_clear_hotplug(phys_addr_t base, phys_addr_t size);
 int memblock_mark_mirror(phys_addr_t base, phys_addr_t size);
 int memblock_mark_nomap(phys_addr_t base, phys_addr_t size);
+int memblock_clear_nomap(phys_addr_t base, phys_addr_t size);
 ulong choose_memblock_flags(void);
 
 /* Low level functions */
index 40402dcf1f2f84d447f873eac295902f907211d6..aa321a212a87975285945d460105b57db8e4ac2d 100644 (file)
@@ -834,6 +834,18 @@ int __init_memblock memblock_mark_nomap(phys_addr_t base, phys_addr_t size)
        return memblock_setclr_flag(base, size, 1, MEMBLOCK_NOMAP);
 }
 
+/**
+ * memblock_clear_nomap - Clear flag MEMBLOCK_NOMAP for a specified region.
+ * @base: the base phys addr of the region
+ * @size: the size of the region
+ *
+ * Return 0 on success, -errno on failure.
+ */
+int __init_memblock memblock_clear_nomap(phys_addr_t base, phys_addr_t size)
+{
+       return memblock_setclr_flag(base, size, 0, MEMBLOCK_NOMAP);
+}
+
 /**
  * __next_reserved_mem_region - next function for for_each_reserved_region()
  * @idx: pointer to u64 loop variable