Skip to contentSkip to conversation

lmb: enable LMB_LIMIT_DMA_BELOW_RAM_TOP for ARCH_MVEBU

PATCH Stefan Roese 1 participant 2 messages Oct 5 1 message not in the archive

lore
Share & tools
lore

Stefan Roese

author Reviewed-by
#1 lore raw
In reply to a message not in the archive
Quoted 28 lines · Bruno Banelli

On Armada 7k/8k only a part of DRAM is mapped in U-Boot's MMU. arch/arm/mach-mvebu/armada8k/cpu.c maps 0..0x04000000 and 0x05400000..0x85400000 (plus MMIO), and arm64-common.c clamps board_get_usable_ram_top() to USABLE_RAM_SIZE (2 GiB) with the comment "Not all memory is mapped in the MMU". At the same time a8k_dram_init_banksize() advertises the whole DRAM in bi_dram[], adding a second bank at 4 GiB whenever more than 3 GiB is populated.

Until commit e1b6822d6522 ("efi_memory: do not add RAM memory to the memory map") the EFI subsystem bridged that gap: efi_add_known_memory() reserved everything above gd->ram_top, as introduced by commit 7b78d6438a2b ("efi_loader: Reserve unaccessible memory"). EFI allocations are now backed by LMB, and LMB does not consider ram_top by default, so the first efi_allocate_pool() of the boot - from efi_init_early() -> efi_console_register() -> efi_create_event() - takes the highest free page and faults:

Tested on a SolidRun MACCHIATObin (Armada 8040): without this change the abort reproduces both with 4 GiB of DRAM (far 0x13ffff000) and with 8 GiB (far 0x23ffff000), the faulting address tracking the top of the highest bank; with it, U-Boot reaches the prompt.

LMB_LIMIT_DMA_BELOW_RAM_TOP, added by commit af4aad1f0a0b ("lmb:
Optionally limit available memory to 4 GiB on limited systems"), reserves the memory above ram_top and addresses exactly this case. It is already enabled for ARCH_BCM283X and ARCH_ROCKCHIP; enable it for ARCH_MVEBU as well.

Quoted 6 lines

Tested on a SolidRun MACCHIATObin (Armada 8040) with 4 GiB of DRAM, which reproduces the abort above without this change and reaches the prompt with it.

Fixes e1b6822d6522 ("efi_memory: do not add RAM memory to the memory map")

Thanks,
Stefan

#2 lore raw
In reply to a message not in the archive
Quoted 28 lines · Bruno Banelli

On Armada 7k/8k only a part of DRAM is mapped in U-Boot's MMU. arch/arm/mach-mvebu/armada8k/cpu.c maps 0..0x04000000 and 0x05400000..0x85400000 (plus MMIO), and arm64-common.c clamps board_get_usable_ram_top() to USABLE_RAM_SIZE (2 GiB) with the comment "Not all memory is mapped in the MMU". At the same time a8k_dram_init_banksize() advertises the whole DRAM in bi_dram[], adding a second bank at 4 GiB whenever more than 3 GiB is populated.

Until commit e1b6822d6522 ("efi_memory: do not add RAM memory to the memory map") the EFI subsystem bridged that gap: efi_add_known_memory() reserved everything above gd->ram_top, as introduced by commit 7b78d6438a2b ("efi_loader: Reserve unaccessible memory"). EFI allocations are now backed by LMB, and LMB does not consider ram_top by default, so the first efi_allocate_pool() of the boot - from efi_init_early() -> efi_console_register() -> efi_create_event() - takes the highest free page and faults:

Tested on a SolidRun MACCHIATObin (Armada 8040): without this change the abort reproduces both with 4 GiB of DRAM (far 0x13ffff000) and with 8 GiB (far 0x23ffff000), the faulting address tracking the top of the highest bank; with it, U-Boot reaches the prompt.

LMB_LIMIT_DMA_BELOW_RAM_TOP, added by commit af4aad1f0a0b ("lmb:
Optionally limit available memory to 4 GiB on limited systems"), reserves the memory above ram_top and addresses exactly this case. It is already enabled for ARCH_BCM283X and ARCH_ROCKCHIP; enable it for ARCH_MVEBU as well.

Quoted 6 lines

Tested on a SolidRun MACCHIATObin (Armada 8040) with 4 GiB of DRAM, which reproduces the abort above without this change and reaches the prompt with it.

Fixes e1b6822d6522 ("efi_memory: do not add RAM memory to the memory map")

Applied to u-boot-marvell/next

Thanks,
Stefan