summaryrefslogtreecommitdiff
path: root/drivers/irqchip
diff options
context:
space:
mode:
authorGuo Ren (Alibaba DAMO Academy) <guoren@kernel.org>2026-05-25 15:19:44 +0530
committerAnup Patel <anup@brainfault.org>2026-05-26 09:05:10 +0530
commit59ebc16276c51fa3c462e5a0d21280249755502d (patch)
tree313d084600a3bf239d1fd03a5eac302a58957037 /drivers/irqchip
parent5eb6d68fe24dc856df173700958e90ac0f990333 (diff)
irqchip/riscv-imsic: Add nr_guest_files in per-HART local config
Add nr_guest_files in per-HART local config to represent the number of guest files available on a particular HART whereas the nr_guest_files in the global config represents the number of guest files available across all HARTs. This allows KVM RISC-V to use nr_guest_files from per-HART local config for asymmetric big.Little systems. Signed-off-by: Guo Ren (Alibaba DAMO Academy) <guoren@kernel.org> Acked-by: Thomas Gleixner <tglx@kernel.org> Signed-off-by: Anup Patel <anup.patel@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260525094945.3721783-2-anup.patel@oss.qualcomm.com Signed-off-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'drivers/irqchip')
-rw-r--r--drivers/irqchip/irq-riscv-imsic-state.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/irqchip/irq-riscv-imsic-state.c b/drivers/irqchip/irq-riscv-imsic-state.c
index e3ed874d89e7..b8d1bbbf42f7 100644
--- a/drivers/irqchip/irq-riscv-imsic-state.c
+++ b/drivers/irqchip/irq-riscv-imsic-state.c
@@ -920,13 +920,12 @@ int __init imsic_setup_state(struct fwnode_handle *fwnode, void *opaque)
local->msi_va = mmios_va[index] + reloff;
/*
- * KVM uses global->nr_guest_files to determine the available guest
- * interrupt files on each CPU. Take the minimum number of guest
- * interrupt files across all CPUs to avoid KVM incorrectly allocating
- * an unexisted or unmapped guest interrupt file on some CPUs.
+ * KVM uses both local->nr_guest_files and global->nr_guest_files
+ * to determine the available guest interrupt files on each CPU.
*/
nr_guest_files = (resource_size(&mmios[index]) - reloff) / IMSIC_MMIO_PAGE_SZ - 1;
- global->nr_guest_files = min(global->nr_guest_files, nr_guest_files);
+ local->nr_guest_files = min((BIT(global->guest_index_bits) - 1), nr_guest_files);
+ global->nr_guest_files = min(global->nr_guest_files, local->nr_guest_files);
nr_handlers++;
}