The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] soc: qcom: pmic_glink: Avoid losing early rpmsg probe
@ 2026-07-20 14:39 Konrad Dybcio
  2026-07-20 15:02 ` Dmitry Baryshkov
  2026-07-26  3:11 ` Val Packett
  0 siblings, 2 replies; 4+ messages in thread
From: Konrad Dybcio @ 2026-07-20 14:39 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Neil Armstrong
  Cc: linux-arm-msm, linux-kernel, usb4-upstream, Raghavendra Thoorpu,
	Konrad Dybcio

From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

The PMIC GLINK rpmsg device can appear before the platform device has
finished probing. In that case pmic_glink_rpmsg_probe() sees
__pmic_glink as NULL and returns -ENODEV, which is treated as a fatal
probe failure for the rpmsg endpoint.

If this race is hit, pg->ept is never installed and PMIC GLINK clients
never receive the service-up notification. This may leave the system
with no Type-C functionality and without battery/power supply
management.

Return -EPROBE_DEFER when the rpmsg endpoint arrives before the platform
device is ready.

Fixes: 58ef4ece1e41 ("soc: qcom: pmic_glink: Introduce base PMIC GLINK driver")
Assisted-by: Codex:GPT-5.5
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
---
 drivers/soc/qcom/pmic_glink.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/qcom/pmic_glink.c b/drivers/soc/qcom/pmic_glink.c
index 3042261578aa..84fd0c82c0c4 100644
--- a/drivers/soc/qcom/pmic_glink.c
+++ b/drivers/soc/qcom/pmic_glink.c
@@ -250,7 +250,8 @@ static int pmic_glink_rpmsg_probe(struct rpmsg_device *rpdev)
 	guard(mutex)(&__pmic_glink_lock);
 	pg = __pmic_glink;
 	if (!pg)
-		return dev_err_probe(&rpdev->dev, -ENODEV, "no pmic_glink device to attach to\n");
+		return dev_err_probe(&rpdev->dev, -EPROBE_DEFER,
+				     "no pmic_glink device to attach to\n");
 
 	dev_set_drvdata(&rpdev->dev, pg);
 	pg->pdr_available = rpdev->id.driver_data;

---
base-commit: 0718283ab28bc3907e10b61a6b4be6fefa1cbb2f
change-id: 20260720-topic-pmic_glink_defer-34600458ecc7

Best regards,
--  
Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] soc: qcom: pmic_glink: Avoid losing early rpmsg probe
  2026-07-20 14:39 [PATCH] soc: qcom: pmic_glink: Avoid losing early rpmsg probe Konrad Dybcio
@ 2026-07-20 15:02 ` Dmitry Baryshkov
  2026-07-26  3:11 ` Val Packett
  1 sibling, 0 replies; 4+ messages in thread
From: Dmitry Baryshkov @ 2026-07-20 15:02 UTC (permalink / raw)
  To: Konrad Dybcio
  Cc: Bjorn Andersson, Neil Armstrong, linux-arm-msm, linux-kernel,
	usb4-upstream, Raghavendra Thoorpu, Konrad Dybcio

On Mon, Jul 20, 2026 at 04:39:02PM +0200, Konrad Dybcio wrote:
> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> 
> The PMIC GLINK rpmsg device can appear before the platform device has
> finished probing. In that case pmic_glink_rpmsg_probe() sees
> __pmic_glink as NULL and returns -ENODEV, which is treated as a fatal
> probe failure for the rpmsg endpoint.
> 
> If this race is hit, pg->ept is never installed and PMIC GLINK clients
> never receive the service-up notification. This may leave the system
> with no Type-C functionality and without battery/power supply
> management.
> 
> Return -EPROBE_DEFER when the rpmsg endpoint arrives before the platform
> device is ready.
> 
> Fixes: 58ef4ece1e41 ("soc: qcom: pmic_glink: Introduce base PMIC GLINK driver")
> Assisted-by: Codex:GPT-5.5
> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> ---
>  drivers/soc/qcom/pmic_glink.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>


