Skip to content

Commit

Permalink
mpfs/mpfs_irq.c: Enable interrupts on all harts
Browse files Browse the repository at this point in the history
Instead of enabling an interrupt on the calling hart, enable it on every
hart. This should balance the interrupt load some, especially in cases
where the interrupt source is enabled only once (which will almost
certainly happen on CPU 0 only).

Signed-off-by: Ville Juven <[email protected]>
  • Loading branch information
pussuw committed Feb 14, 2025
1 parent 381d3fe commit f0214f0
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions arch/risc-v/src/mpfs/mpfs_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ void up_disable_irq(int irq)
PANIC();
}

/* Disable the irq on all harts, we don't know on which it was
* enabled
*/
/* Disable the irq on all harts */

for (i = 0; i < CONFIG_SMP_NCPUS; i++)
{
Expand Down Expand Up @@ -157,6 +155,7 @@ void up_disable_irq(int irq)
void up_enable_irq(int irq)
{
int extirq;
int i;

if (irq == RISCV_IRQ_SOFT)
{
Expand All @@ -173,19 +172,21 @@ void up_enable_irq(int irq)
else if (irq >= MPFS_IRQ_EXT_START)
{
extirq = irq - MPFS_IRQ_EXT_START;
if (extirq < 0 || extirq > NR_IRQS - MPFS_IRQ_EXT_START)
{
PANIC();
}

/* Set enable bit for the irq */

uintptr_t iebase = mpfs_plic_get_iebase(up_cpu_index());
/* Enable the irq on all harts */

if (0 <= extirq && extirq <= NR_IRQS - MPFS_IRQ_EXT_START)
for (i = 0; i < CONFIG_SMP_NCPUS; i++)
{
uintptr_t iebase = mpfs_plic_get_iebase(riscv_cpuid_to_hartid(i));

/* Set enable bit for the irq */

modifyreg32(iebase + (4 * (extirq / 32)), 0, 1 << (extirq % 32));
}
else
{
PANIC();
}
}
}

Expand Down

0 comments on commit f0214f0

Please sign in to comment.