mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3] irqchip/gic-v3-its: Size the collection table for all possible CPUs
@ 2026-11-18  2:51 Jinjie Ruan
  2026-11-18 16:44 ` Zenghui Yu
  0 siblings, 1 reply; 3+ messages in thread
From: Jinjie Ruan @ 2026-11-18  2:51 UTC (permalink / raw)
  To: maz, tglx, radu, linux-arm-kernel, linux-kernel; +Cc: ruanjinjie

The collection table is currently sized at a single ITS page size,
and the driver's allocation policy is to allocate a single collection
per CPU. On systems with more CPUs that the ITS can fit in a single
page, no LPI can be routed to the CPUs that don't have an allocated
collection, and the system grinds to a halt.

Change the allocation policy to allow two-level tables, similarly to
the other tables.

Suggested-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
v3:
- Bail out on a BASER type the architecture does not define.
- Add Suggested-by.
- Link to v2: https://lore.kernel.org/all/20261117123116.591621-1-ruanjinjie@huawei.com/
v2:
- Cleanup the similar calls of its_parse_indirect_baser() (Marc).
- Simplfy the commit message (Marc).
- Drop fix tag and comment (Marc).
- Link to v1: https://lore.kernel.org/all/20261116022330.273840-1-ruanjinjie@huawei.com/
---
 drivers/irqchip/irq-gic-v3-its.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index c952c069f937..9f7616c46c7d 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -2682,7 +2682,7 @@ static int its_alloc_tables(struct its_node *its)
 		u64 val = its_read_baser(its, baser);
 		u64 type = GITS_BASER_TYPE(val);
 		bool indirect = false;
-		u32 order;
+		u32 order, nr_ids;
 
 		if (type == GITS_BASER_TYPE_NONE)
 			continue;
@@ -2696,8 +2696,7 @@ static int its_alloc_tables(struct its_node *its)
 
 		switch (type) {
 		case GITS_BASER_TYPE_DEVICE:
-			indirect = its_parse_indirect_baser(its, baser, &order,
-							    device_ids(its));
+			nr_ids = device_ids(its);
 			break;
 
 		case GITS_BASER_TYPE_VCPU:
@@ -2713,11 +2712,21 @@ static int its_alloc_tables(struct its_node *its)
 				}
 			}
 
-			indirect = its_parse_indirect_baser(its, baser, &order,
-							    ITS_MAX_VPEID_BITS);
+			nr_ids = ITS_MAX_VPEID_BITS;
 			break;
+
+		case GITS_BASER_TYPE_COLLECTION:
+			nr_ids = order_base_2(num_possible_cpus());
+			break;
+
+		default:
+			pr_err("ITS@%pa: BASER%d has invalid type 0x%llx\n",
+			       &its->phys_base, i, type);
+			its_free_tables(its);
+			return -ENXIO;
 		}
 
+		indirect = its_parse_indirect_baser(its, baser, &order, nr_ids);
 		err = its_setup_baser(its, baser, cache, shr, order, indirect);
 		if (err < 0) {
 			its_free_tables(its);
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] irqchip/gic-v3-its: Size the collection table for all possible CPUs
  2026-11-18  2:51 [PATCH v3] irqchip/gic-v3-its: Size the collection table for all possible CPUs Jinjie Ruan
@ 2026-11-18 16:44 ` Zenghui Yu
  2026-11-18 17:20   ` Marc Zyngier
  0 siblings, 1 reply; 3+ messages in thread
From: Zenghui Yu @ 2026-11-18 16:44 UTC (permalink / raw)
  To: Jinjie Ruan; +Cc: maz, tglx, radu, linux-arm-kernel, linux-kernel

On 11/18/26 10:51 AM, Jinjie Ruan wrote:
> The collection table is currently sized at a single ITS page size,
> and the driver's allocation policy is to allocate a single collection
> per CPU. On systems with more CPUs that the ITS can fit in a single
> page, no LPI can be routed to the CPUs that don't have an allocated
> collection, and the system grinds to a halt.

The issue on the reported hardware ("384-CPU HiSilicon HIP12 system", as
described in v1) is fixed by allocating 2 pages for the flat collection
table. That is fine.

> 
> Change the allocation policy to allow two-level tables, similarly to
> the other tables.

But I'm afraid that the two-level CT is still not supported: nothing in the
driver allocates the level-2 CTs.

Thanks,
Zenghui

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] irqchip/gic-v3-its: Size the collection table for all possible CPUs
  2026-11-18 16:44 ` Zenghui Yu
@ 2026-11-18 17:20   ` Marc Zyngier
  0 siblings, 0 replies; 3+ messages in thread
From: Marc Zyngier @ 2026-11-18 17:20 UTC (permalink / raw)
  To: Zenghui Yu; +Cc: Jinjie Ruan, tglx, radu, linux-arm-kernel, linux-kernel

On Wed, 18 Nov 2026 16:44:11 +0000,
Zenghui Yu <zenghui.yu@linux.dev> wrote:
> 
> On 11/18/26 10:51 AM, Jinjie Ruan wrote:
> > The collection table is currently sized at a single ITS page size,
> > and the driver's allocation policy is to allocate a single collection
> > per CPU. On systems with more CPUs that the ITS can fit in a single
> > page, no LPI can be routed to the CPUs that don't have an allocated
> > collection, and the system grinds to a halt.
> 
> The issue on the reported hardware ("384-CPU HiSilicon HIP12 system", as
> described in v1) is fixed by allocating 2 pages for the flat collection
> table. That is fine.
> 
> > 
> > Change the allocation policy to allow two-level tables, similarly to
> > the other tables.
> 
> But I'm afraid that the two-level CT is still not supported: nothing in the
> driver allocates the level-2 CTs.

Hmmm. You're are absolutely right.

It should only be a matter of plugging its_alloc_table_entry() in
its_alloc_collections() and getting the error handling right (which
is, I reckon, the hardest part).

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-18 17:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-18  2:51 [PATCH v3] irqchip/gic-v3-its: Size the collection table for all possible CPUs Jinjie Ruan
2026-11-18 16:44 ` Zenghui Yu
2026-11-18 17:20   ` Marc Zyngier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®