diff mbox series

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

Message ID 20240311160944.1233523-8-apatel@ventanamicro.com
State Changes Requested
Headers show
Series Improve trap handling for nested traps | expand

Commit Message

Anup Patel March 11, 2024, 4:09 p.m. UTC
The trap irq handling functions no longer require regs parameter
so remove it.

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
---
 lib/sbi/sbi_trap.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Samuel Holland March 11, 2024, 7:47 p.m. UTC | #1
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@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.

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;
>  	}
Anup Patel March 12, 2024, 5:20 a.m. UTC | #2
On Tue, Mar 12, 2024 at 1:17 AM Samuel Holland
<samuel.holland@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@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;
> >       }
>
diff mbox series

Patch

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)
 {
 	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;
 	}