summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid E. Garcia Porras <[email protected]>2026-07-27 12:30:39 -0600
committerAnup Patel <[email protected]>2026-09-01 10:36:07 +0530
commit27d954538410a7fbecf0ed68ce319706d3e3b142 (patch)
tree32458e6ec00d4d90a0ca16410e14a4c533ce92c1 /include
parent548518e675d0ed387ff3ee2d9a2226a6e93090a4 (diff)
lib: sbi: dbtr: add platform device for per-slot trigger capabilities
The tinfo probe only discovers trigger types; WARL fields tied off inside an implemented trigger CSR (e.g. an mcontrol6 trigger without load/store address match) are not discoverable. sbi_alloc_trigger() also selects the first free trigger slot irrespective of the requested trigger type or configuration. Unsupported configurations are thus silently dropped by the hardware while SBI reports success, where SBI v3.0 sections 19.4 / 19.5 require SBI_ERR_NOT_SUPPORTED. Add an optional platform device, struct sbi_dbtr_device, with a trigger_supported(idx, tdata1, tdata2, tdata3) callback reporting whether the trigger slot selected by idx (the tselect value) supports a given configuration. Use it, together with the probed per-slot type_mask, to: - allocate only trigger slots supporting the requested configuration (new dbtr_find_free_slot() helper) - reject unsupportable install/update requests with SBI_ERR_NOT_SUPPORTED - count only supporting slots in sbi_dbtr_num_trig() (SBI v3.0 section 19.1) The install path now dry-runs the allocation of the whole batch before programming any trigger, so a partially-installed batch is never left behind. Without a registered device, only the type matching applies (unchanged behavior). Fixes: 97f234f15c96 ("lib: sbi: Introduce the SBI debug triggers extension support") Signed-off-by: David E. Garcia Porras <[email protected]> Reviewed-by: Anup Patel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Anup Patel <[email protected]>
Diffstat (limited to 'include')
-rw-r--r--include/sbi/sbi_dbtr.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/sbi/sbi_dbtr.h b/include/sbi/sbi_dbtr.h
index 5e0bf84e..90871f0d 100644
--- a/include/sbi/sbi_dbtr.h
+++ b/include/sbi/sbi_dbtr.h
@@ -77,6 +77,16 @@ struct sbi_dbtr_hart_triggers_state {
u32 probed;
};
+/** Platform specific debug trigger operations */
+struct sbi_dbtr_device {
+ char name[32];
+ bool (*trigger_supported)(unsigned long idx, unsigned long tdata1,
+ unsigned long tdata2, unsigned long tdata3);
+};
+
+const struct sbi_dbtr_device *sbi_dbtr_get_device(void);
+void sbi_dbtr_set_device(const struct sbi_dbtr_device *dev);
+
#define TDATA1_GET_TYPE(_t1) \
EXTRACT_FIELD(_t1, RV_DBTR_BIT_MASK(TDATA1, TYPE))