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

Samuel Holland samuel.holland at sifive.com
Tue Dec 10 10:47:48 PST 2024


Hi Clément,

On 2024-12-10 11:05 AM, Clément Léger wrote:
> 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;
> +}

This isn't correct as-is because the PMU code hardcodes MIP_LCOFIP several
places in the SSE handling code. Those would first need to be changed to use
sbi_pmu_irq_bit() before we can use the PMU SSE event on non-Sscofpmf platforms.

Regards,
Samuel

> +
>  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,




More information about the opensbi mailing list