-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] soc: qcom: pmic_glink: Avoid losing early rpmsg probe
  2026-07-20 14:39 [PATCH] soc: qcom: pmic_glink: Avoid losing early rpmsg probe Konrad Dybcio
  2026-07-20 15:02 ` Dmitry Baryshkov
@ 2026-07-26  3:11 ` Val Packett
  2026-07-27  3:08   ` Bjorn Andersson
  1 sibling, 1 reply; 4+ messages in thread
From: Val Packett @ 2026-07-26  3:11 UTC (permalink / raw)
  To: Konrad Dybcio, Bjorn Andersson, Neil Armstrong, Abel Vesa,
	Stephan Gerhold
  Cc: linux-arm-msm, linux-kernel, usb4-upstream, Raghavendra Thoorpu,
	Konrad Dybcio


On 7/20/26 11:39 AM, Konrad Dybcio wrote:
> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>
> The PMIC GLINK rpmsg device can appear before the platform device has
> finished probing. In that case pmic_glink_rpmsg_probe() sees
> __pmic_glink as NULL and returns -ENODEV, which is treated as a fatal
> probe failure for the rpmsg endpoint.
>
> If this race is hit, pg->ept is never installed and PMIC GLINK clients
> never receive the service-up notification. This may leave the system
> with no Type-C functionality and without battery/power supply
> management.
>
> Return -EPROBE_DEFER when the rpmsg endpoint arrives before the platform
> device is ready. [..]

Hm, in the Linaro tree there was this hack patch to accomplish the same 
thing differently:

https://gitlab.com/Linaro/arm64-laptops/linux/-/commit/8c309c7e852a49118ddc2ee54c3d8b7c74466f6a

that claimed that "Returning -EPROBE_DEFER from the rpmsg driver does 
not seem to work because the rpmsg core doesn't handle EPROBE_DEFER(?)"

Was that resolved or was that always wrong?


Thanks,
~val


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] soc: qcom: pmic_glink: Avoid losing early rpmsg probe
  2026-07-26  3:11 ` Val Packett
@ 2026-07-27  3:08   ` Bjorn Andersson
  0 siblings, 0 replies; 4+ messages in thread
From: Bjorn Andersson @ 2026-07-27  3:08 UTC (permalink / raw)
  To: Val Packett
  Cc: Konrad Dybcio, Neil Armstrong, Abel Vesa, Stephan Gerhold,
	linux-arm-msm, linux-kernel, usb4-upstream, Raghavendra Thoorpu,
	Konrad Dybcio

On Sun, Jul 26, 2026 at 12:11:48AM -0300, Val Packett wrote:
> 
> On 7/20/26 11:39 AM, Konrad Dybcio wrote:
> > From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> > 
> > The PMIC GLINK rpmsg device can appear before the platform device has
> > finished probing. In that case pmic_glink_rpmsg_probe() sees
> > __pmic_glink as NULL and returns -ENODEV, which is treated as a fatal
> > probe failure for the rpmsg endpoint.
> > 
> > If this race is hit, pg->ept is never installed and PMIC GLINK clients
> > never receive the service-up notification. This may leave the system
> > with no Type-C functionality and without battery/power supply
> > management.
> > 
> > Return -EPROBE_DEFER when the rpmsg endpoint arrives before the platform
> > device is ready. [..]
> 
> Hm, in the Linaro tree there was this hack patch to accomplish the same
> thing differently:
> 
> https://gitlab.com/Linaro/arm64-laptops/linux/-/commit/8c309c7e852a49118ddc2ee54c3d8b7c74466f6a
> 
> that claimed that "Returning -EPROBE_DEFER from the rpmsg driver does not
> seem to work because the rpmsg core doesn't handle EPROBE_DEFER(?)"
> 
> Was that resolved or was that always wrong?
> 

Returning an error from probe of an rpmsg driver will destroy the
"endpoint", which results in the GLINK channel being closed again. (See
rpmsg_dev_probe())

This is still on the todo list to figure out how to gracefully handle.

Regards,
Bjorn

> 
> Thanks,
> ~val
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-07-27  3:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-20 14:39 [PATCH] soc: qcom: pmic_glink: Avoid losing early rpmsg probe Konrad Dybcio
2026-07-20 15:02 ` Dmitry Baryshkov
2026-07-26  3:11 ` Val Packett
2026-07-27  3:08   ` Bjorn Andersson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox