Re: [PATCH 2/2] soc: qcom: apr: Publish GPR callback before client probe

From: Shawn Guo

Date: Sat Nov 14 2026 - 10:25:32 EST


On Thu, Oct 22, 2026 at 08:11:30PM +0530, Mohit Sharma wrote:
> 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@xxxxxxxxxxxxxxx
> Co-developed-by: Ajay Kumar Nandam <ajay.nandam@xxxxxxxxxxxxxxxx>
> Signed-off-by: Ajay Kumar Nandam <ajay.nandam@xxxxxxxxxxxxxxxx>
> Signed-off-by: Mohit Sharma <mohit.sharma@xxxxxxxxxxxxxxxx>

Thanks for the patch, Mohit! It fixes a 5s timeout with audio card probe
on Nord platform.

Without the patch:

[ 4.483213] qcom,apr 4c00000.remoteproc:glink-edge.adsp_apps.-1.-1: Adding APR/GPR dev: gprsvc:service:2:1
[ 4.483249] qcom,apr 4c00000.remoteproc:glink-edge.adsp_apps.-1.-1: Adding APR/GPR dev: gprsvc:service:2:2
[ 4.491115] platform 4c00000.remoteproc:glink-edge:fastrpc:compute-cb@3: Adding to iommu group 5
[ 4.492141] platform 4c00000.remoteproc:glink-edge:fastrpc:compute-cb@4: Adding to iommu group 6
[ 4.492727] platform 4c00000.remoteproc:glink-edge:fastrpc:compute-cb@5: Adding to iommu group 7
[ 4.493313] platform 4c00000.remoteproc:glink-edge:fastrpc:compute-cb@6: Adding to iommu group 8
[ 9.623909] qcom-apm gprsvc:service:2:1: CMD timeout for [1001021] opcode
[ 9.624571] platform 4c00000.remoteproc:glink-edge:gpr:service@1:dais: Adding to iommu group 61
[ 9.675293] snd-sc8280xp sound: ASoC: Parent card not yet available, widget card binding deferred
[ 9.678425] ALSA: Control name 'stream0.vol_ctrl0 MultiMedia1 Playback Volume' truncated to 'stream0.vol_ctrl0 MultiMedia1 Playback Volu'

With the patch:

[ 5.243457] qcom,apr 4c00000.remoteproc:glink-edge.adsp_apps.-1.-1: Adding APR/GPR dev: gprsvc:service:2:1
[ 5.243487] qcom,apr 4c00000.remoteproc:glink-edge.adsp_apps.-1.-1: Adding APR/GPR dev: gprsvc:service:2:2
[ 5.259454] platform 4c00000.remoteproc:glink-edge:fastrpc:compute-cb@3: Adding to iommu group 5
[ 5.260433] platform 4c00000.remoteproc:glink-edge:fastrpc:compute-cb@4: Adding to iommu group 6
[ 5.261131] platform 4c00000.remoteproc:glink-edge:fastrpc:compute-cb@5: Adding to iommu group 7
[ 5.261770] platform 4c00000.remoteproc:glink-edge:fastrpc:compute-cb@6: Adding to iommu group 8
[ 5.393166] snd-sc8280xp sound: ASoC: Parent card not yet available, widget card binding deferred
[ 5.395934] ALSA: Control name 'stream0.vol_ctrl0 MultiMedia1 Playback Volume' truncated to 'stream0.vol_ctrl0 MultiMedia1 Playback Volu'

So on Nord platform:

Tested-by: Shawn Guo <shengchao.guo@xxxxxxxxxxxxxxxx>

> ---
> 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)

I wonder whether it's really necessary to have this GPR condition guard.
How would it possibly cause problem for APR?

The code will be much cleaner without the GPR guard.

Shawn

> + 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
>