Skip to content

Commit 15ff2ff

Browse files
committed
RISC-V: KVM: Don't setup SGEI for zero guest external interrupts
No need to setup SGEI local interrupt when there are zero guest external interrupts (i.e. zero HW IMSIC guest files). Signed-off-by: Anup Patel <apatel@ventanamicro.com> Reviewed-by: Atish Patra <atishp@rivosinc.com> Link: https://lore.kernel.org/r/20241020194734.58686-7-apatel@ventanamicro.com Signed-off-by: Anup Patel <anup@brainfault.org>
1 parent 5d8f7ee commit 15ff2ff

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

arch/riscv/kvm/aia.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,10 @@ static int aia_hgei_init(void)
499499
hgctrl->free_bitmap = 0;
500500
}
501501

502+
/* Skip SGEI interrupt setup for zero guest external interrupts */
503+
if (!kvm_riscv_aia_nr_hgei)
504+
goto skip_sgei_interrupt;
505+
502506
/* Find INTC irq domain */
503507
domain = irq_find_matching_fwnode(riscv_get_intc_hwnode(),
504508
DOMAIN_BUS_ANY);
@@ -522,11 +526,16 @@ static int aia_hgei_init(void)
522526
return rc;
523527
}
524528

529+
skip_sgei_interrupt:
525530
return 0;
526531
}
527532

528533
static void aia_hgei_exit(void)
529534
{
535+
/* Do nothing for zero guest external interrupts */
536+
if (!kvm_riscv_aia_nr_hgei)
537+
return;
538+
530539
/* Free per-CPU SGEI interrupt */
531540
free_percpu_irq(hgei_parent_irq, &aia_hgei);
532541
}

0 commit comments

Comments
 (0)