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

Nicholas Piggin
2026-03-13T05:20:40Z

There is no chain bit validation in in SBI, so do not support it.

Signed-off-by: Nicholas Piggin <npiggin@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))
+ return 0;
+ return 1;
case RISCV_DBTR_TRIG_MCONTROL6:
+ if (tdata & RV_DBTR_BIT_MASK(MC6, CHAIN))
+ 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));