From: guoren@kernel.org
To: fangyu.yu@linux.alibaba.com, cp0613@linux.alibaba.com,
inochiama@gmail.com, me@ziyao.cc, gaohan@iscas.ac.cn,
anup@brainfault.org, atish.patra@linux.dev, pjw@kernel.org,
palmer@dabbelt.com, alex@ghiti.fr, tglx@kernel.org,
Albert Ou <aou@eecs.berkeley.edu>
Cc: kvm-riscv@lists.infradead.org, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Guo Ren (Alibaba DAMO Academy)" <guoren@kernel.org>,
linux-riscv@lists.infradead.org
Subject: [PATCH 3/3] irqchip/riscv-imsic: Remove global nr_guest_files after KVM AIA per-HART conversion
Date: Tue, 21 Apr 2026 10:54:50 -0400 [thread overview]
Message-ID: <20260421145451.1597930-4-guoren@kernel.org> (raw)
In-Reply-To: <20260421145451.1597930-1-guoren@kernel.org>
From: "Guo Ren (Alibaba DAMO Academy)" <guoren@kernel.org>
With the recent KVM AIA changes, HGEI line management is now fully
per-CPU (via struct aia_hgei_control::nr_hgei) and the global
kvm_riscv_aia_nr_hgei has been replaced by a simple enabled flag.
The IMSIC driver no longer needs to compute and enforce a global
minimum number of guest interrupt files across all HARTs.
Remove:
- `u32 nr_guest_files` from `struct imsic_global_config`
- the initial `BIT(global->guest_index_bits) - 1` assignment
- the entire per-CPU MMIO-based min() calculation and its comment
(which was specifically there to protect old KVM)
The per-HART guest file count is already handled locally in
`imsic_local_config` during the parent IRQ loop, so this global
field was redundant.
This completes the cleanup series, eliminates the last global
assumption about guest files, and improves support for heterogeneous
(big.LITTLE / multi-vendor) RISC-V platforms.
Signed-off-by: Guo Ren (Alibaba DAMO Academy) <guoren@kernel.org>
---
drivers/irqchip/irq-riscv-imsic-state.c | 12 +-----------
include/linux/irqchip/riscv-imsic.h | 3 ---
2 files changed, 1 insertion(+), 14 deletions(-)
diff --git a/drivers/irqchip/irq-riscv-imsic-state.c b/drivers/irqchip/irq-riscv-imsic-state.c
index e3ed874d89e7..fef27247a34f 100644
--- a/drivers/irqchip/irq-riscv-imsic-state.c
+++ b/drivers/irqchip/irq-riscv-imsic-state.c
@@ -784,7 +784,7 @@ static int __init imsic_parse_fwnode(struct fwnode_handle *fwnode,
int __init imsic_setup_state(struct fwnode_handle *fwnode, void *opaque)
{
- u32 i, j, index, nr_parent_irqs, nr_mmios, nr_guest_files, nr_handlers = 0;
+ u32 i, j, index, nr_parent_irqs, nr_mmios, nr_handlers = 0;
struct imsic_global_config *global;
struct imsic_local_config *local;
void __iomem **mmios_va = NULL;
@@ -878,7 +878,6 @@ int __init imsic_setup_state(struct fwnode_handle *fwnode, void *opaque)
}
/* Configure handlers for target CPUs */
- global->nr_guest_files = BIT(global->guest_index_bits) - 1;
for (i = 0; i < nr_parent_irqs; i++) {
rc = imsic_get_parent_hartid(fwnode, i, &hartid);
if (rc) {
@@ -919,15 +918,6 @@ int __init imsic_setup_state(struct fwnode_handle *fwnode, void *opaque)
local->msi_pa = mmios[index].start + reloff;
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.
- */
- 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);
-
nr_handlers++;
}
diff --git a/include/linux/irqchip/riscv-imsic.h b/include/linux/irqchip/riscv-imsic.h
index 4b348836de7a..7f3ff5c5ea53 100644
--- a/include/linux/irqchip/riscv-imsic.h
+++ b/include/linux/irqchip/riscv-imsic.h
@@ -68,9 +68,6 @@ struct imsic_global_config {
/* Number of guest interrupt identities */
u32 nr_guest_ids;
- /* Number of guest interrupt files per core */
- u32 nr_guest_files;
-
/* Per-CPU IMSIC addresses */
struct imsic_local_config __percpu *local;
};
--
2.40.1
--
kvm-riscv mailing list
kvm-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kvm-riscv
WARNING: multiple messages have this Message-ID (diff)
From: guoren@kernel.org
To: fangyu.yu@linux.alibaba.com, cp0613@linux.alibaba.com,
inochiama@gmail.com, me@ziyao.cc, gaohan@iscas.ac.cn,
anup@brainfault.org, atish.patra@linux.dev, pjw@kernel.org,
palmer@dabbelt.com, alex@ghiti.fr, tglx@kernel.org,
Albert Ou <aou@eecs.berkeley.edu>
Cc: kvm-riscv@lists.infradead.org, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Guo Ren (Alibaba DAMO Academy)" <guoren@kernel.org>,
linux-riscv@lists.infradead.org
Subject: [PATCH 3/3] irqchip/riscv-imsic: Remove global nr_guest_files after KVM AIA per-HART conversion
Date: Tue, 21 Apr 2026 10:54:50 -0400 [thread overview]
Message-ID: <20260421145451.1597930-4-guoren@kernel.org> (raw)
In-Reply-To: <20260421145451.1597930-1-guoren@kernel.org>
From: "Guo Ren (Alibaba DAMO Academy)" <guoren@kernel.org>
With the recent KVM AIA changes, HGEI line management is now fully
per-CPU (via struct aia_hgei_control::nr_hgei) and the global
kvm_riscv_aia_nr_hgei has been replaced by a simple enabled flag.
The IMSIC driver no longer needs to compute and enforce a global
minimum number of guest interrupt files across all HARTs.
Remove:
- `u32 nr_guest_files` from `struct imsic_global_config`
- the initial `BIT(global->guest_index_bits) - 1` assignment
- the entire per-CPU MMIO-based min() calculation and its comment
(which was specifically there to protect old KVM)
The per-HART guest file count is already handled locally in
`imsic_local_config` during the parent IRQ loop, so this global
field was redundant.
This completes the cleanup series, eliminates the last global
assumption about guest files, and improves support for heterogeneous
(big.LITTLE / multi-vendor) RISC-V platforms.
Signed-off-by: Guo Ren (Alibaba DAMO Academy) <guoren@kernel.org>
---
drivers/irqchip/irq-riscv-imsic-state.c | 12 +-----------
include/linux/irqchip/riscv-imsic.h | 3 ---
2 files changed, 1 insertion(+), 14 deletions(-)
diff --git a/drivers/irqchip/irq-riscv-imsic-state.c b/drivers/irqchip/irq-riscv-imsic-state.c
index e3ed874d89e7..fef27247a34f 100644
--- a/drivers/irqchip/irq-riscv-imsic-state.c
+++ b/drivers/irqchip/irq-riscv-imsic-state.c
@@ -784,7 +784,7 @@ static int __init imsic_parse_fwnode(struct fwnode_handle *fwnode,
int __init imsic_setup_state(struct fwnode_handle *fwnode, void *opaque)
{
- u32 i, j, index, nr_parent_irqs, nr_mmios, nr_guest_files, nr_handlers = 0;
+ u32 i, j, index, nr_parent_irqs, nr_mmios, nr_handlers = 0;
struct imsic_global_config *global;
struct imsic_local_config *local;
void __iomem **mmios_va = NULL;
@@ -878,7 +878,6 @@ int __init imsic_setup_state(struct fwnode_handle *fwnode, void *opaque)
}
/* Configure handlers for target CPUs */
- global->nr_guest_files = BIT(global->guest_index_bits) - 1;
for (i = 0; i < nr_parent_irqs; i++) {
rc = imsic_get_parent_hartid(fwnode, i, &hartid);
if (rc) {
@@ -919,15 +918,6 @@ int __init imsic_setup_state(struct fwnode_handle *fwnode, void *opaque)
local->msi_pa = mmios[index].start + reloff;
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.
- */
- 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);
-
nr_handlers++;
}
diff --git a/include/linux/irqchip/riscv-imsic.h b/include/linux/irqchip/riscv-imsic.h
index 4b348836de7a..7f3ff5c5ea53 100644
--- a/include/linux/irqchip/riscv-imsic.h
+++ b/include/linux/irqchip/riscv-imsic.h
@@ -68,9 +68,6 @@ struct imsic_global_config {
/* Number of guest interrupt identities */
u32 nr_guest_ids;
- /* Number of guest interrupt files per core */
- u32 nr_guest_files;
-
/* Per-CPU IMSIC addresses */
struct imsic_local_config __percpu *local;
};
--
2.40.1
WARNING: multiple messages have this Message-ID (diff)
From: guoren@kernel.org
To: fangyu.yu@linux.alibaba.com, cp0613@linux.alibaba.com,
inochiama@gmail.com, me@ziyao.cc, gaohan@iscas.ac.cn,
anup@brainfault.org, atish.patra@linux.dev, pjw@kernel.org,
palmer@dabbelt.com, alex@ghiti.fr, tglx@kernel.org,
Albert Ou <aou@eecs.berkeley.edu>
Cc: kvm-riscv@lists.infradead.org, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Guo Ren (Alibaba DAMO Academy)" <guoren@kernel.org>,
linux-riscv@lists.infradead.org
Subject: [PATCH 3/3] irqchip/riscv-imsic: Remove global nr_guest_files after KVM AIA per-HART conversion
Date: Tue, 21 Apr 2026 10:54:50 -0400 [thread overview]
Message-ID: <20260421145451.1597930-4-guoren@kernel.org> (raw)
In-Reply-To: <20260421145451.1597930-1-guoren@kernel.org>
From: "Guo Ren (Alibaba DAMO Academy)" <guoren@kernel.org>
With the recent KVM AIA changes, HGEI line management is now fully
per-CPU (via struct aia_hgei_control::nr_hgei) and the global
kvm_riscv_aia_nr_hgei has been replaced by a simple enabled flag.
The IMSIC driver no longer needs to compute and enforce a global
minimum number of guest interrupt files across all HARTs.
Remove:
- `u32 nr_guest_files` from `struct imsic_global_config`
- the initial `BIT(global->guest_index_bits) - 1` assignment
- the entire per-CPU MMIO-based min() calculation and its comment
(which was specifically there to protect old KVM)
The per-HART guest file count is already handled locally in
`imsic_local_config` during the parent IRQ loop, so this global
field was redundant.
This completes the cleanup series, eliminates the last global
assumption about guest files, and improves support for heterogeneous
(big.LITTLE / multi-vendor) RISC-V platforms.
Signed-off-by: Guo Ren (Alibaba DAMO Academy) <guoren@kernel.org>
---
drivers/irqchip/irq-riscv-imsic-state.c | 12 +-----------
include/linux/irqchip/riscv-imsic.h | 3 ---
2 files changed, 1 insertion(+), 14 deletions(-)
diff --git a/drivers/irqchip/irq-riscv-imsic-state.c b/drivers/irqchip/irq-riscv-imsic-state.c
index e3ed874d89e7..fef27247a34f 100644
--- a/drivers/irqchip/irq-riscv-imsic-state.c
+++ b/drivers/irqchip/irq-riscv-imsic-state.c
@@ -784,7 +784,7 @@ static int __init imsic_parse_fwnode(struct fwnode_handle *fwnode,
int __init imsic_setup_state(struct fwnode_handle *fwnode, void *opaque)
{
- u32 i, j, index, nr_parent_irqs, nr_mmios, nr_guest_files, nr_handlers = 0;
+ u32 i, j, index, nr_parent_irqs, nr_mmios, nr_handlers = 0;
struct imsic_global_config *global;
struct imsic_local_config *local;
void __iomem **mmios_va = NULL;
@@ -878,7 +878,6 @@ int __init imsic_setup_state(struct fwnode_handle *fwnode, void *opaque)
}
/* Configure handlers for target CPUs */
- global->nr_guest_files = BIT(global->guest_index_bits) - 1;
for (i = 0; i < nr_parent_irqs; i++) {
rc = imsic_get_parent_hartid(fwnode, i, &hartid);
if (rc) {
@@ -919,15 +918,6 @@ int __init imsic_setup_state(struct fwnode_handle *fwnode, void *opaque)
local->msi_pa = mmios[index].start + reloff;
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.
- */
- 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);
-
nr_handlers++;
}
diff --git a/include/linux/irqchip/riscv-imsic.h b/include/linux/irqchip/riscv-imsic.h
index 4b348836de7a..7f3ff5c5ea53 100644
--- a/include/linux/irqchip/riscv-imsic.h
+++ b/include/linux/irqchip/riscv-imsic.h
@@ -68,9 +68,6 @@ struct imsic_global_config {
/* Number of guest interrupt identities */
u32 nr_guest_ids;
- /* Number of guest interrupt files per core */
- u32 nr_guest_files;
-
/* Per-CPU IMSIC addresses */
struct imsic_local_config __percpu *local;
};
--
2.40.1
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2026-04-21 14:55 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-21 14:54 [PATCH 0/3] RISC-V: KVM: AIA: Convert HGEI management to fully per-HART guoren
2026-04-21 14:54 ` guoren
2026-04-21 14:54 ` guoren
2026-04-21 14:54 ` [PATCH 1/3] RISC-V: KVM: AIA: Make HGEI number and management fully per-CPU guoren
2026-04-21 14:54 ` guoren
2026-04-21 14:54 ` guoren
2026-04-21 14:54 ` [PATCH 2/3] RISC-V: KVM: AIA: Replace global HGEI count with simple enabled bool guoren
2026-04-21 14:54 ` guoren
2026-04-21 14:54 ` guoren
2026-04-21 14:54 ` guoren [this message]
2026-04-21 14:54 ` [PATCH 3/3] irqchip/riscv-imsic: Remove global nr_guest_files after KVM AIA per-HART conversion guoren
2026-04-21 14:54 ` guoren
2026-04-22 3:09 ` Guo Ren
2026-04-22 3:09 ` Guo Ren
2026-04-22 3:09 ` Guo Ren
2026-04-22 9:44 ` Anup Patel
2026-04-22 9:44 ` Anup Patel
2026-04-22 9:44 ` Anup Patel
2026-04-25 1:07 ` guoren
2026-04-25 1:07 ` guoren
2026-04-25 1:07 ` guoren
2026-04-23 4:20 ` Inochi Amaoto
2026-04-23 4:20 ` Inochi Amaoto
2026-04-23 4:20 ` Inochi Amaoto
2026-04-23 9:07 ` Guo Ren
2026-04-23 9:07 ` Guo Ren
2026-04-23 9:07 ` Guo Ren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260421145451.1597930-4-guoren@kernel.org \
--to=guoren@kernel.org \
--cc=alex@ghiti.fr \
--cc=anup@brainfault.org \
--cc=aou@eecs.berkeley.edu \
--cc=atish.patra@linux.dev \
--cc=cp0613@linux.alibaba.com \
--cc=fangyu.yu@linux.alibaba.com \
--cc=gaohan@iscas.ac.cn \
--cc=inochiama@gmail.com \
--cc=kvm-riscv@lists.infradead.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=me@ziyao.cc \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=tglx@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.