* [PATCH 3/6] soc: qcom: pmic_glink_altmode: fix drm bridge use-after-free
[not found] <20240217150228.5788-1-johan+linaro@kernel.org>
@ 2024-02-17 15:02 ` Johan Hovold
2024-02-20 8:25 ` Markus Elfring
` (3 more replies)
2024-02-17 15:02 ` [PATCH 4/6] soc: qcom: pmic_glink: Fix boot when QRTR=m Johan Hovold
` (2 subsequent siblings)
3 siblings, 4 replies; 20+ messages in thread
From: Johan Hovold @ 2024-02-17 15:02 UTC (permalink / raw)
To: Bjorn Andersson, Andrzej Hajda, Neil Armstrong, Robert Foss,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Daniel Vetter, Vinod Koul
Cc: Jonas Karlman, Laurent Pinchart, Jernej Skrabec, Konrad Dybcio,
Kishon Vijay Abraham I, Dmitry Baryshkov, Rob Clark,
Abhinav Kumar, Kuogee Hsieh, freedreno, dri-devel, linux-kernel,
linux-arm-msm, linux-phy, Johan Hovold, stable
A recent DRM series purporting to simplify support for "transparent
bridges" and handling of probe deferrals ironically exposed a
use-after-free issue on pmic_glink_altmode probe deferral.
This has manifested itself as the display subsystem occasionally failing
to initialise and NULL-pointer dereferences during boot of machines like
the Lenovo ThinkPad X13s.
Specifically, the dp-hpd bridge is currently registered before all
resources have been acquired which means that it can also be
deregistered on probe deferrals.
In the meantime there is a race window where the new aux bridge driver
(or PHY driver previously) may have looked up the dp-hpd bridge and
stored a (non-reference-counted) pointer to the bridge which is about to
be deallocated.
When the display controller is later initialised, this triggers a
use-after-free when attaching the bridges:
dp -> aux -> dp-hpd (freed)
which may, for example, result in the freed bridge failing to attach:
[drm:drm_bridge_attach [drm]] *ERROR* failed to attach bridge /soc@0/phy@88eb000 to encoder TMDS-31: -16
or a NULL-pointer dereference:
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
...
Call trace:
drm_bridge_attach+0x70/0x1a8 [drm]
drm_aux_bridge_attach+0x24/0x38 [aux_bridge]
drm_bridge_attach+0x80/0x1a8 [drm]
dp_bridge_init+0xa8/0x15c [msm]
msm_dp_modeset_init+0x28/0xc4 [msm]
The DRM bridge implementation is clearly fragile and implicitly built on
the assumption that bridges may never go away. In this case, the fix is
to move the bridge registration in the pmic_glink_altmode driver to
after all resources have been looked up.
Incidentally, with the new dp-hpd bridge implementation, which registers
child devices, this is also a requirement due to a long-standing issue
in driver core that can otherwise lead to a probe deferral loop (see
fbc35b45f9f6 ("Add documentation on meaning of -EPROBE_DEFER")).
Fixes: 080b4e24852b ("soc: qcom: pmic_glink: Introduce altmode support")
Fixes: 2bcca96abfbf ("soc: qcom: pmic-glink: switch to DRM_AUX_HPD_BRIDGE")
Cc: stable@vger.kernel.org # 6.3
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/soc/qcom/pmic_glink_altmode.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/soc/qcom/pmic_glink_altmode.c b/drivers/soc/qcom/pmic_glink_altmode.c
index 5fcd0fdd2faa..b3808fc24c69 100644
--- a/drivers/soc/qcom/pmic_glink_altmode.c
+++ b/drivers/soc/qcom/pmic_glink_altmode.c
@@ -76,7 +76,7 @@ struct pmic_glink_altmode_port {
struct work_struct work;
- struct device *bridge;
+ struct auxiliary_device *bridge;
enum typec_orientation orientation;
u16 svid;
@@ -230,7 +230,7 @@ static void pmic_glink_altmode_worker(struct work_struct *work)
else
pmic_glink_altmode_enable_usb(altmode, alt_port);
- drm_aux_hpd_bridge_notify(alt_port->bridge,
+ drm_aux_hpd_bridge_notify(&alt_port->bridge->dev,
alt_port->hpd_state ?
connector_status_connected :
connector_status_disconnected);
@@ -454,7 +454,7 @@ static int pmic_glink_altmode_probe(struct auxiliary_device *adev,
alt_port->index = port;
INIT_WORK(&alt_port->work, pmic_glink_altmode_worker);
- alt_port->bridge = drm_dp_hpd_bridge_register(dev, to_of_node(fwnode));
+ alt_port->bridge = devm_drm_dp_hpd_bridge_alloc(dev, to_of_node(fwnode));
if (IS_ERR(alt_port->bridge)) {
fwnode_handle_put(fwnode);
return PTR_ERR(alt_port->bridge);
@@ -510,6 +510,16 @@ static int pmic_glink_altmode_probe(struct auxiliary_device *adev,
}
}
+ for (port = 0; port < ARRAY_SIZE(altmode->ports); port++) {
+ alt_port = &altmode->ports[port];
+ if (!alt_port->bridge)
+ continue;
+
+ ret = devm_drm_dp_hpd_bridge_add(dev, alt_port->bridge);
+ if (ret)
+ return ret;
+ }
+
altmode->client = devm_pmic_glink_register_client(dev,
altmode->owner_id,
pmic_glink_altmode_callback,
--
2.43.0
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH 3/6] soc: qcom: pmic_glink_altmode: fix drm bridge use-after-free
2024-02-17 15:02 ` [PATCH 3/6] soc: qcom: pmic_glink_altmode: fix drm bridge use-after-free Johan Hovold
@ 2024-02-20 8:25 ` Markus Elfring
2024-02-20 10:55 ` Markus Elfring
` (2 subsequent siblings)
3 siblings, 0 replies; 20+ messages in thread
From: Markus Elfring @ 2024-02-20 8:25 UTC (permalink / raw)
To: Johan Hovold, freedreno, dri-devel, linux-phy, linux-arm-msm,
kernel-janitors, Andrzej Hajda, Bjorn Andersson, Daniel Vetter,
David Airlie, Maarten Lankhorst, Maxime Ripard, Neil Armstrong,
Robert Foss, Thomas Zimmermann, Vinod Koul
Cc: LKML, Abhinav Kumar, Dmitry Baryshkov, Jernej Skrabec,
Jonas Karlman, Kishon Vijay Abraham I, Konrad Dybcio,
Kuogee Hsieh, Laurent Pinchart, Rob Clark, stable
…
> Specifically, the dp-hpd bridge is currently registered before all
> resources have been acquired which means that it can also be
> deregistered on probe deferrals.
>
> In the meantime there is a race window where the new aux bridge driver
> (or PHY driver previously) may have looked up the dp-hpd bridge and
> stored a (non-reference-counted) pointer to the bridge which is about to
> be deallocated.
…
I got the impression that the change description can be improved another bit.
1. Will any additional imperative wordings become helpful?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.8-rc5#n94
…
> +++ b/drivers/soc/qcom/pmic_glink_altmode.c
> @@ -76,7 +76,7 @@ struct pmic_glink_altmode_port {
>
> struct work_struct work;
>
> - struct device *bridge;
> + struct auxiliary_device *bridge;
>
> enum typec_orientation orientation;
> u16 svid;
…
2. How do you think about to stress such a data type adjustment?
Regards,
Markus
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 3/6] soc: qcom: pmic_glink_altmode: fix drm bridge use-after-free
2024-02-17 15:02 ` [PATCH 3/6] soc: qcom: pmic_glink_altmode: fix drm bridge use-after-free Johan Hovold
2024-02-20 8:25 ` Markus Elfring
@ 2024-02-20 10:55 ` Markus Elfring
2024-02-20 11:26 ` Johan Hovold
2024-02-22 2:11 ` [PATCH 3/6] " Bjorn Andersson
2024-02-22 21:10 ` Dmitry Baryshkov
3 siblings, 1 reply; 20+ messages in thread
From: Markus Elfring @ 2024-02-20 10:55 UTC (permalink / raw)
To: Johan Hovold, freedreno, dri-devel, linux-phy, linux-arm-msm,
kernel-janitors, Andrzej Hajda, Bjorn Andersson, Daniel Vetter,
David Airlie, Maarten Lankhorst, Maxime Ripard, Neil Armstrong,
Robert Foss, Thomas Zimmermann, Vinod Koul
Cc: LKML, Abhinav Kumar, Dmitry Baryshkov, Jernej Skrabec,
Jonas Karlman, Kishon Vijay Abraham I, Konrad Dybcio,
Kuogee Hsieh, Laurent Pinchart, Rob Clark, stable
…
> Specifically, the dp-hpd bridge is currently registered before all
> resources have been acquired which means that it can also be
> deregistered on probe deferrals.
>
> In the meantime there is a race window where the new aux bridge driver
> (or PHY driver previously) may have looked up the dp-hpd bridge and
> stored a (non-reference-counted) pointer to the bridge which is about to
> be deallocated.
…
> +++ b/drivers/soc/qcom/pmic_glink_altmode.c
…
> @@ -454,7 +454,7 @@ static int pmic_glink_altmode_probe(struct auxiliary_device *adev,
> alt_port->index = port;
> INIT_WORK(&alt_port->work, pmic_glink_altmode_worker);
>
> - alt_port->bridge = drm_dp_hpd_bridge_register(dev, to_of_node(fwnode));
> + alt_port->bridge = devm_drm_dp_hpd_bridge_alloc(dev, to_of_node(fwnode));
> if (IS_ERR(alt_port->bridge)) {
> fwnode_handle_put(fwnode);
> return PTR_ERR(alt_port->bridge);
…
The function call “fwnode_handle_put(fwnode)” is used in multiple if branches.
https://elixir.bootlin.com/linux/v6.8-rc5/source/drivers/soc/qcom/pmic_glink_altmode.c#L435
I suggest to add a jump target so that a bit of exception handling
can be better reused at the end of this function implementation.
Regards,
Markus
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 3/6] soc: qcom: pmic_glink_altmode: fix drm bridge use-after-free
2024-02-20 10:55 ` Markus Elfring
@ 2024-02-20 11:26 ` Johan Hovold
2024-02-20 12:40 ` [3/6] " Markus Elfring
0 siblings, 1 reply; 20+ messages in thread
From: Johan Hovold @ 2024-02-20 11:26 UTC (permalink / raw)
To: Markus Elfring
Cc: Johan Hovold, freedreno, dri-devel, linux-phy, linux-arm-msm,
kernel-janitors, Andrzej Hajda, Bjorn Andersson, Daniel Vetter,
David Airlie, Maarten Lankhorst, Maxime Ripard, Neil Armstrong,
Robert Foss, Thomas Zimmermann, Vinod Koul, LKML, Abhinav Kumar,
Dmitry Baryshkov, Jernej Skrabec, Jonas Karlman,
Kishon Vijay Abraham I, Konrad Dybcio, Kuogee Hsieh,
Laurent Pinchart, Rob Clark, stable
On Tue, Feb 20, 2024 at 11:55:57AM +0100, Markus Elfring wrote:
> …
> > Specifically, the dp-hpd bridge is currently registered before all
> > resources have been acquired which means that it can also be
> > deregistered on probe deferrals.
> >
> > In the meantime there is a race window where the new aux bridge driver
> > (or PHY driver previously) may have looked up the dp-hpd bridge and
> > stored a (non-reference-counted) pointer to the bridge which is about to
> > be deallocated.
> …
> > +++ b/drivers/soc/qcom/pmic_glink_altmode.c
> …
> > @@ -454,7 +454,7 @@ static int pmic_glink_altmode_probe(struct auxiliary_device *adev,
> > alt_port->index = port;
> > INIT_WORK(&alt_port->work, pmic_glink_altmode_worker);
> >
> > - alt_port->bridge = drm_dp_hpd_bridge_register(dev, to_of_node(fwnode));
> > + alt_port->bridge = devm_drm_dp_hpd_bridge_alloc(dev, to_of_node(fwnode));
> > if (IS_ERR(alt_port->bridge)) {
> > fwnode_handle_put(fwnode);
> > return PTR_ERR(alt_port->bridge);
> …
>
> The function call “fwnode_handle_put(fwnode)” is used in multiple if branches.
> https://elixir.bootlin.com/linux/v6.8-rc5/source/drivers/soc/qcom/pmic_glink_altmode.c#L435
>
> I suggest to add a jump target so that a bit of exception handling
> can be better reused at the end of this function implementation.
Markus, as people have told you repeatedly, just stop with these
comments. You're not helping, in fact, you are actively harmful to the
kernel community as you are wasting people's time.
Johan
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [3/6] soc: qcom: pmic_glink_altmode: fix drm bridge use-after-free
2024-02-20 11:26 ` Johan Hovold
@ 2024-02-20 12:40 ` Markus Elfring
0 siblings, 0 replies; 20+ messages in thread
From: Markus Elfring @ 2024-02-20 12:40 UTC (permalink / raw)
To: Johan Hovold, freedreno, dri-devel, linux-phy, linux-arm-msm,
kernel-janitors
Cc: Johan Hovold, Andrzej Hajda, Bjorn Andersson, Daniel Vetter,
David Airlie, Maarten Lankhorst, Maxime Ripard, Neil Armstrong,
Robert Foss, Thomas Zimmermann, Vinod Koul, LKML, Abhinav Kumar,
Dmitry Baryshkov, Jernej Skrabec, Jonas Karlman,
Kishon Vijay Abraham I, Konrad Dybcio, Kuogee Hsieh,
Laurent Pinchart, Rob Clark, stable
>> The function call “fwnode_handle_put(fwnode)” is used in multiple if branches.
>> https://elixir.bootlin.com/linux/v6.8-rc5/source/drivers/soc/qcom/pmic_glink_altmode.c#L435
>>
>> I suggest to add a jump target so that a bit of exception handling
>> can be better reused at the end of this function implementation.
>
> Markus, as people have told you repeatedly, just stop with these comments.
How does such a response fit to advices from another known information sources?
Section “7) Centralized exiting of functions”
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v6.8-rc5#n526
> You're not helping, in fact, you are actively harmful to the
> kernel community as you are wasting people's time.
The proposed source code transformation can eventually be (automatically) achieved
also with help of improved development tools.
Regards,
Markus
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 3/6] soc: qcom: pmic_glink_altmode: fix drm bridge use-after-free
2024-02-17 15:02 ` [PATCH 3/6] soc: qcom: pmic_glink_altmode: fix drm bridge use-after-free Johan Hovold
2024-02-20 8:25 ` Markus Elfring
2024-02-20 10:55 ` Markus Elfring
@ 2024-02-22 2:11 ` Bjorn Andersson
2024-02-22 21:10 ` Dmitry Baryshkov
3 siblings, 0 replies; 20+ messages in thread
From: Bjorn Andersson @ 2024-02-22 2:11 UTC (permalink / raw)
To: Johan Hovold
Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Daniel Vetter,
Vinod Koul, Jonas Karlman, Laurent Pinchart, Jernej Skrabec,
Konrad Dybcio, Kishon Vijay Abraham I, Dmitry Baryshkov,
Rob Clark, Abhinav Kumar, Kuogee Hsieh, freedreno, dri-devel,
linux-kernel, linux-arm-msm, linux-phy, stable
On Sat, Feb 17, 2024 at 04:02:25PM +0100, Johan Hovold wrote:
> A recent DRM series purporting to simplify support for "transparent
> bridges" and handling of probe deferrals ironically exposed a
> use-after-free issue on pmic_glink_altmode probe deferral.
>
> This has manifested itself as the display subsystem occasionally failing
> to initialise and NULL-pointer dereferences during boot of machines like
> the Lenovo ThinkPad X13s.
>
> Specifically, the dp-hpd bridge is currently registered before all
> resources have been acquired which means that it can also be
> deregistered on probe deferrals.
>
> In the meantime there is a race window where the new aux bridge driver
> (or PHY driver previously) may have looked up the dp-hpd bridge and
> stored a (non-reference-counted) pointer to the bridge which is about to
> be deallocated.
>
> When the display controller is later initialised, this triggers a
> use-after-free when attaching the bridges:
>
> dp -> aux -> dp-hpd (freed)
>
> which may, for example, result in the freed bridge failing to attach:
>
> [drm:drm_bridge_attach [drm]] *ERROR* failed to attach bridge /soc@0/phy@88eb000 to encoder TMDS-31: -16
>
> or a NULL-pointer dereference:
>
> Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
> ...
> Call trace:
> drm_bridge_attach+0x70/0x1a8 [drm]
> drm_aux_bridge_attach+0x24/0x38 [aux_bridge]
> drm_bridge_attach+0x80/0x1a8 [drm]
> dp_bridge_init+0xa8/0x15c [msm]
> msm_dp_modeset_init+0x28/0xc4 [msm]
>
> The DRM bridge implementation is clearly fragile and implicitly built on
> the assumption that bridges may never go away. In this case, the fix is
> to move the bridge registration in the pmic_glink_altmode driver to
> after all resources have been looked up.
>
> Incidentally, with the new dp-hpd bridge implementation, which registers
> child devices, this is also a requirement due to a long-standing issue
> in driver core that can otherwise lead to a probe deferral loop (see
> fbc35b45f9f6 ("Add documentation on meaning of -EPROBE_DEFER")).
>
> Fixes: 080b4e24852b ("soc: qcom: pmic_glink: Introduce altmode support")
> Fixes: 2bcca96abfbf ("soc: qcom: pmic-glink: switch to DRM_AUX_HPD_BRIDGE")
> Cc: stable@vger.kernel.org # 6.3
> Cc: Bjorn Andersson <andersson@kernel.org>
> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Reviewed-by: Bjorn Andersson <andersson@kernel.org>
Regards,
Bjorn
> ---
> drivers/soc/qcom/pmic_glink_altmode.c | 16 +++++++++++++---
> 1 file changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/soc/qcom/pmic_glink_altmode.c b/drivers/soc/qcom/pmic_glink_altmode.c
> index 5fcd0fdd2faa..b3808fc24c69 100644
> --- a/drivers/soc/qcom/pmic_glink_altmode.c
> +++ b/drivers/soc/qcom/pmic_glink_altmode.c
> @@ -76,7 +76,7 @@ struct pmic_glink_altmode_port {
>
> struct work_struct work;
>
> - struct device *bridge;
> + struct auxiliary_device *bridge;
>
> enum typec_orientation orientation;
> u16 svid;
> @@ -230,7 +230,7 @@ static void pmic_glink_altmode_worker(struct work_struct *work)
> else
> pmic_glink_altmode_enable_usb(altmode, alt_port);
>
> - drm_aux_hpd_bridge_notify(alt_port->bridge,
> + drm_aux_hpd_bridge_notify(&alt_port->bridge->dev,
> alt_port->hpd_state ?
> connector_status_connected :
> connector_status_disconnected);
> @@ -454,7 +454,7 @@ static int pmic_glink_altmode_probe(struct auxiliary_device *adev,
> alt_port->index = port;
> INIT_WORK(&alt_port->work, pmic_glink_altmode_worker);
>
> - alt_port->bridge = drm_dp_hpd_bridge_register(dev, to_of_node(fwnode));
> + alt_port->bridge = devm_drm_dp_hpd_bridge_alloc(dev, to_of_node(fwnode));
> if (IS_ERR(alt_port->bridge)) {
> fwnode_handle_put(fwnode);
> return PTR_ERR(alt_port->bridge);
> @@ -510,6 +510,16 @@ static int pmic_glink_altmode_probe(struct auxiliary_device *adev,
> }
> }
>
> + for (port = 0; port < ARRAY_SIZE(altmode->ports); port++) {
> + alt_port = &altmode->ports[port];
> + if (!alt_port->bridge)
> + continue;
> +
> + ret = devm_drm_dp_hpd_bridge_add(dev, alt_port->bridge);
> + if (ret)
> + return ret;
> + }
> +
> altmode->client = devm_pmic_glink_register_client(dev,
> altmode->owner_id,
> pmic_glink_altmode_callback,
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 3/6] soc: qcom: pmic_glink_altmode: fix drm bridge use-after-free
2024-02-17 15:02 ` [PATCH 3/6] soc: qcom: pmic_glink_altmode: fix drm bridge use-after-free Johan Hovold
` (2 preceding siblings ...)
2024-02-22 2:11 ` [PATCH 3/6] " Bjorn Andersson
@ 2024-02-22 21:10 ` Dmitry Baryshkov
3 siblings, 0 replies; 20+ messages in thread
From: Dmitry Baryshkov @ 2024-02-22 21:10 UTC (permalink / raw)
To: Johan Hovold
Cc: Bjorn Andersson, Andrzej Hajda, Neil Armstrong, Robert Foss,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Daniel Vetter, Vinod Koul, Jonas Karlman, Laurent Pinchart,
Jernej Skrabec, Konrad Dybcio, Kishon Vijay Abraham I, Rob Clark,
Abhinav Kumar, Kuogee Hsieh, freedreno, dri-devel, linux-kernel,
linux-arm-msm, linux-phy, stable
On Sat, 17 Feb 2024 at 17:03, Johan Hovold <johan+linaro@kernel.org> wrote:
>
> A recent DRM series purporting to simplify support for "transparent
> bridges" and handling of probe deferrals ironically exposed a
> use-after-free issue on pmic_glink_altmode probe deferral.
>
> This has manifested itself as the display subsystem occasionally failing
> to initialise and NULL-pointer dereferences during boot of machines like
> the Lenovo ThinkPad X13s.
>
> Specifically, the dp-hpd bridge is currently registered before all
> resources have been acquired which means that it can also be
> deregistered on probe deferrals.
>
> In the meantime there is a race window where the new aux bridge driver
> (or PHY driver previously) may have looked up the dp-hpd bridge and
> stored a (non-reference-counted) pointer to the bridge which is about to
> be deallocated.
>
> When the display controller is later initialised, this triggers a
> use-after-free when attaching the bridges:
>
> dp -> aux -> dp-hpd (freed)
>
> which may, for example, result in the freed bridge failing to attach:
>
> [drm:drm_bridge_attach [drm]] *ERROR* failed to attach bridge /soc@0/phy@88eb000 to encoder TMDS-31: -16
>
> or a NULL-pointer dereference:
>
> Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
> ...
> Call trace:
> drm_bridge_attach+0x70/0x1a8 [drm]
> drm_aux_bridge_attach+0x24/0x38 [aux_bridge]
> drm_bridge_attach+0x80/0x1a8 [drm]
> dp_bridge_init+0xa8/0x15c [msm]
> msm_dp_modeset_init+0x28/0xc4 [msm]
>
> The DRM bridge implementation is clearly fragile and implicitly built on
> the assumption that bridges may never go away. In this case, the fix is
> to move the bridge registration in the pmic_glink_altmode driver to
> after all resources have been looked up.
>
> Incidentally, with the new dp-hpd bridge implementation, which registers
> child devices, this is also a requirement due to a long-standing issue
> in driver core that can otherwise lead to a probe deferral loop (see
> fbc35b45f9f6 ("Add documentation on meaning of -EPROBE_DEFER")).
>
> Fixes: 080b4e24852b ("soc: qcom: pmic_glink: Introduce altmode support")
> Fixes: 2bcca96abfbf ("soc: qcom: pmic-glink: switch to DRM_AUX_HPD_BRIDGE")
> Cc: stable@vger.kernel.org # 6.3
> Cc: Bjorn Andersson <andersson@kernel.org>
> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> ---
> drivers/soc/qcom/pmic_glink_altmode.c | 16 +++++++++++++---
> 1 file changed, 13 insertions(+), 3 deletions(-)
>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 4/6] soc: qcom: pmic_glink: Fix boot when QRTR=m
[not found] <20240217150228.5788-1-johan+linaro@kernel.org>
2024-02-17 15:02 ` [PATCH 3/6] soc: qcom: pmic_glink_altmode: fix drm bridge use-after-free Johan Hovold
@ 2024-02-17 15:02 ` Johan Hovold
2024-02-22 2:18 ` Bjorn Andersson
` (2 more replies)
2024-02-17 15:02 ` [PATCH 5/6] phy: qcom-qmp-combo: fix drm bridge registration Johan Hovold
2024-02-17 15:02 ` [PATCH 6/6] phy: qcom-qmp-combo: fix type-c switch registration Johan Hovold
3 siblings, 3 replies; 20+ messages in thread
From: Johan Hovold @ 2024-02-17 15:02 UTC (permalink / raw)
To: Bjorn Andersson, Andrzej Hajda, Neil Armstrong, Robert Foss,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Daniel Vetter, Vinod Koul
Cc: Jonas Karlman, Laurent Pinchart, Jernej Skrabec, Konrad Dybcio,
Kishon Vijay Abraham I, Dmitry Baryshkov, Rob Clark,
Abhinav Kumar, Kuogee Hsieh, freedreno, dri-devel, linux-kernel,
linux-arm-msm, linux-phy, Rob Clark, stable, Johan Hovold
From: Rob Clark <robdclark@chromium.org>
We need to bail out before adding/removing devices if we are going to
-EPROBE_DEFER. Otherwise boot can get stuck in a probe deferral loop due
to a long-standing issue in driver core (see fbc35b45f9f6 ("Add
documentation on meaning of -EPROBE_DEFER")).
Deregistering the altmode child device can potentially also trigger bugs
in the DRM bridge implementation, which does not expect bridges to go
away.
Suggested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Rob Clark <robdclark@chromium.org>
Link: https://lore.kernel.org/r/20231213210644.8702-1-robdclark@gmail.com
[ johan: rebase on 6.8-rc4, amend commit message and mention DRM ]
Fixes: 58ef4ece1e41 ("soc: qcom: pmic_glink: Introduce base PMIC GLINK driver")
Cc: stable@vger.kernel.org # 6.3
Cc: Bjorn Andersson <andersson@kernel.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/soc/qcom/pmic_glink.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/drivers/soc/qcom/pmic_glink.c b/drivers/soc/qcom/pmic_glink.c
index f4bfd24386f1..f913e9bd57ed 100644
--- a/drivers/soc/qcom/pmic_glink.c
+++ b/drivers/soc/qcom/pmic_glink.c
@@ -265,10 +265,17 @@ static int pmic_glink_probe(struct platform_device *pdev)
pg->client_mask = *match_data;
+ pg->pdr = pdr_handle_alloc(pmic_glink_pdr_callback, pg);
+ if (IS_ERR(pg->pdr)) {
+ ret = dev_err_probe(&pdev->dev, PTR_ERR(pg->pdr),
+ "failed to initialize pdr\n");
+ return ret;
+ }
+
if (pg->client_mask & BIT(PMIC_GLINK_CLIENT_UCSI)) {
ret = pmic_glink_add_aux_device(pg, &pg->ucsi_aux, "ucsi");
if (ret)
- return ret;
+ goto out_release_pdr_handle;
}
if (pg->client_mask & BIT(PMIC_GLINK_CLIENT_ALTMODE)) {
ret = pmic_glink_add_aux_device(pg, &pg->altmode_aux, "altmode");
@@ -281,17 +288,11 @@ static int pmic_glink_probe(struct platform_device *pdev)
goto out_release_altmode_aux;
}
- pg->pdr = pdr_handle_alloc(pmic_glink_pdr_callback, pg);
- if (IS_ERR(pg->pdr)) {
- ret = dev_err_probe(&pdev->dev, PTR_ERR(pg->pdr), "failed to initialize pdr\n");
- goto out_release_aux_devices;
- }
-
service = pdr_add_lookup(pg->pdr, "tms/servreg", "msm/adsp/charger_pd");
if (IS_ERR(service)) {
ret = dev_err_probe(&pdev->dev, PTR_ERR(service),
"failed adding pdr lookup for charger_pd\n");
- goto out_release_pdr_handle;
+ goto out_release_aux_devices;
}
mutex_lock(&__pmic_glink_lock);
@@ -300,8 +301,6 @@ static int pmic_glink_probe(struct platform_device *pdev)
return 0;
-out_release_pdr_handle:
- pdr_handle_release(pg->pdr);
out_release_aux_devices:
if (pg->client_mask & BIT(PMIC_GLINK_CLIENT_BATT))
pmic_glink_del_aux_device(pg, &pg->ps_aux);
@@ -311,6 +310,8 @@ static int pmic_glink_probe(struct platform_device *pdev)
out_release_ucsi_aux:
if (pg->client_mask & BIT(PMIC_GLINK_CLIENT_UCSI))
pmic_glink_del_aux_device(pg, &pg->ucsi_aux);
+out_release_pdr_handle:
+ pdr_handle_release(pg->pdr);
return ret;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH 4/6] soc: qcom: pmic_glink: Fix boot when QRTR=m
2024-02-17 15:02 ` [PATCH 4/6] soc: qcom: pmic_glink: Fix boot when QRTR=m Johan Hovold
@ 2024-02-22 2:18 ` Bjorn Andersson
2024-02-22 21:10 ` Dmitry Baryshkov
2024-02-23 11:04 ` Neil Armstrong
2 siblings, 0 replies; 20+ messages in thread
From: Bjorn Andersson @ 2024-02-22 2:18 UTC (permalink / raw)
To: Johan Hovold
Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Daniel Vetter,
Vinod Koul, Jonas Karlman, Laurent Pinchart, Jernej Skrabec,
Konrad Dybcio, Kishon Vijay Abraham I, Dmitry Baryshkov,
Rob Clark, Abhinav Kumar, Kuogee Hsieh, freedreno, dri-devel,
linux-kernel, linux-arm-msm, linux-phy, Rob Clark, stable
On Sat, Feb 17, 2024 at 04:02:26PM +0100, Johan Hovold wrote:
> From: Rob Clark <robdclark@chromium.org>
>
> We need to bail out before adding/removing devices if we are going to
> -EPROBE_DEFER. Otherwise boot can get stuck in a probe deferral loop due
> to a long-standing issue in driver core (see fbc35b45f9f6 ("Add
> documentation on meaning of -EPROBE_DEFER")).
>
> Deregistering the altmode child device can potentially also trigger bugs
> in the DRM bridge implementation, which does not expect bridges to go
> away.
>
> Suggested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Signed-off-by: Rob Clark <robdclark@chromium.org>
> Link: https://lore.kernel.org/r/20231213210644.8702-1-robdclark@gmail.com
> [ johan: rebase on 6.8-rc4, amend commit message and mention DRM ]
> Fixes: 58ef4ece1e41 ("soc: qcom: pmic_glink: Introduce base PMIC GLINK driver")
> Cc: stable@vger.kernel.org # 6.3
> Cc: Bjorn Andersson <andersson@kernel.org>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Reviewed-by: Bjorn Andersson <andersson@kernel.org>
Regards,
Bjorn
> ---
> drivers/soc/qcom/pmic_glink.c | 21 +++++++++++----------
> 1 file changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/soc/qcom/pmic_glink.c b/drivers/soc/qcom/pmic_glink.c
> index f4bfd24386f1..f913e9bd57ed 100644
> --- a/drivers/soc/qcom/pmic_glink.c
> +++ b/drivers/soc/qcom/pmic_glink.c
> @@ -265,10 +265,17 @@ static int pmic_glink_probe(struct platform_device *pdev)
>
> pg->client_mask = *match_data;
>
> + pg->pdr = pdr_handle_alloc(pmic_glink_pdr_callback, pg);
> + if (IS_ERR(pg->pdr)) {
> + ret = dev_err_probe(&pdev->dev, PTR_ERR(pg->pdr),
> + "failed to initialize pdr\n");
> + return ret;
> + }
> +
> if (pg->client_mask & BIT(PMIC_GLINK_CLIENT_UCSI)) {
> ret = pmic_glink_add_aux_device(pg, &pg->ucsi_aux, "ucsi");
> if (ret)
> - return ret;
> + goto out_release_pdr_handle;
> }
> if (pg->client_mask & BIT(PMIC_GLINK_CLIENT_ALTMODE)) {
> ret = pmic_glink_add_aux_device(pg, &pg->altmode_aux, "altmode");
> @@ -281,17 +288,11 @@ static int pmic_glink_probe(struct platform_device *pdev)
> goto out_release_altmode_aux;
> }
>
> - pg->pdr = pdr_handle_alloc(pmic_glink_pdr_callback, pg);
> - if (IS_ERR(pg->pdr)) {
> - ret = dev_err_probe(&pdev->dev, PTR_ERR(pg->pdr), "failed to initialize pdr\n");
> - goto out_release_aux_devices;
> - }
> -
> service = pdr_add_lookup(pg->pdr, "tms/servreg", "msm/adsp/charger_pd");
> if (IS_ERR(service)) {
> ret = dev_err_probe(&pdev->dev, PTR_ERR(service),
> "failed adding pdr lookup for charger_pd\n");
> - goto out_release_pdr_handle;
> + goto out_release_aux_devices;
> }
>
> mutex_lock(&__pmic_glink_lock);
> @@ -300,8 +301,6 @@ static int pmic_glink_probe(struct platform_device *pdev)
>
> return 0;
>
> -out_release_pdr_handle:
> - pdr_handle_release(pg->pdr);
> out_release_aux_devices:
> if (pg->client_mask & BIT(PMIC_GLINK_CLIENT_BATT))
> pmic_glink_del_aux_device(pg, &pg->ps_aux);
> @@ -311,6 +310,8 @@ static int pmic_glink_probe(struct platform_device *pdev)
> out_release_ucsi_aux:
> if (pg->client_mask & BIT(PMIC_GLINK_CLIENT_UCSI))
> pmic_glink_del_aux_device(pg, &pg->ucsi_aux);
> +out_release_pdr_handle:
> + pdr_handle_release(pg->pdr);
>
> return ret;
> }
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 4/6] soc: qcom: pmic_glink: Fix boot when QRTR=m
2024-02-17 15:02 ` [PATCH 4/6] soc: qcom: pmic_glink: Fix boot when QRTR=m Johan Hovold
2024-02-22 2:18 ` Bjorn Andersson
@ 2024-02-22 21:10 ` Dmitry Baryshkov
2024-02-23 11:04 ` Neil Armstrong
2 siblings, 0 replies; 20+ messages in thread
From: Dmitry Baryshkov @ 2024-02-22 21:10 UTC (permalink / raw)
To: Johan Hovold
Cc: Bjorn Andersson, Andrzej Hajda, Neil Armstrong, Robert Foss,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Daniel Vetter, Vinod Koul, Jonas Karlman, Laurent Pinchart,
Jernej Skrabec, Konrad Dybcio, Kishon Vijay Abraham I, Rob Clark,
Abhinav Kumar, Kuogee Hsieh, freedreno, dri-devel, linux-kernel,
linux-arm-msm, linux-phy, Rob Clark, stable
On Sat, 17 Feb 2024 at 17:03, Johan Hovold <johan+linaro@kernel.org> wrote:
>
> From: Rob Clark <robdclark@chromium.org>
>
> We need to bail out before adding/removing devices if we are going to
> -EPROBE_DEFER. Otherwise boot can get stuck in a probe deferral loop due
> to a long-standing issue in driver core (see fbc35b45f9f6 ("Add
> documentation on meaning of -EPROBE_DEFER")).
>
> Deregistering the altmode child device can potentially also trigger bugs
> in the DRM bridge implementation, which does not expect bridges to go
> away.
>
> Suggested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Signed-off-by: Rob Clark <robdclark@chromium.org>
> Link: https://lore.kernel.org/r/20231213210644.8702-1-robdclark@gmail.com
> [ johan: rebase on 6.8-rc4, amend commit message and mention DRM ]
> Fixes: 58ef4ece1e41 ("soc: qcom: pmic_glink: Introduce base PMIC GLINK driver")
> Cc: stable@vger.kernel.org # 6.3
> Cc: Bjorn Andersson <andersson@kernel.org>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> ---
> drivers/soc/qcom/pmic_glink.c | 21 +++++++++++----------
> 1 file changed, 11 insertions(+), 10 deletions(-)
>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 4/6] soc: qcom: pmic_glink: Fix boot when QRTR=m
2024-02-17 15:02 ` [PATCH 4/6] soc: qcom: pmic_glink: Fix boot when QRTR=m Johan Hovold
2024-02-22 2:18 ` Bjorn Andersson
2024-02-22 21:10 ` Dmitry Baryshkov
@ 2024-02-23 11:04 ` Neil Armstrong
2 siblings, 0 replies; 20+ messages in thread
From: Neil Armstrong @ 2024-02-23 11:04 UTC (permalink / raw)
To: Johan Hovold, Bjorn Andersson, Andrzej Hajda, Robert Foss,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Daniel Vetter, Vinod Koul
Cc: Jonas Karlman, Laurent Pinchart, Jernej Skrabec, Konrad Dybcio,
Kishon Vijay Abraham I, Dmitry Baryshkov, Rob Clark,
Abhinav Kumar, Kuogee Hsieh, freedreno, dri-devel, linux-kernel,
linux-arm-msm, linux-phy, Rob Clark, stable
On 17/02/2024 16:02, Johan Hovold wrote:
> From: Rob Clark <robdclark@chromium.org>
>
> We need to bail out before adding/removing devices if we are going to
> -EPROBE_DEFER. Otherwise boot can get stuck in a probe deferral loop due
> to a long-standing issue in driver core (see fbc35b45f9f6 ("Add
> documentation on meaning of -EPROBE_DEFER")).
>
> Deregistering the altmode child device can potentially also trigger bugs
> in the DRM bridge implementation, which does not expect bridges to go
> away.
>
> Suggested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Signed-off-by: Rob Clark <robdclark@chromium.org>
> Link: https://lore.kernel.org/r/20231213210644.8702-1-robdclark@gmail.com
> [ johan: rebase on 6.8-rc4, amend commit message and mention DRM ]
> Fixes: 58ef4ece1e41 ("soc: qcom: pmic_glink: Introduce base PMIC GLINK driver")
> Cc: stable@vger.kernel.org # 6.3
> Cc: Bjorn Andersson <andersson@kernel.org>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> ---
> drivers/soc/qcom/pmic_glink.c | 21 +++++++++++----------
> 1 file changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/soc/qcom/pmic_glink.c b/drivers/soc/qcom/pmic_glink.c
> index f4bfd24386f1..f913e9bd57ed 100644
> --- a/drivers/soc/qcom/pmic_glink.c
> +++ b/drivers/soc/qcom/pmic_glink.c
> @@ -265,10 +265,17 @@ static int pmic_glink_probe(struct platform_device *pdev)
>
> pg->client_mask = *match_data;
>
> + pg->pdr = pdr_handle_alloc(pmic_glink_pdr_callback, pg);
> + if (IS_ERR(pg->pdr)) {
> + ret = dev_err_probe(&pdev->dev, PTR_ERR(pg->pdr),
> + "failed to initialize pdr\n");
> + return ret;
> + }
> +
> if (pg->client_mask & BIT(PMIC_GLINK_CLIENT_UCSI)) {
> ret = pmic_glink_add_aux_device(pg, &pg->ucsi_aux, "ucsi");
> if (ret)
> - return ret;
> + goto out_release_pdr_handle;
> }
> if (pg->client_mask & BIT(PMIC_GLINK_CLIENT_ALTMODE)) {
> ret = pmic_glink_add_aux_device(pg, &pg->altmode_aux, "altmode");
> @@ -281,17 +288,11 @@ static int pmic_glink_probe(struct platform_device *pdev)
> goto out_release_altmode_aux;
> }
>
> - pg->pdr = pdr_handle_alloc(pmic_glink_pdr_callback, pg);
> - if (IS_ERR(pg->pdr)) {
> - ret = dev_err_probe(&pdev->dev, PTR_ERR(pg->pdr), "failed to initialize pdr\n");
> - goto out_release_aux_devices;
> - }
> -
> service = pdr_add_lookup(pg->pdr, "tms/servreg", "msm/adsp/charger_pd");
> if (IS_ERR(service)) {
> ret = dev_err_probe(&pdev->dev, PTR_ERR(service),
> "failed adding pdr lookup for charger_pd\n");
> - goto out_release_pdr_handle;
> + goto out_release_aux_devices;
> }
>
> mutex_lock(&__pmic_glink_lock);
> @@ -300,8 +301,6 @@ static int pmic_glink_probe(struct platform_device *pdev)
>
> return 0;
>
> -out_release_pdr_handle:
> - pdr_handle_release(pg->pdr);
> out_release_aux_devices:
> if (pg->client_mask & BIT(PMIC_GLINK_CLIENT_BATT))
> pmic_glink_del_aux_device(pg, &pg->ps_aux);
> @@ -311,6 +310,8 @@ static int pmic_glink_probe(struct platform_device *pdev)
> out_release_ucsi_aux:
> if (pg->client_mask & BIT(PMIC_GLINK_CLIENT_UCSI))
> pmic_glink_del_aux_device(pg, &pg->ucsi_aux);
> +out_release_pdr_handle:
> + pdr_handle_release(pg->pdr);
>
> return ret;
> }
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 5/6] phy: qcom-qmp-combo: fix drm bridge registration
[not found] <20240217150228.5788-1-johan+linaro@kernel.org>
2024-02-17 15:02 ` [PATCH 3/6] soc: qcom: pmic_glink_altmode: fix drm bridge use-after-free Johan Hovold
2024-02-17 15:02 ` [PATCH 4/6] soc: qcom: pmic_glink: Fix boot when QRTR=m Johan Hovold
@ 2024-02-17 15:02 ` Johan Hovold
2024-02-19 9:03 ` Neil Armstrong
` (3 more replies)
2024-02-17 15:02 ` [PATCH 6/6] phy: qcom-qmp-combo: fix type-c switch registration Johan Hovold
3 siblings, 4 replies; 20+ messages in thread
From: Johan Hovold @ 2024-02-17 15:02 UTC (permalink / raw)
To: Bjorn Andersson, Andrzej Hajda, Neil Armstrong, Robert Foss,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Daniel Vetter, Vinod Koul
Cc: Jonas Karlman, Laurent Pinchart, Jernej Skrabec, Konrad Dybcio,
Kishon Vijay Abraham I, Dmitry Baryshkov, Rob Clark,
Abhinav Kumar, Kuogee Hsieh, freedreno, dri-devel, linux-kernel,
linux-arm-msm, linux-phy, Johan Hovold, stable, Bjorn Andersson
Due to a long-standing issue in driver core, drivers may not probe defer
after having registered child devices to avoid triggering a probe
deferral loop (see fbc35b45f9f6 ("Add documentation on meaning of
-EPROBE_DEFER")).
This could potentially also trigger a bug in the DRM bridge
implementation which does not expect bridges to go away even if device
links may avoid triggering this (when enabled).
Move registration of the DRM aux bridge to after looking up clocks and
other resources.
Note that PHY creation can in theory also trigger a probe deferral when
a 'phy' supply is used. This does not seem to affect the QMP PHY driver
but the PHY subsystem should be reworked to address this (i.e. by
separating initialisation and registration of the PHY).
Fixes: 35921910bbd0 ("phy: qcom: qmp-combo: switch to DRM_AUX_BRIDGE")
Fixes: 1904c3f578dc ("phy: qcom-qmp-combo: Introduce drm_bridge")
Cc: stable@vger.kernel.org # 6.5
Cc: Bjorn Andersson <quic_bjorande@quicinc.com>
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
index 1ad10110dd25..e19d6a084f10 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
@@ -3566,10 +3566,6 @@ static int qmp_combo_probe(struct platform_device *pdev)
if (ret)
return ret;
- ret = drm_aux_bridge_register(dev);
- if (ret)
- return ret;
-
/* Check for legacy binding with child nodes. */
usb_np = of_get_child_by_name(dev->of_node, "usb3-phy");
if (usb_np) {
@@ -3589,6 +3585,10 @@ static int qmp_combo_probe(struct platform_device *pdev)
if (ret)
goto err_node_put;
+ ret = drm_aux_bridge_register(dev);
+ if (ret)
+ goto err_node_put;
+
pm_runtime_set_active(dev);
ret = devm_pm_runtime_enable(dev);
if (ret)
--
2.43.0
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH 5/6] phy: qcom-qmp-combo: fix drm bridge registration
2024-02-17 15:02 ` [PATCH 5/6] phy: qcom-qmp-combo: fix drm bridge registration Johan Hovold
@ 2024-02-19 9:03 ` Neil Armstrong
2024-02-22 2:21 ` Bjorn Andersson
` (2 subsequent siblings)
3 siblings, 0 replies; 20+ messages in thread
From: Neil Armstrong @ 2024-02-19 9:03 UTC (permalink / raw)
To: Johan Hovold, Bjorn Andersson, Andrzej Hajda, Robert Foss,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Daniel Vetter, Vinod Koul
Cc: Jonas Karlman, Laurent Pinchart, Jernej Skrabec, Konrad Dybcio,
Kishon Vijay Abraham I, Dmitry Baryshkov, Rob Clark,
Abhinav Kumar, Kuogee Hsieh, freedreno, dri-devel, linux-kernel,
linux-arm-msm, linux-phy, stable, Bjorn Andersson
On 17/02/2024 16:02, Johan Hovold wrote:
> Due to a long-standing issue in driver core, drivers may not probe defer
> after having registered child devices to avoid triggering a probe
> deferral loop (see fbc35b45f9f6 ("Add documentation on meaning of
> -EPROBE_DEFER")).
>
> This could potentially also trigger a bug in the DRM bridge
> implementation which does not expect bridges to go away even if device
> links may avoid triggering this (when enabled).
>
> Move registration of the DRM aux bridge to after looking up clocks and
> other resources.
>
> Note that PHY creation can in theory also trigger a probe deferral when
> a 'phy' supply is used. This does not seem to affect the QMP PHY driver
> but the PHY subsystem should be reworked to address this (i.e. by
> separating initialisation and registration of the PHY).
>
> Fixes: 35921910bbd0 ("phy: qcom: qmp-combo: switch to DRM_AUX_BRIDGE")
> Fixes: 1904c3f578dc ("phy: qcom-qmp-combo: Introduce drm_bridge")
> Cc: stable@vger.kernel.org # 6.5
> Cc: Bjorn Andersson <quic_bjorande@quicinc.com>
> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> ---
> drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> index 1ad10110dd25..e19d6a084f10 100644
> --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> @@ -3566,10 +3566,6 @@ static int qmp_combo_probe(struct platform_device *pdev)
> if (ret)
> return ret;
>
> - ret = drm_aux_bridge_register(dev);
> - if (ret)
> - return ret;
> -
> /* Check for legacy binding with child nodes. */
> usb_np = of_get_child_by_name(dev->of_node, "usb3-phy");
> if (usb_np) {
> @@ -3589,6 +3585,10 @@ static int qmp_combo_probe(struct platform_device *pdev)
> if (ret)
> goto err_node_put;
>
> + ret = drm_aux_bridge_register(dev);
> + if (ret)
> + goto err_node_put;
> +
> pm_runtime_set_active(dev);
> ret = devm_pm_runtime_enable(dev);
> if (ret)
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 5/6] phy: qcom-qmp-combo: fix drm bridge registration
2024-02-17 15:02 ` [PATCH 5/6] phy: qcom-qmp-combo: fix drm bridge registration Johan Hovold
2024-02-19 9:03 ` Neil Armstrong
@ 2024-02-22 2:21 ` Bjorn Andersson
2024-02-22 21:11 ` Dmitry Baryshkov
2024-02-23 12:09 ` Vinod Koul
3 siblings, 0 replies; 20+ messages in thread
From: Bjorn Andersson @ 2024-02-22 2:21 UTC (permalink / raw)
To: Johan Hovold
Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Daniel Vetter,
Vinod Koul, Jonas Karlman, Laurent Pinchart, Jernej Skrabec,
Konrad Dybcio, Kishon Vijay Abraham I, Dmitry Baryshkov,
Rob Clark, Abhinav Kumar, Kuogee Hsieh, freedreno, dri-devel,
linux-kernel, linux-arm-msm, linux-phy, stable, Bjorn Andersson
On Sat, Feb 17, 2024 at 04:02:27PM +0100, Johan Hovold wrote:
> Due to a long-standing issue in driver core, drivers may not probe defer
> after having registered child devices to avoid triggering a probe
> deferral loop (see fbc35b45f9f6 ("Add documentation on meaning of
> -EPROBE_DEFER")).
>
> This could potentially also trigger a bug in the DRM bridge
> implementation which does not expect bridges to go away even if device
> links may avoid triggering this (when enabled).
>
> Move registration of the DRM aux bridge to after looking up clocks and
> other resources.
>
> Note that PHY creation can in theory also trigger a probe deferral when
> a 'phy' supply is used. This does not seem to affect the QMP PHY driver
> but the PHY subsystem should be reworked to address this (i.e. by
> separating initialisation and registration of the PHY).
>
> Fixes: 35921910bbd0 ("phy: qcom: qmp-combo: switch to DRM_AUX_BRIDGE")
> Fixes: 1904c3f578dc ("phy: qcom-qmp-combo: Introduce drm_bridge")
> Cc: stable@vger.kernel.org # 6.5
> Cc: Bjorn Andersson <quic_bjorande@quicinc.com>
> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Reviewed-by: Bjorn Andersson <andersson@kernel.org>
Regards,
Bjorn
> ---
> drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> index 1ad10110dd25..e19d6a084f10 100644
> --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> @@ -3566,10 +3566,6 @@ static int qmp_combo_probe(struct platform_device *pdev)
> if (ret)
> return ret;
>
> - ret = drm_aux_bridge_register(dev);
> - if (ret)
> - return ret;
> -
> /* Check for legacy binding with child nodes. */
> usb_np = of_get_child_by_name(dev->of_node, "usb3-phy");
> if (usb_np) {
> @@ -3589,6 +3585,10 @@ static int qmp_combo_probe(struct platform_device *pdev)
> if (ret)
> goto err_node_put;
>
> + ret = drm_aux_bridge_register(dev);
> + if (ret)
> + goto err_node_put;
> +
> pm_runtime_set_active(dev);
> ret = devm_pm_runtime_enable(dev);
> if (ret)
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 5/6] phy: qcom-qmp-combo: fix drm bridge registration
2024-02-17 15:02 ` [PATCH 5/6] phy: qcom-qmp-combo: fix drm bridge registration Johan Hovold
2024-02-19 9:03 ` Neil Armstrong
2024-02-22 2:21 ` Bjorn Andersson
@ 2024-02-22 21:11 ` Dmitry Baryshkov
2024-02-23 12:09 ` Vinod Koul
3 siblings, 0 replies; 20+ messages in thread
From: Dmitry Baryshkov @ 2024-02-22 21:11 UTC (permalink / raw)
To: Johan Hovold
Cc: Bjorn Andersson, Andrzej Hajda, Neil Armstrong, Robert Foss,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Daniel Vetter, Vinod Koul, Jonas Karlman, Laurent Pinchart,
Jernej Skrabec, Konrad Dybcio, Kishon Vijay Abraham I, Rob Clark,
Abhinav Kumar, Kuogee Hsieh, freedreno, dri-devel, linux-kernel,
linux-arm-msm, linux-phy, stable, Bjorn Andersson
On Sat, 17 Feb 2024 at 17:03, Johan Hovold <johan+linaro@kernel.org> wrote:
>
> Due to a long-standing issue in driver core, drivers may not probe defer
> after having registered child devices to avoid triggering a probe
> deferral loop (see fbc35b45f9f6 ("Add documentation on meaning of
> -EPROBE_DEFER")).
>
> This could potentially also trigger a bug in the DRM bridge
> implementation which does not expect bridges to go away even if device
> links may avoid triggering this (when enabled).
>
> Move registration of the DRM aux bridge to after looking up clocks and
> other resources.
>
> Note that PHY creation can in theory also trigger a probe deferral when
> a 'phy' supply is used. This does not seem to affect the QMP PHY driver
> but the PHY subsystem should be reworked to address this (i.e. by
> separating initialisation and registration of the PHY).
>
> Fixes: 35921910bbd0 ("phy: qcom: qmp-combo: switch to DRM_AUX_BRIDGE")
> Fixes: 1904c3f578dc ("phy: qcom-qmp-combo: Introduce drm_bridge")
> Cc: stable@vger.kernel.org # 6.5
> Cc: Bjorn Andersson <quic_bjorande@quicinc.com>
> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> ---
> drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 5/6] phy: qcom-qmp-combo: fix drm bridge registration
2024-02-17 15:02 ` [PATCH 5/6] phy: qcom-qmp-combo: fix drm bridge registration Johan Hovold
` (2 preceding siblings ...)
2024-02-22 21:11 ` Dmitry Baryshkov
@ 2024-02-23 12:09 ` Vinod Koul
3 siblings, 0 replies; 20+ messages in thread
From: Vinod Koul @ 2024-02-23 12:09 UTC (permalink / raw)
To: Johan Hovold
Cc: Bjorn Andersson, Andrzej Hajda, Neil Armstrong, Robert Foss,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Daniel Vetter, Jonas Karlman, Laurent Pinchart, Jernej Skrabec,
Konrad Dybcio, Kishon Vijay Abraham I, Dmitry Baryshkov,
Rob Clark, Abhinav Kumar, Kuogee Hsieh, freedreno, dri-devel,
linux-kernel, linux-arm-msm, linux-phy, stable, Bjorn Andersson
On 17-02-24, 16:02, Johan Hovold wrote:
> Due to a long-standing issue in driver core, drivers may not probe defer
> after having registered child devices to avoid triggering a probe
> deferral loop (see fbc35b45f9f6 ("Add documentation on meaning of
> -EPROBE_DEFER")).
>
> This could potentially also trigger a bug in the DRM bridge
> implementation which does not expect bridges to go away even if device
> links may avoid triggering this (when enabled).
>
> Move registration of the DRM aux bridge to after looking up clocks and
> other resources.
>
> Note that PHY creation can in theory also trigger a probe deferral when
> a 'phy' supply is used. This does not seem to affect the QMP PHY driver
> but the PHY subsystem should be reworked to address this (i.e. by
> separating initialisation and registration of the PHY).
Acked-by: Vinod Koul <vkoul@kernel.org>
--
~Vinod
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 6/6] phy: qcom-qmp-combo: fix type-c switch registration
[not found] <20240217150228.5788-1-johan+linaro@kernel.org>
` (2 preceding siblings ...)
2024-02-17 15:02 ` [PATCH 5/6] phy: qcom-qmp-combo: fix drm bridge registration Johan Hovold
@ 2024-02-17 15:02 ` Johan Hovold
2024-02-22 2:23 ` Bjorn Andersson
` (2 more replies)
3 siblings, 3 replies; 20+ messages in thread
From: Johan Hovold @ 2024-02-17 15:02 UTC (permalink / raw)
To: Bjorn Andersson, Andrzej Hajda, Neil Armstrong, Robert Foss,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Daniel Vetter, Vinod Koul
Cc: Jonas Karlman, Laurent Pinchart, Jernej Skrabec, Konrad Dybcio,
Kishon Vijay Abraham I, Dmitry Baryshkov, Rob Clark,
Abhinav Kumar, Kuogee Hsieh, freedreno, dri-devel, linux-kernel,
linux-arm-msm, linux-phy, Johan Hovold, stable, Bjorn Andersson
Due to a long-standing issue in driver core, drivers may not probe defer
after having registered child devices to avoid triggering a probe
deferral loop (see fbc35b45f9f6 ("Add documentation on meaning of
-EPROBE_DEFER")).
Move registration of the typec switch to after looking up clocks and
other resources.
Note that PHY creation can in theory also trigger a probe deferral when
a 'phy' supply is used. This does not seem to affect the QMP PHY driver
but the PHY subsystem should be reworked to address this (i.e. by
separating initialisation and registration of the PHY).
Fixes: 2851117f8f42 ("phy: qcom-qmp-combo: Introduce orientation switching")
Cc: stable@vger.kernel.org # 6.5
Cc: Bjorn Andersson <quic_bjorande@quicinc.com>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
index e19d6a084f10..17c4ad7553a5 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
@@ -3562,10 +3562,6 @@ static int qmp_combo_probe(struct platform_device *pdev)
if (ret)
return ret;
- ret = qmp_combo_typec_switch_register(qmp);
- if (ret)
- return ret;
-
/* Check for legacy binding with child nodes. */
usb_np = of_get_child_by_name(dev->of_node, "usb3-phy");
if (usb_np) {
@@ -3585,6 +3581,10 @@ static int qmp_combo_probe(struct platform_device *pdev)
if (ret)
goto err_node_put;
+ ret = qmp_combo_typec_switch_register(qmp);
+ if (ret)
+ goto err_node_put;
+
ret = drm_aux_bridge_register(dev);
if (ret)
goto err_node_put;
--
2.43.0
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH 6/6] phy: qcom-qmp-combo: fix type-c switch registration
2024-02-17 15:02 ` [PATCH 6/6] phy: qcom-qmp-combo: fix type-c switch registration Johan Hovold
@ 2024-02-22 2:23 ` Bjorn Andersson
2024-02-22 21:12 ` Dmitry Baryshkov
2024-02-23 12:10 ` Vinod Koul
2 siblings, 0 replies; 20+ messages in thread
From: Bjorn Andersson @ 2024-02-22 2:23 UTC (permalink / raw)
To: Johan Hovold
Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Daniel Vetter,
Vinod Koul, Jonas Karlman, Laurent Pinchart, Jernej Skrabec,
Konrad Dybcio, Kishon Vijay Abraham I, Dmitry Baryshkov,
Rob Clark, Abhinav Kumar, Kuogee Hsieh, freedreno, dri-devel,
linux-kernel, linux-arm-msm, linux-phy, stable, Bjorn Andersson
On Sat, Feb 17, 2024 at 04:02:28PM +0100, Johan Hovold wrote:
> Due to a long-standing issue in driver core, drivers may not probe defer
> after having registered child devices to avoid triggering a probe
> deferral loop (see fbc35b45f9f6 ("Add documentation on meaning of
> -EPROBE_DEFER")).
>
> Move registration of the typec switch to after looking up clocks and
> other resources.
>
> Note that PHY creation can in theory also trigger a probe deferral when
> a 'phy' supply is used. This does not seem to affect the QMP PHY driver
> but the PHY subsystem should be reworked to address this (i.e. by
> separating initialisation and registration of the PHY).
>
> Fixes: 2851117f8f42 ("phy: qcom-qmp-combo: Introduce orientation switching")
> Cc: stable@vger.kernel.org # 6.5
> Cc: Bjorn Andersson <quic_bjorande@quicinc.com>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Reviewed-by: Bjorn Andersson <andersson@kernel.org>
Regards,
Bjorn
> ---
> drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> index e19d6a084f10..17c4ad7553a5 100644
> --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> @@ -3562,10 +3562,6 @@ static int qmp_combo_probe(struct platform_device *pdev)
> if (ret)
> return ret;
>
> - ret = qmp_combo_typec_switch_register(qmp);
> - if (ret)
> - return ret;
> -
> /* Check for legacy binding with child nodes. */
> usb_np = of_get_child_by_name(dev->of_node, "usb3-phy");
> if (usb_np) {
> @@ -3585,6 +3581,10 @@ static int qmp_combo_probe(struct platform_device *pdev)
> if (ret)
> goto err_node_put;
>
> + ret = qmp_combo_typec_switch_register(qmp);
> + if (ret)
> + goto err_node_put;
> +
> ret = drm_aux_bridge_register(dev);
> if (ret)
> goto err_node_put;
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 6/6] phy: qcom-qmp-combo: fix type-c switch registration
2024-02-17 15:02 ` [PATCH 6/6] phy: qcom-qmp-combo: fix type-c switch registration Johan Hovold
2024-02-22 2:23 ` Bjorn Andersson
@ 2024-02-22 21:12 ` Dmitry Baryshkov
2024-02-23 12:10 ` Vinod Koul
2 siblings, 0 replies; 20+ messages in thread
From: Dmitry Baryshkov @ 2024-02-22 21:12 UTC (permalink / raw)
To: Johan Hovold
Cc: Bjorn Andersson, Andrzej Hajda, Neil Armstrong, Robert Foss,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Daniel Vetter, Vinod Koul, Jonas Karlman, Laurent Pinchart,
Jernej Skrabec, Konrad Dybcio, Kishon Vijay Abraham I, Rob Clark,
Abhinav Kumar, Kuogee Hsieh, freedreno, dri-devel, linux-kernel,
linux-arm-msm, linux-phy, stable, Bjorn Andersson
On Sat, 17 Feb 2024 at 17:03, Johan Hovold <johan+linaro@kernel.org> wrote:
>
> Due to a long-standing issue in driver core, drivers may not probe defer
> after having registered child devices to avoid triggering a probe
> deferral loop (see fbc35b45f9f6 ("Add documentation on meaning of
> -EPROBE_DEFER")).
>
> Move registration of the typec switch to after looking up clocks and
> other resources.
>
> Note that PHY creation can in theory also trigger a probe deferral when
> a 'phy' supply is used. This does not seem to affect the QMP PHY driver
> but the PHY subsystem should be reworked to address this (i.e. by
> separating initialisation and registration of the PHY).
>
> Fixes: 2851117f8f42 ("phy: qcom-qmp-combo: Introduce orientation switching")
> Cc: stable@vger.kernel.org # 6.5
> Cc: Bjorn Andersson <quic_bjorande@quicinc.com>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> ---
> drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Note to myself (or to anybody else, who has spare hands), we should
probably implement the same changes for phy-qcom-qmp-usbc.c
>
> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> index e19d6a084f10..17c4ad7553a5 100644
> --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> @@ -3562,10 +3562,6 @@ static int qmp_combo_probe(struct platform_device *pdev)
> if (ret)
> return ret;
>
> - ret = qmp_combo_typec_switch_register(qmp);
> - if (ret)
> - return ret;
> -
> /* Check for legacy binding with child nodes. */
> usb_np = of_get_child_by_name(dev->of_node, "usb3-phy");
> if (usb_np) {
> @@ -3585,6 +3581,10 @@ static int qmp_combo_probe(struct platform_device *pdev)
> if (ret)
> goto err_node_put;
>
> + ret = qmp_combo_typec_switch_register(qmp);
> + if (ret)
> + goto err_node_put;
> +
> ret = drm_aux_bridge_register(dev);
> if (ret)
> goto err_node_put;
> --
> 2.43.0
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 6/6] phy: qcom-qmp-combo: fix type-c switch registration
2024-02-17 15:02 ` [PATCH 6/6] phy: qcom-qmp-combo: fix type-c switch registration Johan Hovold
2024-02-22 2:23 ` Bjorn Andersson
2024-02-22 21:12 ` Dmitry Baryshkov
@ 2024-02-23 12:10 ` Vinod Koul
2 siblings, 0 replies; 20+ messages in thread
From: Vinod Koul @ 2024-02-23 12:10 UTC (permalink / raw)
To: Johan Hovold
Cc: Bjorn Andersson, Andrzej Hajda, Neil Armstrong, Robert Foss,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Daniel Vetter, Jonas Karlman, Laurent Pinchart, Jernej Skrabec,
Konrad Dybcio, Kishon Vijay Abraham I, Dmitry Baryshkov,
Rob Clark, Abhinav Kumar, Kuogee Hsieh, freedreno, dri-devel,
linux-kernel, linux-arm-msm, linux-phy, stable, Bjorn Andersson
On 17-02-24, 16:02, Johan Hovold wrote:
> Due to a long-standing issue in driver core, drivers may not probe defer
> after having registered child devices to avoid triggering a probe
> deferral loop (see fbc35b45f9f6 ("Add documentation on meaning of
> -EPROBE_DEFER")).
>
> Move registration of the typec switch to after looking up clocks and
> other resources.
>
> Note that PHY creation can in theory also trigger a probe deferral when
> a 'phy' supply is used. This does not seem to affect the QMP PHY driver
> but the PHY subsystem should be reworked to address this (i.e. by
> separating initialisation and registration of the PHY).
Acked-by: Vinod Koul <vkoul@kernel.org>
--
~Vinod
^ permalink raw reply [flat|nested] 20+ messages in thread