[PATCH 05/18] dbtr: Do not support chain bit

Nicholas Piggin npiggin at gmail.com
Mon May 25 21:35:23 PDT 2026


On Mon, May 04, 2026 at 08:45:14PM +0530, Himanshu Chauhan wrote:
> On Fri, Mar 13, 2026 at 03:19:34PM +1000, Nicholas Piggin wrote:
> > There is no chain bit validation in in SBI, so do not support it.
> > 
> > Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
> > ---
> >  lib/sbi/sbi_dbtr.c | 14 ++++++++++++--
> >  1 file changed, 12 insertions(+), 2 deletions(-)
> > 
> > diff --git a/lib/sbi/sbi_dbtr.c b/lib/sbi/sbi_dbtr.c
> > index 65c3b2df..224f2350 100644
> > --- a/lib/sbi/sbi_dbtr.c
> > +++ b/lib/sbi/sbi_dbtr.c
> > @@ -466,11 +466,21 @@ static void dbtr_trigger_clear(struct sbi_dbtr_trigger *trig)
> >  	csr_write(CSR_TDATA2, 0x0);
> >  }
> >  
> > -static int dbtr_trigger_supported(unsigned long type)
> > +static int dbtr_trigger_supported(unsigned long type, unsigned long tdata)
> >  {
> >  	switch (type) {
> >  	case RISCV_DBTR_TRIG_MCONTROL:
> > +		/*
> > +		 * SBI currently does not validate chain bit in install/update
> > +		 * so we do not support it.
> > +		 */
> > +		if (tdata & RV_DBTR_BIT_MASK(MC, CHAIN))
> 
> Just a minor suggestion. Since it may be supported in future, I would suggest that
> we print a warning message that a trigger with chain support was asked for.

I'm not sure that is an appropriate way to report this.

There are already, in theory, certain configurations that may be
supported by the underlying hardware, but are today rejected due
to opensbi not having support for it (e.g., the other trigger
types).

The idea of logging / warning is interesting, maybe under a "verbose"
boot/build option? And the issue of missing hardware vs opensbi support
for a feature is certainly something a user might be interested in. But
I think it's for another patch series.

Thanks,
Nick

> 
> > +			return 0;
> > +		return 1;
> >  	case RISCV_DBTR_TRIG_MCONTROL6:
> > +		if (tdata & RV_DBTR_BIT_MASK(MC6, CHAIN))
> ditto
> 
> Otherwise looks good.
> 
> Reviewed-by: Himanshu Chauhan <himanshu.chauhan at oss.qualcomm.com>
> 
> Thanks
> Regards
> Himanshu
> 
> > +			return 0;
> > +		return 1;
> >  	case RISCV_DBTR_TRIG_ICOUNT:
> >  		return 1;
> >  	default:
> > @@ -613,7 +623,7 @@ int sbi_dbtr_install_trig(unsigned long smode,
> >  		recv = (struct sbi_dbtr_data_msg *)(&entry->data);
> >  		tdata1 = lle_to_cpu(recv->tdata1);
> >  
> > -		if (!dbtr_trigger_supported(TDATA1_GET_TYPE(tdata1))) {
> > +		if (!dbtr_trigger_supported(TDATA1_GET_TYPE(tdata1), tdata1)) {
> >  			*out = _idx;
> >  			sbi_hart_protection_unmap_range((unsigned long)shmem_base,
> >  							trig_count * sizeof(*entry));
> > -- 
> > 2.51.0
> > 
> > 
> > -- 
> > opensbi mailing list
> > opensbi at lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/opensbi
> 
> -- 
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi



More information about the opensbi mailing list