Attention is currently required from: Philipp Hug, ron minnich.
Maximilian Brune has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/81083?usp=email )
Change subject: tmp: Tru to use 512 harts for QEMU ......................................................................
tmp: Tru to use 512 harts for QEMU
Signed-off-by: Maximilian Brune maximilian.brune@9elements.com Change-Id: I149c8d8a43733c8ba3e02a84b0a3606d98f8b2c1 --- M src/arch/riscv/include/arch/memlayout.h M src/arch/riscv/smp.c M src/arch/riscv/trap_handler.c M src/lib/Makefile.mk M src/mainboard/emulation/qemu-riscv/Kconfig M src/mainboard/emulation/qemu-riscv/Makefile.mk 6 files changed, 19 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/83/81083/1
diff --git a/src/arch/riscv/include/arch/memlayout.h b/src/arch/riscv/include/arch/memlayout.h index 0c539d2..8b74897 100644 --- a/src/arch/riscv/include/arch/memlayout.h +++ b/src/arch/riscv/include/arch/memlayout.h @@ -6,6 +6,9 @@ #define __ARCH_MEMLAYOUT_H
#define STACK(addr, size) REGION(stack, addr, size, 4096) + //TODO + //REGION(stack, addr, size, 4096) \ + //_ = ASSERT(size >= (MACHINE_STACK_SIZE * CONFIG_MAX_CPUS), "stack should be have enough space to hold all hart stacks");
#if ENV_ROMSTAGE_OR_BEFORE #define CAR_STACK(addr, size) \ diff --git a/src/arch/riscv/smp.c b/src/arch/riscv/smp.c index 6ecfbc5..c77fe0c 100644 --- a/src/arch/riscv/smp.c +++ b/src/arch/riscv/smp.c @@ -13,6 +13,11 @@ return CONFIG_MAX_CPUS; }
+int __weak smp_get_hart_count() +{ + return CONFIG_MAX_CPUS; +} + void smp_pause(int working_hartid) { #define SYNCA (OTHER_HLS(working_hartid)->entry.sync_a) diff --git a/src/arch/riscv/trap_handler.c b/src/arch/riscv/trap_handler.c index 4cbccc5..573722b 100644 --- a/src/arch/riscv/trap_handler.c +++ b/src/arch/riscv/trap_handler.c @@ -125,13 +125,17 @@ case CAUSE_BREAKPOINT: case CAUSE_LOAD_ACCESS: case CAUSE_STORE_ACCESS: + print_trap_information(tf); + break; case CAUSE_USER_ECALL: case CAUSE_HYPERVISOR_ECALL: case CAUSE_MACHINE_ECALL: print_trap_information(tf); + write_csr(mepc, read_csr(mepc) + 4); break; case CAUSE_SUPERVISOR_ECALL: handle_sbi(tf); + write_csr(mepc, read_csr(mepc) + 4); return; case CAUSE_MISALIGNED_LOAD: case CAUSE_MISALIGNED_STORE: diff --git a/src/lib/Makefile.mk b/src/lib/Makefile.mk index e22fd08..0077432 100644 --- a/src/lib/Makefile.mk +++ b/src/lib/Makefile.mk @@ -63,6 +63,7 @@ bootblock-y += memcmp.c bootblock-y += boot_device.c bootblock-y += fmap.c +bootblock-$(CONFIG_FLATTENED_DEVICE_TREE) += device_tree.c
verstage-y += prog_loaders.c verstage-y += prog_ops.c @@ -91,6 +92,7 @@ $(eval rmodules_$(arch)-y += rmodule.ld))
romstage-y += fmap.c +romstage-$(CONFIG_FLATTENED_DEVICE_TREE) += device_tree.c romstage-y += delay.c romstage-y += cbfs.c ifneq ($(CONFIG_COMPRESS_RAMSTAGE_LZMA)$(CONFIG_FSP_COMPRESS_FSP_M_LZMA),) diff --git a/src/mainboard/emulation/qemu-riscv/Kconfig b/src/mainboard/emulation/qemu-riscv/Kconfig index 94f9e56..c8a7f18 100644 --- a/src/mainboard/emulation/qemu-riscv/Kconfig +++ b/src/mainboard/emulation/qemu-riscv/Kconfig @@ -34,6 +34,7 @@ select ARCH_ROMSTAGE_RISCV select ARCH_RAMSTAGE_RISCV select RISCV_USE_ARCH_TIMER + select FLATTENED_DEVICE_TREE
config MEMLAYOUT_LD_FILE string @@ -47,7 +48,7 @@
config MAX_CPUS int - default 1 + default 512 # QEMUs current limit for the virt target
config RISCV_ARCH string diff --git a/src/mainboard/emulation/qemu-riscv/Makefile.mk b/src/mainboard/emulation/qemu-riscv/Makefile.mk index bed0f80..0f240aa 100644 --- a/src/mainboard/emulation/qemu-riscv/Makefile.mk +++ b/src/mainboard/emulation/qemu-riscv/Makefile.mk @@ -4,12 +4,14 @@ bootblock-y += uart.c bootblock-y += rom_media.c bootblock-y += clint.c +bootblock-y += smp.c
romstage-y += cbmem.c romstage-y += romstage.c romstage-y += uart.c romstage-y += rom_media.c romstage-y += clint.c +romstage-y += smp.c
ramstage-y += mainboard.c ramstage-y += uart.c @@ -17,5 +19,6 @@ ramstage-y += clint.c ramstage-y += cbmem.c ramstage-y += chip.c +ramstage-y += smp.c
CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/include