From 4d4776f320f50f8a5a5fe6c402cbdb556a699be4 Mon Sep 17 00:00:00 2001 From: Maximilian Brune Date: Fri, 15 Nov 2024 03:54:33 +0100 Subject: [PATCH] mb/emulation/qemu-sbsa: Configure flash region for MMU Since QEMU commit 728b923f548d ("target/arm: Do memory type alignment check when translation enabled") alignment is checked for device memory. That causes exceptions during bootup of coreboot trying to load things (e.g. stages) from the memory mapped flash. To fix it the memory mapped flash region will be marked as MA_MEM (normal memory) instead of MA_DEV (device memory). Technically that isn't 100% correct, but avoids having to write a custom memory mapped flash driver that checks for alignment on all accesses. Since it is emulation and therefore always normal memory anyway, there shouldn't be any side effects. Signed-off-by: Maximilian Brune Change-Id: I98bd1a18495e3d153ce53abec8686c7871ee12c5 Reviewed-on: https://review.coreboot.org/c/coreboot/+/85147 Reviewed-by: David Milosevic Tested-by: build bot (Jenkins) Reviewed-by: Lean Sheng Tan --- src/mainboard/emulation/qemu-sbsa/bootblock.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mainboard/emulation/qemu-sbsa/bootblock.c b/src/mainboard/emulation/qemu-sbsa/bootblock.c index b38df6ec71..53eb9af053 100644 --- a/src/mainboard/emulation/qemu-sbsa/bootblock.c +++ b/src/mainboard/emulation/qemu-sbsa/bootblock.c @@ -4,6 +4,7 @@ #include #include +DECLARE_REGION(flash); void bootblock_mainboard_init(void) { mmu_init(); @@ -13,6 +14,8 @@ void bootblock_mainboard_init(void) /* Set a dummy value for DRAM. ramstage should update the mapping. */ mmu_config_range(_dram, ((size_t) CONFIG_DRAM_SIZE_MB) * MiB, MA_MEM | MA_RW); + mmu_config_range(_flash, REGION_SIZE(flash), MA_MEM | MA_RO | MA_MEM_NC); + mmu_config_range(_ttb, REGION_SIZE(ttb), MA_MEM | MA_S | MA_RW); mmu_config_range(_bootblock, REGION_SIZE(bootblock), MA_MEM | MA_S | MA_RW); mmu_config_range(_ramstage, REGION_SIZE(ramstage), MA_MEM | MA_S | MA_RW);