Skip to content

Commit 0bcff59

Browse files
abrestic-rivosardbiesheuvel
authored andcommitted
efi: Don't add memblocks for soft-reserved memory
Adding memblocks for soft-reserved regions prevents them from later being hotplugged in by dax_kmem. Signed-off-by: Andrew Bresticker <abrestic@rivosinc.com> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
1 parent de1034b commit 0bcff59

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

drivers/firmware/efi/efi-init.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,6 @@ static __init int is_usable_memory(efi_memory_desc_t *md)
143143
case EFI_BOOT_SERVICES_DATA:
144144
case EFI_CONVENTIONAL_MEMORY:
145145
case EFI_PERSISTENT_MEMORY:
146-
/*
147-
* Special purpose memory is 'soft reserved', which means it
148-
* is set aside initially, but can be hotplugged back in or
149-
* be assigned to the dax driver after boot.
150-
*/
151-
if (efi_soft_reserve_enabled() &&
152-
(md->attribute & EFI_MEMORY_SP))
153-
return false;
154-
155146
/*
156147
* According to the spec, these regions are no longer reserved
157148
* after calling ExitBootServices(). However, we can only use
@@ -196,6 +187,16 @@ static __init void reserve_regions(void)
196187
size = npages << PAGE_SHIFT;
197188

198189
if (is_memory(md)) {
190+
/*
191+
* Special purpose memory is 'soft reserved', which
192+
* means it is set aside initially. Don't add a memblock
193+
* for it now so that it can be hotplugged back in or
194+
* be assigned to the dax driver after boot.
195+
*/
196+
if (efi_soft_reserve_enabled() &&
197+
(md->attribute & EFI_MEMORY_SP))
198+
continue;
199+
199200
early_init_dt_add_memory_arch(paddr, size);
200201

201202
if (!is_usable_memory(md))

0 commit comments

Comments
 (0)