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 1/4] firmware: smccc: lfa: Stop PRIME retry after completion
Date: Thu, 3 Dec 2026 09:38:14 +0800 [thread overview]
Message-ID: <20261203013817.1215179-2-jiangtianfeng@linux.alibaba.com> (raw)
In-Reply-To: <20261203013817.1215179-1-jiangtianfeng@linux.alibaba.com>
The PRIME retry flag is set after CALL_AGAIN but never cleared. Once
firmware reports completion, the driver can keep issuing PRIME calls
without sleeping or checking the timeout budget.
Return success immediately when CALL_AGAIN is clear, while retaining
the existing timeout, signal and CANCEL paths for incomplete or failed
operations.
Link: https://lore.kernel.org/all/705b63c3-297a-4bf8-9eb2-b826e280e7da@nvidia.com/
Signed-off-by: Jiangtian Feng <jiangtianfeng@linux.alibaba.com>
---
drivers/firmware/smccc/lfa_fw.c | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/drivers/firmware/smccc/lfa_fw.c b/drivers/firmware/smccc/lfa_fw.c
index 3ff368dca949..383157ab7cea 100644
--- a/drivers/firmware/smccc/lfa_fw.c
+++ b/drivers/firmware/smccc/lfa_fw.c
@@ -495,7 +495,6 @@ 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 retry = false;
int ret = 0;
if (comp->may_reset_cpu) {
@@ -509,7 +508,7 @@ static int prime_fw_component(struct fw_component *comp)
* be called again.
* regs.a1 will become 0 once the prime process completes.
*/
- do {
+ for (;;) {
struct arm_smccc_1_2_regs regs = {
.a0 = ARM_SMCCC_LFA_PRIME,
};
@@ -527,21 +526,21 @@ static int prime_fw_component(struct fw_component *comp)
return lfa_to_linux_errno((s64)regs.a0);
}
- if ((regs.a1 & LFA_PRIME_CALL_AGAIN)) {
- if (ktime_before(ktime_get(), end)) {
- if (msleep_interruptible(LFA_PRIME_DELAY_MS)) {
- ret = -EINTR;
- break;
- }
- } else {
- pr_err("LFA_PRIME for component %s timed out",
- kobject_name(&comp->kobj));
- ret = -ETIMEDOUT;
+ if (!(regs.a1 & LFA_PRIME_CALL_AGAIN))
+ return 0;
+
+ if (ktime_before(ktime_get(), end)) {
+ if (msleep_interruptible(LFA_PRIME_DELAY_MS)) {
+ ret = -EINTR;
break;
}
- retry = true;
+ } else {
+ pr_err("LFA_PRIME for component %s timed out\n",
+ kobject_name(&comp->kobj));
+ ret = -ETIMEDOUT;
+ break;
}
- } while (retry);
+ }
if (ret)
lfa_cancel(comp);
--
2.47.3
next prev parent reply other threads:[~2026-12-03 1:38 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 ` Jiangtian Feng [this message]
2026-12-03 5:56 ` [PATCH] firmware: smccc: lfa: Cancel PRIME after a partial failure Jiangtian Feng
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=20261203013817.1215179-2-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®