[PATCH v2 4/4] lib: sbi: pmu: add an sse .is_supported_cb callback implementation

Clément Léger cleger at rivosinc.com
Tue Dec 10 09:05:52 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 6f192440..46dbcc9a 100644
--- a/lib/sbi/sbi_pmu.c
+++ b/lib/sbi/sbi_pmu.c
@@ -1110,7 +1110,16 @@ static void pmu_sse_complete(uint32_t event_id)
 	csr_set(CSR_MIE, MIP_LCOFIP);
 }
 
+static bool pmu_sse_is_supported(uint32_t event_id)
+{
+	if (!sbi_pmu_irq_bit())
+		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