[PATCH v2 4/5] efi: Use efi_mem_reserve() to reserve the memory attribute table

Ard Biesheuvel posted 5 patches 8 hours ago
[PATCH v2 4/5] efi: Use efi_mem_reserve() to reserve the memory attribute table
Posted by Ard Biesheuvel 8 hours ago
From: Ard Biesheuvel <ardb@kernel.org>

Use efi_mem_reserve() rather than memblock_reserve() to reserve the EFI
memory attributes table. This is needed on x86, where memblock_reserve()
is not sufficient for assets that may be placed in EFI boot services
data memory.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 drivers/firmware/efi/memattr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/memattr.c b/drivers/firmware/efi/memattr.c
index b83f1c5a9164..785b7fc687fe 100644
--- a/drivers/firmware/efi/memattr.c
+++ b/drivers/firmware/efi/memattr.c
@@ -75,7 +75,7 @@ void __init efi_memattr_init(void)
 	}
 
 	tbl_size = sizeof(*tbl) + tbl->num_entries * tbl->desc_size;
-	memblock_reserve(efi_mem_attr_table, tbl_size);
+	efi_mem_reserve(efi_mem_attr_table, tbl_size);
 	set_bit(EFI_MEM_ATTR, &efi.flags);
 
 unmap:
-- 
2.53.0.1118.gaef5881109-goog
Re: [PATCH v2 4/5] efi: Use efi_mem_reserve() to reserve the memory attribute table
Posted by Breno Leitao 2 hours ago
On Wed, Apr 01, 2026 at 02:23:56PM +0200, Ard Biesheuvel wrote:
> From: Ard Biesheuvel <ardb@kernel.org>
> 
> Use efi_mem_reserve() rather than memblock_reserve() to reserve the EFI
> memory attributes table. This is needed on x86, where memblock_reserve()
> is not sufficient for assets that may be placed in EFI boot services
> data memory.
> 
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>

Reviewed-by: Breno Leitao <leitao@debian.org>

> ---
>  drivers/firmware/efi/memattr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/firmware/efi/memattr.c b/drivers/firmware/efi/memattr.c
> index b83f1c5a9164..785b7fc687fe 100644
> --- a/drivers/firmware/efi/memattr.c
> +++ b/drivers/firmware/efi/memattr.c
> @@ -75,7 +75,7 @@ void __init efi_memattr_init(void)
>  	}
>  
>  	tbl_size = sizeof(*tbl) + tbl->num_entries * tbl->desc_size;
> -	memblock_reserve(efi_mem_attr_table, tbl_size);

nit: memblock_reserve seems to be the only memblock usage in the file,
so after this patch, the #include <linux/memblock.h> becomes dead.
Re: [PATCH v2 4/5] efi: Use efi_mem_reserve() to reserve the memory attribute table
Posted by Ard Biesheuvel 2 hours ago

On Wed, 1 Apr 2026, at 19:39, Breno Leitao wrote:
> On Wed, Apr 01, 2026 at 02:23:56PM +0200, Ard Biesheuvel wrote:
>> From: Ard Biesheuvel <ardb@kernel.org>
>> 
>> Use efi_mem_reserve() rather than memblock_reserve() to reserve the EFI
>> memory attributes table. This is needed on x86, where memblock_reserve()
>> is not sufficient for assets that may be placed in EFI boot services
>> data memory.
>> 
>> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
>
> Reviewed-by: Breno Leitao <leitao@debian.org>
>
>> ---
>>  drivers/firmware/efi/memattr.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/drivers/firmware/efi/memattr.c b/drivers/firmware/efi/memattr.c
>> index b83f1c5a9164..785b7fc687fe 100644
>> --- a/drivers/firmware/efi/memattr.c
>> +++ b/drivers/firmware/efi/memattr.c
>> @@ -75,7 +75,7 @@ void __init efi_memattr_init(void)
>>  	}
>>  
>>  	tbl_size = sizeof(*tbl) + tbl->num_entries * tbl->desc_size;
>> -	memblock_reserve(efi_mem_attr_table, tbl_size);
>
> nit: memblock_reserve seems to be the only memblock usage in the file,
> so after this patch, the #include <linux/memblock.h> becomes dead.

Thanks for spotting that. Will fix.