Message ID | b1b2252d3105eeaf0cee10ae2be253c8526d0e5c.1677237653.git.oleksii.kurochko@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | RISCV basic exception handling implementation | expand |
On 24.02.2023 12:35, Oleksii Kurochko wrote: > @@ -11,6 +13,8 @@ void __init noreturn start_xen(void) > { > early_printk("Hello from C env\n"); > > + trap_init(); > + > for ( ;; ) > asm volatile ("wfi"); Along the lines of what Andrew has said there - it's hard to see how this can come (both code flow and patch ordering wise) ahead of clearing .bss. Jan
On Mon, 2023-02-27 at 13:50 +0100, Jan Beulich wrote: > On 24.02.2023 12:35, Oleksii Kurochko wrote: > > @@ -11,6 +13,8 @@ void __init noreturn start_xen(void) > > { > > early_printk("Hello from C env\n"); > > > > + trap_init(); > > + > > for ( ;; ) > > asm volatile ("wfi"); > > Along the lines of what Andrew has said there - it's hard to see > how this can come (both code flow and patch ordering wise) ahead > of clearing .bss. So should I add the patch with initializatin of bss as a part of this patch series? ~ Oleksii
On 01.03.2023 11:34, Oleksii wrote: > On Mon, 2023-02-27 at 13:50 +0100, Jan Beulich wrote: >> On 24.02.2023 12:35, Oleksii Kurochko wrote: >>> @@ -11,6 +13,8 @@ void __init noreturn start_xen(void) >>> { >>> early_printk("Hello from C env\n"); >>> >>> + trap_init(); >>> + >>> for ( ;; ) >>> asm volatile ("wfi"); >> >> Along the lines of what Andrew has said there - it's hard to see >> how this can come (both code flow and patch ordering wise) ahead >> of clearing .bss. > So should I add the patch with initializatin of bss as a part of this > patch series? That or make clear in the cover letter that there is a dependency. Jan
diff --git a/xen/arch/riscv/include/asm/traps.h b/xen/arch/riscv/include/asm/traps.h index f3fb6b25d1..f1879294ef 100644 --- a/xen/arch/riscv/include/asm/traps.h +++ b/xen/arch/riscv/include/asm/traps.h @@ -7,6 +7,7 @@ void do_trap(struct cpu_user_regs *cpu_regs); void handle_trap(void); +void trap_init(void); #endif /* __ASSEMBLY__ */ diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c index d09ffe1454..c8513ca4f8 100644 --- a/xen/arch/riscv/setup.c +++ b/xen/arch/riscv/setup.c @@ -1,7 +1,9 @@ #include <xen/compile.h> #include <xen/init.h> +#include <asm/csr.h> #include <asm/early_printk.h> +#include <asm/traps.h> /* Xen stack for bringing up the first CPU. */ unsigned char __initdata cpu0_boot_stack[STACK_SIZE] @@ -11,6 +13,8 @@ void __init noreturn start_xen(void) { early_printk("Hello from C env\n"); + trap_init(); + for ( ;; ) asm volatile ("wfi"); diff --git a/xen/arch/riscv/traps.c b/xen/arch/riscv/traps.c index 29b1a0dfae..ad7311f269 100644 --- a/xen/arch/riscv/traps.c +++ b/xen/arch/riscv/traps.c @@ -13,6 +13,13 @@ #include <asm/processor.h> #include <asm/traps.h> +void trap_init(void) +{ + unsigned long addr = (unsigned long)&handle_trap; + + csr_write(CSR_STVEC, addr); +} + static const char *decode_trap_cause(unsigned long cause) { static const char *const trap_causes[] = {