mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] soc: qcom: rpmh: Preserve the first error from flush_batch()
@ 2026-12-05 14:42 Lee Youngjoon
  0 siblings, 0 replies; only message in thread
From: Lee Youngjoon @ 2026-12-05 14:42 UTC (permalink / raw)
  To: Konrad Dybcio; +Cc: linux-arm-msm, linux-kernel

A failed sleep or wake TCS write skips the rest of its cached batch.
If a later batch succeeds, flush_batch() can return success. Once the
individual cached requests also succeed, rpmh_flush() marks the cache
clean even though some batch commands were never programmed. The next
flush then skips those commands until the cache changes.

Keep the first write error and return it after walking the batch list.
Continue to try subsequent independent batches. A partial flush then
leaves the cache dirty so the next flush programs the cached requests
again.

Fixes: c8790cb6da58 ("drivers: qcom: rpmh: add support for batch RPMH request")
Signed-off-by: Lee Youngjoon <getfeus@gmail.com>
---
Changes in v2:
- Keep processing later cached batches after a write error, as Konrad
  pointed out that they can target independent endpoints.
- Test the next rpmh_flush() with the failing batch first and last.

Link to v1: https://lore.kernel.org/r/CA+m4KrAaEbbZywwCq38BqvTuh9dn2+23br6N3FYxB-mix_+R6g@mail.gmail.com
Review: https://lore.kernel.org/r/7807a6d3-1bdf-4a5d-9f55-3a8c2f107aca@oss.qualcomm.com

OpenAI Codex assisted with the change, commit message and host tests.

 drivers/soc/qcom/rpmh.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/soc/qcom/rpmh.c b/drivers/soc/qcom/rpmh.c
index 360242a31..a449dcb74 100644
--- a/drivers/soc/qcom/rpmh.c
+++ b/drivers/soc/qcom/rpmh.c
@@ -338,7 +338,8 @@ static int flush_batch(struct rpmh_ctrlr *ctrlr)
 {
 	struct batch_cache_req *req;
 	const struct rpmh_request *rpm_msg;
-	int ret = 0;
+	int first_error = 0;
+	int ret;
 	int i;
 
 	/* Send Sleep/Wake requests to the controller, expect no response */
@@ -347,12 +348,15 @@ static int flush_batch(struct rpmh_ctrlr *ctrlr)
 			rpm_msg = req->rpm_msgs + i;
 			ret = rpmh_rsc_write_ctrl_data(ctrlr_to_drv(ctrlr),
 						       &rpm_msg->msg);
-			if (ret)
+			if (ret) {
+				if (!first_error)
+					first_error = ret;
 				break;
+			}
 		}
 	}
 
-	return ret;
+	return first_error;
 }
 
 /**

base-commit: 1e5bbf63105d0b367efc6df0bf87c7fde0f91995

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-05 14:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-05 14:42 [PATCH v2] soc: qcom: rpmh: Preserve the first error from flush_batch() Lee Youngjoon

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®