lib: sbi: pmu: fix usage of sbi_pmu_irq_bit()

While sbi_pmu_irq_bit() was used to delegate irq to S-mode, LCOFIP usage
was still hardcoded in various places. This led to change the returned
value of sbi_pmu_irq_bit() to be a bit number rather than a bit mask
since it returns an 'int' and we need to obtain the bit number itself to
handle it in the IRQs handlers. Add a similar function to return the
irq mask which can also be used where the mask is required rather than
the bit itself.

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Reviewed-by: Samuel Holland <samuel.holland@sifive.com>
Reviewed-by: Atish Patra <atishp@rivosinc.com>
This commit is contained in:
Clément Léger
2025-01-10 14:15:50 +01:00
committed by Anup Patel
parent bd613dd921
commit 3943ddbaab
6 changed files with 41 additions and 24 deletions

View File

@@ -122,6 +122,5 @@
/* T-HEAD C9xx MIP CSR extension */
#define THEAD_C9XX_IRQ_PMU_OVF 17
#define THEAD_C9XX_MIP_MOIP (_UL(1) << THEAD_C9XX_IRQ_PMU_OVF)
#endif

View File

@@ -53,7 +53,7 @@ static void thead_c9xx_pmu_ctr_disable_irq(uint32_t ctr_idx)
static int thead_c9xx_pmu_irq_bit(void)
{
return THEAD_C9XX_MIP_MOIP;
return THEAD_C9XX_IRQ_PMU_OVF;
}
static const struct sbi_pmu_device thead_c9xx_pmu_device = {