Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/38535 )
Change subject: mb/emulation/qemu-aarch64: Add ARM trusted firmware support ......................................................................
mb/emulation/qemu-aarch64: Add ARM trusted firmware support
Tested on qemu-system-aarch64: Fixes a hang and allows to boot into Linux userspace.
Change-Id: I809742522240185431621cc4fd8b9c7deaf2bb54 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M src/mainboard/emulation/qemu-aarch64/Kconfig M src/mainboard/emulation/qemu-aarch64/Makefile.inc M src/mainboard/emulation/qemu-aarch64/bootblock.c M src/mainboard/emulation/qemu-aarch64/include/mainboard/addressmap.h M src/mainboard/emulation/qemu-aarch64/mainboard.c M src/mainboard/emulation/qemu-aarch64/memlayout.ld 6 files changed, 19 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/35/38535/1
diff --git a/src/mainboard/emulation/qemu-aarch64/Kconfig b/src/mainboard/emulation/qemu-aarch64/Kconfig index 895446d..0579b04 100644 --- a/src/mainboard/emulation/qemu-aarch64/Kconfig +++ b/src/mainboard/emulation/qemu-aarch64/Kconfig @@ -27,6 +27,7 @@ select MAINBOARD_FORCE_NATIVE_VGA_INIT select MAINBOARD_HAS_NATIVE_VGA_INIT select MISSING_BOARD_RESET + select ARM64_USE_ARM_TRUSTED_FIRMWARE
config MAINBOARD_DIR string diff --git a/src/mainboard/emulation/qemu-aarch64/Makefile.inc b/src/mainboard/emulation/qemu-aarch64/Makefile.inc index 4d5f2bd..b710f15 100644 --- a/src/mainboard/emulation/qemu-aarch64/Makefile.inc +++ b/src/mainboard/emulation/qemu-aarch64/Makefile.inc @@ -24,3 +24,5 @@ bootblock-y += bootblock_custom.S
CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/include + +BL31_MAKEARGS += PLAT=qemu ARM_ARCH_MAJOR=8 M0_CROSS_COMPILE="$(CROSS_COMPILE_arm)" diff --git a/src/mainboard/emulation/qemu-aarch64/bootblock.c b/src/mainboard/emulation/qemu-aarch64/bootblock.c index 2c878b6..d4b3c6f 100644 --- a/src/mainboard/emulation/qemu-aarch64/bootblock.c +++ b/src/mainboard/emulation/qemu-aarch64/bootblock.c @@ -16,6 +16,8 @@ #include <bootblock_common.h> #include <symbols.h>
+extern u8 _secram[], _esecram[]; + void bootblock_mainboard_init(void) { mmu_init(); @@ -27,5 +29,7 @@ mmu_config_range(_romstage, REGION_SIZE(romstage), MA_MEM | MA_S | MA_RW); mmu_config_range(_ramstage, REGION_SIZE(ramstage), MA_MEM | MA_S | MA_RW);
+ mmu_config_range(_secram, REGION_SIZE(secram), MA_MEM | MA_S | MA_RW); + mmu_enable(); } diff --git a/src/mainboard/emulation/qemu-aarch64/include/mainboard/addressmap.h b/src/mainboard/emulation/qemu-aarch64/include/mainboard/addressmap.h index 6f0c802..7233863 100644 --- a/src/mainboard/emulation/qemu-aarch64/include/mainboard/addressmap.h +++ b/src/mainboard/emulation/qemu-aarch64/include/mainboard/addressmap.h @@ -23,6 +23,7 @@ * 0x0905_0000..0x0907_0000: SMMU (smmu-v3) * 0x0a00_0000..0x0a00_0200: MMIO (virtio) * 0x0c00_0000..0x0e00_0000: Platform bus + * 0x0e00_0000..0x0eff_ffff: Secure SRAM * 0x4000_0000..: RAM */ #define VIRT_UART_BASE 0x09000000 @@ -32,3 +33,4 @@ #define VIRT_SMMU_BASE 0x09050000 #define VIRT_MMIO_BASE 0x0a000000 #define VIRT_PLATFORM_BUS_BASE 0x0c000000 +#define VIRT_SECRAM_BASE 0xe000000 diff --git a/src/mainboard/emulation/qemu-aarch64/mainboard.c b/src/mainboard/emulation/qemu-aarch64/mainboard.c index 5735455..7eaed5b 100644 --- a/src/mainboard/emulation/qemu-aarch64/mainboard.c +++ b/src/mainboard/emulation/qemu-aarch64/mainboard.c @@ -10,6 +10,15 @@ #include <ramdetect.h> #include <symbols.h> #include <device/device.h> +#include <bootmem.h> +#include <console/console.h> + +extern u8 _secram[], _esecram[]; + +void bootmem_platform_add_ranges(void) +{ + bootmem_add_range((uintptr_t)_secram, REGION_SIZE(secram), BM_MEM_BL31); +}
static void mainboard_enable(struct device *dev) { diff --git a/src/mainboard/emulation/qemu-aarch64/memlayout.ld b/src/mainboard/emulation/qemu-aarch64/memlayout.ld index cd86073..beb30a3 100644 --- a/src/mainboard/emulation/qemu-aarch64/memlayout.ld +++ b/src/mainboard/emulation/qemu-aarch64/memlayout.ld @@ -22,6 +22,7 @@ { REGION(flash, 0x00000000, CONFIG_ROM_SIZE, 8)
+ REGION(secram, 0xe000000, 0xf000000, 4096) DRAM_START(0x40000000) BOOTBLOCK(0x60010000, 64K) STACK(0x60020000, 62K)
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38535 )
Change subject: mb/emulation/qemu-aarch64: Add ARM trusted firmware support ......................................................................
Patch Set 1:
(2 comments)
https://review.coreboot.org/c/coreboot/+/38535/1//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/38535/1//COMMIT_MSG@10 PS1, Line 10: Fixes a hang Is that a Linux kernel bug?
https://review.coreboot.org/c/coreboot/+/38535/1//COMMIT_MSG@10 PS1, Line 10: Linux Please add the version to be explicit.
Hello Julius Werner, build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38535
to look at the new patch set (#2).
Change subject: mb/emulation/qemu-aarch64: Add ARM trusted firmware support ......................................................................
mb/emulation/qemu-aarch64: Add ARM trusted firmware support
Linux expects a working PSCI and hangs if not found. Add BL31 into CBFS as '-M virt,secure=on -bios ' commands line arguments cause qemu's internal PSCI emulation to shutdown. BL31 is placed in qemu's SECURERAM memory region and won't conflict with resources in DRAM.
Tested on qemu-system-aarch64: Fixes a hang and allows to boot into Linux userspace.
Change-Id: I809742522240185431621cc4fd8b9c7deaf2bb54 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M src/mainboard/emulation/qemu-aarch64/Kconfig M src/mainboard/emulation/qemu-aarch64/Makefile.inc M src/mainboard/emulation/qemu-aarch64/bootblock.c M src/mainboard/emulation/qemu-aarch64/include/mainboard/addressmap.h M src/mainboard/emulation/qemu-aarch64/mainboard.c M src/mainboard/emulation/qemu-aarch64/memlayout.ld 6 files changed, 19 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/35/38535/2
Hello Julius Werner, build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38535
to look at the new patch set (#3).
Change subject: mb/emulation/qemu-aarch64: Add ARM trusted firmware support ......................................................................
mb/emulation/qemu-aarch64: Add ARM trusted firmware support
Linux expects a working PSCI and hangs if not found. Add BL31 into CBFS as '-M virt,secure=on -bios ' commands line arguments cause qemu's internal PSCI emulation to shutdown. BL31 is placed in qemu's SECURERAM memory region and won't conflict with resources in DRAM.
Tested on qemu-system-aarch64: Fixes a hang and allows to boot into Linux 5.4.14 userspace.
Change-Id: I809742522240185431621cc4fd8b9c7deaf2bb54 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M src/mainboard/emulation/qemu-aarch64/Kconfig M src/mainboard/emulation/qemu-aarch64/Makefile.inc M src/mainboard/emulation/qemu-aarch64/bootblock.c M src/mainboard/emulation/qemu-aarch64/include/mainboard/addressmap.h M src/mainboard/emulation/qemu-aarch64/mainboard.c M src/mainboard/emulation/qemu-aarch64/memlayout.ld 6 files changed, 19 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/35/38535/3
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38535 )
Change subject: mb/emulation/qemu-aarch64: Add ARM trusted firmware support ......................................................................
Patch Set 3:
(2 comments)
https://review.coreboot.org/c/coreboot/+/38535/1//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/38535/1//COMMIT_MSG@10 PS1, Line 10: Fixes a hang
Is that a Linux kernel bug?
I don't think so.
https://review.coreboot.org/c/coreboot/+/38535/1//COMMIT_MSG@10 PS1, Line 10: Linux
Please add the version to be explicit.
Done
Hello Julius Werner, build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38535
to look at the new patch set (#4).
Change subject: mb/emulation/qemu-aarch64: Add ARM trusted firmware support ......................................................................
mb/emulation/qemu-aarch64: Add ARM trusted firmware support
Linux expects a working PSCI and hangs if not found. Add BL31 into CBFS as '-M virt,secure=on -bios ' commands line arguments cause qemu's internal PSCI emulation to shutdown. BL31 is placed in qemu's SECURERAM memory region and won't conflict with resources in DRAM.
Tested on qemu-system-aarch64: Fixes a hang and allows to boot into Linux 5.4.14 userspace.
Change-Id: I809742522240185431621cc4fd8b9c7deaf2bb54 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M src/mainboard/emulation/qemu-aarch64/Kconfig M src/mainboard/emulation/qemu-aarch64/Makefile.inc M src/mainboard/emulation/qemu-aarch64/bootblock.c M src/mainboard/emulation/qemu-aarch64/include/mainboard/addressmap.h M src/mainboard/emulation/qemu-aarch64/mainboard.c M src/mainboard/emulation/qemu-aarch64/memlayout.ld 6 files changed, 18 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/35/38535/4
Hello Julius Werner, build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38535
to look at the new patch set (#5).
Change subject: mb/emulation/qemu-aarch64: Add ARM trusted firmware support ......................................................................
mb/emulation/qemu-aarch64: Add ARM trusted firmware support
Linux expects a working PSCI and hangs if not found. Add BL31 into CBFS as '-M virt,secure=on -bios ' commands line arguments cause qemu's internal PSCI emulation to shutdown. BL31 is placed in qemu's SECURERAM memory region and won't conflict with resources in DRAM.
Tested on qemu-system-aarch64: Fixes a hang and allows to boot into Linux 5.4.14 userspace.
Change-Id: I809742522240185431621cc4fd8b9c7deaf2bb54 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M src/mainboard/emulation/qemu-aarch64/Kconfig M src/mainboard/emulation/qemu-aarch64/Makefile.inc M src/mainboard/emulation/qemu-aarch64/bootblock.c M src/mainboard/emulation/qemu-aarch64/include/mainboard/addressmap.h M src/mainboard/emulation/qemu-aarch64/mainboard.c M src/mainboard/emulation/qemu-aarch64/memlayout.ld 6 files changed, 18 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/35/38535/5
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38535 )
Change subject: mb/emulation/qemu-aarch64: Add ARM trusted firmware support ......................................................................
Patch Set 5:
(1 comment)
https://review.coreboot.org/c/coreboot/+/38535/5/src/mainboard/emulation/qem... File src/mainboard/emulation/qemu-aarch64/bootblock.c:
https://review.coreboot.org/c/coreboot/+/38535/5/src/mainboard/emulation/qem... PS5, Line 19: _esecram Is this used anywhere?
Arthur Heymans has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38535 )
Change subject: mb/emulation/qemu-aarch64: Add ARM trusted firmware support ......................................................................
Patch Set 5: Code-Review+2
(1 comment)
https://review.coreboot.org/c/coreboot/+/38535/5/src/mainboard/emulation/qem... File src/mainboard/emulation/qemu-aarch64/bootblock.c:
https://review.coreboot.org/c/coreboot/+/38535/5/src/mainboard/emulation/qem... PS5, Line 19: _esecram
Is this used anywhere?
the REGION_SIZE macro consumes this.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38535 )
Change subject: mb/emulation/qemu-aarch64: Add ARM trusted firmware support ......................................................................
Patch Set 5:
(1 comment)
https://review.coreboot.org/c/coreboot/+/38535/5/src/mainboard/emulation/qem... File src/mainboard/emulation/qemu-aarch64/bootblock.c:
https://review.coreboot.org/c/coreboot/+/38535/5/src/mainboard/emulation/qem... PS5, Line 19: _esecram
Is this used anywhere? […]
Ack
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38535 )
Change subject: mb/emulation/qemu-aarch64: Add ARM trusted firmware support ......................................................................
Patch Set 7:
rebased to trigger new job
Philipp Deppenwiese has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38535 )
Change subject: mb/emulation/qemu-aarch64: Add ARM trusted firmware support ......................................................................
Patch Set 8: Code-Review+2
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38535 )
Change subject: mb/emulation/qemu-aarch64: Add ARM trusted firmware support ......................................................................
Patch Set 8:
(1 comment)
https://review.coreboot.org/c/coreboot/+/38535/1//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/38535/1//COMMIT_MSG@10 PS1, Line 10: Fixes a hang
I don't think so.
Done
Philipp Deppenwiese has submitted this change. ( https://review.coreboot.org/c/coreboot/+/38535 )
Change subject: mb/emulation/qemu-aarch64: Add ARM trusted firmware support ......................................................................
mb/emulation/qemu-aarch64: Add ARM trusted firmware support
Linux expects a working PSCI and hangs if not found. Add BL31 into CBFS as '-M virt,secure=on -bios ' commands line arguments cause qemu's internal PSCI emulation to shutdown. BL31 is placed in qemu's SECURERAM memory region and won't conflict with resources in DRAM.
Tested on qemu-system-aarch64: Fixes a hang and allows to boot into Linux 5.4.14 userspace.
Change-Id: I809742522240185431621cc4fd8b9c7deaf2bb54 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/38535 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Philipp Deppenwiese zaolin.daisuki@gmail.com Reviewed-by: Arthur Heymans arthur@aheymans.xyz --- M src/mainboard/emulation/qemu-aarch64/Kconfig M src/mainboard/emulation/qemu-aarch64/Makefile.inc M src/mainboard/emulation/qemu-aarch64/bootblock.c M src/mainboard/emulation/qemu-aarch64/include/mainboard/addressmap.h M src/mainboard/emulation/qemu-aarch64/mainboard.c M src/mainboard/emulation/qemu-aarch64/memlayout.ld 6 files changed, 18 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Philipp Deppenwiese: Looks good to me, approved Arthur Heymans: Looks good to me, approved
diff --git a/src/mainboard/emulation/qemu-aarch64/Kconfig b/src/mainboard/emulation/qemu-aarch64/Kconfig index 895446d..0579b04 100644 --- a/src/mainboard/emulation/qemu-aarch64/Kconfig +++ b/src/mainboard/emulation/qemu-aarch64/Kconfig @@ -27,6 +27,7 @@ select MAINBOARD_FORCE_NATIVE_VGA_INIT select MAINBOARD_HAS_NATIVE_VGA_INIT select MISSING_BOARD_RESET + select ARM64_USE_ARM_TRUSTED_FIRMWARE
config MAINBOARD_DIR string diff --git a/src/mainboard/emulation/qemu-aarch64/Makefile.inc b/src/mainboard/emulation/qemu-aarch64/Makefile.inc index 4d5f2bd..b710f15 100644 --- a/src/mainboard/emulation/qemu-aarch64/Makefile.inc +++ b/src/mainboard/emulation/qemu-aarch64/Makefile.inc @@ -24,3 +24,5 @@ bootblock-y += bootblock_custom.S
CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/include + +BL31_MAKEARGS += PLAT=qemu ARM_ARCH_MAJOR=8 M0_CROSS_COMPILE="$(CROSS_COMPILE_arm)" diff --git a/src/mainboard/emulation/qemu-aarch64/bootblock.c b/src/mainboard/emulation/qemu-aarch64/bootblock.c index 280f77e..77d7e53 100644 --- a/src/mainboard/emulation/qemu-aarch64/bootblock.c +++ b/src/mainboard/emulation/qemu-aarch64/bootblock.c @@ -15,6 +15,8 @@ #include <bootblock_common.h> #include <symbols.h>
+extern u8 _secram[], _esecram[]; + void bootblock_mainboard_init(void) { mmu_init(); @@ -29,5 +31,7 @@ mmu_config_range(_romstage, REGION_SIZE(romstage), MA_MEM | MA_S | MA_RW); mmu_config_range(_ramstage, REGION_SIZE(ramstage), MA_MEM | MA_S | MA_RW);
+ mmu_config_range(_secram, REGION_SIZE(secram), MA_MEM | MA_S | MA_RW); + mmu_enable(); } diff --git a/src/mainboard/emulation/qemu-aarch64/include/mainboard/addressmap.h b/src/mainboard/emulation/qemu-aarch64/include/mainboard/addressmap.h index 6f0c802..7233863 100644 --- a/src/mainboard/emulation/qemu-aarch64/include/mainboard/addressmap.h +++ b/src/mainboard/emulation/qemu-aarch64/include/mainboard/addressmap.h @@ -23,6 +23,7 @@ * 0x0905_0000..0x0907_0000: SMMU (smmu-v3) * 0x0a00_0000..0x0a00_0200: MMIO (virtio) * 0x0c00_0000..0x0e00_0000: Platform bus + * 0x0e00_0000..0x0eff_ffff: Secure SRAM * 0x4000_0000..: RAM */ #define VIRT_UART_BASE 0x09000000 @@ -32,3 +33,4 @@ #define VIRT_SMMU_BASE 0x09050000 #define VIRT_MMIO_BASE 0x0a000000 #define VIRT_PLATFORM_BUS_BASE 0x0c000000 +#define VIRT_SECRAM_BASE 0xe000000 diff --git a/src/mainboard/emulation/qemu-aarch64/mainboard.c b/src/mainboard/emulation/qemu-aarch64/mainboard.c index 5735455..2980f48 100644 --- a/src/mainboard/emulation/qemu-aarch64/mainboard.c +++ b/src/mainboard/emulation/qemu-aarch64/mainboard.c @@ -10,6 +10,14 @@ #include <ramdetect.h> #include <symbols.h> #include <device/device.h> +#include <bootmem.h> + +extern u8 _secram[], _esecram[]; + +void bootmem_platform_add_ranges(void) +{ + bootmem_add_range((uintptr_t)_secram, REGION_SIZE(secram), BM_MEM_BL31); +}
static void mainboard_enable(struct device *dev) { diff --git a/src/mainboard/emulation/qemu-aarch64/memlayout.ld b/src/mainboard/emulation/qemu-aarch64/memlayout.ld index 248d0ab..4af2362 100644 --- a/src/mainboard/emulation/qemu-aarch64/memlayout.ld +++ b/src/mainboard/emulation/qemu-aarch64/memlayout.ld @@ -22,6 +22,7 @@ { REGION(flash, 0x00000000, CONFIG_ROM_SIZE, 8)
+ REGION(secram, 0xe000000, 0x1000000, 4096) DRAM_START(0x40000000) BOOTBLOCK(0x60010000, 64K) STACK(0x60020000, 62K)
9elements QA has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38535 )
Change subject: mb/emulation/qemu-aarch64: Add ARM trusted firmware support ......................................................................
Patch Set 9:
Automatic boot test returned (PASS/FAIL/TOTAL): 3/0/3 Emulation targets: EMULATION_QEMU_X86_Q35 using payload TianoCore : SUCCESS : https://lava.9esec.io/r/1002 EMULATION_QEMU_X86_Q35 using payload SeaBIOS : SUCCESS : https://lava.9esec.io/r/1001 EMULATION_QEMU_X86_I440FX using payload SeaBIOS : SUCCESS : https://lava.9esec.io/r/1000
Please note: This test is under development and might not be accurate at all!