Skip to contentSkip to conversation

efi: Improve logging around memmap init

PATCH Applied Bartosz Szczepanek 2 participants 2 messages Apr 23, 2025 – May 9, 2025 EFI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 efi: Improve logging around memmap init

Be more informative if memremap fails, and print out physical address together with size. This change intends to make investigations of such early failures slightly easier.

---
 drivers/firmware/efi/memmap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/firmware/efi/memmap.c +2 -1
index 34109fd86c55..f1c04d7cfd71 100644
@@ -31,31 +31,32 @@
  * Returns: zero on success, a negative error code on failure.
  */
 int __init __efi_memmap_init(struct efi_memory_map_data *data)
 {
 	struct efi_memory_map map;
 	phys_addr_t phys_map;
 
 	phys_map = data->phys_map;
 
 	if (data->flags & EFI_MEMMAP_LATE)
 		map.map = memremap(phys_map, data->size, MEMREMAP_WB);
 	else
 		map.map = early_memremap(phys_map, data->size);
 
 	if (!map.map) {
-		pr_err("Could not map the memory map!\n");
+		pr_err("Could not map the memory map! phys_map=%pa, size=0x%lx\n",
+			&phys_map, data->size);
 		return -ENOMEM;
 	}
 
 	map.phys_map = data->phys_map;
 	map.nr_map = data->size / data->desc_size;
 	map.map_end = map.map + data->size;
 
 	map.desc_version = data->desc_version;
 	map.desc_size = data->desc_size;
 	map.flags = data->flags;
 
 	set_bit(EFI_MEMMAP, &efi.flags);
 
 	efi.memmap = map;
 
Signature · 1 line
2.47.1
maintainer Applied
#1 lore raw
Quoted 10 lines · Bartosz Szczepanek

Be more informative if memremap fails, and print out physical address together with size. This change intends to make investigations of such early failures slightly easier.

---
 drivers/firmware/efi/memmap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Queued in efi/next - thanks.

Quoted 41 lines
drivers/firmware/efi/memmap.c +2 -2
index 34109fd86c55..f1c04d7cfd71 100644
@@ -31,31 +31,32 @@
  * Returns: zero on success, a negative error code on failure.
  */
 int __init __efi_memmap_init(struct efi_memory_map_data *data)
 {
        struct efi_memory_map map;
        phys_addr_t phys_map;
 
        phys_map = data->phys_map;
 
        if (data->flags & EFI_MEMMAP_LATE)
                map.map = memremap(phys_map, data->size, MEMREMAP_WB);
        else
                map.map = early_memremap(phys_map, data->size);
 
        if (!map.map) {
-               pr_err("Could not map the memory map!\n");
+               pr_err("Could not map the memory map! phys_map=%pa, size=0x%lx\n",
+                       &phys_map, data->size);
                return -ENOMEM;
        }
 
        map.phys_map = data->phys_map;
        map.nr_map = data->size / data->desc_size;
        map.map_end = map.map + data->size;
 
        map.desc_version = data->desc_version;
        map.desc_size = data->desc_size;
        map.flags = data->flags;
 
        set_bit(EFI_MEMMAP, &efi.flags);
 
        efi.memmap = map;
 
--

2.47.1