[PATCH v3 6/8] firmware: smccc: lfa: Register DT interrupt
Andre Przywara
andre.przywara at arm.com
Mon Jul 6 06:44:46 PDT 2026
The Arm Live Firmware Activation spec describes an asynchronous
notification mechanism, where the platform can notify the host OS about
newly pending image updates.
In the absence of the ACPI notification mechanism also a simple
devicetree node can describe an interrupt.
Add code to find the respective DT node and register the specified
interrupt, to trigger the activation if needed.
Signed-off-by: Andre Przywara <andre.przywara at arm.com>
---
drivers/firmware/smccc/lfa_fw.c | 45 +++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/drivers/firmware/smccc/lfa_fw.c b/drivers/firmware/smccc/lfa_fw.c
index ce4f966db475..2a9c2a90b1bb 100644
--- a/drivers/firmware/smccc/lfa_fw.c
+++ b/drivers/firmware/smccc/lfa_fw.c
@@ -16,6 +16,8 @@
#include <linux/list.h>
#include <linux/module.h>
#include <linux/nmi.h>
+#include <linux/of.h>
+#include <linux/of_irq.h>
#include <linux/psci.h>
#include <linux/stop_machine.h>
#include <linux/string.h>
@@ -832,6 +834,43 @@ static void lfa_remove_acpi(struct device *dev)
}
#endif
+static irqreturn_t lfa_irq_handler(int irq, void *dev_id)
+{
+ return IRQ_WAKE_THREAD;
+}
+
+static irqreturn_t lfa_irq_handler_thread(int irq, void *dev_id)
+{
+ int ret;
+
+ while (!(ret = activate_pending_image()))
+ ;
+
+ if (ret != -ENOENT)
+ pr_warn("notified image activation failed: %d\n", ret);
+
+ return IRQ_HANDLED;
+}
+
+static int lfa_register_dt(struct device *dev)
+{
+ struct device_node *np;
+ unsigned int irq;
+
+ np = of_find_compatible_node(NULL, NULL, "arm,lfa");
+ if (!np)
+ return -ENODEV;
+
+ irq = irq_of_parse_and_map(np, 0);
+ of_node_put(np);
+ if (!irq)
+ return -ENODEV;
+
+ return devm_request_threaded_irq(dev, irq, lfa_irq_handler,
+ lfa_irq_handler_thread,
+ IRQF_COND_ONESHOT, NULL, NULL);
+}
+
static int lfa_smccc_probe(struct arm_smccc_device *sdev)
{
struct arm_smccc_1_2_regs reg = { 0 };
@@ -877,6 +916,12 @@ static int lfa_smccc_probe(struct arm_smccc_device *sdev)
}
}
+ err = lfa_register_dt(&sdev->dev);
+ if (!err)
+ pr_info("registered LFA DT notification interrupt\n");
+ if (err != -ENODEV)
+ return err;
+
return 0;
}
--
2.43.0
More information about the linux-arm-kernel
mailing list