]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
irqchip/riscv-imsic: Adjust the number of available guest irq files
authorXu Lu <luxu.kernel@bytedance.com>
Sun, 4 Jan 2026 13:34:57 +0000 (21:34 +0800)
committerAnup Patel <anup@brainfault.org>
Fri, 6 Feb 2026 13:35:34 +0000 (19:05 +0530)
commit376e2f8cca2816c489a9196e65cc904d1a907fd2
tree02c454b2ed0325bea19a1f245e0986dccc027102
parented7ae7a34bea06f81270866dfbe619a22518666b
irqchip/riscv-imsic: Adjust the number of available guest irq files

Currently, KVM assumes the minimum of implemented HGEIE bits and
"BIT(gc->guest_index_bits) - 1" as the number of guest files available
across all CPUs. This will not work when CPUs have different number
of guest files because KVM may incorrectly allocate a guest file on a
CPU with fewer guest files.

To address above, during initialization, calculate the number of
available guest interrupt files according to MMIO resources and
constrain the number of guest interrupt files that can be allocated
by KVM.

Signed-off-by: Xu Lu <luxu.kernel@bytedance.com>
Reviewed-by: Nutty Liu <nutty.liu@hotmail.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Acked-by: Thomas Gleixner <tglx@kernel.org>
Link: https://lore.kernel.org/r/20260104133457.57742-1-luxu.kernel@bytedance.com
Signed-off-by: Anup Patel <anup@brainfault.org>
arch/riscv/kvm/aia.c
drivers/irqchip/irq-riscv-imsic-state.c
include/linux/irqchip/riscv-imsic.h