* [PATCH 0/3] drm/msm: dsi: Properly handle disconnected secondary dsi block
@ 2018-07-30 15:26 Sean Paul
[not found] ` <20180730152658.157098-1-seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
0 siblings, 1 reply; 7+ messages in thread
From: Sean Paul @ 2018-07-30 15:26 UTC (permalink / raw)
To: robdclark-Re5JQEeQqe8AvxtiuMwx3w,
freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
linux-arm-msm-u79uwXL29TY76Z2rM5mHXA
Cc: Sean Paul, dianders-F7+t8E8rja9g9hUCZPvPmw
The configuration where dsi0 is connected and dsi1 is disconnected
doesn't work currently. When dsi1 fails, it paves the reference to dsi0
in dsi_manager, which causes mass carnage. This set ensures that we
clean up the correct dsi device, and that we fail gracefully if a device
is not connected to anything.
Sean
Sean Paul (3):
drm/msm: dsi: Initialize msm_dsi->id to -1
drm/msm: dsi: Return errors whan dt parsing fails
drm/msm: Don't fail bind if nothing connected to dsi
drivers/gpu/drm/msm/dsi/dsi.c | 10 ++++++++--
drivers/gpu/drm/msm/dsi/dsi_host.c | 2 ++
drivers/gpu/drm/msm/dsi/dsi_manager.c | 4 +++-
3 files changed, 13 insertions(+), 3 deletions(-)
--
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] drm/msm: dsi: Initialize msm_dsi->id to -1
[not found] ` <20180730152658.157098-1-seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
@ 2018-07-30 15:26 ` Sean Paul
[not found] ` <20180730152658.157098-2-seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2018-07-30 15:26 ` [PATCH 2/3] drm/msm: dsi: Return errors whan dt parsing fails Sean Paul
2018-07-30 15:26 ` [PATCH 3/3] drm/msm: Don't fail bind if nothing connected to dsi Sean Paul
2 siblings, 1 reply; 7+ messages in thread
From: Sean Paul @ 2018-07-30 15:26 UTC (permalink / raw)
To: robdclark-Re5JQEeQqe8AvxtiuMwx3w,
freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
linux-arm-msm-u79uwXL29TY76Z2rM5mHXA
Cc: Archit Taneja, Sean Paul, dianders-F7+t8E8rja9g9hUCZPvPmw,
Abhinav Kumar
Currently msm_dsi->id is initialized to 0 during kzalloc. If bind fails
for a secondary dsi device before its id can be properly set (such as
during dt parsing), the id will point to the primary dsi device, causing
its reference to be removed from dsi_manager's global (msm_dsim_glb)
array.
This patch initializes the id to -1 and checks for negative in the
manager cleanup.
Cc: Doug Anderson <dianders@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
drivers/gpu/drm/msm/dsi/dsi.c | 1 +
drivers/gpu/drm/msm/dsi/dsi_manager.c | 4 +++-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c
index ff8164cc6738..ee07d58c2d97 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.c
+++ b/drivers/gpu/drm/msm/dsi/dsi.c
@@ -83,6 +83,7 @@ static struct msm_dsi *dsi_init(struct platform_device *pdev)
return ERR_PTR(-ENOMEM);
DBG("dsi probed=%p", msm_dsi);
+ msm_dsi->id = -1;
msm_dsi->pdev = pdev;
platform_set_drvdata(pdev, msm_dsi);
diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c
index 5224010d90e4..80aa6344185e 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
@@ -839,6 +839,8 @@ void msm_dsi_manager_unregister(struct msm_dsi *msm_dsi)
if (msm_dsi->host)
msm_dsi_host_unregister(msm_dsi->host);
- msm_dsim->dsi[msm_dsi->id] = NULL;
+
+ if (msm_dsi->id >= 0)
+ msm_dsim->dsi[msm_dsi->id] = NULL;
}
--
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] drm/msm: dsi: Return errors whan dt parsing fails
[not found] ` <20180730152658.157098-1-seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2018-07-30 15:26 ` [PATCH 1/3] drm/msm: dsi: Initialize msm_dsi->id to -1 Sean Paul
@ 2018-07-30 15:26 ` Sean Paul
[not found] ` <20180730152658.157098-3-seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2018-07-30 15:26 ` [PATCH 3/3] drm/msm: Don't fail bind if nothing connected to dsi Sean Paul
2 siblings, 1 reply; 7+ messages in thread
From: Sean Paul @ 2018-07-30 15:26 UTC (permalink / raw)
To: robdclark-Re5JQEeQqe8AvxtiuMwx3w,
freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
linux-arm-msm-u79uwXL29TY76Z2rM5mHXA
Cc: Archit Taneja, Sean Paul, dianders-F7+t8E8rja9g9hUCZPvPmw,
Abhinav Kumar
If dt parsing fails, we should return an error instead of pretending
everything completed successfully.
Cc: Doug Anderson <dianders@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
drivers/gpu/drm/msm/dsi/dsi_host.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index 96fb5f635314..9c6c523eacdc 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -1750,6 +1750,7 @@ static int dsi_host_parse_dt(struct msm_dsi_host *msm_host)
if (ret) {
dev_err(dev, "%s: invalid lane configuration %d\n",
__func__, ret);
+ ret = -EINVAL;
goto err;
}
@@ -1757,6 +1758,7 @@ static int dsi_host_parse_dt(struct msm_dsi_host *msm_host)
device_node = of_graph_get_remote_node(np, 1, 0);
if (!device_node) {
dev_dbg(dev, "%s: no valid device\n", __func__);
+ ret = -ENODEV;
goto err;
}
--
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] drm/msm: Don't fail bind if nothing connected to dsi
[not found] ` <20180730152658.157098-1-seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2018-07-30 15:26 ` [PATCH 1/3] drm/msm: dsi: Initialize msm_dsi->id to -1 Sean Paul
2018-07-30 15:26 ` [PATCH 2/3] drm/msm: dsi: Return errors whan dt parsing fails Sean Paul
@ 2018-07-30 15:26 ` Sean Paul
[not found] ` <20180730152658.157098-4-seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2 siblings, 1 reply; 7+ messages in thread
From: Sean Paul @ 2018-07-30 15:26 UTC (permalink / raw)
To: robdclark-Re5JQEeQqe8AvxtiuMwx3w,
freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
linux-arm-msm-u79uwXL29TY76Z2rM5mHXA
Cc: Archit Taneja, Sean Paul, dianders-F7+t8E8rja9g9hUCZPvPmw
If there is no bridge or panel connected to a dsi node, don't fail the
entire msm bind. Just ignore the dsi block and move on.
Cc: Doug Anderson <dianders@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
drivers/gpu/drm/msm/dsi/dsi.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c
index ee07d58c2d97..a9768f823290 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.c
+++ b/drivers/gpu/drm/msm/dsi/dsi.c
@@ -118,8 +118,13 @@ static int dsi_bind(struct device *dev, struct device *master, void *data)
DBG("");
msm_dsi = dsi_init(pdev);
- if (IS_ERR(msm_dsi))
- return PTR_ERR(msm_dsi);
+ if (IS_ERR(msm_dsi)) {
+ /* Don't fail the bind if the dsi port is not connected */
+ if (PTR_ERR(msm_dsi) == -ENODEV)
+ return 0;
+ else
+ return PTR_ERR(msm_dsi);
+ }
priv->dsi[msm_dsi->id] = msm_dsi;
--
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] drm/msm: dsi: Initialize msm_dsi->id to -1
[not found] ` <20180730152658.157098-2-seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
@ 2018-07-30 22:29 ` abhinavk-sgV2jX0FEOL9JmXXK+q4OQ
0 siblings, 0 replies; 7+ messages in thread
From: abhinavk-sgV2jX0FEOL9JmXXK+q4OQ @ 2018-07-30 22:29 UTC (permalink / raw)
To: Sean Paul
Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
robdclark-Re5JQEeQqe8AvxtiuMwx3w,
freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
dianders-F7+t8E8rja9g9hUCZPvPmw, Archit Taneja
On 2018-07-30 08:26, Sean Paul wrote:
> Currently msm_dsi->id is initialized to 0 during kzalloc. If bind fails
> for a secondary dsi device before its id can be properly set (such as
> during dt parsing), the id will point to the primary dsi device,
> causing
> its reference to be removed from dsi_manager's global (msm_dsim_glb)
> array.
>
> This patch initializes the id to -1 and checks for negative in the
> manager cleanup.
>
> Cc: Doug Anderson <dianders@chromium.org>
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Abhinav Kumar <abhinavk@codeaurora.org>
> ---
> drivers/gpu/drm/msm/dsi/dsi.c | 1 +
> drivers/gpu/drm/msm/dsi/dsi_manager.c | 4 +++-
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/msm/dsi/dsi.c
> b/drivers/gpu/drm/msm/dsi/dsi.c
> index ff8164cc6738..ee07d58c2d97 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi.c
> @@ -83,6 +83,7 @@ static struct msm_dsi *dsi_init(struct
> platform_device *pdev)
> return ERR_PTR(-ENOMEM);
> DBG("dsi probed=%p", msm_dsi);
>
> + msm_dsi->id = -1;
> msm_dsi->pdev = pdev;
> platform_set_drvdata(pdev, msm_dsi);
>
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c
> b/drivers/gpu/drm/msm/dsi/dsi_manager.c
> index 5224010d90e4..80aa6344185e 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
> @@ -839,6 +839,8 @@ void msm_dsi_manager_unregister(struct msm_dsi
> *msm_dsi)
>
> if (msm_dsi->host)
> msm_dsi_host_unregister(msm_dsi->host);
> - msm_dsim->dsi[msm_dsi->id] = NULL;
> +
> + if (msm_dsi->id >= 0)
> + msm_dsim->dsi[msm_dsi->id] = NULL;
> }
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] drm/msm: dsi: Return errors whan dt parsing fails
[not found] ` <20180730152658.157098-3-seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
@ 2018-07-30 22:30 ` abhinavk-sgV2jX0FEOL9JmXXK+q4OQ
0 siblings, 0 replies; 7+ messages in thread
From: abhinavk-sgV2jX0FEOL9JmXXK+q4OQ @ 2018-07-30 22:30 UTC (permalink / raw)
To: Sean Paul
Cc: Archit Taneja, linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
dianders-F7+t8E8rja9g9hUCZPvPmw, robdclark-Re5JQEeQqe8AvxtiuMwx3w,
freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
linux-arm-msm-owner-u79uwXL29TY76Z2rM5mHXA
On 2018-07-30 08:26, Sean Paul wrote:
> If dt parsing fails, we should return an error instead of pretending
> everything completed successfully.
>
> Cc: Doug Anderson <dianders@chromium.org>
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
Thanks for fixing this !
Reviewed-by: Abhinav Kumar <abhinavk@codeaurora.org>
> ---
> drivers/gpu/drm/msm/dsi/dsi_host.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c
> b/drivers/gpu/drm/msm/dsi/dsi_host.c
> index 96fb5f635314..9c6c523eacdc 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_host.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
> @@ -1750,6 +1750,7 @@ static int dsi_host_parse_dt(struct msm_dsi_host
> *msm_host)
> if (ret) {
> dev_err(dev, "%s: invalid lane configuration %d\n",
> __func__, ret);
> + ret = -EINVAL;
> goto err;
> }
>
> @@ -1757,6 +1758,7 @@ static int dsi_host_parse_dt(struct msm_dsi_host
> *msm_host)
> device_node = of_graph_get_remote_node(np, 1, 0);
> if (!device_node) {
> dev_dbg(dev, "%s: no valid device\n", __func__);
> + ret = -ENODEV;
> goto err;
> }
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] drm/msm: Don't fail bind if nothing connected to dsi
[not found] ` <20180730152658.157098-4-seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
@ 2018-07-30 22:30 ` abhinavk-sgV2jX0FEOL9JmXXK+q4OQ
0 siblings, 0 replies; 7+ messages in thread
From: abhinavk-sgV2jX0FEOL9JmXXK+q4OQ @ 2018-07-30 22:30 UTC (permalink / raw)
To: Sean Paul
Cc: Archit Taneja, linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
dianders-F7+t8E8rja9g9hUCZPvPmw, robdclark-Re5JQEeQqe8AvxtiuMwx3w,
freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
linux-arm-msm-owner-u79uwXL29TY76Z2rM5mHXA
On 2018-07-30 08:26, Sean Paul wrote:
> If there is no bridge or panel connected to a dsi node, don't fail the
> entire msm bind. Just ignore the dsi block and move on.
>
> Cc: Doug Anderson <dianders@chromium.org>
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Abhinav Kumar <abhinavk@codeaurora.org>
> ---
> drivers/gpu/drm/msm/dsi/dsi.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/dsi/dsi.c
> b/drivers/gpu/drm/msm/dsi/dsi.c
> index ee07d58c2d97..a9768f823290 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi.c
> @@ -118,8 +118,13 @@ static int dsi_bind(struct device *dev, struct
> device *master, void *data)
>
> DBG("");
> msm_dsi = dsi_init(pdev);
> - if (IS_ERR(msm_dsi))
> - return PTR_ERR(msm_dsi);
> + if (IS_ERR(msm_dsi)) {
> + /* Don't fail the bind if the dsi port is not connected */
> + if (PTR_ERR(msm_dsi) == -ENODEV)
> + return 0;
> + else
> + return PTR_ERR(msm_dsi);
> + }
>
> priv->dsi[msm_dsi->id] = msm_dsi;
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-07-30 22:30 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-30 15:26 [PATCH 0/3] drm/msm: dsi: Properly handle disconnected secondary dsi block Sean Paul
[not found] ` <20180730152658.157098-1-seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2018-07-30 15:26 ` [PATCH 1/3] drm/msm: dsi: Initialize msm_dsi->id to -1 Sean Paul
[not found] ` <20180730152658.157098-2-seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2018-07-30 22:29 ` abhinavk-sgV2jX0FEOL9JmXXK+q4OQ
2018-07-30 15:26 ` [PATCH 2/3] drm/msm: dsi: Return errors whan dt parsing fails Sean Paul
[not found] ` <20180730152658.157098-3-seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2018-07-30 22:30 ` abhinavk-sgV2jX0FEOL9JmXXK+q4OQ
2018-07-30 15:26 ` [PATCH 3/3] drm/msm: Don't fail bind if nothing connected to dsi Sean Paul
[not found] ` <20180730152658.157098-4-seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2018-07-30 22:30 ` abhinavk-sgV2jX0FEOL9JmXXK+q4OQ
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).