* [PATCH RFC v2 0/9] ACPI: ARM64: Implement IRQ mapping probe deferral for static table devices
@ 2026-11-30 8:54 Lorenzo Pieralisi
2026-11-30 8:54 ` [PATCH RFC v2 1/9] ACPI: irq: Return -EPROBE_DEFER on missing IRQ domain Lorenzo Pieralisi
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: Lorenzo Pieralisi @ 2026-11-30 8:54 UTC (permalink / raw)
To: Rafael J. Wysocki, Mark Rutland, Marc Zyngier, Daniel Lezcano,
Thomas Gleixner, Greg Kroah-Hartman, Danilo Krummrich,
Hanjun Guo, Sudeep Holla, Robin Murphy, Catalin Marinas,
Will Deacon, Bartosz Golaszewski, Andy Shevchenko, Leo Yan
Cc: linux-acpi, linux-kernel, linux-arm-kernel, driver-core,
Lorenzo Pieralisi
On ACPI ARM64 some platform devices (ie SMMUs, MPAM, MMIO MEM timer) are
created when the respective static ACPI table (GTDT, IORT, MPAM) entries
are parsed and the platform device resources, inclusive of their
IRQ number are stashed in the platform device resources to be used by
device drivers at probe time to retrieve the resource values.
For IRQs, this works well as long as interrupt controller drivers
managing IRQs for those devices are probed before the code creating
the IRQ mapping out of static table GSI numbers is run, in that the
interrupt controller drivers create the IRQ domain that allow the actual
IRQ mappings.
So far, that's always been the case on ACPI ARM64 systems given that
IRQs were routed to the GICv<5 interrupt controllers (wired and MSI)
and those controllers drivers probe earlier than any code creating
GSI mappings out of static ACPI table entries.
With the advent of GICv5 - wired IRQs (former GICv3 SPIs) can be routed
to a GICv5 IWB; the IWB is modelled as a device and its IRQ domain
is created when the IWB driver probes - that might be later than
the device drivers for platform devices created out of static ACPI tables
probe, resulting in failures to map the IRQs because the IRQ domain is not
registered yet so the IRQ mapping cannot be resolved.
This RFC series aims at solving this issue and should be used as
a starting point to build a solution and hopefully get some feedback.
PATCH 4 is a fixlet, I included with the series since I noticed
while updating the arch MEM MMIO timer driver.
Herein below, some technical details behind the patchset decisions
and questions to be addressed.
================
Misc design info
================
The main idea behind the patchset relies in augmenting the ACPI
static fwnode with a structure backing to stash GSI number,
trigger and polarity (and possibly its "name") so that the device drivers
can retrieve their values in a uniform manner when the device drivers
probe, the same way it is done on OF.
I converted IORT table platform devices to provide an example of
what it looks like and check whether that's the right direction of travel.
A question I have about this approach is that resources for a given
device are stored in separate data, struct resource for MMIO address
space and ACPI static fwnode for GSI data.
I decided to handle the arch MMIO timer conversion differently as
a point solution. Converting the arch MMIO timer to ACPI static fwnodes
would require creating an ACPI static fwnode per-frame and would
complicate things for not much. Instead, I just stash the GSI
number and properties in static data per frame (that exists already,
struct arch_timer_mem_frame) at GTDT parse time that can be
used by the driver later to map the GSI when the MMIO timer driver
probes.
acpi_register_gsi() was augmented to return -EPROBE_DEFER to handle
a missing IRQ domain and therefore enabling probe deferral.
The fwnode API was augmented as well so that device drivers can actually
retrieve IRQ numbers using standard platform device APIs:
platform_get_irq*()
when the fwnode itself is an ACPI static fwnode value.
I tested this on a GICv5 FVP model by re-routing MMIO timer and SMMUv3
IRQs to an IWB and checking that IRQ mappings and probe deferral work.
Feedback more than welcome.
Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
---
Changes in v2:
- Removed software nodes usage and converted the set to use ACPI static
fwnode instead
- Fixed minor !CONFIG_ACPI compilation issue
- Removed SBSA watchdog conversion following Sashiko's report
https://lore.kernel.org/all/20260925075726.B0A6B1F000FF@smtp.kernel.org/
- Link to v1: https://patch.msgid.link/20260925-acpi-static-table-irq-probe-defer-v1-0-2c62125d0085@kernel.org
---
Lorenzo Pieralisi (9):
ACPI: irq: Return -EPROBE_DEFER on missing IRQ domain
ACPI: Introduce IRQ methods for static fwnodes
driver core: platform: Add static ACPI nodes IRQ retrieval/mapping code
clocksource/drivers/arm_arch_timer_mmio: Dispose IRQ mappings on probe failure
clocksource/drivers/arm_arch_timer_mmio: Implement arch mem timer deferred probe
ACPI/IORT: Convert IORT devices to use the ACPI static fwnode IRQs
iommu/arm-smmu: Add arm-smmu IRQ mapping -EPROBE_DEFER handling
iommu/arm-smmu-v3: Add IRQ mapping -EPROBE_DEFER handling
perf/arm-smmuv3: Add IRQ mapping -EPROBE_DEFER handling
drivers/acpi/arm64/gtdt.c | 42 +-----
drivers/acpi/arm64/iort.c | 206 +++++++++++-----------------
drivers/acpi/irq.c | 6 +
drivers/acpi/property.c | 41 +++++-
drivers/base/platform.c | 6 +
drivers/clocksource/arm_arch_timer_mmio.c | 135 +++++++++++++++++-
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 43 ++++--
drivers/iommu/arm/arm-smmu/arm-smmu.c | 2 +
drivers/perf/arm_smmuv3_pmu.c | 3 +
include/clocksource/arm_arch_timer.h | 4 +
include/linux/acpi.h | 68 +++++++--
11 files changed, 363 insertions(+), 193 deletions(-)
---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20260924-acpi-static-table-irq-probe-defer-69b976bd723d
Best regards,
--
Lorenzo Pieralisi <lpieralisi@kernel.org>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH RFC v2 1/9] ACPI: irq: Return -EPROBE_DEFER on missing IRQ domain
2026-11-30 8:54 [PATCH RFC v2 0/9] ACPI: ARM64: Implement IRQ mapping probe deferral for static table devices Lorenzo Pieralisi
@ 2026-11-30 8:54 ` Lorenzo Pieralisi
2026-11-30 8:54 ` [PATCH RFC v2 2/9] ACPI: Introduce IRQ methods for static fwnodes Lorenzo Pieralisi
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Lorenzo Pieralisi @ 2026-11-30 8:54 UTC (permalink / raw)
To: Rafael J. Wysocki, Mark Rutland, Marc Zyngier, Daniel Lezcano,
Thomas Gleixner, Greg Kroah-Hartman, Danilo Krummrich,
Hanjun Guo, Sudeep Holla, Robin Murphy, Catalin Marinas,
Will Deacon, Bartosz Golaszewski, Andy Shevchenko, Leo Yan
Cc: linux-acpi, linux-kernel, linux-arm-kernel, driver-core,
Lorenzo Pieralisi
acpi_register_gsi() might fail if the IRQ domain a GSI belongs to has
not been registered yet by the respective interrupt controller driver.
Return -EPROBE_DEFER in this case so that the mapping can be retried
later by deferring the probe for the driver that requested the IRQ
mapping.
Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
---
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Marc Zyngier <maz@kernel.org>
---
drivers/acpi/irq.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/acpi/irq.c b/drivers/acpi/irq.c
index a670722ddd5a..24b0f5b42df0 100644
--- a/drivers/acpi/irq.c
+++ b/drivers/acpi/irq.c
@@ -52,11 +52,13 @@ EXPORT_SYMBOL_GPL(acpi_gsi_to_irq);
* @polarity: polarity of the GSI to be mapped
*
* Returns: a valid linux IRQ number on success
+ * -EPROBE_DEFER when the domain was not yet registered
* -EINVAL on failure
*/
int acpi_register_gsi(struct device *dev, u32 gsi, int trigger,
int polarity)
{
+ struct irq_domain *domain;
struct irq_fwspec fwspec;
unsigned int irq;
@@ -66,6 +68,10 @@ int acpi_register_gsi(struct device *dev, u32 gsi, int trigger,
return -EINVAL;
}
+ domain = irq_find_matching_fwnode(fwspec.fwnode, DOMAIN_BUS_ANY);
+ if (!domain)
+ return -EPROBE_DEFER;
+
fwspec.param[0] = gsi;
fwspec.param[1] = acpi_dev_get_irq_type(trigger, polarity);
fwspec.param_count = 2;
--
2.53.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH RFC v2 2/9] ACPI: Introduce IRQ methods for static fwnodes
2026-11-30 8:54 [PATCH RFC v2 0/9] ACPI: ARM64: Implement IRQ mapping probe deferral for static table devices Lorenzo Pieralisi
2026-11-30 8:54 ` [PATCH RFC v2 1/9] ACPI: irq: Return -EPROBE_DEFER on missing IRQ domain Lorenzo Pieralisi
@ 2026-11-30 8:54 ` Lorenzo Pieralisi
2026-11-30 8:54 ` [PATCH RFC v2 3/9] driver core: platform: Add static ACPI nodes IRQ retrieval/mapping code Lorenzo Pieralisi
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Lorenzo Pieralisi @ 2026-11-30 8:54 UTC (permalink / raw)
To: Rafael J. Wysocki, Mark Rutland, Marc Zyngier, Daniel Lezcano,
Thomas Gleixner, Greg Kroah-Hartman, Danilo Krummrich,
Hanjun Guo, Sudeep Holla, Robin Murphy, Catalin Marinas,
Will Deacon, Bartosz Golaszewski, Andy Shevchenko, Leo Yan
Cc: linux-acpi, linux-kernel, linux-arm-kernel, driver-core,
Lorenzo Pieralisi
To describe and map GSIs for firmware nodes created out of ACPI static
table entries in a uniform way later than at static tables parsing time,
it is required to store GSI data (number, trigger/polarity and name) in
the ACPI static fwnode for late retrieval.
Define an ACPI static fwnode structure and add to it data that can store
GSI number/flag/names to describe GSIs and their trigger mode/polarity,
and implement irq_get()/property_read_string_array() callbacks for static
fwnodes so that core code can retrieve and map IRQs for ACPI static fwnodes
in standard manner.
Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
---
Cc: Bartosz Golaszewski <brgl@kernel.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
---
drivers/acpi/property.c | 41 ++++++++++++++++++++++++++++-
include/linux/acpi.h | 68 +++++++++++++++++++++++++++++++++++++++++++------
2 files changed, 100 insertions(+), 9 deletions(-)
diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index 8ee5a1f0eb48..4df29c725e44 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -1766,7 +1766,46 @@ static int acpi_fwnode_irq_get(const struct fwnode_handle *fwnode,
DECLARE_ACPI_FWNODE_OPS(acpi_device_fwnode_ops);
DECLARE_ACPI_FWNODE_OPS(acpi_data_fwnode_ops);
-const struct fwnode_operations acpi_static_fwnode_ops;
+
+static int acpi_static_fwnode_read_string_array(const struct fwnode_handle *fwnode,
+ const char *propname,
+ const char **val, size_t nval)
+{
+ const struct acpi_static_fwnode *node = container_of(fwnode,
+ struct acpi_static_fwnode, fwnode);
+ unsigned int i;
+
+ if (strcmp(propname, "interrupt-names") || !node->irq_count || !node->irqs[0].name)
+ return -EINVAL;
+
+ if (!val)
+ return node->irq_count;
+
+ nval = min_t(size_t, nval, node->irq_count);
+
+ for (i = 0; i < nval; i++)
+ val[i] = node->irqs[i].name;
+
+ return nval;
+}
+
+int acpi_static_fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index)
+{
+ const struct acpi_static_fwnode *node = container_of(fwnode,
+ struct acpi_static_fwnode, fwnode);
+ const struct acpi_static_irq *irq;
+
+ if (index >= node->irq_count)
+ return -ENXIO;
+
+ irq = &node->irqs[index];
+ return acpi_register_gsi(NULL, irq->gsi, irq->trigger, irq->polarity);
+}
+
+const struct fwnode_operations acpi_static_fwnode_ops = {
+ .property_read_string_array = acpi_static_fwnode_read_string_array,
+ .irq_get = acpi_static_fwnode_irq_get,
+};
bool is_acpi_device_node(const struct fwnode_handle *fwnode)
{
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 9d3f039ebd94..8a4d218841c2 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -64,17 +64,58 @@ static inline acpi_handle acpi_device_handle(struct acpi_device *adev)
#define ACPI_HANDLE_FWNODE(fwnode) \
acpi_device_handle(to_acpi_device_node(fwnode))
-static inline struct fwnode_handle *acpi_alloc_fwnode_static(void)
-{
- struct fwnode_handle *fwnode;
- fwnode = kzalloc_obj(struct fwnode_handle);
- if (!fwnode)
+struct acpi_static_irq {
+ u32 gsi;
+ u8 trigger;
+ u8 polarity;
+ const char *name;
+};
+
+struct acpi_static_fwnode {
+ struct fwnode_handle fwnode;
+ unsigned int irq_count;
+ unsigned int nr_irqs;
+ struct acpi_static_irq irqs[];
+};
+
+int acpi_static_fwnode_irq_get(const struct fwnode_handle *fwnode,
+ unsigned int index);
+
+static inline struct fwnode_handle *acpi_alloc_fwnode_static_irqs(unsigned int nr_irqs)
+{
+ struct acpi_static_fwnode *node;
+
+ node = kzalloc(struct_size(node, irqs, nr_irqs), GFP_KERNEL);
+ if (!node)
return NULL;
- fwnode_init(fwnode, &acpi_static_fwnode_ops);
+ fwnode_init(&node->fwnode, &acpi_static_fwnode_ops);
+ node->nr_irqs = nr_irqs;
- return fwnode;
+ return &node->fwnode;
+}
+
+static inline struct fwnode_handle *acpi_alloc_fwnode_static(void)
+{
+ return acpi_alloc_fwnode_static_irqs(0);
+}
+
+static inline void acpi_static_fwnode_add_irq(struct fwnode_handle *fwnode,
+ u32 gsi, u8 trigger, u8 polarity,
+ const char *name)
+{
+ struct acpi_static_fwnode *node = container_of(fwnode,
+ struct acpi_static_fwnode, fwnode);
+ struct acpi_static_irq *irq;
+
+ if (WARN_ON(node->irq_count >= node->nr_irqs))
+ return;
+ irq = &node->irqs[node->irq_count++];
+ irq->gsi = gsi;
+ irq->trigger = trigger;
+ irq->polarity = polarity;
+ irq->name = name;
}
static inline void acpi_free_fwnode_static(struct fwnode_handle *fwnode)
@@ -82,7 +123,7 @@ static inline void acpi_free_fwnode_static(struct fwnode_handle *fwnode)
if (WARN_ON(!is_acpi_static_node(fwnode)))
return;
- kfree(fwnode);
+ kfree(container_of(fwnode, struct acpi_static_fwnode, fwnode));
}
static inline bool has_acpi_companion(struct device *dev)
@@ -890,6 +931,17 @@ static inline bool is_acpi_device_node(const struct fwnode_handle *fwnode)
return false;
}
+static inline bool is_acpi_static_node(const struct fwnode_handle *fwnode)
+{
+ return false;
+}
+
+static inline int acpi_static_fwnode_irq_get(const struct fwnode_handle *fwnode,
+ unsigned int index)
+{
+ return -ENXIO;
+}
+
static inline struct acpi_device *to_acpi_device_node(const struct fwnode_handle *fwnode)
{
return NULL;
--
2.53.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH RFC v2 3/9] driver core: platform: Add static ACPI nodes IRQ retrieval/mapping code
2026-11-30 8:54 [PATCH RFC v2 0/9] ACPI: ARM64: Implement IRQ mapping probe deferral for static table devices Lorenzo Pieralisi
2026-11-30 8:54 ` [PATCH RFC v2 1/9] ACPI: irq: Return -EPROBE_DEFER on missing IRQ domain Lorenzo Pieralisi
2026-11-30 8:54 ` [PATCH RFC v2 2/9] ACPI: Introduce IRQ methods for static fwnodes Lorenzo Pieralisi
@ 2026-11-30 8:54 ` Lorenzo Pieralisi
2026-11-30 8:54 ` [PATCH RFC v2 4/9] clocksource/drivers/arm_arch_timer_mmio: Dispose IRQ mappings on probe failure Lorenzo Pieralisi
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Lorenzo Pieralisi @ 2026-11-30 8:54 UTC (permalink / raw)
To: Rafael J. Wysocki, Mark Rutland, Marc Zyngier, Daniel Lezcano,
Thomas Gleixner, Greg Kroah-Hartman, Danilo Krummrich,
Hanjun Guo, Sudeep Holla, Robin Murphy, Catalin Marinas,
Will Deacon, Bartosz Golaszewski, Andy Shevchenko, Leo Yan
Cc: linux-acpi, linux-kernel, linux-arm-kernel, driver-core,
Lorenzo Pieralisi
ACPI static fwnodes types are not contemplated in the current
platform_get_irq_affinity()
implementation that is there to retrieve and map IRQs for a device.
Add acpi_static_fwnode_irq_get() to platform_get_irq_affinity() for static
ACPI fwnodes to overcome this shortcoming, enabling IRQ retrieval and
mapping for the ACPI static fwnode type in the generic platform IRQ
retrieval API.
Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
---
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Danilo Krummrich <dakr@kernel.org>
---
drivers/base/platform.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 3593d45f4a7a..08a53e44ee26 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -228,6 +228,12 @@ int platform_get_irq_affinity(struct platform_device *dev, unsigned int num,
goto out;
}
+ if (is_acpi_static_node(fwnode)) {
+ ret = acpi_static_fwnode_irq_get(fwnode, num);
+ if (ret > 0 || ret == -EPROBE_DEFER)
+ goto out;
+ }
+
/*
* For the index 0 interrupt, allow falling back to GpioInt
* resources. While a device could have both Interrupt and GpioInt
--
2.53.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH RFC v2 4/9] clocksource/drivers/arm_arch_timer_mmio: Dispose IRQ mappings on probe failure
2026-11-30 8:54 [PATCH RFC v2 0/9] ACPI: ARM64: Implement IRQ mapping probe deferral for static table devices Lorenzo Pieralisi
` (2 preceding siblings ...)
2026-11-30 8:54 ` [PATCH RFC v2 3/9] driver core: platform: Add static ACPI nodes IRQ retrieval/mapping code Lorenzo Pieralisi
@ 2026-11-30 8:54 ` Lorenzo Pieralisi
2026-11-30 8:54 ` [PATCH RFC v2 5/9] clocksource/drivers/arm_arch_timer_mmio: Implement arch mem timer deferred probe Lorenzo Pieralisi
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Lorenzo Pieralisi @ 2026-11-30 8:54 UTC (permalink / raw)
To: Rafael J. Wysocki, Mark Rutland, Marc Zyngier, Daniel Lezcano,
Thomas Gleixner, Greg Kroah-Hartman, Danilo Krummrich,
Hanjun Guo, Sudeep Holla, Robin Murphy, Catalin Marinas,
Will Deacon, Bartosz Golaszewski, Andy Shevchenko, Leo Yan
Cc: linux-acpi, linux-kernel, linux-arm-kernel, driver-core,
Lorenzo Pieralisi
On probe failure the driver does not dispose the IRQ mappings that
were carried out before the probe function hit an error condition.
Add code to dispose the IRQ mappings on driver probe failure.
Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
---
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Marc Zyngier <maz@kernel.org>
---
drivers/clocksource/arm_arch_timer_mmio.c | 45 ++++++++++++++++++++++++++-----
1 file changed, 38 insertions(+), 7 deletions(-)
diff --git a/drivers/clocksource/arm_arch_timer_mmio.c b/drivers/clocksource/arm_arch_timer_mmio.c
index d678f764d3bb..825f236d0c52 100644
--- a/drivers/clocksource/arm_arch_timer_mmio.c
+++ b/drivers/clocksource/arm_arch_timer_mmio.c
@@ -191,6 +191,33 @@ static irqreturn_t arch_timer_mmio_handler(int irq, void *dev_id)
return IRQ_NONE;
}
+static void arch_timer_mmio_unmap_irq(int *irq)
+{
+ if (!(*irq))
+ return;
+
+ irq_dispose_mapping(*irq);
+ *irq = 0;
+}
+
+static void arch_timer_mmio_unmap_frame_irqs(struct arch_timer_mem_frame *frame)
+{
+ arch_timer_mmio_unmap_irq(&frame->phys_irq);
+ arch_timer_mmio_unmap_irq(&frame->virt_irq);
+}
+
+static void arch_timer_mmio_unmap_irqs(struct arch_timer_mem *gt_block)
+{
+ for (unsigned int i = 0; i < ARCH_TIMER_MEM_MAX_FRAMES; i++) {
+ struct arch_timer_mem_frame *frame = >_block->frame[i];
+
+ if (!frame->valid)
+ continue;
+
+ arch_timer_mmio_unmap_frame_irqs(frame);
+ }
+}
+
static struct arch_timer_mem_frame *find_best_frame(struct platform_device *pdev)
{
struct arch_timer_mem_frame *frame, *best_frame = NULL;
@@ -398,6 +425,7 @@ static int arch_timer_mmio_probe(struct platform_device *pdev)
frame = find_best_frame(pdev);
if (!frame) {
+ arch_timer_mmio_unmap_irqs(at->gt_block);
dev_err(&pdev->dev,
"Unable to find a suitable frame in timer @ %pa\n",
&at->gt_block->cntctlbase);
@@ -405,14 +433,17 @@ static int arch_timer_mmio_probe(struct platform_device *pdev)
}
ret = arch_timer_mmio_frame_register(pdev, frame);
- if (!ret)
- dev_info(&pdev->dev,
- "mmio timer running at %lu.%02luMHz (%s)\n",
- (unsigned long)at->rate / 1000000,
- (unsigned long)(at->rate / 10000) % 100,
- at->access == VIRT_ACCESS ? "virt" : "phys");
+ if (ret) {
+ arch_timer_mmio_unmap_irqs(at->gt_block);
+ return ret;
+ }
- return ret;
+ dev_info(&pdev->dev, "mmio timer running at %lu.%02luMHz (%s)\n",
+ (unsigned long)at->rate / 1000000,
+ (unsigned long)(at->rate / 10000) % 100,
+ at->access == VIRT_ACCESS ? "virt" : "phys");
+
+ return 0;
}
static const struct of_device_id arch_timer_mmio_of_table[] = {
--
2.53.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH RFC v2 5/9] clocksource/drivers/arm_arch_timer_mmio: Implement arch mem timer deferred probe
2026-11-30 8:54 [PATCH RFC v2 0/9] ACPI: ARM64: Implement IRQ mapping probe deferral for static table devices Lorenzo Pieralisi
` (3 preceding siblings ...)
2026-11-30 8:54 ` [PATCH RFC v2 4/9] clocksource/drivers/arm_arch_timer_mmio: Dispose IRQ mappings on probe failure Lorenzo Pieralisi
@ 2026-11-30 8:54 ` Lorenzo Pieralisi
2026-11-30 8:54 ` [PATCH RFC v2 6/9] ACPI/IORT: Convert IORT devices to use the ACPI static fwnode IRQs Lorenzo Pieralisi
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Lorenzo Pieralisi @ 2026-11-30 8:54 UTC (permalink / raw)
To: Rafael J. Wysocki, Mark Rutland, Marc Zyngier, Daniel Lezcano,
Thomas Gleixner, Greg Kroah-Hartman, Danilo Krummrich,
Hanjun Guo, Sudeep Holla, Robin Murphy, Catalin Marinas,
Will Deacon, Bartosz Golaszewski, Andy Shevchenko, Leo Yan
Cc: linux-acpi, linux-kernel, linux-arm-kernel, driver-core,
Lorenzo Pieralisi
Resolving the arch mem timer IRQ on ACPI systems might require
two-steps if the IRQ is wired to an interrupt controller whose
driver has not probed yet at the time the IRQ mapping is carried
out through acpi_register_gsi(), which would result in an
-EPROBE_DEFER return value that in turn should trigger a
driver probe deferral.
Instead of trying to map an IRQ when the arch mem timer device is
created, stash the GSIs number and flag values in the arch_timer_mem_frame
data structure and use it at driver probe time to map the GSIs.
Add -EPROBE_DEFER handling to the arch mem timer driver so
that it can cope with GSIs that are routed to interrupt controllers
whose driver has not yet probed at the time acpi_register_gsi() is
invoked.
Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
---
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Marc Zyngier <maz@kernel.org>
---
drivers/acpi/arm64/gtdt.c | 42 +++------------
drivers/clocksource/arm_arch_timer_mmio.c | 90 +++++++++++++++++++++++++++++++
include/clocksource/arm_arch_timer.h | 4 ++
3 files changed, 100 insertions(+), 36 deletions(-)
diff --git a/drivers/acpi/arm64/gtdt.c b/drivers/acpi/arm64/gtdt.c
index 00158c8aa6d9..430016519e09 100644
--- a/drivers/acpi/arm64/gtdt.c
+++ b/drivers/acpi/arm64/gtdt.c
@@ -279,31 +279,20 @@ static int __init gtdt_parse_timer_block(struct acpi_gtdt_timer_block *block,
continue;
if (gtdt_frame->frame_number >= ARCH_TIMER_MEM_MAX_FRAMES ||
!gtdt_frame->base_address || !gtdt_frame->timer_interrupt)
- goto error;
+ return -EINVAL;
frame = &timer_mem->frame[gtdt_frame->frame_number];
/* duplicate frame */
if (frame->valid)
- goto error;
+ return -EINVAL;
- frame->phys_irq = map_gt_gsi(gtdt_frame->timer_interrupt,
- gtdt_frame->timer_flags);
- if (frame->phys_irq <= 0) {
- pr_warn("failed to map physical timer irq in frame %d.\n",
- gtdt_frame->frame_number);
- goto error;
- }
+ frame->phys_gsi = gtdt_frame->timer_interrupt;
+ frame->phys_flags = gtdt_frame->timer_flags;
if (gtdt_frame->virtual_timer_interrupt) {
- frame->virt_irq =
- map_gt_gsi(gtdt_frame->virtual_timer_interrupt,
- gtdt_frame->virtual_timer_flags);
- if (frame->virt_irq <= 0) {
- pr_warn("failed to map virtual timer irq in frame %d.\n",
- gtdt_frame->frame_number);
- goto error;
- }
+ frame->virt_gsi = gtdt_frame->virtual_timer_interrupt;
+ frame->virt_flags = gtdt_frame->virtual_timer_flags;
} else {
pr_debug("virtual timer in frame %d not implemented.\n",
gtdt_frame->frame_number);
@@ -320,25 +309,6 @@ static int __init gtdt_parse_timer_block(struct acpi_gtdt_timer_block *block,
}
return 0;
-
-error:
- do {
- if (gtdt_frame->common_flags & ACPI_GTDT_GT_IS_SECURE_TIMER ||
- gtdt_frame->frame_number >= ARCH_TIMER_MEM_MAX_FRAMES)
- continue;
-
- frame = &timer_mem->frame[gtdt_frame->frame_number];
-
- if (frame->phys_irq > 0)
- acpi_unregister_gsi(gtdt_frame->timer_interrupt);
- frame->phys_irq = 0;
-
- if (frame->virt_irq > 0)
- acpi_unregister_gsi(gtdt_frame->virtual_timer_interrupt);
- frame->virt_irq = 0;
- } while (i-- > 0 && gtdt_frame--);
-
- return -EINVAL;
}
/*
diff --git a/drivers/clocksource/arm_arch_timer_mmio.c b/drivers/clocksource/arm_arch_timer_mmio.c
index 825f236d0c52..08d051adef67 100644
--- a/drivers/clocksource/arm_arch_timer_mmio.c
+++ b/drivers/clocksource/arm_arch_timer_mmio.c
@@ -10,6 +10,7 @@
#define pr_fmt(fmt) "arch_timer_mmio: " fmt
+#include <linux/acpi.h>
#include <linux/clockchips.h>
#include <linux/interrupt.h>
#include <linux/io-64-nonatomic-lo-hi.h>
@@ -206,6 +207,92 @@ static void arch_timer_mmio_unmap_frame_irqs(struct arch_timer_mem_frame *frame)
arch_timer_mmio_unmap_irq(&frame->virt_irq);
}
+#ifdef CONFIG_ACPI
+static int arch_timer_mmio_map_gsi(struct platform_device *pdev, u32 gsi,
+ u32 flags, int *irq)
+{
+ int trigger, polarity, ret;
+
+ if (!gsi || *irq)
+ return 0;
+
+ trigger = (flags & ACPI_GTDT_INTERRUPT_MODE) ? ACPI_EDGE_SENSITIVE
+ : ACPI_LEVEL_SENSITIVE;
+ polarity = (flags & ACPI_GTDT_INTERRUPT_POLARITY) ? ACPI_ACTIVE_LOW
+ : ACPI_ACTIVE_HIGH;
+
+ ret = acpi_register_gsi(&pdev->dev, gsi, trigger, polarity);
+ if (ret < 0)
+ return ret;
+
+ *irq = ret;
+
+ return 0;
+}
+
+static int arch_timer_mmio_map_frame_gsis(struct platform_device *pdev,
+ struct arch_timer_mem_frame *frame)
+{
+ int ret;
+
+ ret = arch_timer_mmio_map_gsi(pdev, frame->phys_gsi, frame->phys_flags, &frame->phys_irq);
+ if (ret < 0) {
+ dev_err_probe(&pdev->dev, ret,
+ "Failed to map physical timer GSI %u for frame @ %pa: %d\n",
+ frame->phys_gsi, &frame->cntbase, ret);
+ return ret;
+ }
+
+ ret = arch_timer_mmio_map_gsi(pdev, frame->virt_gsi, frame->virt_flags, &frame->virt_irq);
+ if (ret < 0) {
+ dev_err_probe(&pdev->dev, ret,
+ "Failed to map virtual timer GSI %u for frame @ %pa: %d\n",
+ frame->virt_gsi, &frame->cntbase, ret);
+ arch_timer_mmio_unmap_irq(&frame->phys_irq);
+ return ret;
+ }
+
+ return 0;
+}
+
+static int arch_timer_mmio_map_gsis(struct platform_device *pdev,
+ struct arch_timer_mem *gt_block)
+{
+ int i, ret;
+
+ for (i = 0; i < ARCH_TIMER_MEM_MAX_FRAMES; i++) {
+ struct arch_timer_mem_frame *frame = >_block->frame[i];
+
+ if (!frame->valid)
+ continue;
+
+ ret = arch_timer_mmio_map_frame_gsis(pdev, frame);
+ if (ret < 0)
+ goto unmap_err;
+ }
+
+ return 0;
+
+unmap_err:
+ for (i--; i >= 0; i--) {
+ struct arch_timer_mem_frame *frame = >_block->frame[i];
+
+ if (!frame->valid)
+ continue;
+
+ arch_timer_mmio_unmap_frame_irqs(frame);
+ }
+
+ return ret;
+}
+#else
+static inline int arch_timer_mmio_map_gsis(struct platform_device *pdev,
+ struct arch_timer_mem *gt_block)
+{
+ return -ENODEV;
+}
+#endif
+
static void arch_timer_mmio_unmap_irqs(struct arch_timer_mem *gt_block)
{
for (unsigned int i = 0; i < ARCH_TIMER_MEM_MAX_FRAMES; i++) {
@@ -419,6 +506,9 @@ static int arch_timer_mmio_probe(struct platform_device *pdev)
return ret;
} else {
at->gt_block = dev_get_platdata(&pdev->dev);
+ ret = arch_timer_mmio_map_gsis(pdev, at->gt_block);
+ if (ret)
+ return ret;
}
platform_set_drvdata(pdev, at);
diff --git a/include/clocksource/arm_arch_timer.h b/include/clocksource/arm_arch_timer.h
index 2eda895f19f5..c14741519899 100644
--- a/include/clocksource/arm_arch_timer.h
+++ b/include/clocksource/arm_arch_timer.h
@@ -76,6 +76,10 @@ struct arch_timer_mem_frame {
size_t size;
int phys_irq;
int virt_irq;
+ u32 phys_gsi;
+ u32 phys_flags;
+ u32 virt_gsi;
+ u32 virt_flags;
};
struct arch_timer_mem {
--
2.53.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH RFC v2 6/9] ACPI/IORT: Convert IORT devices to use the ACPI static fwnode IRQs
2026-11-30 8:54 [PATCH RFC v2 0/9] ACPI: ARM64: Implement IRQ mapping probe deferral for static table devices Lorenzo Pieralisi
` (4 preceding siblings ...)
2026-11-30 8:54 ` [PATCH RFC v2 5/9] clocksource/drivers/arm_arch_timer_mmio: Implement arch mem timer deferred probe Lorenzo Pieralisi
@ 2026-11-30 8:54 ` Lorenzo Pieralisi
2026-11-30 8:54 ` [PATCH RFC v2 7/9] iommu/arm-smmu: Add arm-smmu IRQ mapping -EPROBE_DEFER handling Lorenzo Pieralisi
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Lorenzo Pieralisi @ 2026-11-30 8:54 UTC (permalink / raw)
To: Rafael J. Wysocki, Mark Rutland, Marc Zyngier, Daniel Lezcano,
Thomas Gleixner, Greg Kroah-Hartman, Danilo Krummrich,
Hanjun Guo, Sudeep Holla, Robin Murphy, Catalin Marinas,
Will Deacon, Bartosz Golaszewski, Andy Shevchenko, Leo Yan
Cc: linux-acpi, linux-kernel, linux-arm-kernel, driver-core,
Lorenzo Pieralisi
Static devices created out of IORT nodes might require GSI interrupts that
are routed to interrupt controllers that have not yet probed (so their
respective IRQ domain is not registered yet and therefore the GSI
mapping would fail if tried) to be mapped in current IORT code.
Instead of trying to map the GSIs at platform device creation time and
save them in the platform device IRQ resource, stash standard GSIs numbers,
trigger/polarity and names data into the IORT ACPI static fwnode using the
acpi_static_fwnode_add_irq() helper so that they can be later retrieved
(and mapped into a virtual IRQ), in a uniform fashion, by the device
drivers requesting them.
Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
---
Cc: Hanjun Guo <guohanjun@huawei.com>
Cc: Sudeep Holla <sudeep.holla@kernel.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
---
drivers/acpi/arm64/iort.c | 206 ++++++++++++++++++----------------------------
1 file changed, 80 insertions(+), 126 deletions(-)
diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
index 1020ac953e42..478aa2802cc9 100644
--- a/drivers/acpi/arm64/iort.c
+++ b/drivers/acpi/arm64/iort.c
@@ -1567,47 +1567,14 @@ int iort_dma_get_ranges(struct device *dev, u64 *limit)
return nc_dma_get_range(dev, limit);
}
-static void __init acpi_iort_register_irq(int hwirq, const char *name,
- int trigger,
- struct resource *res)
+static void __init acpi_iort_add_irq(u32 hwirq, const char *name, unsigned int trigger_val,
+ struct fwnode_handle *fwnode)
{
- int irq = acpi_register_gsi(NULL, hwirq, trigger,
- ACPI_ACTIVE_HIGH);
-
- if (irq <= 0) {
- pr_err("could not register gsi hwirq %d name [%s]\n", hwirq,
- name);
+ if (!hwirq)
return;
- }
- res->start = irq;
- res->end = irq;
- res->flags = IORESOURCE_IRQ;
- res->name = name;
-}
-
-static int __init arm_smmu_v3_count_resources(struct acpi_iort_node *node)
-{
- struct acpi_iort_smmu_v3 *smmu;
- /* Always present mem resource */
- int num_res = 1;
-
- /* Retrieve SMMUv3 specific data */
- smmu = (struct acpi_iort_smmu_v3 *)node->node_data;
-
- if (smmu->event_gsiv)
- num_res++;
-
- if (smmu->pri_gsiv)
- num_res++;
-
- if (smmu->gerr_gsiv)
- num_res++;
-
- if (smmu->sync_gsiv)
- num_res++;
-
- return num_res;
+ acpi_static_fwnode_add_irq(fwnode, hwirq, trigger_val, ACPI_ACTIVE_HIGH,
+ name);
}
static bool arm_smmu_v3_is_combined_irq(struct acpi_iort_smmu_v3 *smmu)
@@ -1644,43 +1611,35 @@ static void __init arm_smmu_v3_init_resources(struct resource *res,
struct acpi_iort_node *node)
{
struct acpi_iort_smmu_v3 *smmu;
- int num_res = 0;
/* Retrieve SMMUv3 specific data */
smmu = (struct acpi_iort_smmu_v3 *)node->node_data;
- res[num_res].start = smmu->base_address;
- res[num_res].end = smmu->base_address +
- arm_smmu_v3_resource_size(smmu) - 1;
- res[num_res].flags = IORESOURCE_MEM;
+ res[0].start = smmu->base_address;
+ res[0].end = smmu->base_address + arm_smmu_v3_resource_size(smmu) - 1;
+ res[0].flags = IORESOURCE_MEM;
+}
+
+static void __init arm_smmu_v3_init_irqs(struct fwnode_handle *fwnode,
+ struct acpi_iort_node *node)
+{
+ struct acpi_iort_smmu_v3 *smmu;
+
+ smmu = (struct acpi_iort_smmu_v3 *)node->node_data;
- num_res++;
if (arm_smmu_v3_is_combined_irq(smmu)) {
- if (smmu->event_gsiv)
- acpi_iort_register_irq(smmu->event_gsiv, "combined",
- ACPI_EDGE_SENSITIVE,
- &res[num_res++]);
+ acpi_iort_add_irq(smmu->event_gsiv, "combined",
+ ACPI_EDGE_SENSITIVE, fwnode);
} else {
+ acpi_iort_add_irq(smmu->event_gsiv, "eventq",
+ ACPI_EDGE_SENSITIVE, fwnode);
- if (smmu->event_gsiv)
- acpi_iort_register_irq(smmu->event_gsiv, "eventq",
- ACPI_EDGE_SENSITIVE,
- &res[num_res++]);
-
- if (smmu->pri_gsiv)
- acpi_iort_register_irq(smmu->pri_gsiv, "priq",
- ACPI_EDGE_SENSITIVE,
- &res[num_res++]);
-
- if (smmu->gerr_gsiv)
- acpi_iort_register_irq(smmu->gerr_gsiv, "gerror",
- ACPI_EDGE_SENSITIVE,
- &res[num_res++]);
-
- if (smmu->sync_gsiv)
- acpi_iort_register_irq(smmu->sync_gsiv, "cmdq-sync",
- ACPI_EDGE_SENSITIVE,
- &res[num_res++]);
+ acpi_iort_add_irq(smmu->pri_gsiv, "priq",
+ ACPI_EDGE_SENSITIVE, fwnode);
+ acpi_iort_add_irq(smmu->gerr_gsiv, "gerror",
+ ACPI_EDGE_SENSITIVE, fwnode);
+ acpi_iort_add_irq(smmu->sync_gsiv, "cmdq-sync",
+ ACPI_EDGE_SENSITIVE, fwnode);
}
}
@@ -1730,55 +1689,36 @@ static int __init arm_smmu_v3_set_proximity(struct device *dev,
#define arm_smmu_v3_set_proximity NULL
#endif
-static int __init arm_smmu_count_resources(struct acpi_iort_node *node)
-{
- struct acpi_iort_smmu *smmu;
-
- /* Retrieve SMMU specific data */
- smmu = (struct acpi_iort_smmu *)node->node_data;
-
- /*
- * Only consider the global fault interrupt and ignore the
- * configuration access interrupt.
- *
- * MMIO address and global fault interrupt resources are always
- * present so add them to the context interrupt count as a static
- * value.
- */
- return smmu->context_interrupt_count + 2;
-}
-
static void __init arm_smmu_init_resources(struct resource *res,
struct acpi_iort_node *node)
{
struct acpi_iort_smmu *smmu;
- int i, hw_irq, trigger, num_res = 0;
- u64 *ctx_irq, *glb_irq;
/* Retrieve SMMU specific data */
smmu = (struct acpi_iort_smmu *)node->node_data;
- res[num_res].start = smmu->base_address;
- res[num_res].end = smmu->base_address + smmu->span - 1;
- res[num_res].flags = IORESOURCE_MEM;
- num_res++;
+ res[0].start = smmu->base_address;
+ res[0].end = smmu->base_address + smmu->span - 1;
+ res[0].flags = IORESOURCE_MEM;
+}
+
+static void __init arm_smmu_init_irqs(struct fwnode_handle *fwnode,
+ struct acpi_iort_node *node)
+{
+ struct acpi_iort_smmu *smmu;
+ u64 *ctx_irq, *glb_irq;
+ int i;
+
+ smmu = (struct acpi_iort_smmu *)node->node_data;
glb_irq = ACPI_ADD_PTR(u64, node, smmu->global_interrupt_offset);
- /* Global IRQs */
- hw_irq = IORT_IRQ_MASK(glb_irq[0]);
- trigger = IORT_IRQ_TRIGGER_MASK(glb_irq[0]);
+ acpi_iort_add_irq(IORT_IRQ_MASK(glb_irq[0]), NULL,
+ IORT_IRQ_TRIGGER_MASK(glb_irq[0]), fwnode);
- acpi_iort_register_irq(hw_irq, "arm-smmu-global", trigger,
- &res[num_res++]);
-
- /* Context IRQs */
ctx_irq = ACPI_ADD_PTR(u64, node, smmu->context_interrupt_offset);
for (i = 0; i < smmu->context_interrupt_count; i++) {
- hw_irq = IORT_IRQ_MASK(ctx_irq[i]);
- trigger = IORT_IRQ_TRIGGER_MASK(ctx_irq[i]);
-
- acpi_iort_register_irq(hw_irq, "arm-smmu-context", trigger,
- &res[num_res++]);
+ acpi_iort_add_irq(IORT_IRQ_MASK(ctx_irq[i]), NULL,
+ IORT_IRQ_TRIGGER_MASK(ctx_irq[i]), fwnode);
}
}
@@ -1801,20 +1741,6 @@ static void __init arm_smmu_dma_configure(struct device *dev,
acpi_dma_configure(dev, attr);
}
-static int __init arm_smmu_v3_pmcg_count_resources(struct acpi_iort_node *node)
-{
- struct acpi_iort_pmcg *pmcg;
-
- /* Retrieve PMCG specific data */
- pmcg = (struct acpi_iort_pmcg *)node->node_data;
-
- /*
- * There are always 2 memory resources.
- * If the overflow_gsiv is present then add that for a total of 3.
- */
- return pmcg->overflow_gsiv ? 3 : 2;
-}
-
static void __init arm_smmu_v3_pmcg_init_resources(struct resource *res,
struct acpi_iort_node *node)
{
@@ -1837,10 +1763,17 @@ static void __init arm_smmu_v3_pmcg_init_resources(struct resource *res,
res[1].end = pmcg->page1_base_address + SZ_4K - 1;
res[1].flags = IORESOURCE_MEM;
}
+}
- if (pmcg->overflow_gsiv)
- acpi_iort_register_irq(pmcg->overflow_gsiv, "overflow",
- ACPI_EDGE_SENSITIVE, &res[2]);
+static void __init arm_smmu_v3_pmcg_init_irqs(struct fwnode_handle *fwnode,
+ struct acpi_iort_node *node)
+{
+ struct acpi_iort_pmcg *pmcg;
+
+ pmcg = (struct acpi_iort_pmcg *)node->node_data;
+
+ acpi_iort_add_irq(pmcg->overflow_gsiv, "overflow", ACPI_EDGE_SENSITIVE,
+ fwnode);
}
static struct acpi_platform_list pmcg_plat_info[] __initdata = {
@@ -1878,12 +1811,15 @@ static int __init arm_smmu_v3_pmcg_add_platdata(struct platform_device *pdev)
struct iort_dev_config {
const char *name;
+ unsigned int nr_irqs;
+ unsigned int nr_res;
int (*dev_init)(struct acpi_iort_node *node);
void (*dev_dma_configure)(struct device *dev,
struct acpi_iort_node *node);
- int (*dev_count_resources)(struct acpi_iort_node *node);
void (*dev_init_resources)(struct resource *res,
struct acpi_iort_node *node);
+ void (*dev_init_irqs)(struct fwnode_handle *fwnode,
+ struct acpi_iort_node *node);
int (*dev_set_proximity)(struct device *dev,
struct acpi_iort_node *node);
int (*dev_add_platdata)(struct platform_device *pdev);
@@ -1891,23 +1827,28 @@ struct iort_dev_config {
static const struct iort_dev_config iort_arm_smmu_v3_cfg __initconst = {
.name = "arm-smmu-v3",
+ .nr_irqs = 4,
+ .nr_res = 1,
.dev_dma_configure = arm_smmu_v3_dma_configure,
- .dev_count_resources = arm_smmu_v3_count_resources,
.dev_init_resources = arm_smmu_v3_init_resources,
+ .dev_init_irqs = arm_smmu_v3_init_irqs,
.dev_set_proximity = arm_smmu_v3_set_proximity,
};
static const struct iort_dev_config iort_arm_smmu_cfg __initconst = {
.name = "arm-smmu",
+ .nr_res = 1,
.dev_dma_configure = arm_smmu_dma_configure,
- .dev_count_resources = arm_smmu_count_resources,
.dev_init_resources = arm_smmu_init_resources,
+ .dev_init_irqs = arm_smmu_init_irqs,
};
static const struct iort_dev_config iort_arm_smmu_v3_pmcg_cfg __initconst = {
.name = "arm-smmu-v3-pmcg",
- .dev_count_resources = arm_smmu_v3_pmcg_count_resources,
+ .nr_irqs = 1,
+ .nr_res = 2,
.dev_init_resources = arm_smmu_v3_pmcg_init_resources,
+ .dev_init_irqs = arm_smmu_v3_pmcg_init_irqs,
.dev_add_platdata = arm_smmu_v3_pmcg_add_platdata,
};
@@ -1951,7 +1892,7 @@ static int __init iort_add_platform_device(struct acpi_iort_node *node,
goto dev_put;
}
- count = ops->dev_count_resources(node);
+ count = ops->nr_res;
r = kzalloc_objs(*r, count);
if (!r) {
@@ -1994,6 +1935,9 @@ static int __init iort_add_platform_device(struct acpi_iort_node *node,
platform_device_set_fwnode(pdev, fwnode);
+ if (ops->dev_init_irqs)
+ ops->dev_init_irqs(fwnode, node);
+
if (ops->dev_dma_configure)
ops->dev_dma_configure(&pdev->dev, node);
@@ -2007,6 +1951,7 @@ static int __init iort_add_platform_device(struct acpi_iort_node *node,
dma_deconfigure:
arch_teardown_dma_ops(&pdev->dev);
+ platform_device_set_fwnode(pdev, NULL);
dev_put:
platform_device_put(pdev);
@@ -2082,7 +2027,16 @@ static void __init iort_init_platform_devices(void)
ops = iort_get_dev_cfg(iort_node);
if (ops) {
- fwnode = acpi_alloc_fwnode_static();
+ unsigned int nr_irqs = ops->nr_irqs;
+
+ if (iort_node->type == ACPI_IORT_NODE_SMMU) {
+ struct acpi_iort_smmu *smmu =
+ (struct acpi_iort_smmu *)iort_node->node_data;
+
+ nr_irqs = smmu->context_interrupt_count + 1;
+ }
+
+ fwnode = acpi_alloc_fwnode_static_irqs(nr_irqs);
if (!fwnode)
return;
--
2.53.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH RFC v2 7/9] iommu/arm-smmu: Add arm-smmu IRQ mapping -EPROBE_DEFER handling
2026-11-30 8:54 [PATCH RFC v2 0/9] ACPI: ARM64: Implement IRQ mapping probe deferral for static table devices Lorenzo Pieralisi
` (5 preceding siblings ...)
2026-11-30 8:54 ` [PATCH RFC v2 6/9] ACPI/IORT: Convert IORT devices to use the ACPI static fwnode IRQs Lorenzo Pieralisi
@ 2026-11-30 8:54 ` Lorenzo Pieralisi
2026-11-30 8:54 ` [PATCH RFC v2 8/9] iommu/arm-smmu-v3: Add " Lorenzo Pieralisi
2026-11-30 8:54 ` [PATCH RFC v2 9/9] perf/arm-smmuv3: " Lorenzo Pieralisi
8 siblings, 0 replies; 10+ messages in thread
From: Lorenzo Pieralisi @ 2026-11-30 8:54 UTC (permalink / raw)
To: Rafael J. Wysocki, Mark Rutland, Marc Zyngier, Daniel Lezcano,
Thomas Gleixner, Greg Kroah-Hartman, Danilo Krummrich,
Hanjun Guo, Sudeep Holla, Robin Murphy, Catalin Marinas,
Will Deacon, Bartosz Golaszewski, Andy Shevchenko, Leo Yan
Cc: linux-acpi, linux-kernel, linux-arm-kernel, driver-core,
Lorenzo Pieralisi
With the advent of GICv5, IRQs mapping can fail if the interrupt
controller the wired SMMU interrupts are routed to has not probed
yet when the SMMU driver probes.
Handle -EPROBE_DEFER gracefully for IRQ mappings failures.
Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
---
Cc: Will Deacon <will@kernel.org>
Cc: Robin Murphy <robin.murphy@arm.com>
---
drivers/iommu/arm/arm-smmu/arm-smmu.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c
index 889a0966d36c..fe85c3e17eeb 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c
@@ -2154,6 +2154,8 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
return PTR_ERR(smmu);
num_irqs = platform_irq_count(pdev);
+ if (num_irqs < 0)
+ return dev_err_probe(dev, num_irqs, "IRQ count failed\n");
smmu->num_context_irqs = num_irqs - global_irqs - pmu_irqs;
if (smmu->num_context_irqs <= 0)
--
2.53.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH RFC v2 8/9] iommu/arm-smmu-v3: Add IRQ mapping -EPROBE_DEFER handling
2026-11-30 8:54 [PATCH RFC v2 0/9] ACPI: ARM64: Implement IRQ mapping probe deferral for static table devices Lorenzo Pieralisi
` (6 preceding siblings ...)
2026-11-30 8:54 ` [PATCH RFC v2 7/9] iommu/arm-smmu: Add arm-smmu IRQ mapping -EPROBE_DEFER handling Lorenzo Pieralisi
@ 2026-11-30 8:54 ` Lorenzo Pieralisi
2026-11-30 8:54 ` [PATCH RFC v2 9/9] perf/arm-smmuv3: " Lorenzo Pieralisi
8 siblings, 0 replies; 10+ messages in thread
From: Lorenzo Pieralisi @ 2026-11-30 8:54 UTC (permalink / raw)
To: Rafael J. Wysocki, Mark Rutland, Marc Zyngier, Daniel Lezcano,
Thomas Gleixner, Greg Kroah-Hartman, Danilo Krummrich,
Hanjun Guo, Sudeep Holla, Robin Murphy, Catalin Marinas,
Will Deacon, Bartosz Golaszewski, Andy Shevchenko, Leo Yan
Cc: linux-acpi, linux-kernel, linux-arm-kernel, driver-core,
Lorenzo Pieralisi
With the advent of GICv5, IRQs mapping can fail if the interrupt
controller the wired SMMU interrupts are routed to has not probed
yet when the SMMU driver probes.
Handle -EPROBE_DEFER gracefully for IRQ mappings failures.
Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
---
Cc: Will Deacon <will@kernel.org>
Cc: Robin Murphy <robin.murphy@arm.com>
---
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 43 +++++++++++++++++++----------
1 file changed, 28 insertions(+), 15 deletions(-)
diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index 6d4520c47308..602a31ea3bd1 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -5779,13 +5779,26 @@ static struct arm_smmu_device *arm_smmu_impl_probe(struct arm_smmu_device *smmu)
return ERR_PTR(ret);
}
+static int arm_smmu_get_irq(struct platform_device *pdev, const char *name,
+ int *irq_out)
+{
+ int irq = platform_get_irq_byname_optional(pdev, name);
+
+ if (irq == -EPROBE_DEFER)
+ return dev_err_probe(&pdev->dev, irq, "failed to get %s IRQ\n", name);
+ if (irq > 0)
+ *irq_out = irq;
+
+ return 0;
+}
+
static int arm_smmu_device_probe(struct platform_device *pdev)
{
- int irq, ret;
struct resource *res;
resource_size_t ioaddr;
struct arm_smmu_device *smmu;
struct device *dev = &pdev->dev;
+ int ret;
smmu = devm_kzalloc(dev, sizeof(*smmu), GFP_KERNEL);
if (!smmu)
@@ -5833,22 +5846,22 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
/* Interrupt lines */
- irq = platform_get_irq_byname_optional(pdev, "combined");
- if (irq > 0)
- smmu->combined_irq = irq;
- else {
- irq = platform_get_irq_byname_optional(pdev, "eventq");
- if (irq > 0)
- smmu->evtq.q.irq = irq;
+ ret = arm_smmu_get_irq(pdev, "combined", &smmu->combined_irq);
+ if (ret)
+ return ret;
- irq = platform_get_irq_byname_optional(pdev, "priq");
- if (irq > 0)
- smmu->priq.q.irq = irq;
-
- irq = platform_get_irq_byname_optional(pdev, "gerror");
- if (irq > 0)
- smmu->gerr_irq = irq;
+ if (!smmu->combined_irq) {
+ ret = arm_smmu_get_irq(pdev, "eventq", &smmu->evtq.q.irq);
+ if (ret)
+ return ret;
+ ret = arm_smmu_get_irq(pdev, "priq", &smmu->priq.q.irq);
+ if (ret)
+ return ret;
+ ret = arm_smmu_get_irq(pdev, "gerror", &smmu->gerr_irq);
+ if (ret)
+ return ret;
}
+
/* Probe the h/w */
ret = arm_smmu_device_hw_probe(smmu);
if (ret)
--
2.53.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH RFC v2 9/9] perf/arm-smmuv3: Add IRQ mapping -EPROBE_DEFER handling
2026-11-30 8:54 [PATCH RFC v2 0/9] ACPI: ARM64: Implement IRQ mapping probe deferral for static table devices Lorenzo Pieralisi
` (7 preceding siblings ...)
2026-11-30 8:54 ` [PATCH RFC v2 8/9] iommu/arm-smmu-v3: Add " Lorenzo Pieralisi
@ 2026-11-30 8:54 ` Lorenzo Pieralisi
8 siblings, 0 replies; 10+ messages in thread
From: Lorenzo Pieralisi @ 2026-11-30 8:54 UTC (permalink / raw)
To: Rafael J. Wysocki, Mark Rutland, Marc Zyngier, Daniel Lezcano,
Thomas Gleixner, Greg Kroah-Hartman, Danilo Krummrich,
Hanjun Guo, Sudeep Holla, Robin Murphy, Catalin Marinas,
Will Deacon, Bartosz Golaszewski, Andy Shevchenko, Leo Yan
Cc: linux-acpi, linux-kernel, linux-arm-kernel, driver-core,
Lorenzo Pieralisi
With the advent of GICv5, IRQs mapping can fail if the interrupt
controller the wired SMMU PMCG interrupts are routed to has not probed
yet when the SMMU PMCG driver probes.
Handle -EPROBE_DEFER gracefully for IRQ mappings failures.
Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
---
Cc: Will Deacon <will@kernel.org>
Cc: Robin Murphy <robin.murphy@arm.com>
---
drivers/perf/arm_smmuv3_pmu.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c
index 8ce34e6bb82b..d8d977c13ab9 100644
--- a/drivers/perf/arm_smmuv3_pmu.c
+++ b/drivers/perf/arm_smmuv3_pmu.c
@@ -893,6 +893,9 @@ static int smmu_pmu_probe(struct platform_device *pdev)
}
irq = platform_get_irq_optional(pdev, 0);
+ if (irq == -EPROBE_DEFER)
+ return dev_err_probe(dev, irq, "failed to get PMCG IRQ\n");
+
if (irq > 0)
smmu_pmu->irq = irq;
--
2.53.0
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2026-11-30 8:55 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-30 8:54 [PATCH RFC v2 0/9] ACPI: ARM64: Implement IRQ mapping probe deferral for static table devices Lorenzo Pieralisi
2026-11-30 8:54 ` [PATCH RFC v2 1/9] ACPI: irq: Return -EPROBE_DEFER on missing IRQ domain Lorenzo Pieralisi
2026-11-30 8:54 ` [PATCH RFC v2 2/9] ACPI: Introduce IRQ methods for static fwnodes Lorenzo Pieralisi
2026-11-30 8:54 ` [PATCH RFC v2 3/9] driver core: platform: Add static ACPI nodes IRQ retrieval/mapping code Lorenzo Pieralisi
2026-11-30 8:54 ` [PATCH RFC v2 4/9] clocksource/drivers/arm_arch_timer_mmio: Dispose IRQ mappings on probe failure Lorenzo Pieralisi
2026-11-30 8:54 ` [PATCH RFC v2 5/9] clocksource/drivers/arm_arch_timer_mmio: Implement arch mem timer deferred probe Lorenzo Pieralisi
2026-11-30 8:54 ` [PATCH RFC v2 6/9] ACPI/IORT: Convert IORT devices to use the ACPI static fwnode IRQs Lorenzo Pieralisi
2026-11-30 8:54 ` [PATCH RFC v2 7/9] iommu/arm-smmu: Add arm-smmu IRQ mapping -EPROBE_DEFER handling Lorenzo Pieralisi
2026-11-30 8:54 ` [PATCH RFC v2 8/9] iommu/arm-smmu-v3: Add " Lorenzo Pieralisi
2026-11-30 8:54 ` [PATCH RFC v2 9/9] perf/arm-smmuv3: " Lorenzo Pieralisi
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®