Skip to content

Commit a142d0a

Browse files
committed
memblock: Permit existing reserved regions to be marked RSRV_KERN
Permit existing memblock reservations to be marked as RSRV_KERN. This will be used by the EFI code on x86 to distinguish between reservations of boot services data regions that have actual significance to the kernel and regions that are reserved temporarily to work around buggy firmware. Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
1 parent 5d0faa8 commit a142d0a

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

include/linux/memblock.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ int memblock_mark_mirror(phys_addr_t base, phys_addr_t size);
155155
int memblock_mark_nomap(phys_addr_t base, phys_addr_t size);
156156
int memblock_clear_nomap(phys_addr_t base, phys_addr_t size);
157157
int memblock_reserved_mark_noinit(phys_addr_t base, phys_addr_t size);
158+
int memblock_reserved_mark_kern(phys_addr_t base, phys_addr_t size);
158159
int memblock_mark_kho_scratch(phys_addr_t base, phys_addr_t size);
159160
int memblock_clear_kho_scratch(phys_addr_t base, phys_addr_t size);
160161

mm/memblock.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,6 +1115,21 @@ int __init_memblock memblock_reserved_mark_noinit(phys_addr_t base, phys_addr_t
11151115
MEMBLOCK_RSRV_NOINIT);
11161116
}
11171117

1118+
/**
1119+
* memblock_reserved_mark_kern - Mark a reserved memory region with flag
1120+
* MEMBLOCK_RSRV_KERN
1121+
*
1122+
* @base: the base phys addr of the region
1123+
* @size: the size of the region
1124+
*
1125+
* Return: 0 on success, -errno on failure.
1126+
*/
1127+
int __init_memblock memblock_reserved_mark_kern(phys_addr_t base, phys_addr_t size)
1128+
{
1129+
return memblock_setclr_flag(&memblock.reserved, base, size, 1,
1130+
MEMBLOCK_RSRV_KERN);
1131+
}
1132+
11181133
/**
11191134
* memblock_mark_kho_scratch - Mark a memory region as MEMBLOCK_KHO_SCRATCH.
11201135
* @base: the base phys addr of the region

0 commit comments

Comments
 (0)