Re: [PATCH v4 2/5] xen/riscv: introduce trap_init()
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
Re: [PATCH v4 2/5] xen/riscv: introduce trap_init()
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
Re: [PATCH v4 2/5] xen/riscv: introduce trap_init()
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
[PATCH v4 2/5] xen/riscv: introduce trap_init()
Signed-off-by: Oleksii Kurochko Reviewed-by: Alistair Francis --- Changes in V4: - Nothing changed --- Changes in V3: - Nothing changed --- Changes in V2: - Rename setup_trap_handler() to trap_init(). - Add Reviewed-by to the commit message. --- xen/arch/riscv/include/asm/traps.h | 1 + xen/arch/riscv/setup.c | 4 xen/arch/riscv/traps.c | 7 +++ 3 files changed, 12 insertions(+) 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 #include +#include #include +#include /* 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 #include +void trap_init(void) +{ +unsigned long addr = (unsigned long)_trap; + +csr_write(CSR_STVEC, addr); +} + static const char *decode_trap_cause(unsigned long cause) { static const char *const trap_causes[] = { -- 2.39.0