Message ID | 20200904121341.156416-4-anup.patel@wdc.com |
---|---|
State | Accepted |
Headers | show |
Series | Few ECALL improvements | expand |
On Fri, Sep 4, 2020 at 5:14 AM Anup Patel <anup.patel@wdc.com> wrote: > > We should allow M-mode to M-mode ECALLs because: > 1. No other mode can handle M-mode ECALLs > 2. In future, we can allow M-mode baremetal application (not > linked to OpenSBI) running independently and cooperatively > without corrupting OpenSBI M-mode state (CSRs and memory). > > Signed-off-by: Anup Patel <anup.patel@wdc.com> > --- > lib/sbi/sbi_trap.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/lib/sbi/sbi_trap.c b/lib/sbi/sbi_trap.c > index b8bb20c..db5aa2f 100644 > --- a/lib/sbi/sbi_trap.c > +++ b/lib/sbi/sbi_trap.c > @@ -252,6 +252,7 @@ void sbi_trap_handler(struct sbi_trap_regs *regs) > msg = "misaligned store handler failed"; > break; > case CAUSE_SUPERVISOR_ECALL: > + case CAUSE_MACHINE_ECALL: > rc = sbi_ecall_handler(regs); > msg = "ecall handler failed"; > break; > -- > 2.25.1 > > > -- > opensbi mailing list > opensbi@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/opensbi Reviewed-by: Atish Patra <atish.patra@wdc.com>
> -----Original Message----- > From: Atish Patra <atishp@atishpatra.org> > Sent: 08 September 2020 11:20 > To: Anup Patel <Anup.Patel@wdc.com> > Cc: Atish Patra <Atish.Patra@wdc.com>; Alistair Francis > <Alistair.Francis@wdc.com>; Anup Patel <anup@brainfault.org>; OpenSBI > <opensbi@lists.infradead.org> > Subject: Re: [PATCH 3/3] lib: sbi_trap: Allow M-mode to M-mode ECALLs > > On Fri, Sep 4, 2020 at 5:14 AM Anup Patel <anup.patel@wdc.com> wrote: > > > > We should allow M-mode to M-mode ECALLs because: > > 1. No other mode can handle M-mode ECALLs 2. In future, we can allow > > M-mode baremetal application (not > > linked to OpenSBI) running independently and cooperatively > > without corrupting OpenSBI M-mode state (CSRs and memory). > > > > Signed-off-by: Anup Patel <anup.patel@wdc.com> > > --- > > lib/sbi/sbi_trap.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/lib/sbi/sbi_trap.c b/lib/sbi/sbi_trap.c index > > b8bb20c..db5aa2f 100644 > > --- a/lib/sbi/sbi_trap.c > > +++ b/lib/sbi/sbi_trap.c > > @@ -252,6 +252,7 @@ void sbi_trap_handler(struct sbi_trap_regs *regs) > > msg = "misaligned store handler failed"; > > break; > > case CAUSE_SUPERVISOR_ECALL: > > + case CAUSE_MACHINE_ECALL: > > rc = sbi_ecall_handler(regs); > > msg = "ecall handler failed"; > > break; > > -- > > 2.25.1 > > > > > > -- > > opensbi mailing list > > opensbi@lists.infradead.org > > http://lists.infradead.org/mailman/listinfo/opensbi > > > Reviewed-by: Atish Patra <atish.patra@wdc.com> Applied this patch to the riscv/opensbi repo Regards, Anup
On 9/9/20 1:04 PM, Anup Patel wrote: > > >> -----Original Message----- >> From: Atish Patra <atishp@atishpatra.org> >> Sent: 08 September 2020 11:20 >> To: Anup Patel <Anup.Patel@wdc.com> >> Cc: Atish Patra <Atish.Patra@wdc.com>; Alistair Francis >> <Alistair.Francis@wdc.com>; Anup Patel <anup@brainfault.org>; OpenSBI >> <opensbi@lists.infradead.org> >> Subject: Re: [PATCH 3/3] lib: sbi_trap: Allow M-mode to M-mode ECALLs >> >> On Fri, Sep 4, 2020 at 5:14 AM Anup Patel <anup.patel@wdc.com> wrote: >>> >>> We should allow M-mode to M-mode ECALLs because: >>> 1. No other mode can handle M-mode ECALLs 2. In future, we can allow >>> M-mode baremetal application (not >>> linked to OpenSBI) running independently and cooperatively >>> without corrupting OpenSBI M-mode state (CSRs and memory). Nice! I was wondering why this wasn't there and I thought maybe it's not allowed. Good to see that there's nothing special about M-Mode making ecalls. Since we now switch to S-Mode very early in EDK2, it doesn't make a difference for us. >>> Signed-off-by: Anup Patel <anup.patel@wdc.com> >>> --- >>> lib/sbi/sbi_trap.c | 1 + >>> 1 file changed, 1 insertion(+) >>> >>> diff --git a/lib/sbi/sbi_trap.c b/lib/sbi/sbi_trap.c index >>> b8bb20c..db5aa2f 100644 >>> --- a/lib/sbi/sbi_trap.c >>> +++ b/lib/sbi/sbi_trap.c >>> @@ -252,6 +252,7 @@ void sbi_trap_handler(struct sbi_trap_regs *regs) >>> msg = "misaligned store handler failed"; >>> break; >>> case CAUSE_SUPERVISOR_ECALL: >>> + case CAUSE_MACHINE_ECALL: >>> rc = sbi_ecall_handler(regs); >>> msg = "ecall handler failed"; >>> break; >>> -- >>> 2.25.1 >>> >>> >>> -- >>> opensbi mailing list >>> opensbi@lists.infradead.org >>> http://lists.infradead.org/mailman/listinfo/opensbi >> >> >> Reviewed-by: Atish Patra <atish.patra@wdc.com> > > Applied this patch to the riscv/opensbi repo > > Regards, > Anup >
diff --git a/lib/sbi/sbi_trap.c b/lib/sbi/sbi_trap.c index b8bb20c..db5aa2f 100644 --- a/lib/sbi/sbi_trap.c +++ b/lib/sbi/sbi_trap.c @@ -252,6 +252,7 @@ void sbi_trap_handler(struct sbi_trap_regs *regs) msg = "misaligned store handler failed"; break; case CAUSE_SUPERVISOR_ECALL: + case CAUSE_MACHINE_ECALL: rc = sbi_ecall_handler(regs); msg = "ecall handler failed"; break;
We should allow M-mode to M-mode ECALLs because: 1. No other mode can handle M-mode ECALLs 2. In future, we can allow M-mode baremetal application (not linked to OpenSBI) running independently and cooperatively without corrupting OpenSBI M-mode state (CSRs and memory). Signed-off-by: Anup Patel <anup.patel@wdc.com> --- lib/sbi/sbi_trap.c | 1 + 1 file changed, 1 insertion(+)