riscv: Capture IMSIC addresses at boot time
Subsystems (2)
PATCH 1/1 riscv: Capture IMSIC addresses at boot time
Tests may want to use the IMSICs for MSIs and the upcoming BRS tests want to confirm IMSICs are present. Provide those tests the S-mode interrupt file addresses by parsing DT and capturing them at boot time.
Cc Xiang W <[email protected]>
Signed-off-by Andrew Jones <[email protected]>
--- lib/riscv/asm/imsic.h | 8 ++++ lib/riscv/asm/processor.h | 1 + lib/riscv/imsic.c | 86 +++++++++++++++++++++++++++++++++++++++ lib/riscv/setup.c | 2 + riscv/Makefile | 1 + 5 files changed, 98 insertions(+) create mode 100644 lib/riscv/asm/imsic.h create mode 100644 lib/riscv/imsic.c
lib/riscv/asm/imsic.h new file +8 -0
@@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef _ASMRISCV_IMSIC_H_ +#define _ASMRISCV_IMSIC_H_ +#include <asm/processor.h> + +void imsic_init (struct thread_info *ti); + +#endif /* _ASMRISCV_IMSIC_H_ */
lib/riscv/asm/processor.h +1 -0
@@ -15,6 +15,7 @@ struct thread_info {int cpu;unsigned long hartid;unsigned long isa[1 ]; +phys_addr_t imsic_addr;/* S-level interrupt file, INVALID_PHYS_ADDR if none */ unsigned long sp;exception_fn exception_handlers[EXCEPTION_CAUSE_MAX ];exception_fn interrupt_handlers[INTERRUPT_CAUSE_MAX ];
lib/riscv/imsic.c new file +86 -0
86 lines not on this page · raw message
lib/riscv/setup.c +2 -0
@@ -16,6 +16,7 @@#include <on-cpus.h> #include <vmalloc.h> #include <asm/csr.h> +#include <asm/imsic.h> #include <asm/mmu.h> #include <asm/page.h> #include <asm/processor.h>
@@ -56,6 +57,7 @@ static void cpu_set_fdt(int fdtnode __unused, u64 regval, void *info __unused) cpus[cpu].cpu = cpu; cpus[cpu].hartid = regval; +imsic_init (&cpus[cpu]);if (!sbi_hart_get_status (cpus[cpu].hartid).error)set_cpu_present (cpu, true);
riscv/Makefile +1 -0
@@ -39,6 +39,7 @@ cflatobjs += lib/on-cpus.o cflatobjs += lib/vmalloc.o cflatobjs += lib/riscv/bitops.o cflatobjs += lib/riscv/delay.o +cflatobjs += lib/riscv/imsic.o cflatobjs += lib/riscv/io.o cflatobjs += lib/riscv/isa.o cflatobjs += lib/riscv/mmu.o
Signature · 7 lines
2.56.0 -- kvm-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kvm-riscv