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

Himanshu Chauhan <[email protected]>
Newsgroups org.infradead.lists.opensbi
Message-ID <[email protected]>
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 <[email protected]>
> ---
>  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.

> +			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 <[email protected]>

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
> [email protected]
> http://lists.infradead.org/mailman/listinfo/opensbi

-- 
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.