Devicetree
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@arm.com>
To: Sudeep Holla <sudeep.holla@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Lorenzo Pieralisi <lpieralisi@kernel.org>,
	Salman Nabi <salman.nabi@arm.com>,
	Vedashree Vidwans <vvidwans@nvidia.com>,
	Trilok Soni <trilokkumar.soni@oss.qualcomm.com>,
	Nirmoy Das <nirmoyd@nvidia.com>,
	vsethi@nvidia.com, Varun Wadekar <vwadekar@nvidia.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v4 6/8] firmware: smccc: lfa: Register DT interrupt
Date: Fri, 16 Oct 2026 18:43:46 +0100	[thread overview]
Message-ID: <b5f4bdca-28e8-4b66-853d-7a3dbbbdca07@arm.com> (raw)
In-Reply-To: <20260921-aloof-sympathetic-python-54aa7d@sudeepholla>

Hi,

(sorry, forgot to send the reply earlier, that goes together with the 
ACPI reply)

On 9/21/26 18:09, Sudeep Holla wrote:
> On Fri, Sep 18, 2026 at 04:11:09PM +0200, Andre Przywara wrote:
>> 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@arm.com>
>> ---
>>   drivers/firmware/smccc/lfa_fw.c | 39 +++++++++++++++++++++++++++++++++
>>   1 file changed, 39 insertions(+)
>>
>> diff --git a/drivers/firmware/smccc/lfa_fw.c b/drivers/firmware/smccc/lfa_fw.c
>> index 7a55b4a6785d8..a23df331ffde9 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>
>> @@ -871,6 +873,37 @@ static void lfa_remove_acpi(struct device *dev)
>>   }
>>   #endif
>>   
>> +static irqreturn_t lfa_irq_handler_thread(int irq, void *dev_id)
>> +{
>> +	int ret;
>> +
>> +	while (!(ret = activate_pending_image()))
>> +		;
> 
> Yet again trusting firmware too much!

Yes, same problem as with the ACPI patch, and will be fixed by the same 
new code.
>> +
>> +	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, NULL, lfa_irq_handler_thread,
>> +					 IRQF_COND_ONESHOT, NULL, NULL);
> 
> And where can I find free_irq() ? Yes devm_() can do that for you but how
> does that work with races around removal of device for example. I prefer
> to have free_irq() at the very beginning of lfa_remove().

OK, added that.

> 
>> +}
>> +
>>   static int lfa_smccc_probe(struct arm_smccc_device *sdev)
>>   {
>>   	struct arm_smccc_1_2_regs reg = { 0 };
>> @@ -913,6 +946,12 @@ static int lfa_smccc_probe(struct arm_smccc_device *sdev)
>>   			pr_info("registered LFA ACPI notification\n");
>>   		if (err != -ENODEV)
>>   			return err;
>> +	} else {
>> +		err = lfa_register_dt(&sdev->dev);
>> +		if (!err)
>> +			pr_info("registered LFA DT notification interrupt\n");
>> +		if (err != -ENODEV)
>> +			return err;
> 
> More code addition with absolutely no error handling 🙁.

Right, but fixed now by the same code that fixed the ACPI part.

Cheers,
Andre

> 
> 
>>   	}
>>   
>>   	return 0;
>> -- 
>> 2.43.0
>>
> 


  reply	other threads:[~2026-10-16 17:43 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-18 14:11 [PATCH v4 0/8] Arm Live Firmware Activation (LFA) support Andre Przywara
2026-09-18 14:11 ` [PATCH v4 1/8] dt-bindings: arm: Add Live Firmware Activation Andre Przywara
2026-09-21 15:10   ` Sudeep Holla
2026-09-21 15:41     ` Andre Przywara
2026-09-18 14:11 ` [PATCH v4 2/8] firmware: smccc: Add support for Live Firmware Activation (LFA) Andre Przywara
2026-09-18 15:24   ` Mark Rutland
2026-09-21 15:25     ` Andre Przywara
2026-10-13 14:48       ` Mark Rutland
2026-10-16 17:42         ` Andre Przywara
2026-10-16 18:13           ` Mark Rutland
2026-09-21 15:32   ` Sudeep Holla
2026-09-23 11:46     ` Andre Przywara
2026-09-23 11:58       ` Sudeep Holla
2026-09-18 14:11 ` [PATCH v4 3/8] firmware: smccc: lfa: Add timeout and trigger watchdog Andre Przywara
2026-09-21 15:36   ` Sudeep Holla
2026-10-02 13:57     ` Andre Przywara
2026-09-18 14:11 ` [PATCH v4 4/8] firmware: smccc: lfa: Register ACPI notification Andre Przywara
2026-09-21 16:04   ` Sudeep Holla
2026-10-02 13:37     ` Andre Przywara
2026-09-18 14:11 ` [PATCH v4 5/8] firmware: smccc: lfa: Add auto_activate sysfs file Andre Przywara
2026-09-18 14:11 ` [PATCH v4 6/8] firmware: smccc: lfa: Register DT interrupt Andre Przywara
2026-09-21 16:09   ` Sudeep Holla
2026-10-16 17:43     ` Andre Przywara [this message]
2026-09-18 14:11 ` [PATCH v4 7/8] firmware: smccc: lfa: introduce SMC access lock Andre Przywara
2026-09-18 14:11 ` [PATCH v4 8/8] firmware: smccc: lfa: add sysfs ABI documentation Andre Przywara
2026-09-21 16:19   ` Sudeep Holla
2026-10-16 18:35     ` Andre Przywara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b5f4bdca-28e8-4b66-853d-7a3dbbbdca07@arm.com \
    --to=andre.przywara@arm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=nirmoyd@nvidia.com \
    --cc=robh@kernel.org \
    --cc=salman.nabi@arm.com \
    --cc=sudeep.holla@kernel.org \
    --cc=trilokkumar.soni@oss.qualcomm.com \
    --cc=vsethi@nvidia.com \
    --cc=vvidwans@nvidia.com \
    --cc=vwadekar@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox