[PATCH v3 4/5] lib: sbi: pmu: add an sse .is_supported_cb callback implementation
Clément Léger
cleger at rivosinc.com
Thu Dec 12 12:34:20 PST 2024
Since the PMU overflow event can only be generated if a PMU overflow irq
is implemented, add a pmu_sse_is_supported() function to check for the
PMU irq presence.
Signed-off-by: Clément Léger <cleger at rivosinc.com>
---
lib/sbi/sbi_pmu.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/lib/sbi/sbi_pmu.c b/lib/sbi/sbi_pmu.c
index 182d8db9..dae587ab 100644
--- a/lib/sbi/sbi_pmu.c
+++ b/lib/sbi/sbi_pmu.c
@@ -1122,7 +1122,16 @@ static void pmu_sse_complete(uint32_t event_id)
csr_set(CSR_MIE, sbi_pmu_irq_mask());
}
+static bool pmu_sse_is_supported(uint32_t event_id)
+{
+ if (sbi_pmu_irq_bit() < 0)
+ return false;
+
+ return true;
+}
+
static const struct sbi_sse_cb_ops pmu_sse_cb_ops = {
+ .is_supported_cb = pmu_sse_is_supported,
.enable_cb = pmu_sse_enable,
.disable_cb = pmu_sse_disable,
.complete_cb = pmu_sse_complete,
--
2.45.2
More information about the opensbi
mailing list