Skip to content

Commit fc7b7e9

Browse files
author
AKASHI Takahiro
committed
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>
1 parent a6bc75e commit fc7b7e9

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

include/linux/memblock.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ int memblock_mark_hotplug(phys_addr_t base, phys_addr_t size);
8484
int memblock_clear_hotplug(phys_addr_t base, phys_addr_t size);
8585
int memblock_mark_mirror(phys_addr_t base, phys_addr_t size);
8686
int memblock_mark_nomap(phys_addr_t base, phys_addr_t size);
87+
int memblock_clear_nomap(phys_addr_t base, phys_addr_t size);
8788
ulong choose_memblock_flags(void);
8889

8990
/* Low level functions */

mm/memblock.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,18 @@ int __init_memblock memblock_mark_nomap(phys_addr_t base, phys_addr_t size)
834834
return memblock_setclr_flag(base, size, 1, MEMBLOCK_NOMAP);
835835
}
836836

837+
/**
838+
* memblock_clear_nomap - Clear flag MEMBLOCK_NOMAP for a specified region.
839+
* @base: the base phys addr of the region
840+
* @size: the size of the region
841+
*
842+
* Return 0 on success, -errno on failure.
843+
*/
844+
int __init_memblock memblock_clear_nomap(phys_addr_t base, phys_addr_t size)
845+
{
846+
return memblock_setclr_flag(base, size, 0, MEMBLOCK_NOMAP);
847+
}
848+
837849
/**
838850
* __next_reserved_mem_region - next function for for_each_reserved_region()
839851
* @idx: pointer to u64 loop variable

0 commit comments

Comments
 (0)