mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiangtian Feng <jiangtianfeng@linux.alibaba.com>
To: andre.przywara@arm.com
Cc: mark.rutland@arm.com, lpieralisi@kernel.org,
	sudeep.holla@kernel.org, salman.nabi@arm.com,
	vvidwans@nvidia.com, nirmoyd@nvidia.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Jiangtian Feng <jiangtianfeng@linux.alibaba.com>
Subject: [PATCH] firmware: smccc: lfa: Cancel PRIME after a partial failure
Date: Thu,  3 Dec 2026 13:56:54 +0800	[thread overview]
Message-ID: <20261203055654.2456095-1-jiangtianfeng@linux.alibaba.com> (raw)
In-Reply-To: <20261203013817.1215179-2-jiangtianfeng@linux.alibaba.com>

Once PRIME has returned CALL_AGAIN, a later firmware error currently
returns directly and skips the CANCEL used for timeout and interrupt
failures. This can leave a component primed while another transaction
starts.

Track the firmware-requested continuation and route subsequent errors
through the existing cancellation path. Preserve immediate first-call
errors and the existing timeout and interrupt behavior.

Qoder, an AI coding assistant, helped analyze the PRIME transaction
failure path and draft this change and description. The submitter
reviewed the change and is responsible for final validation.

Link: https://lore.kernel.org/all/20261203013817.1215179-2-jiangtianfeng@linux.alibaba.com/
Signed-off-by: Jiangtian Feng <jiangtianfeng@linux.alibaba.com>
---
 drivers/firmware/smccc/lfa_fw.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/smccc/lfa_fw.c b/drivers/firmware/smccc/lfa_fw.c
index 0ddfe7b98f5d..d876262b93cb 100644
--- a/drivers/firmware/smccc/lfa_fw.c
+++ b/drivers/firmware/smccc/lfa_fw.c
@@ -493,6 +493,7 @@ static int activate_fw_component(struct fw_component *comp)
 static int prime_fw_component(struct fw_component *comp)
 {
 	ktime_t end = ktime_add_ms(ktime_get(), LFA_PRIME_BUDGET_MS);
+	bool prime_pending = false;
 	int ret = 0;
 
 	if (comp->may_reset_cpu) {
@@ -521,12 +522,16 @@ static int prime_fw_component(struct fw_component *comp)
 			pr_err("LFA_PRIME for component %s failed: %s (%ld)\n",
 			       kobject_name(&comp->kobj),
 			       lfa_error_string((s64)regs.a0), regs.a0);
-			return lfa_to_linux_errno((s64)regs.a0);
+			ret = lfa_to_linux_errno((s64)regs.a0);
+			if (!prime_pending)
+				return ret;
+			break;
 		}
 
 		if (!(regs.a1 & LFA_PRIME_CALL_AGAIN))
 			return 0;
 
+		prime_pending = true;
 		if (ktime_before(ktime_get(), end)) {
 			if (msleep_interruptible(LFA_PRIME_DELAY_MS)) {
 				ret = -EINTR;
-- 
2.47.3


  reply	other threads:[~2026-12-03  5:57 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02 16:54 [PATCH v5 RESEND 0/6] Arm Live Firmware Activation (LFA) support Andre Przywara
2026-11-02 16:54 ` [PATCH v5 RESEND 1/6] dt-bindings: arm: Add Live Firmware Activation Andre Przywara
2026-11-02 16:54 ` [PATCH v5 RESEND 2/6] firmware: smccc: Add support for Live Firmware Activation (LFA) Andre Przywara
2026-11-04 22:50   ` Vedashree Vidwans
2026-11-02 16:54 ` [PATCH v5 RESEND 3/6] firmware: smccc: lfa: Register ACPI notification Andre Przywara
2026-11-04 20:03   ` Nirmoy Das
2026-11-04 23:02     ` Vedashree Vidwans
2026-11-02 16:54 ` [PATCH v5 RESEND 4/6] firmware: smccc: lfa: Add auto_activate sysfs file Andre Przywara
2026-11-02 16:54 ` [PATCH v5 RESEND 5/6] firmware: smccc: lfa: Register DT interrupt Andre Przywara
2026-11-03  4:20   ` kernel test robot
2026-11-03  7:50   ` kernel test robot
2026-11-03  9:25   ` kernel test robot
2026-11-02 16:54 ` [PATCH v5 RESEND 6/6] firmware: smccc: lfa: add sysfs ABI documentation Andre Przywara
2026-11-05  9:17 ` [PATCH v5 RESEND 0/6] Arm Live Firmware Activation (LFA) support Nirmoy Das
2026-12-03  1:38 ` [PATCH 0/4] firmware: smccc: lfa: Fix deterministic v5 issues Jiangtian Feng
2026-12-03  1:38   ` [PATCH 1/4] firmware: smccc: lfa: Stop PRIME retry after completion Jiangtian Feng
2026-12-03  5:56     ` Jiangtian Feng [this message]
2026-12-03  1:38   ` [PATCH 2/4] firmware: smccc: lfa: Drop nested CPU hotplug read lock Jiangtian Feng
2026-12-03  1:38   ` [PATCH 3/4] firmware: smccc: lfa: Fix probe and notification rollback Jiangtian Feng
2026-12-03  1:38   ` [PATCH 4/4] firmware: smccc: lfa: Close DT IRQ mapping lifetime Jiangtian Feng
2026-12-03  9:34 ` [RFC] firmware: smccc: lfa: Inventory and notification failure recovery Jiangtian Feng

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=20261203055654.2456095-1-jiangtianfeng@linux.alibaba.com \
    --to=jiangtianfeng@linux.alibaba.com \
    --cc=andre.przywara@arm.com \
    --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=salman.nabi@arm.com \
    --cc=sudeep.holla@kernel.org \
    --cc=vvidwans@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

all inboxes | Powered by JetHome®