Commit 3acb7bc37d56d5dc80112459c0d72c6be8bde3c9

Authored by AKASHI Takahiro
1 parent f1aa865ae5

memblock: add memblock_clear_nomap()

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>

Showing 2 changed files with 13 additions and 0 deletions Side-by-side Diff

include/linux/memblock.h
... ... @@ -92,6 +92,7 @@
92 92 int memblock_clear_hotplug(phys_addr_t base, phys_addr_t size);
93 93 int memblock_mark_mirror(phys_addr_t base, phys_addr_t size);
94 94 int memblock_mark_nomap(phys_addr_t base, phys_addr_t size);
  95 +int memblock_clear_nomap(phys_addr_t base, phys_addr_t size);
95 96 ulong choose_memblock_flags(void);
96 97  
97 98 /* Low level functions */
... ... @@ -814,6 +814,18 @@
814 814 }
815 815  
816 816 /**
  817 + * memblock_clear_nomap - Clear flag MEMBLOCK_NOMAP for a specified region.
  818 + * @base: the base phys addr of the region
  819 + * @size: the size of the region
  820 + *
  821 + * Return 0 on success, -errno on failure.
  822 + */
  823 +int __init_memblock memblock_clear_nomap(phys_addr_t base, phys_addr_t size)
  824 +{
  825 + return memblock_setclr_flag(base, size, 0, MEMBLOCK_NOMAP);
  826 +}
  827 +
  828 +/**
817 829 * __next_reserved_mem_region - next function for for_each_reserved_region()
818 830 * @idx: pointer to u64 loop variable
819 831 * @out_start: ptr to phys_addr_t for start address of the region, can be %NULL