Re: [PATCH 02/18] dbtr: Trigger update should set sbiret.value on failure
Himanshu Chauhan <[email protected]>
| Newsgroups | org.infradead.lists.opensbi |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Mar 13, 2026 at 03:19:31PM +1000, Nicholas Piggin wrote: > According to RISC-V SBI specification, trigger updates should return the > value of the problem trigger index on failure. > > Signed-off-by: Nicholas Piggin <[email protected]> > --- > include/sbi/sbi_dbtr.h | 2 +- > lib/sbi/sbi_dbtr.c | 4 +++- > lib/sbi/sbi_ecall_dbtr.c | 2 +- > 3 files changed, 5 insertions(+), 3 deletions(-) > > diff --git a/include/sbi/sbi_dbtr.h b/include/sbi/sbi_dbtr.h > index 5e0bf84e..b8b5c9ab 100644 > --- a/include/sbi/sbi_dbtr.h > +++ b/include/sbi/sbi_dbtr.h > @@ -115,7 +115,7 @@ int sbi_dbtr_uninstall_trig(unsigned long trig_idx_base, > int sbi_dbtr_enable_trig(unsigned long trig_idx_base, > unsigned long trig_idx_mask); > int sbi_dbtr_update_trig(unsigned long smode, > - unsigned long trig_count); > + unsigned long trig_count, unsigned long *out); > int sbi_dbtr_disable_trig(unsigned long trig_idx_base, > unsigned long trig_idx_mask); > > diff --git a/lib/sbi/sbi_dbtr.c b/lib/sbi/sbi_dbtr.c > index b0160163..8f59e407 100644 > --- a/lib/sbi/sbi_dbtr.c > +++ b/lib/sbi/sbi_dbtr.c > @@ -714,7 +714,7 @@ int sbi_dbtr_enable_trig(unsigned long trig_idx_base, > } > > int sbi_dbtr_update_trig(unsigned long smode, > - unsigned long trig_count) > + unsigned long trig_count, unsigned long *out) > { > unsigned long trig_idx; > struct sbi_dbtr_trigger *trig; > @@ -740,6 +740,7 @@ int sbi_dbtr_update_trig(unsigned long smode, > > if (trig_idx >= hs->total_trigs) { > sbi_hart_protection_unmap_range((unsigned long)entry, sizeof(*entry)); > + *out = _idx; > return SBI_ERR_INVALID_PARAM; > } > > @@ -747,6 +748,7 @@ int sbi_dbtr_update_trig(unsigned long smode, > > if (!(trig->state & RV_DBTR_BIT_MASK(TS, MAPPED))) { > sbi_hart_protection_unmap_range((unsigned long)entry, sizeof(*entry)); > + *out = _idx; > return SBI_ERR_FAILED; > } > > diff --git a/lib/sbi/sbi_ecall_dbtr.c b/lib/sbi/sbi_ecall_dbtr.c > index 40a437ee..f3196feb 100644 > --- a/lib/sbi/sbi_ecall_dbtr.c > +++ b/lib/sbi/sbi_ecall_dbtr.c > @@ -43,7 +43,7 @@ static int sbi_ecall_dbtr_handler(unsigned long extid, unsigned long funcid, > ret = sbi_dbtr_enable_trig(regs->a0, regs->a1); > break; > case SBI_EXT_DBTR_TRIGGER_UPDATE: > - ret = sbi_dbtr_update_trig(smode, regs->a0); > + ret = sbi_dbtr_update_trig(smode, regs->a0, &out->value); > break; > case SBI_EXT_DBTR_TRIGGER_DISABLE: > ret = sbi_dbtr_disable_trig(regs->a0, regs->a1); Looks good. Reviewed-by: Himanshu Chauhan <[email protected]> T/R Himanshu > -- > 2.51.0 > > > -- > opensbi mailing list > [email protected] > http://lists.infradead.org/mailman/listinfo/opensbi -- opensbi mailing list [email protected] http://lists.infradead.org/mailman/listinfo/opensbi