Skip to content

Commit

Permalink
efi: Don't add memblocks for soft-reserved memory
Browse files Browse the repository at this point in the history
[ Upstream commit 0bcff59 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
abrestic-rivos authored and gregkh committed Mar 1, 2024
1 parent cf3d681 commit 5c7ed4d
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions drivers/firmware/efi/efi-init.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,6 @@ static __init int is_usable_memory(efi_memory_desc_t *md)
case EFI_BOOT_SERVICES_DATA:
case EFI_CONVENTIONAL_MEMORY:
case EFI_PERSISTENT_MEMORY:
/*
* Special purpose memory is 'soft reserved', which means it
* is set aside initially, but can be hotplugged back in or
* be assigned to the dax driver after boot.
*/
if (efi_soft_reserve_enabled() &&
(md->attribute & EFI_MEMORY_SP))
return false;

/*
* According to the spec, these regions are no longer reserved
* after calling ExitBootServices(). However, we can only use
Expand Down Expand Up @@ -187,6 +178,16 @@ static __init void reserve_regions(void)
size = npages << PAGE_SHIFT;

if (is_memory(md)) {
/*
* Special purpose memory is 'soft reserved', which
* means it is set aside initially. Don't add a memblock
* for it now so that it can be hotplugged back in or
* be assigned to the dax driver after boot.
*/
if (efi_soft_reserve_enabled() &&
(md->attribute & EFI_MEMORY_SP))
continue;

early_init_dt_add_memory_arch(paddr, size);

if (!is_usable_memory(md))
Expand Down

0 comments on commit 5c7ed4d

Please sign in to comment.