[PATCH 7/9] lib: sbi: Remove regs parameter from trap irq handling functions

Anup Patel anup at brainfault.org
Mon Mar 11 22:20:17 PDT 2024


On Tue, Mar 12, 2024 at 1:17 AM Samuel Holland
<samuel.holland at sifive.com> wrote:
>
> Hi Anup,
>
> On 2024-03-11 11:09 AM, Anup Patel wrote:
> > The trap irq handling functions no longer require regs parameter
> > so remove it.
> >
> > Signed-off-by: Anup Patel <apatel at ventanamicro.com>
> > ---
> >  lib/sbi/sbi_trap.c | 12 ++++++------
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/lib/sbi/sbi_trap.c b/lib/sbi/sbi_trap.c
> > index e6ef6d1..a50e466 100644
> > --- a/lib/sbi/sbi_trap.c
> > +++ b/lib/sbi/sbi_trap.c
> > @@ -198,9 +198,9 @@ int sbi_trap_redirect(struct sbi_trap_regs *regs,
> >       return 0;
> >  }
> >
> > -static int sbi_trap_nonaia_irq(struct sbi_trap_regs *regs, ulong mcause)
> > +static int sbi_trap_nonaia_irq(unsigned long mcause)
> >  {
> > -     mcause &= ~(1UL << (__riscv_xlen - 1));
> > +     mcause &= ~BIT(__riscv_xlen - 1);
> >       switch (mcause) {
> >       case IRQ_M_TIMER:
> >               sbi_timer_process();
> > @@ -217,7 +217,7 @@ static int sbi_trap_nonaia_irq(struct sbi_trap_regs *regs, ulong mcause)
> >       return 0;
> >  }
> >
> > -static int sbi_trap_aia_irq(struct sbi_trap_regs *regs, ulong mcause)
> > +static int sbi_trap_aia_irq(unsigned long mcause)
>
> The mcause parameter is not used in this function either.

Ahh, yes. I will drop it in the next revision.

Regards,
Anup

>
> Regards,
> Samuel
>
> >  {
> >       int rc;
> >       unsigned long mtopi;
> > @@ -291,12 +291,12 @@ struct sbi_trap_regs *sbi_trap_handler(struct sbi_trap_regs *regs)
> >       /* Update trap context pointer */
> >       sbi_trap_set_context(scratch, &tcntx);
> >
> > -     if (mcause & (1UL << (__riscv_xlen - 1))) {
> > +     if (mcause & BIT(__riscv_xlen - 1)) {
> >               if (sbi_hart_has_extension(sbi_scratch_thishart_ptr(),
> >                                          SBI_HART_EXT_SMAIA))
> > -                     rc = sbi_trap_aia_irq(regs, mcause);
> > +                     rc = sbi_trap_aia_irq(mcause);
> >               else
> > -                     rc = sbi_trap_nonaia_irq(regs, mcause);
> > +                     rc = sbi_trap_nonaia_irq(mcause);
> >               msg = "unhandled local interrupt";
> >               goto trap_done;
> >       }
>



More information about the opensbi mailing list