From: Mohit Sharma <mohit.sharma@oss.qualcomm.com>
To: Srinivas Kandagatla <srini@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Mark Brown <broonie@kernel.org>
Cc: Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Konrad Dybcio <konradybcio@kernel.org>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>,
linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org,
Mohit Sharma <mohit.sharma@oss.qualcomm.com>,
stable@vger.kernel.org
Subject: [PATCH 2/2] soc: qcom: apr: Publish GPR callback before client probe
Date: Thu, 22 Oct 2026 20:11:30 +0530 [thread overview]
Message-ID: <20261022144130.2443667-3-mohit.sharma@oss.qualcomm.com> (raw)
In-Reply-To: <20261022144130.2443667-1-mohit.sharma@oss.qualcomm.com>
A GPR service driver can issue synchronous commands from its probe path,
or populate child devices which issue commands before the parent probe
returns. The APR/GPR bus currently installs the GPR service callback only
after the service driver's probe has completed.
If a response arrives while the client probe is still running, GPR finds
the destination service but cannot dispatch the response because the
service callback is NULL. The client waiting for the response eventually
times out.
This was observed intermittently on Qualcomm Lemans and Monaco platforms
when q6apm child probing sent an APM shared-memory map command before the
parent probe returned. The failure has the following signature:
qcom-apm ... CMD timeout for [100100c] opcode
q6apm-dai ... Audio Start: Buffer Allocation failed rc = -110
snd-sc8280xp ... ASoC: can't create pcm MultiMedia1 Playback :-110
Install the GPR callback before invoking the client probe so responses to
probe-time commands can be dispatched. Clear the callback again if probe
fails, and preserve the existing callback ordering for APR clients.
Fixes: ec1471a898cc ("soc: qcom: apr: Add GPR support")
Cc: stable@vger.kernel.org
Co-developed-by: Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com>
Signed-off-by: Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com>
Signed-off-by: Mohit Sharma <mohit.sharma@oss.qualcomm.com>
---
drivers/soc/qcom/apr.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/soc/qcom/apr.c b/drivers/soc/qcom/apr.c
index ea7f83916d8d..829e5c8fdf98 100644
--- a/drivers/soc/qcom/apr.c
+++ b/drivers/soc/qcom/apr.c
@@ -365,13 +365,24 @@ static int apr_device_probe(struct device *dev)
{
struct apr_device *adev = to_apr_device(dev);
struct apr_driver *adrv = to_apr_driver(dev->driver);
+ struct packet_router *apr = dev_get_drvdata(dev->parent);
int ret;
+ if (apr->type == PR_TYPE_GPR)
+ adev->svc.callback = adrv->gpr_callback;
+
ret = adrv->probe(adev);
- if (!ret)
+ if (ret) {
+ if (apr->type == PR_TYPE_GPR)
+ adev->svc.callback = NULL;
+
+ return ret;
+ }
+
+ if (apr->type != PR_TYPE_GPR)
adev->svc.callback = adrv->gpr_callback;
- return ret;
+ return 0;
}
static void apr_device_remove(struct device *dev)
--
2.34.1
prev parent reply other threads:[~2026-10-22 14:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-22 14:41 [PATCH 0/2] Fix GPR callback registration race during probe Mohit Sharma
2026-10-22 14:41 ` [PATCH 1/2] ASoC: qcom: q6apm: Guard callbacks until probe data is ready Mohit Sharma
2026-10-22 14:41 ` Mohit Sharma [this message]
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=20261022144130.2443667-3-mohit.sharma@oss.qualcomm.com \
--to=mohit.sharma@oss.qualcomm.com \
--cc=ajay.nandam@oss.qualcomm.com \
--cc=andersson@kernel.org \
--cc=broonie@kernel.org \
--cc=konradybcio@kernel.org \
--cc=krzysztof.kozlowski@oss.qualcomm.com \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=srini@kernel.org \
--cc=stable@vger.kernel.org \
--cc=tiwai@suse.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®