* [PATCH v3 00/14] irqchip/gic-v5: Fix misc IRS and ITS host driver issues
@ 2026-11-18 17:35 Sascha Bischoff
2026-11-18 17:35 ` [PATCH v3 01/14] irqchip/gic-v5: Reject SPIs not backed by an IRS Sascha Bischoff
` (13 more replies)
0 siblings, 14 replies; 25+ messages in thread
From: Sascha Bischoff @ 2026-11-18 17:35 UTC (permalink / raw)
To: Marc Zyngier, Lorenzo Pieralisi, Thomas Gleixner, Radu Rendec,
Timothy Hayes, Catalin Marinas, Jonathan Cameron,
Rafael J. Wysocki
Cc: linux-arm-kernel, linux-kernel, Fuad Tabba, Sascha Bischoff,
Sashiko AI
This series fixes issues in the GICv5 host IRS and ITS drivers.
The ITS invalidation serialisation fix addresses Sashiko's report of a
race between event and device invalidation commands [1]. The other
patches fix IRS allocation and routing, IRS synchronisation, ITS table
selection and cache maintenance, ACPI coherency handling, and resource
cleanup.
Since v2, Fuad reported missing cache maintenance and L1 invalidation
when allocating an L2 device table, as well as unsafe table cleanup
after a hardware timeout [2]. This revision includes his L2
device-table cache-clean patch and adds fixes for L1 invalidation and
the host IRS and ITS timeout paths.
The IRS changes:
* Reject allocation of an SPI without a backing IRS and warn about
broken firmware.
* Only program IRS_PE_CR0.DPS when 1-of-N routing is supported.
* Serialise synchronisation requests and their completion polls.
* Retain the L2 IST and its L1 entry if mapping times out, and prevent
a later allocation from overwriting the pending mapping.
The ITS changes:
* Serialise event and device cache invalidations, which share the
DIDR register.
* Select linear device and interrupt translation tables when one L2
table covers the full ID space.
* Honour the ACPI noncoherent flag.
* Use firmware-node names in initialisation warnings.
* Invalidate the device cache before freeing an ITT.
* Correct cache-maintenance sizing after limiting the DeviceID width.
* Release the reserved MMIO region if DT-based ITS initialisation
fails.
* Retain the ITT if device invalidation times out during registration
or teardown.
* Clean a new L2 device table before publishing its valid L1 DTE.
* Invalidate the L1 DTE immediately after publishing the L2 device
table, including when device registration subsequently fails.
The IRS/ITS locking fixes, ITS table-selection fix, ACPI coherency
fix, device-table cache-maintenance fixes and L1 DTE invalidation fix
carry Cc: stable trailers for backporting.
The series is based on v7.4-rc3. Thanks to Lorenzo for the review and
to Fuad for the additional reports and cache-clean patch.
Sascha
[1] https://sashiko.dev/#/patchset/20261016155741.979985-1-sascha.bischoff@arm.com?part=11
[2] https://lore.kernel.org/r/20261112145814.853424-1-fuad.tabba@linux.dev
Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com>
---
Changes in v3:
- Rebased onto v7.4-rc3.
- Added Fuad's patch to clean an L2 device table before publishing it.
- Retain the L2 IST and its L1 entry on a mapping timeout, and reject
subsequent allocation attempts that would overwrite a pending mapping.
- Retain ITTs when device invalidation times out during registration
or teardown.
- Added L1 DTE invalidation immediately after publishing an L2 device
table, keeping single-device invalidations for registration and teardown.
- Reworded the IRS synchronisation and ITS invalidation commit messages
to describe the host issues without relying on future KVM support.
- Collected Acked-by tags and reordered commit trailers as requested.
- Link to v2: https://patch.msgid.link/20261104-host_gicv5_fixes-v2-0-e47ad20ea3c8@arm.com
Changes in v2:
- Explained why IRS synchronisation uses a raw spinlock in the KVM
affinity path.
- Clarified the ITS invalidation race and described the KVM forwarding
path.
- Reworked to calculate the device-table size after capping the
DeviceID width.
- Reordered local declarations in the ITS probe function to be in
reverse fir tree order.
- Added Acked-by tags.
- Link to v1: https://patch.msgid.link/20261102-host_gicv5_fixes-v1-0-743b61626fc5@arm.com
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
To: Lorenzo Pieralisi <lpieralisi@kernel.org>
To: Marc Zyngier <maz@kernel.org>
To: Thomas Gleixner <tglx@kernel.org>
To: Radu Rendec <radu@rendec.net>
To: Sascha Bischoff <sascha.bischoff@arm.com>
To: Timothy Hayes <timothy.hayes@arm.com>
To: Catalin Marinas <catalin.marinas@arm.com>
To: Jonathan Cameron <jic23@kernel.org>
To: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
---
Fuad Tabba (1):
irqchip/gic-v5: Clean a level 2 device table before making it valid
Sascha Bischoff (13):
irqchip/gic-v5: Reject SPIs not backed by an IRS
irqchip/gic-v5: Only set IRS DPS when 1ofN routing is supported
irqchip/gic-v5: Serialise IRS synchronisation requests
irqchip/gic-v5: Retain the L2 IST when mapping times out
irqchip/gic-v5: Serialise ITS invalidation commands
irqchip/gic-v5: Use linear DT and ITT when L2 covers all IDs
irqchip/gic-v5: Honour ACPI ITS noncoherent flag
irqchip/gic-v5: Use firmware node name in ITS warning
irqchip/gic-v5: Invalidate ITS device cache before freeing ITT
irqchip/gic-v5: Clean the allocated linear device table size
irqchip/gic-v5: Release ITS MMIO region on DT probe failure
irqchip/gic-v5: Retain the ITT when device invalidation times out
irqchip/gic-v5: Invalidate the L1 DTE when allocating an L2 device table
drivers/irqchip/irq-gic-v5-irs.c | 34 ++++++++++++-------
drivers/irqchip/irq-gic-v5-its.c | 68 +++++++++++++++++++++++++++++---------
drivers/irqchip/irq-gic-v5.c | 9 +++++
include/linux/irqchip/arm-gic-v5.h | 1 +
4 files changed, 84 insertions(+), 28 deletions(-)
---
base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3
change-id: 20261102-host_gicv5_fixes-1eeea29d2ea4
Best regards,
--
Sascha Bischoff <sascha.bischoff@arm.com>
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH v3 01/14] irqchip/gic-v5: Reject SPIs not backed by an IRS
2026-11-18 17:35 [PATCH v3 00/14] irqchip/gic-v5: Fix misc IRS and ITS host driver issues Sascha Bischoff
@ 2026-11-18 17:35 ` Sascha Bischoff
2026-11-18 17:35 ` [PATCH v3 02/14] irqchip/gic-v5: Only set IRS DPS when 1ofN routing is supported Sascha Bischoff
` (12 subsequent siblings)
13 siblings, 0 replies; 25+ messages in thread
From: Sascha Bischoff @ 2026-11-18 17:35 UTC (permalink / raw)
To: Marc Zyngier, Lorenzo Pieralisi, Thomas Gleixner, Radu Rendec,
Timothy Hayes, Catalin Marinas, Jonathan Cameron,
Rafael J. Wysocki
Cc: linux-arm-kernel, linux-kernel, Fuad Tabba, Sascha Bischoff
It is possible to build a multi-IRS GICv5 system where there are gaps
in the global SPI range that are not backed by any IRS. In the current
incarnation, this results in dereferencing a null pointer.
Reject cases where the firmware attempts to use those SPIs during IRQ
allocation by catching the case where there is no chip_data associated
with the irq (meaning that there is no IRS to back it). Spit out a
warning about broken firmware when this is encountered as it shouldn't
be using non-existent SPIs in the first place.
Fixes: 5cb1b6dab2def ("irqchip/gic-v5: Add GICv5 IRS/SPI support")
Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com>
Acked-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
---
drivers/irqchip/irq-gic-v5.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/irqchip/irq-gic-v5.c b/drivers/irqchip/irq-gic-v5.c
index 8c0303af71e7d..f3cce2bd28cc3 100644
--- a/drivers/irqchip/irq-gic-v5.c
+++ b/drivers/irqchip/irq-gic-v5.c
@@ -727,6 +727,15 @@ static int gicv5_irq_spi_domain_alloc(struct irq_domain *domain, unsigned int vi
irqd = irq_desc_get_irq_data(irq_to_desc(virq));
chip_data = gicv5_irs_lookup_by_spi_id(hwirq);
+ /*
+ * The global SPI range may contain IDs not covered by any IRS, i.e., it
+ * may have gaps, in which case there is no IRS to back the SPI. Catch
+ * broken firmware trying to use any of those SPIs.
+ */
+ if (!chip_data) {
+ pr_warn("Firmware bug! Unimplemented SPI (0x%lx)!\n", hwirq);
+ return -EINVAL;
+ }
irq_domain_set_info(domain, virq, hwirq, &gicv5_spi_irq_chip, chip_data,
handle_fasteoi_irq, NULL, NULL);
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v3 02/14] irqchip/gic-v5: Only set IRS DPS when 1ofN routing is supported
2026-11-18 17:35 [PATCH v3 00/14] irqchip/gic-v5: Fix misc IRS and ITS host driver issues Sascha Bischoff
2026-11-18 17:35 ` [PATCH v3 01/14] irqchip/gic-v5: Reject SPIs not backed by an IRS Sascha Bischoff
@ 2026-11-18 17:35 ` Sascha Bischoff
2026-11-19 11:50 ` Fuad Tabba
2026-11-18 17:35 ` [PATCH v3 03/14] irqchip/gic-v5: Serialise IRS synchronisation requests Sascha Bischoff
` (11 subsequent siblings)
13 siblings, 1 reply; 25+ messages in thread
From: Sascha Bischoff @ 2026-11-18 17:35 UTC (permalink / raw)
To: Marc Zyngier, Lorenzo Pieralisi, Thomas Gleixner, Radu Rendec,
Timothy Hayes, Catalin Marinas, Jonathan Cameron,
Rafael J. Wysocki
Cc: linux-arm-kernel, linux-kernel, Fuad Tabba, Sascha Bischoff
IRS_PE_CR0.DPS is RES0 when the IRS does not support 1ofN routing.
Read the capability from IRS_IDR0 and skip programming DPS on systems
without support for 1ofN routing, rather than blindly writing it.
Fixes: 5cb1b6dab2def ("irqchip/gic-v5: Add GICv5 IRS/SPI support")
Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com>
Acked-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
---
drivers/irqchip/irq-gic-v5-irs.c | 14 +++++++++-----
include/linux/irqchip/arm-gic-v5.h | 1 +
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/irqchip/irq-gic-v5-irs.c b/drivers/irqchip/irq-gic-v5-irs.c
index 9d60f474aa4f6..4edf787f3f97f 100644
--- a/drivers/irqchip/irq-gic-v5-irs.c
+++ b/drivers/irqchip/irq-gic-v5-irs.c
@@ -541,12 +541,15 @@ int gicv5_irs_register_cpu(int cpuid)
return -ENXIO;
}
- cr0 = FIELD_PREP(GICV5_IRS_PE_CR0_DPS, 0x1);
- irs_writel_relaxed(irs_data, cr0, GICV5_IRS_PE_CR0);
+ /* IRS_PE_CR0.DPS is RES0 when 1ofN routing is unsupported. */
+ if (gicv5_global_data.one_of_n) {
+ cr0 = FIELD_PREP(GICV5_IRS_PE_CR0_DPS, 0x1);
+ irs_writel_relaxed(irs_data, cr0, GICV5_IRS_PE_CR0);
- ret = gicv5_irs_wait_for_pe_cr0(irs_data);
- if (ret)
- return ret;
+ ret = gicv5_irs_wait_for_pe_cr0(irs_data);
+ if (ret)
+ return ret;
+ }
pr_debug("CPU %d enabled PE IAFFID 0x%x\n", cpuid, iaffid);
@@ -725,6 +728,7 @@ static int __init gicv5_irs_init(struct gicv5_irs_chip_data *irs_data)
if (list_empty(&irs_nodes)) {
idr = irs_readl_relaxed(irs_data, GICV5_IRS_IDR0);
gicv5_global_data.virt_capable = !!FIELD_GET(GICV5_IRS_IDR0_VIRT, idr);
+ gicv5_global_data.one_of_n = !!FIELD_GET(GICV5_IRS_IDR0_ONE_N, idr);
idr = irs_readl_relaxed(irs_data, GICV5_IRS_IDR1);
irs_setup_pri_bits(idr);
diff --git a/include/linux/irqchip/arm-gic-v5.h b/include/linux/irqchip/arm-gic-v5.h
index 299e75bc95255..34e22e7d4a4c7 100644
--- a/include/linux/irqchip/arm-gic-v5.h
+++ b/include/linux/irqchip/arm-gic-v5.h
@@ -532,6 +532,7 @@ struct gicv5_chip_data {
u8 cpuif_id_bits;
u8 irs_pri_bits;
bool virt_capable;
+ bool one_of_n;
struct {
__le64 *l1ist_addr;
u32 l2_size;
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v3 03/14] irqchip/gic-v5: Serialise IRS synchronisation requests
2026-11-18 17:35 [PATCH v3 00/14] irqchip/gic-v5: Fix misc IRS and ITS host driver issues Sascha Bischoff
2026-11-18 17:35 ` [PATCH v3 01/14] irqchip/gic-v5: Reject SPIs not backed by an IRS Sascha Bischoff
2026-11-18 17:35 ` [PATCH v3 02/14] irqchip/gic-v5: Only set IRS DPS when 1ofN routing is supported Sascha Bischoff
@ 2026-11-18 17:35 ` Sascha Bischoff
2026-11-19 11:53 ` Fuad Tabba
2026-11-18 17:35 ` [PATCH v3 04/14] irqchip/gic-v5: Retain the L2 IST when mapping times out Sascha Bischoff
` (10 subsequent siblings)
13 siblings, 1 reply; 25+ messages in thread
From: Sascha Bischoff @ 2026-11-18 17:35 UTC (permalink / raw)
To: Marc Zyngier, Lorenzo Pieralisi, Thomas Gleixner, Radu Rendec,
Timothy Hayes, Catalin Marinas, Jonathan Cameron,
Rafael J. Wysocki
Cc: linux-arm-kernel, linux-kernel, Fuad Tabba, Sascha Bischoff
IRS_SYNCR writes are ignored while IRS_SYNC_STATUSR.IDLE is clear.
Concurrent calls to gicv5_irs_syncr() can overlap, causing a request
to be dropped. A caller can then observe the earlier request
completing and assume that its own events have been processed.
gicv5_irs_syncr() may need to be called in atomic context. Serialise
the request and completion poll with a raw spinlock, and use atomic
polling.
Fixes: 57d72196dfc8 ("irqchip/gic-v5: Add GICv5 ITS support")
Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com>
Acked-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
Cc: stable@vger.kernel.org
---
drivers/irqchip/irq-gic-v5-irs.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/irqchip/irq-gic-v5-irs.c b/drivers/irqchip/irq-gic-v5-irs.c
index 4edf787f3f97f..ead76560ea08f 100644
--- a/drivers/irqchip/irq-gic-v5-irs.c
+++ b/drivers/irqchip/irq-gic-v5-irs.c
@@ -10,6 +10,7 @@
#include <linux/log2.h>
#include <linux/of.h>
#include <linux/of_address.h>
+#include <linux/spinlock.h>
#include <linux/irqchip.h>
#include <linux/irqchip/arm-gic-v5.h>
@@ -22,6 +23,8 @@
#define LPI_ID_BITS_LINEAR 12
static DEFINE_PER_CPU_READ_MOSTLY(struct gicv5_irs_chip_data *, per_cpu_irs_data);
+/* Synchronization requests must not overlap in an IRS Domain. */
+static DEFINE_RAW_SPINLOCK(irs_sync_lock);
static LIST_HEAD(irs_nodes);
static u32 irs_readl_relaxed(struct gicv5_irs_chip_data *irs_data,
@@ -507,10 +510,11 @@ void gicv5_irs_syncr(void)
return;
syncr = FIELD_PREP(GICV5_IRS_SYNCR_SYNC, 1);
+ guard(raw_spinlock_irqsave)(&irs_sync_lock);
irs_writel_relaxed(irs_data, syncr, GICV5_IRS_SYNCR);
- gicv5_wait_for_op(irs_data->irs_base, GICV5_IRS_SYNC_STATUSR,
- GICV5_IRS_SYNC_STATUSR_IDLE);
+ gicv5_wait_for_op_atomic(irs_data->irs_base, GICV5_IRS_SYNC_STATUSR,
+ GICV5_IRS_SYNC_STATUSR_IDLE, NULL);
}
int gicv5_irs_register_cpu(int cpuid)
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v3 04/14] irqchip/gic-v5: Retain the L2 IST when mapping times out
2026-11-18 17:35 [PATCH v3 00/14] irqchip/gic-v5: Fix misc IRS and ITS host driver issues Sascha Bischoff
` (2 preceding siblings ...)
2026-11-18 17:35 ` [PATCH v3 03/14] irqchip/gic-v5: Serialise IRS synchronisation requests Sascha Bischoff
@ 2026-11-18 17:35 ` Sascha Bischoff
2026-11-19 12:00 ` Fuad Tabba
2026-11-18 17:35 ` [PATCH v3 05/14] irqchip/gic-v5: Serialise ITS invalidation commands Sascha Bischoff
` (9 subsequent siblings)
13 siblings, 1 reply; 25+ messages in thread
From: Sascha Bischoff @ 2026-11-18 17:35 UTC (permalink / raw)
To: Marc Zyngier, Lorenzo Pieralisi, Thomas Gleixner, Radu Rendec,
Timothy Hayes, Catalin Marinas, Jonathan Cameron,
Rafael J. Wysocki
Cc: linux-arm-kernel, linux-kernel, Fuad Tabba, Sascha Bischoff
If the IDLE poll after IRS_MAP_L2_ISTR times out, the mapping
operation has not been cancelled and could arguably still happen at a
later stage. Clearing the L1 entry and freeing the L2 IST can
therefore race with hardware completing the map and accessing the
freed table.
Retain the L1 entry and L2 IST on failure. Reject a subsequent
allocation that finds a nonzero but invalid L1 entry, so it cannot
overwrite the entry while the earlier mapping may still be
pending. Mark the retained table as intentional for kmemleak on both
success and failure.
Fixes: 0f01013258768 ("irqchip/gic-v5: Add GICv5 LPI/IPI support")
Reported-by: Fuad Tabba <fuad.tabba@linux.dev>
Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com>
Link: https://lore.kernel.org/r/20261112145814.853424-1-fuad.tabba@linux.dev
---
drivers/irqchip/irq-gic-v5-irs.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/irqchip/irq-gic-v5-irs.c b/drivers/irqchip/irq-gic-v5-irs.c
index ead76560ea08f..78deb46baa784 100644
--- a/drivers/irqchip/irq-gic-v5-irs.c
+++ b/drivers/irqchip/irq-gic-v5-irs.c
@@ -217,6 +217,10 @@ int gicv5_irs_iste_alloc(const u32 lpi)
if (FIELD_GET(GICV5_ISTL1E_VALID, le64_to_cpu(l1ist[index])))
return 0;
+ /* A previous map timed out; do not overwrite its pending L1 entry. */
+ if (READ_ONCE(l1ist[index]))
+ return -EBUSY;
+
l2ist = kzalloc(l2size, GFP_KERNEL);
if (!l2ist)
return -ENOMEM;
@@ -235,13 +239,11 @@ int gicv5_irs_iste_alloc(const u32 lpi)
l2istr = FIELD_PREP(GICV5_IRS_MAP_L2_ISTR_ID, lpi);
irs_writel_relaxed(irs_data, l2istr, GICV5_IRS_MAP_L2_ISTR);
+ /* The map cannot be cancelled, so retain the table even on timeout. */
+ kmemleak_ignore(l2ist);
ret = gicv5_irs_ist_synchronise(irs_data);
- if (ret) {
- l1ist[index] = 0;
- kfree(l2ist);
+ if (ret)
return ret;
- }
- kmemleak_ignore(l2ist);
/*
* Make sure we invalidate the cache line pulled before the IRS
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v3 05/14] irqchip/gic-v5: Serialise ITS invalidation commands
2026-11-18 17:35 [PATCH v3 00/14] irqchip/gic-v5: Fix misc IRS and ITS host driver issues Sascha Bischoff
` (3 preceding siblings ...)
2026-11-18 17:35 ` [PATCH v3 04/14] irqchip/gic-v5: Retain the L2 IST when mapping times out Sascha Bischoff
@ 2026-11-18 17:35 ` Sascha Bischoff
2026-11-18 17:35 ` [PATCH v3 06/14] irqchip/gic-v5: Use linear DT and ITT when L2 covers all IDs Sascha Bischoff
` (8 subsequent siblings)
13 siblings, 0 replies; 25+ messages in thread
From: Sascha Bischoff @ 2026-11-18 17:35 UTC (permalink / raw)
To: Marc Zyngier, Lorenzo Pieralisi, Thomas Gleixner, Radu Rendec,
Timothy Hayes, Catalin Marinas, Jonathan Cameron,
Rafael J. Wysocki
Cc: linux-arm-kernel, linux-kernel, Fuad Tabba, Sascha Bischoff,
Sashiko AI
The ITS uses the shared DIDR and EIDR registers to select the DeviceID
and EventID to invalidate. Event invalidations for different IRQs can
overlap, as can an event invalidation and a device invalidation. The
per-IRQ descriptor lock does not serialise these commands, so
concurrent writes can cause an invalidation to use the DeviceID or
EventID set by another concurrent invalidation.
Serialise the command register writes and STATUSR.IDLE polls for both
invalidation paths with a per-ITS raw spinlock. Use atomic polling
while holding the lock.
Fixes: 57d72196dfc8 ("irqchip/gic-v5: Add GICv5 ITS support")
Reported-by: Sashiko AI <sashiko-bot@kernel.org>
Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com>
Acked-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
Cc: stable@vger.kernel.org
Link: https://sashiko.dev/#/patchset/20261016155741.979985-1-sascha.bischoff@arm.com?part=11
---
drivers/irqchip/irq-gic-v5-its.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/irqchip/irq-gic-v5-its.c b/drivers/irqchip/irq-gic-v5-its.c
index f876dc0de1b96..88d18822a1ff4 100644
--- a/drivers/irqchip/irq-gic-v5-its.c
+++ b/drivers/irqchip/irq-gic-v5-its.c
@@ -16,6 +16,7 @@
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/slab.h>
+#include <linux/spinlock.h>
#include <linux/irqchip.h>
#include <linux/irqchip/arm-gic-v5.h>
@@ -28,6 +29,8 @@
struct gicv5_its_chip_data {
struct xarray its_devices;
struct mutex dev_alloc_lock;
+ /* Event and device invalidation commands share DIDR. */
+ raw_spinlock_t inv_lock;
struct fwnode_handle *fwnode;
struct gicv5_its_devtab_cfg devtab_cfgr;
void __iomem *its_base;
@@ -129,6 +132,8 @@ static int gicv5_its_itt_cache_inv(struct gicv5_its_chip_data *its, u32 device_i
eidr = FIELD_PREP(GICV5_ITS_EIDR_EVENTID, event_id);
eventr = FIELD_PREP(GICV5_ITS_INV_EVENTR_I, 0x1);
+ guard(raw_spinlock_irqsave)(&its->inv_lock);
+
its_writeq_relaxed(its, didr, GICV5_ITS_DIDR);
its_writel_relaxed(its, eidr, GICV5_ITS_EIDR);
its_writel_relaxed(its, eventr, GICV5_ITS_INV_EVENTR);
@@ -371,6 +376,9 @@ static int gicv5_its_device_cache_inv(struct gicv5_its_chip_data *its,
FIELD_PREP(GICV5_ITS_INV_DEVICER_EVENTID_BITS,
its_dev->itt_cfg.event_id_bits) |
FIELD_PREP(GICV5_ITS_INV_DEVICER_L1, 0x0);
+
+ guard(raw_spinlock_irqsave)(&its->inv_lock);
+
its_writeq_relaxed(its, didr, GICV5_ITS_DIDR);
its_writel_relaxed(its, devicer, GICV5_ITS_INV_DEVICER);
@@ -1112,6 +1120,7 @@ static int __init gicv5_its_init_bases(void __iomem *its_base, struct fwnode_han
return -ENOMEM;
mutex_init(&its_node->dev_alloc_lock);
+ raw_spin_lock_init(&its_node->inv_lock);
xa_init(&its_node->its_devices);
its_node->fwnode = handle;
its_node->its_base = its_base;
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v3 06/14] irqchip/gic-v5: Use linear DT and ITT when L2 covers all IDs
2026-11-18 17:35 [PATCH v3 00/14] irqchip/gic-v5: Fix misc IRS and ITS host driver issues Sascha Bischoff
` (4 preceding siblings ...)
2026-11-18 17:35 ` [PATCH v3 05/14] irqchip/gic-v5: Serialise ITS invalidation commands Sascha Bischoff
@ 2026-11-18 17:35 ` Sascha Bischoff
2026-11-18 17:35 ` [PATCH v3 07/14] irqchip/gic-v5: Honour ACPI ITS noncoherent flag Sascha Bischoff
` (7 subsequent siblings)
13 siblings, 0 replies; 25+ messages in thread
From: Sascha Bischoff @ 2026-11-18 17:35 UTC (permalink / raw)
To: Marc Zyngier, Lorenzo Pieralisi, Thomas Gleixner, Radu Rendec,
Timothy Hayes, Catalin Marinas, Jonathan Cameron,
Rafael J. Wysocki
Cc: linux-arm-kernel, linux-kernel, Fuad Tabba, Sascha Bischoff
The DT and ITT level selector incorrectly chooses a two-level table
when the selected L2 table has exactly enough entries to cover the
full ID space. There are no L1 index bits in this case. ITT allocation
correctly rejects the layout and device registration fails; the DT
path instead allocates an unnecessary one-entry L1 table.
Select a linear DT or ITT when the L2 width equals the ID width.
Fixes: 57d72196dfc85 ("irqchip/gic-v5: Add GICv5 ITS support")
Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com>
Acked-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
Cc: stable@vger.kernel.org
---
drivers/irqchip/irq-gic-v5-its.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-gic-v5-its.c b/drivers/irqchip/irq-gic-v5-its.c
index 88d18822a1ff4..5f9fa80ea6aa6 100644
--- a/drivers/irqchip/irq-gic-v5-its.c
+++ b/drivers/irqchip/irq-gic-v5-its.c
@@ -337,7 +337,7 @@ static bool gicv5_its_l2sz_two_level(bool devtab, u32 its_idr1, u8 id_bits, u8 *
l2_bits = gicv5_its_l2sz_to_l2_bits(l2_sz);
- if (l2_bits > id_bits)
+ if (l2_bits >= id_bits)
return false;
*sz = l2_sz;
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v3 07/14] irqchip/gic-v5: Honour ACPI ITS noncoherent flag
2026-11-18 17:35 [PATCH v3 00/14] irqchip/gic-v5: Fix misc IRS and ITS host driver issues Sascha Bischoff
` (5 preceding siblings ...)
2026-11-18 17:35 ` [PATCH v3 06/14] irqchip/gic-v5: Use linear DT and ITT when L2 covers all IDs Sascha Bischoff
@ 2026-11-18 17:35 ` Sascha Bischoff
2026-11-18 17:35 ` [PATCH v3 08/14] irqchip/gic-v5: Use firmware node name in ITS warning Sascha Bischoff
` (6 subsequent siblings)
13 siblings, 0 replies; 25+ messages in thread
From: Sascha Bischoff @ 2026-11-18 17:35 UTC (permalink / raw)
To: Marc Zyngier, Lorenzo Pieralisi, Thomas Gleixner, Radu Rendec,
Timothy Hayes, Catalin Marinas, Jonathan Cameron,
Rafael J. Wysocki
Cc: linux-arm-kernel, linux-kernel, Fuad Tabba, Sascha Bischoff
The ACPI ITS probe passes its noncoherent flag to
gicv5_its_init_bases(), but the common initializer checks a DT
property instead. For an ACPI ITS, this always selects coherent cache
settings and skips the cache maintenance required for its tables.
Use the noncoherent argument, which both firmware paths already
supply.
Fixes: a97efa5ba5946 ("irqchip/gic-v5: Add ACPI ITS probing")
Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com>
Acked-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
Cc: stable@vger.kernel.org
---
drivers/irqchip/irq-gic-v5-its.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-gic-v5-its.c b/drivers/irqchip/irq-gic-v5-its.c
index 5f9fa80ea6aa6..9e8077dada5ef 100644
--- a/drivers/irqchip/irq-gic-v5-its.c
+++ b/drivers/irqchip/irq-gic-v5-its.c
@@ -1135,7 +1135,7 @@ static int __init gicv5_its_init_bases(void __iomem *its_base, struct fwnode_han
goto out_free_node;
}
- if (of_property_read_bool(np, "dma-noncoherent")) {
+ if (noncoherent) {
/*
* A non-coherent ITS implies that some cache levels cannot be
* used coherently by the cores and GIC. Our only option is to mark
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v3 08/14] irqchip/gic-v5: Use firmware node name in ITS warning
2026-11-18 17:35 [PATCH v3 00/14] irqchip/gic-v5: Fix misc IRS and ITS host driver issues Sascha Bischoff
` (6 preceding siblings ...)
2026-11-18 17:35 ` [PATCH v3 07/14] irqchip/gic-v5: Honour ACPI ITS noncoherent flag Sascha Bischoff
@ 2026-11-18 17:35 ` Sascha Bischoff
2026-11-18 17:35 ` [PATCH v3 09/14] irqchip/gic-v5: Invalidate ITS device cache before freeing ITT Sascha Bischoff
` (5 subsequent siblings)
13 siblings, 0 replies; 25+ messages in thread
From: Sascha Bischoff @ 2026-11-18 17:35 UTC (permalink / raw)
To: Marc Zyngier, Lorenzo Pieralisi, Thomas Gleixner, Radu Rendec,
Timothy Hayes, Catalin Marinas, Jonathan Cameron,
Rafael J. Wysocki
Cc: linux-arm-kernel, linux-kernel, Fuad Tabba, Sascha Bischoff
The common ITS initialiser can be called with an ACPI firmware node.
If firmware leaves the ITS enabled, the warning dereferences the DT
node pointer, which is NULL on that path.
Use the firmware node name for the warning and drop the DT-only
pointer.
Fixes: a97efa5ba5946 ("irqchip/gic-v5: Add ACPI ITS probing")
Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com>
Acked-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
---
drivers/irqchip/irq-gic-v5-its.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/irqchip/irq-gic-v5-its.c b/drivers/irqchip/irq-gic-v5-its.c
index 9e8077dada5ef..876437017ccc5 100644
--- a/drivers/irqchip/irq-gic-v5-its.c
+++ b/drivers/irqchip/irq-gic-v5-its.c
@@ -1109,7 +1109,6 @@ static int gicv5_its_init_domain(struct gicv5_its_chip_data *its, struct irq_dom
static int __init gicv5_its_init_bases(void __iomem *its_base, struct fwnode_handle *handle,
struct irq_domain *parent_domain, bool noncoherent)
{
- struct device_node *np = to_of_node(handle);
struct gicv5_its_chip_data *its_node;
u32 cr0, cr1;
bool enabled;
@@ -1129,7 +1128,8 @@ static int __init gicv5_its_init_bases(void __iomem *its_base, struct fwnode_han
cr0 = its_readl_relaxed(its_node, GICV5_ITS_CR0);
enabled = FIELD_GET(GICV5_ITS_CR0_ITSEN, cr0);
- if (WARN(enabled, "ITS %s enabled, disabling it before proceeding\n", np->full_name)) {
+ if (WARN(enabled, "ITS %s enabled, disabling it before proceeding\n",
+ fwnode_get_name(handle))) {
ret = gicv5_its_disable(its_node);
if (ret)
goto out_free_node;
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v3 09/14] irqchip/gic-v5: Invalidate ITS device cache before freeing ITT
2026-11-18 17:35 [PATCH v3 00/14] irqchip/gic-v5: Fix misc IRS and ITS host driver issues Sascha Bischoff
` (7 preceding siblings ...)
2026-11-18 17:35 ` [PATCH v3 08/14] irqchip/gic-v5: Use firmware node name in ITS warning Sascha Bischoff
@ 2026-11-18 17:35 ` Sascha Bischoff
2026-11-18 17:35 ` [PATCH v3 10/14] irqchip/gic-v5: Clean the allocated linear device table size Sascha Bischoff
` (4 subsequent siblings)
13 siblings, 0 replies; 25+ messages in thread
From: Sascha Bischoff @ 2026-11-18 17:35 UTC (permalink / raw)
To: Marc Zyngier, Lorenzo Pieralisi, Thomas Gleixner, Radu Rendec,
Timothy Hayes, Catalin Marinas, Jonathan Cameron,
Rafael J. Wysocki
Cc: linux-arm-kernel, linux-kernel, Fuad Tabba, Sascha Bischoff
A cached device table entry can still reference the ITT after its
memory is freed via kfree(), even if the DTE has been marked as
invalid. Once the memory has been released, it could be reallocated,
and it would be unfortunate for the hardware to interpret this as a
valid ITT.
Invalidate the device cache and wait for completion before freeing the
ITT during device teardown.
Fixes: 57d72196dfc85 ("irqchip/gic-v5: Add GICv5 ITS support")
Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com>
Acked-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
Cc: stable@vger.kernel.org
---
drivers/irqchip/irq-gic-v5-its.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-gic-v5-its.c b/drivers/irqchip/irq-gic-v5-its.c
index 876437017ccc5..dce5bfd1a78dd 100644
--- a/drivers/irqchip/irq-gic-v5-its.c
+++ b/drivers/irqchip/irq-gic-v5-its.c
@@ -556,6 +556,7 @@ static int gicv5_its_device_unregister(struct gicv5_its_chip_data *its,
struct gicv5_its_dev *its_dev)
{
__le64 *dte;
+ int ret;
dte = gicv5_its_devtab_get_dte_ref(its, its_dev->device_id, false);
@@ -568,9 +569,10 @@ static int gicv5_its_device_unregister(struct gicv5_its_chip_data *its,
/* Zero everything - make it clear that this is an invalid entry */
its_write_table_entry(its, dte, 0);
+ ret = gicv5_its_device_cache_inv(its, its_dev);
gicv5_its_free_itt(its_dev);
- return gicv5_its_device_cache_inv(its, its_dev);
+ return ret;
}
/*
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v3 10/14] irqchip/gic-v5: Clean the allocated linear device table size
2026-11-18 17:35 [PATCH v3 00/14] irqchip/gic-v5: Fix misc IRS and ITS host driver issues Sascha Bischoff
` (8 preceding siblings ...)
2026-11-18 17:35 ` [PATCH v3 09/14] irqchip/gic-v5: Invalidate ITS device cache before freeing ITT Sascha Bischoff
@ 2026-11-18 17:35 ` Sascha Bischoff
2026-11-18 17:35 ` [PATCH v3 11/14] irqchip/gic-v5: Release ITS MMIO region on DT probe failure Sascha Bischoff
` (3 subsequent siblings)
13 siblings, 0 replies; 25+ messages in thread
From: Sascha Bischoff @ 2026-11-18 17:35 UTC (permalink / raw)
To: Marc Zyngier, Lorenzo Pieralisi, Thomas Gleixner, Radu Rendec,
Timothy Hayes, Catalin Marinas, Jonathan Cameron,
Rafael J. Wysocki
Cc: linux-arm-kernel, linux-kernel, Fuad Tabba, Sascha Bischoff
When the linear device table exceeds the kmalloc limit, the driver
caps the DeviceID width before allocation but keeps the original size
for cache maintenance. On a noncoherent ITS, this cleans beyond the
allocated table.
Recalculate the size after capping the DeviceID width.
Fixes: 57d72196dfc85 ("irqchip/gic-v5: Add GICv5 ITS support")
Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com>
Acked-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
Cc: stable@vger.kernel.org
---
drivers/irqchip/irq-gic-v5-its.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/irqchip/irq-gic-v5-its.c b/drivers/irqchip/irq-gic-v5-its.c
index dce5bfd1a78dd..e7db4449fe916 100644
--- a/drivers/irqchip/irq-gic-v5-its.c
+++ b/drivers/irqchip/irq-gic-v5-its.c
@@ -594,14 +594,14 @@ static int gicv5_its_alloc_devtab_linear(struct gicv5_its_chip_data *its,
* kmalloc limits so that the system can chug along with a linear
* device table.
*/
- sz = BIT_ULL(device_id_bits) * sizeof(*devtab);
- if (sz > KMALLOC_MAX_SIZE) {
- u8 device_id_cap = ilog2(KMALLOC_MAX_SIZE/sizeof(*devtab));
+ if (BIT_ULL(device_id_bits) * sizeof(*devtab) > KMALLOC_MAX_SIZE) {
+ u8 device_id_cap = ilog2(KMALLOC_MAX_SIZE / sizeof(*devtab));
pr_warn("Limiting device ID bits from %u to %u\n",
device_id_bits, device_id_cap);
device_id_bits = device_id_cap;
}
+ sz = BIT_ULL(device_id_bits) * sizeof(*devtab);
devtab = kzalloc_objs(*devtab, BIT(device_id_bits));
if (!devtab)
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v3 11/14] irqchip/gic-v5: Release ITS MMIO region on DT probe failure
2026-11-18 17:35 [PATCH v3 00/14] irqchip/gic-v5: Fix misc IRS and ITS host driver issues Sascha Bischoff
` (9 preceding siblings ...)
2026-11-18 17:35 ` [PATCH v3 10/14] irqchip/gic-v5: Clean the allocated linear device table size Sascha Bischoff
@ 2026-11-18 17:35 ` Sascha Bischoff
2026-11-18 17:35 ` [PATCH v3 12/14] irqchip/gic-v5: Retain the ITT when device invalidation times out Sascha Bischoff
` (2 subsequent siblings)
13 siblings, 0 replies; 25+ messages in thread
From: Sascha Bischoff @ 2026-11-18 17:35 UTC (permalink / raw)
To: Marc Zyngier, Lorenzo Pieralisi, Thomas Gleixner, Radu Rendec,
Timothy Hayes, Catalin Marinas, Jonathan Cameron,
Rafael J. Wysocki
Cc: linux-arm-kernel, linux-kernel, Fuad Tabba, Sascha Bischoff
of_io_request_and_map() reserves the ITS configuration frame region.
If ITS initialisation fails after mapping it, the error path only
unmaps the registers and leaves the region reserved.
Keep the resource description and release the region on that path.
Fixes: 57d72196dfc85 ("irqchip/gic-v5: Add GICv5 ITS support")
Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com>
Acked-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
---
drivers/irqchip/irq-gic-v5-its.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/irqchip/irq-gic-v5-its.c b/drivers/irqchip/irq-gic-v5-its.c
index e7db4449fe916..db13011ef6d93 100644
--- a/drivers/irqchip/irq-gic-v5-its.c
+++ b/drivers/irqchip/irq-gic-v5-its.c
@@ -1188,6 +1188,7 @@ static int __init gicv5_its_init_bases(void __iomem *its_base, struct fwnode_han
static int __init gicv5_its_init(struct device_node *node)
{
void __iomem *its_base;
+ struct resource res;
int ret, idx;
idx = of_property_match_string(node, "reg-names", "ns-config");
@@ -1196,6 +1197,11 @@ static int __init gicv5_its_init(struct device_node *node)
return -ENODEV;
}
+ /* Save the region to release if ITS setup fails after mapping it. */
+ ret = of_address_to_resource(node, idx, &res);
+ if (ret)
+ return ret;
+
its_base = of_io_request_and_map(node, idx, of_node_full_name(node));
if (IS_ERR(its_base)) {
pr_err("%pOF: unable to map GICv5 ITS_CONFIG_FRAME\n", node);
@@ -1212,6 +1218,7 @@ static int __init gicv5_its_init(struct device_node *node)
out_unmap:
iounmap(its_base);
+ release_mem_region(res.start, resource_size(&res));
return ret;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v3 12/14] irqchip/gic-v5: Retain the ITT when device invalidation times out
2026-11-18 17:35 [PATCH v3 00/14] irqchip/gic-v5: Fix misc IRS and ITS host driver issues Sascha Bischoff
` (10 preceding siblings ...)
2026-11-18 17:35 ` [PATCH v3 11/14] irqchip/gic-v5: Release ITS MMIO region on DT probe failure Sascha Bischoff
@ 2026-11-18 17:35 ` Sascha Bischoff
2026-11-19 10:28 ` Lorenzo Pieralisi
2026-11-18 17:35 ` [PATCH v3 13/14] irqchip/gic-v5: Clean a level 2 device table before making it valid Sascha Bischoff
2026-11-18 17:35 ` [PATCH v3 14/14] irqchip/gic-v5: Invalidate the L1 DTE when allocating an L2 device table Sascha Bischoff
13 siblings, 1 reply; 25+ messages in thread
From: Sascha Bischoff @ 2026-11-18 17:35 UTC (permalink / raw)
To: Marc Zyngier, Lorenzo Pieralisi, Thomas Gleixner, Radu Rendec,
Timothy Hayes, Catalin Marinas, Jonathan Cameron,
Rafael J. Wysocki
Cc: linux-arm-kernel, linux-kernel, Fuad Tabba, Sascha Bischoff
Device registration publishes a DTE pointing to the new ITT before
invalidating the ITS device cache. If invalidation times out, clearing
the DTE in memory does not guarantee that the ITS has discarded a
cached reference to the ITT, and hence the hardware could still try
and access the memory. Freeing the ITT on that path can therefore
leave the ITS accessing memory that has been reallocated.
Device teardown has the same problem: it frees the ITT even when the
invalidation issued after clearing the DTE fails to complete in the
specified timeout.
Retain the ITT on either failure path. Continue returning the
invalidation error, and free the ITT during teardown only after
successful completion. This deliberately retains memory on hardware
failure because a timeout does not cancel the operation or establish
that cached references are gone.
Fixes: 57d72196dfc85 ("irqchip/gic-v5: Add GICv5 ITS support")
Reported-by: Fuad Tabba <fuad.tabba@linux.dev>
Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com>
Link: https://lore.kernel.org/r/20261112145814.853424-1-fuad.tabba@linux.dev
---
drivers/irqchip/irq-gic-v5-its.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/irqchip/irq-gic-v5-its.c b/drivers/irqchip/irq-gic-v5-its.c
index db13011ef6d93..cfa86aa68bf3c 100644
--- a/drivers/irqchip/irq-gic-v5-its.c
+++ b/drivers/irqchip/irq-gic-v5-its.c
@@ -540,8 +540,8 @@ static int gicv5_its_device_register(struct gicv5_its_chip_data *its,
ret = gicv5_its_device_cache_inv(its, its_dev);
if (ret) {
+ /* The ITS may still have a cached reference to the ITT. */
its_write_table_entry(its, dte, 0);
- gicv5_its_free_itt(its_dev);
return ret;
}
@@ -570,7 +570,9 @@ static int gicv5_its_device_unregister(struct gicv5_its_chip_data *its,
its_write_table_entry(its, dte, 0);
ret = gicv5_its_device_cache_inv(its, its_dev);
- gicv5_its_free_itt(its_dev);
+ /* Only release the ITT once the ITS has discarded its references. */
+ if (!ret)
+ gicv5_its_free_itt(its_dev);
return ret;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v3 13/14] irqchip/gic-v5: Clean a level 2 device table before making it valid
2026-11-18 17:35 [PATCH v3 00/14] irqchip/gic-v5: Fix misc IRS and ITS host driver issues Sascha Bischoff
` (11 preceding siblings ...)
2026-11-18 17:35 ` [PATCH v3 12/14] irqchip/gic-v5: Retain the ITT when device invalidation times out Sascha Bischoff
@ 2026-11-18 17:35 ` Sascha Bischoff
2026-11-19 10:19 ` Lorenzo Pieralisi
2026-11-18 17:35 ` [PATCH v3 14/14] irqchip/gic-v5: Invalidate the L1 DTE when allocating an L2 device table Sascha Bischoff
13 siblings, 1 reply; 25+ messages in thread
From: Sascha Bischoff @ 2026-11-18 17:35 UTC (permalink / raw)
To: Marc Zyngier, Lorenzo Pieralisi, Thomas Gleixner, Radu Rendec,
Timothy Hayes, Catalin Marinas, Jonathan Cameron,
Rafael J. Wysocki
Cc: linux-arm-kernel, linux-kernel, Fuad Tabba, Sascha Bischoff
From: Fuad Tabba <fuad.tabba@linux.dev>
gicv5_its_alloc_l2_devtab() allocates a zeroed level 2 device table and
writes the level 1 DTE that points to it with VALID set. Unlike the
other ITS tables, the new table isn't cleaned to the PoC first. On a
non-coherent ITS, the zeroes can still sit in the CPU caches when the
ITS reads the table, so it can take stale memory as a valid level 2 DTE
for a DeviceID that nothing has registered.
Clean the table before the level 1 DTE is written.
Fixes: 57d72196dfc85 ("irqchip/gic-v5: Add GICv5 ITS support")
Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com>
Cc: stable@vger.kernel.org
---
drivers/irqchip/irq-gic-v5-its.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/irqchip/irq-gic-v5-its.c b/drivers/irqchip/irq-gic-v5-its.c
index cfa86aa68bf3c..7fff2db9ae08e 100644
--- a/drivers/irqchip/irq-gic-v5-its.c
+++ b/drivers/irqchip/irq-gic-v5-its.c
@@ -415,6 +415,8 @@ static int gicv5_its_alloc_l2_devtab(struct gicv5_its_chip_data *its,
if (!l2devtab)
return -ENOMEM;
+ gicv5_its_dcache_clean(its, l2devtab, BIT(span) * sizeof(*l2devtab));
+
its->devtab_cfgr.l2.l2ptrs[l1_index] = l2devtab;
l1dte = FIELD_PREP(GICV5_DTL1E_SPAN, span) |
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v3 14/14] irqchip/gic-v5: Invalidate the L1 DTE when allocating an L2 device table
2026-11-18 17:35 [PATCH v3 00/14] irqchip/gic-v5: Fix misc IRS and ITS host driver issues Sascha Bischoff
` (12 preceding siblings ...)
2026-11-18 17:35 ` [PATCH v3 13/14] irqchip/gic-v5: Clean a level 2 device table before making it valid Sascha Bischoff
@ 2026-11-18 17:35 ` Sascha Bischoff
2026-11-19 10:13 ` Lorenzo Pieralisi
13 siblings, 1 reply; 25+ messages in thread
From: Sascha Bischoff @ 2026-11-18 17:35 UTC (permalink / raw)
To: Marc Zyngier, Lorenzo Pieralisi, Thomas Gleixner, Radu Rendec,
Timothy Hayes, Catalin Marinas, Jonathan Cameron,
Rafael J. Wysocki
Cc: linux-arm-kernel, linux-kernel, Fuad Tabba, Sascha Bischoff
Allocating an L2 device table makes its parent L1 DTE valid, but the
single-device invalidation performed during device registration does
not invalidate that L1 DTE. An ITS that cached the L1 DTE while it was
invalid can therefore continue dropping events for DeviceIDs in its
range.
Invalidate the L1 DTE and wait for completion immediately after
publishing the new L2 table. This also covers a registration that
subsequently fails, leaving the L2 table allocated and its parent L1
DTE valid. Keep single-device invalidations for device registration
and teardown when updating individual L2 DTEs.
Fixes: 57d72196dfc85 ("irqchip/gic-v5: Add GICv5 ITS support")
Reported-by: Fuad Tabba <fuad.tabba@linux.dev>
Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20261112145814.853424-1-fuad.tabba@linux.dev
---
drivers/irqchip/irq-gic-v5-its.c | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/drivers/irqchip/irq-gic-v5-its.c b/drivers/irqchip/irq-gic-v5-its.c
index 7fff2db9ae08e..a05417bdd3a19 100644
--- a/drivers/irqchip/irq-gic-v5-its.c
+++ b/drivers/irqchip/irq-gic-v5-its.c
@@ -365,17 +365,17 @@ static __le64 *gicv5_its_device_get_itte_ref(struct gicv5_its_dev *its_dev,
return &l2_itt[l2_idx];
}
-static int gicv5_its_device_cache_inv(struct gicv5_its_chip_data *its,
- struct gicv5_its_dev *its_dev)
+static int __gicv5_its_device_cache_inv(struct gicv5_its_chip_data *its,
+ u32 device_id, u8 event_id_bits, bool l1)
{
u32 devicer;
u64 didr;
- didr = FIELD_PREP(GICV5_ITS_DIDR_DEVICEID, its_dev->device_id);
+ didr = FIELD_PREP(GICV5_ITS_DIDR_DEVICEID, device_id);
devicer = FIELD_PREP(GICV5_ITS_INV_DEVICER_I, 0x1) |
FIELD_PREP(GICV5_ITS_INV_DEVICER_EVENTID_BITS,
- its_dev->itt_cfg.event_id_bits) |
- FIELD_PREP(GICV5_ITS_INV_DEVICER_L1, 0x0);
+ event_id_bits) |
+ FIELD_PREP(GICV5_ITS_INV_DEVICER_L1, l1);
guard(raw_spinlock_irqsave)(&its->inv_lock);
@@ -385,6 +385,19 @@ static int gicv5_its_device_cache_inv(struct gicv5_its_chip_data *its,
return gicv5_its_cache_sync(its);
}
+static int gicv5_its_device_cache_inv(struct gicv5_its_chip_data *its,
+ struct gicv5_its_dev *its_dev)
+{
+ return __gicv5_its_device_cache_inv(its, its_dev->device_id,
+ its_dev->itt_cfg.event_id_bits, false);
+}
+
+static int gicv5_its_device_l1_cache_inv(struct gicv5_its_chip_data *its,
+ u32 device_id)
+{
+ return __gicv5_its_device_cache_inv(its, device_id, 0, true);
+}
+
/*
* Allocate a level 2 device table entry, update L1 parent to reference it.
* Only used for 2-level device tables, and it is called on demand.
@@ -424,7 +437,8 @@ static int gicv5_its_alloc_l2_devtab(struct gicv5_its_chip_data *its,
FIELD_PREP(GICV5_DTL1E_VALID, 0x1);
its_write_table_entry(its, &l1devtab[l1_index], l1dte);
- return 0;
+ /* Invalidate the cached L1 DTE before using the new L2 table. */
+ return gicv5_its_device_l1_cache_inv(its, l1_index << l2_bits);
}
static __le64 *gicv5_its_devtab_get_dte_ref(struct gicv5_its_chip_data *its,
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [PATCH v3 14/14] irqchip/gic-v5: Invalidate the L1 DTE when allocating an L2 device table
2026-11-18 17:35 ` [PATCH v3 14/14] irqchip/gic-v5: Invalidate the L1 DTE when allocating an L2 device table Sascha Bischoff
@ 2026-11-19 10:13 ` Lorenzo Pieralisi
2026-11-19 12:32 ` Fuad Tabba
0 siblings, 1 reply; 25+ messages in thread
From: Lorenzo Pieralisi @ 2026-11-19 10:13 UTC (permalink / raw)
To: Sascha Bischoff
Cc: Marc Zyngier, Thomas Gleixner, Radu Rendec, Timothy Hayes,
Catalin Marinas, Jonathan Cameron, Rafael J. Wysocki,
linux-arm-kernel, linux-kernel, Fuad Tabba
On Wed, Nov 18, 2026 at 05:35:43PM +0000, Sascha Bischoff wrote:
> Allocating an L2 device table makes its parent L1 DTE valid, but the
> single-device invalidation performed during device registration does
> not invalidate that L1 DTE. An ITS that cached the L1 DTE while it was
> invalid can therefore continue dropping events for DeviceIDs in its
> range.
>
> Invalidate the L1 DTE and wait for completion immediately after
> publishing the new L2 table. This also covers a registration that
> subsequently fails, leaving the L2 table allocated and its parent L1
> DTE valid. Keep single-device invalidations for device registration
> and teardown when updating individual L2 DTEs.
>
> Fixes: 57d72196dfc85 ("irqchip/gic-v5: Add GICv5 ITS support")
> Reported-by: Fuad Tabba <fuad.tabba@linux.dev>
> Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com>
> Cc: stable@vger.kernel.org
> Link: https://lore.kernel.org/r/20261112145814.853424-1-fuad.tabba@linux.dev
> ---
> drivers/irqchip/irq-gic-v5-its.c | 26 ++++++++++++++++++++------
> 1 file changed, 20 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/irqchip/irq-gic-v5-its.c b/drivers/irqchip/irq-gic-v5-its.c
> index 7fff2db9ae08e..a05417bdd3a19 100644
> --- a/drivers/irqchip/irq-gic-v5-its.c
> +++ b/drivers/irqchip/irq-gic-v5-its.c
> @@ -365,17 +365,17 @@ static __le64 *gicv5_its_device_get_itte_ref(struct gicv5_its_dev *its_dev,
> return &l2_itt[l2_idx];
> }
>
> -static int gicv5_its_device_cache_inv(struct gicv5_its_chip_data *its,
> - struct gicv5_its_dev *its_dev)
> +static int __gicv5_its_device_cache_inv(struct gicv5_its_chip_data *its,
> + u32 device_id, u8 event_id_bits, bool l1)
> {
> u32 devicer;
> u64 didr;
>
> - didr = FIELD_PREP(GICV5_ITS_DIDR_DEVICEID, its_dev->device_id);
> + didr = FIELD_PREP(GICV5_ITS_DIDR_DEVICEID, device_id);
> devicer = FIELD_PREP(GICV5_ITS_INV_DEVICER_I, 0x1) |
> FIELD_PREP(GICV5_ITS_INV_DEVICER_EVENTID_BITS,
> - its_dev->itt_cfg.event_id_bits) |
> - FIELD_PREP(GICV5_ITS_INV_DEVICER_L1, 0x0);
> + event_id_bits) |
> + FIELD_PREP(GICV5_ITS_INV_DEVICER_L1, l1);
>
> guard(raw_spinlock_irqsave)(&its->inv_lock);
>
> @@ -385,6 +385,19 @@ static int gicv5_its_device_cache_inv(struct gicv5_its_chip_data *its,
> return gicv5_its_cache_sync(its);
> }
>
> +static int gicv5_its_device_cache_inv(struct gicv5_its_chip_data *its,
> + struct gicv5_its_dev *its_dev)
> +{
> + return __gicv5_its_device_cache_inv(its, its_dev->device_id,
> + its_dev->itt_cfg.event_id_bits, false);
> +}
> +
> +static int gicv5_its_device_l1_cache_inv(struct gicv5_its_chip_data *its,
> + u32 device_id)
> +{
> + return __gicv5_its_device_cache_inv(its, device_id, 0, true);
I would highlight why event_id_bits is set to 0 (actually it is irrelevant,
let's explicitly say so).
> +}
> +
> /*
> * Allocate a level 2 device table entry, update L1 parent to reference it.
> * Only used for 2-level device tables, and it is called on demand.
> @@ -424,7 +437,8 @@ static int gicv5_its_alloc_l2_devtab(struct gicv5_its_chip_data *its,
> FIELD_PREP(GICV5_DTL1E_VALID, 0x1);
> its_write_table_entry(its, &l1devtab[l1_index], l1dte);
>
> - return 0;
> + /* Invalidate the cached L1 DTE before using the new L2 table. */
Nit: it is not a given that it is cached.
> + return gicv5_its_device_l1_cache_inv(its, l1_index << l2_bits);
Nit: this l1/l2/deviceid bits/index dance is a bit clumsy (I mean, in
current code, without taking into account this patch) but we can rework it
in a follow-up patch to keep this one as simple as possible.
Acked-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
> }
>
> static __le64 *gicv5_its_devtab_get_dte_ref(struct gicv5_its_chip_data *its,
>
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v3 13/14] irqchip/gic-v5: Clean a level 2 device table before making it valid
2026-11-18 17:35 ` [PATCH v3 13/14] irqchip/gic-v5: Clean a level 2 device table before making it valid Sascha Bischoff
@ 2026-11-19 10:19 ` Lorenzo Pieralisi
0 siblings, 0 replies; 25+ messages in thread
From: Lorenzo Pieralisi @ 2026-11-19 10:19 UTC (permalink / raw)
To: Sascha Bischoff
Cc: Marc Zyngier, Thomas Gleixner, Radu Rendec, Timothy Hayes,
Catalin Marinas, Jonathan Cameron, Rafael J. Wysocki,
linux-arm-kernel, linux-kernel, Fuad Tabba
On Wed, Nov 18, 2026 at 05:35:42PM +0000, Sascha Bischoff wrote:
> From: Fuad Tabba <fuad.tabba@linux.dev>
>
> gicv5_its_alloc_l2_devtab() allocates a zeroed level 2 device table and
> writes the level 1 DTE that points to it with VALID set. Unlike the
> other ITS tables, the new table isn't cleaned to the PoC first. On a
> non-coherent ITS, the zeroes can still sit in the CPU caches when the
> ITS reads the table, so it can take stale memory as a valid level 2 DTE
> for a DeviceID that nothing has registered.
>
> Clean the table before the level 1 DTE is written.
>
> Fixes: 57d72196dfc85 ("irqchip/gic-v5: Add GICv5 ITS support")
> Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
> Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com>
> Cc: stable@vger.kernel.org
> ---
> drivers/irqchip/irq-gic-v5-its.c | 2 ++
> 1 file changed, 2 insertions(+)
Acked-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
> diff --git a/drivers/irqchip/irq-gic-v5-its.c b/drivers/irqchip/irq-gic-v5-its.c
> index cfa86aa68bf3c..7fff2db9ae08e 100644
> --- a/drivers/irqchip/irq-gic-v5-its.c
> +++ b/drivers/irqchip/irq-gic-v5-its.c
> @@ -415,6 +415,8 @@ static int gicv5_its_alloc_l2_devtab(struct gicv5_its_chip_data *its,
> if (!l2devtab)
> return -ENOMEM;
>
> + gicv5_its_dcache_clean(its, l2devtab, BIT(span) * sizeof(*l2devtab));
> +
> its->devtab_cfgr.l2.l2ptrs[l1_index] = l2devtab;
>
> l1dte = FIELD_PREP(GICV5_DTL1E_SPAN, span) |
>
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v3 12/14] irqchip/gic-v5: Retain the ITT when device invalidation times out
2026-11-18 17:35 ` [PATCH v3 12/14] irqchip/gic-v5: Retain the ITT when device invalidation times out Sascha Bischoff
@ 2026-11-19 10:28 ` Lorenzo Pieralisi
2026-11-19 12:07 ` Fuad Tabba
0 siblings, 1 reply; 25+ messages in thread
From: Lorenzo Pieralisi @ 2026-11-19 10:28 UTC (permalink / raw)
To: Sascha Bischoff
Cc: Marc Zyngier, Thomas Gleixner, Radu Rendec, Timothy Hayes,
Catalin Marinas, Jonathan Cameron, Rafael J. Wysocki,
linux-arm-kernel, linux-kernel, Fuad Tabba
On Wed, Nov 18, 2026 at 05:35:41PM +0000, Sascha Bischoff wrote:
> Device registration publishes a DTE pointing to the new ITT before
> invalidating the ITS device cache. If invalidation times out, clearing
> the DTE in memory does not guarantee that the ITS has discarded a
> cached reference to the ITT, and hence the hardware could still try
> and access the memory. Freeing the ITT on that path can therefore
> leave the ITS accessing memory that has been reallocated.
>
> Device teardown has the same problem: it frees the ITT even when the
> invalidation issued after clearing the DTE fails to complete in the
> specified timeout.
>
> Retain the ITT on either failure path. Continue returning the
> invalidation error, and free the ITT during teardown only after
> successful completion. This deliberately retains memory on hardware
> failure because a timeout does not cancel the operation or establish
> that cached references are gone.
>
> Fixes: 57d72196dfc85 ("irqchip/gic-v5: Add GICv5 ITS support")
> Reported-by: Fuad Tabba <fuad.tabba@linux.dev>
> Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com>
> Link: https://lore.kernel.org/r/20261112145814.853424-1-fuad.tabba@linux.dev
> ---
> drivers/irqchip/irq-gic-v5-its.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/irqchip/irq-gic-v5-its.c b/drivers/irqchip/irq-gic-v5-its.c
> index db13011ef6d93..cfa86aa68bf3c 100644
> --- a/drivers/irqchip/irq-gic-v5-its.c
> +++ b/drivers/irqchip/irq-gic-v5-its.c
> @@ -540,8 +540,8 @@ static int gicv5_its_device_register(struct gicv5_its_chip_data *its,
>
> ret = gicv5_its_device_cache_inv(its, its_dev);
> if (ret) {
> + /* The ITS may still have a cached reference to the ITT. */
> its_write_table_entry(its, dte, 0);
> - gicv5_its_free_itt(its_dev);
> return ret;
> }
>
> @@ -570,7 +570,9 @@ static int gicv5_its_device_unregister(struct gicv5_its_chip_data *its,
> its_write_table_entry(its, dte, 0);
>
> ret = gicv5_its_device_cache_inv(its, its_dev);
> - gicv5_its_free_itt(its_dev);
> + /* Only release the ITT once the ITS has discarded its references. */
> + if (!ret)
> + gicv5_its_free_itt(its_dev);
if (ret)
return ret;
gicv5_its_free_itt(its_dev);
return 0;
Acked-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
>
> return ret;
> }
>
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v3 02/14] irqchip/gic-v5: Only set IRS DPS when 1ofN routing is supported
2026-11-18 17:35 ` [PATCH v3 02/14] irqchip/gic-v5: Only set IRS DPS when 1ofN routing is supported Sascha Bischoff
@ 2026-11-19 11:50 ` Fuad Tabba
0 siblings, 0 replies; 25+ messages in thread
From: Fuad Tabba @ 2026-11-19 11:50 UTC (permalink / raw)
To: Sascha Bischoff
Cc: Marc Zyngier, Lorenzo Pieralisi, Thomas Gleixner, Radu Rendec,
Timothy Hayes, Catalin Marinas, Jonathan Cameron,
Rafael J. Wysocki, linux-arm-kernel, linux-kernel
Hi Sascha,
On Wed, 18 Nov 2026 17:35:31 +0000, Sascha Bischoff
<sascha.bischoff@arm.com> wrote:
> IRS_PE_CR0.DPS is RES0 when the IRS does not support 1ofN routing.
> Read the capability from IRS_IDR0 and skip programming DPS on systems
> without support for 1ofN routing, rather than blindly writing it.
vgic_v5_irs_set_up_vpe() in KVM writes IRS_VPE_CR0.DPS unconditionally
too, and that bit is RES0 when IRS_IDR0.VIRT_ONE_N is clear. Worth a
separate KVM patch for that one?
Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev>
Cheers,
/fuad
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v3 03/14] irqchip/gic-v5: Serialise IRS synchronisation requests
2026-11-18 17:35 ` [PATCH v3 03/14] irqchip/gic-v5: Serialise IRS synchronisation requests Sascha Bischoff
@ 2026-11-19 11:53 ` Fuad Tabba
0 siblings, 0 replies; 25+ messages in thread
From: Fuad Tabba @ 2026-11-19 11:53 UTC (permalink / raw)
To: Sascha Bischoff
Cc: Marc Zyngier, Lorenzo Pieralisi, Thomas Gleixner, Radu Rendec,
Timothy Hayes, Catalin Marinas, Jonathan Cameron,
Rafael J. Wysocki, linux-arm-kernel, linux-kernel
Hi Sascha,
On Wed, 18 Nov 2026 17:35:32 +0000, Sascha Bischoff
<sascha.bischoff@arm.com> wrote:
> IRS_SYNCR writes are ignored while IRS_SYNC_STATUSR.IDLE is clear.
> Concurrent calls to gicv5_irs_syncr() can overlap, causing a request
> to be dropped. A caller can then observe the earlier request
> completing and assume that its own events have been processed.
>
> gicv5_irs_syncr() may need to be called in atomic context. Serialise
> the request and completion poll with a raw spinlock, and use atomic
> polling.
>
> Fixes: 57d72196dfc8 ("irqchip/gic-v5: Add GICv5 ITS support")
> Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com>
> Acked-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
> Cc: stable@vger.kernel.org
I don't think two calls can overlap in the host driver today. The only
caller is gicv5_its_irq_domain_free(), and since the LPI domain is the
parent of every ITS domain, irq_domain_free_irqs() holds the LPI
domain's mutex around that call. Do we need the Fixes: and Cc: stable
tags then?
That said:
Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev>
Cheers,
/fuad
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v3 04/14] irqchip/gic-v5: Retain the L2 IST when mapping times out
2026-11-18 17:35 ` [PATCH v3 04/14] irqchip/gic-v5: Retain the L2 IST when mapping times out Sascha Bischoff
@ 2026-11-19 12:00 ` Fuad Tabba
2026-11-19 13:32 ` Lorenzo Pieralisi
0 siblings, 1 reply; 25+ messages in thread
From: Fuad Tabba @ 2026-11-19 12:00 UTC (permalink / raw)
To: Sascha Bischoff
Cc: Marc Zyngier, Lorenzo Pieralisi, Thomas Gleixner, Radu Rendec,
Timothy Hayes, Catalin Marinas, Jonathan Cameron,
Rafael J. Wysocki, linux-arm-kernel, linux-kernel
Hi Sascha,
On Wed, 18 Nov 2026 17:35:33 +0000, Sascha Bischoff
<sascha.bischoff@arm.com> wrote:
[...]
> diff --git a/drivers/irqchip/irq-gic-v5-irs.c b/drivers/irqchip/irq-gic-v5-irs.c
[...]
> @@ -217,6 +217,10 @@ int gicv5_irs_iste_alloc(const u32 lpi)
> if (FIELD_GET(GICV5_ISTL1E_VALID, le64_to_cpu(l1ist[index])))
> return 0;
>
> + /* A previous map timed out; do not overwrite its pending L1 entry. */
> + if (READ_ONCE(l1ist[index]))
> + return -EBUSY;
Sashiko's review [1] didn't go on the list, in case you missed it.
Sashiko found that l1ist[index] is read twice, and that on a
non-coherent IRS a map completing after the timeout leaves a stale
copy of the L1 entry in the cache for later allocations. Invalidating
the entry before it's first read would fix the latter. Invalidating it
on the timeout path wouldn't, since a later read can refill the line
before the map completes.
With those fixed:
Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev>
Cheers,
/fuad
[1] https://sashiko.dev/#/patchset/20261118-host_gicv5_fixes-v3-0-13c1859e8aa3%40arm.com
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v3 12/14] irqchip/gic-v5: Retain the ITT when device invalidation times out
2026-11-19 10:28 ` Lorenzo Pieralisi
@ 2026-11-19 12:07 ` Fuad Tabba
0 siblings, 0 replies; 25+ messages in thread
From: Fuad Tabba @ 2026-11-19 12:07 UTC (permalink / raw)
To: Lorenzo Pieralisi
Cc: Sascha Bischoff, Marc Zyngier, Thomas Gleixner, Radu Rendec,
Timothy Hayes, Catalin Marinas, Jonathan Cameron,
Rafael J. Wysocki, linux-arm-kernel, linux-kernel
On Thu, 19 Nov 2026 10:28:19 +0000, Lorenzo Pieralisi
<lpieralisi@kernel.org> wrote:
[...]
>> diff --git a/drivers/irqchip/irq-gic-v5-its.c b/drivers/irqchip/irq-gic-v5-its.c
[...]
>> @@ -570,7 +570,9 @@ static int gicv5_its_device_unregister(struct gicv5_its_chip_data *its,
>> its_write_table_entry(its, dte, 0);
>>
>> ret = gicv5_its_device_cache_inv(its, its_dev);
>> - gicv5_its_free_itt(its_dev);
>> + /* Only release the ITT once the ITS has discarded its references. */
>> + if (!ret)
>> + gicv5_its_free_itt(its_dev);
>
> if (ret)
> return ret;
>
> gicv5_its_free_itt(its_dev);
>
> return 0;
In this error path and the one in gicv5_its_device_register(),
kmemleak will report the retained ITT once the caller frees its_dev.
Could you mark the ITT allocations with kmemleak_not_leak() on both
paths, l2ptrs included for a two-level ITT?
With that added:
Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev>
Cheers,
/fuad
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v3 14/14] irqchip/gic-v5: Invalidate the L1 DTE when allocating an L2 device table
2026-11-19 10:13 ` Lorenzo Pieralisi
@ 2026-11-19 12:32 ` Fuad Tabba
2026-11-19 13:36 ` Lorenzo Pieralisi
0 siblings, 1 reply; 25+ messages in thread
From: Fuad Tabba @ 2026-11-19 12:32 UTC (permalink / raw)
To: Lorenzo Pieralisi
Cc: Sascha Bischoff, Marc Zyngier, Thomas Gleixner, Radu Rendec,
Timothy Hayes, Catalin Marinas, Jonathan Cameron,
Rafael J. Wysocki, linux-arm-kernel, linux-kernel
On Thu, 19 Nov 2026 10:13:31 +0000, Lorenzo Pieralisi
<lpieralisi@kernel.org> wrote:
[...]
>> diff --git a/drivers/irqchip/irq-gic-v5-its.c b/drivers/irqchip/irq-gic-v5-its.c
[...]
>> +static int gicv5_its_device_l1_cache_inv(struct gicv5_its_chip_data *its,
>> + u32 device_id)
>> +{
>> + return __gicv5_its_device_cache_inv(its, device_id, 0, true);
>
> I would highlight why event_id_bits is set to 0 (actually it is irrelevant,
> let's explicitly say so).
With L1 set, the effective value of ITS_INV_DEVICER.EVENTID_BITS is
the maximum in ITS_IDR2.EVENTID_BITS, whatever was written.
nit: this helper has a single caller, so could you call
__gicv5_its_device_cache_inv() directly from
gicv5_its_alloc_l2_devtab() and put Lorenzo's comment on that call?
Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev>
Cheers,
/fuad
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v3 04/14] irqchip/gic-v5: Retain the L2 IST when mapping times out
2026-11-19 12:00 ` Fuad Tabba
@ 2026-11-19 13:32 ` Lorenzo Pieralisi
0 siblings, 0 replies; 25+ messages in thread
From: Lorenzo Pieralisi @ 2026-11-19 13:32 UTC (permalink / raw)
To: Fuad Tabba
Cc: Sascha Bischoff, Marc Zyngier, Thomas Gleixner, Radu Rendec,
Timothy Hayes, Catalin Marinas, Jonathan Cameron,
Rafael J. Wysocki, linux-arm-kernel, linux-kernel
On Thu, Nov 19, 2026 at 12:00:15PM +0000, Fuad Tabba wrote:
> Hi Sascha,
>
> On Wed, 18 Nov 2026 17:35:33 +0000, Sascha Bischoff
> <sascha.bischoff@arm.com> wrote:
> [...]
> > diff --git a/drivers/irqchip/irq-gic-v5-irs.c b/drivers/irqchip/irq-gic-v5-irs.c
> [...]
> > @@ -217,6 +217,10 @@ int gicv5_irs_iste_alloc(const u32 lpi)
> > if (FIELD_GET(GICV5_ISTL1E_VALID, le64_to_cpu(l1ist[index])))
> > return 0;
> >
> > + /* A previous map timed out; do not overwrite its pending L1 entry. */
> > + if (READ_ONCE(l1ist[index]))
> > + return -EBUSY;
>
> Sashiko's review [1] didn't go on the list, in case you missed it.
> Sashiko found that l1ist[index] is read twice, and that on a
Yes, we should read it once but see below.
> non-coherent IRS a map completing after the timeout leaves a stale
> copy of the L1 entry in the cache for later allocations. Invalidating
> the entry before it's first read would fix the latter. Invalidating it
> on the timeout path wouldn't, since a later read can refill the line
> before the map completes.
Well, we don't know when the map completes do we ? Is invalidating
just before it is READ_ONCE() really "fixing" this (actually, is what
we are trying to do minimizing the false negatives ie l1 entries
that we wrote and became valid that we would detect as not valid ?)
or we need to sync the IRS and check for idle before the invalidation ?
I will give it more thought - I don't like this complexity much for
basically fixing a very close to fatal error.
Thanks,
Lorenzo
> With those fixed:
> Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev>
>
> Cheers,
> /fuad
>
> [1] https://sashiko.dev/#/patchset/20261118-host_gicv5_fixes-v3-0-13c1859e8aa3%40arm.com
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v3 14/14] irqchip/gic-v5: Invalidate the L1 DTE when allocating an L2 device table
2026-11-19 12:32 ` Fuad Tabba
@ 2026-11-19 13:36 ` Lorenzo Pieralisi
0 siblings, 0 replies; 25+ messages in thread
From: Lorenzo Pieralisi @ 2026-11-19 13:36 UTC (permalink / raw)
To: Fuad Tabba
Cc: Sascha Bischoff, Marc Zyngier, Thomas Gleixner, Radu Rendec,
Timothy Hayes, Catalin Marinas, Jonathan Cameron,
Rafael J. Wysocki, linux-arm-kernel, linux-kernel
On Thu, Nov 19, 2026 at 12:32:56PM +0000, Fuad Tabba wrote:
> On Thu, 19 Nov 2026 10:13:31 +0000, Lorenzo Pieralisi
> <lpieralisi@kernel.org> wrote:
> [...]
> >> diff --git a/drivers/irqchip/irq-gic-v5-its.c b/drivers/irqchip/irq-gic-v5-its.c
> [...]
> >> +static int gicv5_its_device_l1_cache_inv(struct gicv5_its_chip_data *its,
> >> + u32 device_id)
> >> +{
> >> + return __gicv5_its_device_cache_inv(its, device_id, 0, true);
> >
> > I would highlight why event_id_bits is set to 0 (actually it is irrelevant,
> > let's explicitly say so).
>
> With L1 set, the effective value of ITS_INV_DEVICER.EVENTID_BITS is
> the maximum in ITS_IDR2.EVENTID_BITS, whatever was written.
Yep, that's what I meant, I don't want "0" to look like we are
trying to optimize anything in there because there isn't anything
to optimize; a comment would do.
Thanks,
Lorenzo
> nit: this helper has a single caller, so could you call
> __gicv5_its_device_cache_inv() directly from
> gicv5_its_alloc_l2_devtab() and put Lorenzo's comment on that call?
>
> Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev>
>
> Cheers,
> /fuad
^ permalink raw reply [flat|nested] 25+ messages in thread
end of thread, other threads:[~2026-11-19 13:38 UTC | newest]
Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18 17:35 [PATCH v3 00/14] irqchip/gic-v5: Fix misc IRS and ITS host driver issues Sascha Bischoff
2026-11-18 17:35 ` [PATCH v3 01/14] irqchip/gic-v5: Reject SPIs not backed by an IRS Sascha Bischoff
2026-11-18 17:35 ` [PATCH v3 02/14] irqchip/gic-v5: Only set IRS DPS when 1ofN routing is supported Sascha Bischoff
2026-11-19 11:50 ` Fuad Tabba
2026-11-18 17:35 ` [PATCH v3 03/14] irqchip/gic-v5: Serialise IRS synchronisation requests Sascha Bischoff
2026-11-19 11:53 ` Fuad Tabba
2026-11-18 17:35 ` [PATCH v3 04/14] irqchip/gic-v5: Retain the L2 IST when mapping times out Sascha Bischoff
2026-11-19 12:00 ` Fuad Tabba
2026-11-19 13:32 ` Lorenzo Pieralisi
2026-11-18 17:35 ` [PATCH v3 05/14] irqchip/gic-v5: Serialise ITS invalidation commands Sascha Bischoff
2026-11-18 17:35 ` [PATCH v3 06/14] irqchip/gic-v5: Use linear DT and ITT when L2 covers all IDs Sascha Bischoff
2026-11-18 17:35 ` [PATCH v3 07/14] irqchip/gic-v5: Honour ACPI ITS noncoherent flag Sascha Bischoff
2026-11-18 17:35 ` [PATCH v3 08/14] irqchip/gic-v5: Use firmware node name in ITS warning Sascha Bischoff
2026-11-18 17:35 ` [PATCH v3 09/14] irqchip/gic-v5: Invalidate ITS device cache before freeing ITT Sascha Bischoff
2026-11-18 17:35 ` [PATCH v3 10/14] irqchip/gic-v5: Clean the allocated linear device table size Sascha Bischoff
2026-11-18 17:35 ` [PATCH v3 11/14] irqchip/gic-v5: Release ITS MMIO region on DT probe failure Sascha Bischoff
2026-11-18 17:35 ` [PATCH v3 12/14] irqchip/gic-v5: Retain the ITT when device invalidation times out Sascha Bischoff
2026-11-19 10:28 ` Lorenzo Pieralisi
2026-11-19 12:07 ` Fuad Tabba
2026-11-18 17:35 ` [PATCH v3 13/14] irqchip/gic-v5: Clean a level 2 device table before making it valid Sascha Bischoff
2026-11-19 10:19 ` Lorenzo Pieralisi
2026-11-18 17:35 ` [PATCH v3 14/14] irqchip/gic-v5: Invalidate the L1 DTE when allocating an L2 device table Sascha Bischoff
2026-11-19 10:13 ` Lorenzo Pieralisi
2026-11-19 12:32 ` Fuad Tabba
2026-11-19 13:36 ` Lorenzo Pieralisi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox