[PATCH 03/18] dbtr: Fix endian conversion in trigger install handler

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

An endian conversion was missed loading tdata1 from shm. Add the
conversion and change the variable name from ctrl to tdata1 while here.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
lib/sbi/sbi_dbtr.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/sbi/sbi_dbtr.c b/lib/sbi/sbi_dbtr.c
index 8f59e407..10ed6b3e 100644
--- a/lib/sbi/sbi_dbtr.c
+++ b/lib/sbi/sbi_dbtr.c
@@ -589,7 +589,6 @@ int sbi_dbtr_install_trig(unsigned long smode,
union sbi_dbtr_shmem_entry *entry;
struct sbi_dbtr_data_msg *recv;
struct sbi_dbtr_id_msg *xmit;
- unsigned long ctrl;
struct sbi_dbtr_trigger *trig;
struct sbi_dbtr_hart_triggers_state *hs = NULL;

@@ -609,17 +608,19 @@ int sbi_dbtr_install_trig(unsigned long smode,

/* Check requested triggers configuration */
for_each_trig_entry(shmem_base, trig_count, typeof(*entry), entry) {
+ unsigned long tdata1;
+
recv = (struct sbi_dbtr_data_msg *)(&entry->data);
- ctrl = recv->tdata1;
+ tdata1 = lle_to_cpu(recv->tdata1);

- if (!dbtr_trigger_supported(TDATA1_GET_TYPE(ctrl))) {
+ if (!dbtr_trigger_supported(TDATA1_GET_TYPE(tdata1))) {
*out = _idx;
sbi_hart_protection_unmap_range((unsigned long)shmem_base,
trig_count * sizeof(*entry));
return SBI_ERR_FAILED;
}

- if (!dbtr_trigger_valid(TDATA1_GET_TYPE(ctrl), ctrl)) {
+ if (!dbtr_trigger_valid(TDATA1_GET_TYPE(tdata1), tdata1)) {
*out = _idx;
sbi_hart_protection_unmap_range((unsigned long)shmem_base,
trig_count * sizeof(*entry));