[PATCH v4 0/2] RISC-V: KVM: Convert HGEI management to fully per-HART

Anup Patel posted 2 patches an hour ago
arch/riscv/kvm/aia.c                    | 65 +++++++++++++------------
drivers/irqchip/irq-riscv-imsic-state.c |  9 ++--
include/linux/irqchip/riscv-imsic.h     |  5 +-
3 files changed, 41 insertions(+), 38 deletions(-)
[PATCH v4 0/2] RISC-V: KVM: Convert HGEI management to fully per-HART
Posted by Anup Patel an hour ago
From: "Guo Ren (Alibaba DAMO Academy)" <guoren@kernel.org>

This short series converts RISC-V KVM AIA's Hypervisor Guest External
Interrupt (HGEI) line management from a global "one-size-fits-all"
model to a fully per-HART (per-CPU) model. It also performs the
corresponding changes in the IMSIC irqchip driver.

The motivation is to properly support heterogeneous RISC-V SoCs
(big.LITTLE, multi-vendor core mixes) where different HARTs may
expose different numbers of guest interrupt files / HGEIE bits.

After this series, HGEI allocation, freeing, and interrupt delivery
are completely per-HART and there are no remaining global assumptions
about number of guest interrupt files.

Changelog:
V4:
 - Don't modify kvm_riscv_aia_nr_hgei in kvm_riscv_aia_enable()
   since we use kvm_riscv_aia_nr_hgei mostly for HGEI enable/disable
   checks.
 - Use GENMASK_ULL() instead of `BIT(hgctrl->nr_hgei + 1) - 1`
 - Always setup SGEI interrupt irrespective of kvm_riscv_aia_nr_hgei

V3:
 - Move PATCH3 as first patch and kept the nr_guest_files in
   global config as the number of guest files across all CPUs
 - Droped original PATCH2 and squashed original PATCH4 into
   original PATCH1 which is now PATCH2.
 - Addressed comments in original PATCH1.

V2:
 - Add per-HART IMSIC guest files to compute final HGEI count.
 - Add min(local->nr_guest_files, nr_guest_files);

V1:
 - https://lore.kernel.org/kvm-riscv/20260421145451.1597930-1-guoren@kernel.org/

Guo Ren (Alibaba DAMO Academy) (2):
  irqchip/riscv-imsic: Add nr_guest_files in per-HART local config
  RISC-V: KVM: AIA: Make HGEI number management fully per-CPU

 arch/riscv/kvm/aia.c                    | 65 +++++++++++++------------
 drivers/irqchip/irq-riscv-imsic-state.c |  9 ++--
 include/linux/irqchip/riscv-imsic.h     |  5 +-
 3 files changed, 41 insertions(+), 38 deletions(-)

-- 
2.43.0