All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] drm/msm: Fix dsi/bridge probe
@ 2021-12-01 10:52 ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 36+ messages in thread
From: AngeloGioacchino Del Regno @ 2021-12-01 10:52 UTC (permalink / raw)
  To: robdclark
  Cc: dmitry.baryshkov, sean, airlied, daniel, maxime, linux-arm-msm,
	dri-devel, freedreno, linux-kernel, kernel, konrad.dybcio,
	marijn.suijten, jami.kettunen, martin.botka,
	AngeloGioacchino Del Regno

Context, from patch 2/2:
Since commit 8f59ee9a570c ("drm/msm/dsi: Adjust probe order"), the
DSI host gets initialized earlier, but this caused unability to probe
the entire stack of components because they all depend on interrupts
coming from the main `mdss` node (mdp5, or dpu1).

Changes in v3:
- Removed a forgotten (and wrong) kfree() call.

Series v2:
After a very nice conversation with Dmitry, it turned out that my first
approach to solve this issue wasn't great: even though it appeared to
actually work, it was introducing a number of issues, one of which was
critical as it was not removing down the DRM device when it's supposed to.

Instead of actually fixing that patch, I went for "simplifying" the
approach by not initializing the entire MDSS, but just the interrupt
controller, which still untangles the infinite probe deferrals, but
actually doesn't even touch most of the already present logic in place.


AngeloGioacchino Del Regno (2):
  drm/msm: Allocate msm_drm_private early and pass it as driver data
  drm/msm: Initialize MDSS irq domain at probe time

 drivers/gpu/drm/msm/adreno/adreno_device.c | 16 ++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c    |  4 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c   | 50 ++++++++++------
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c   |  3 +-
 drivers/gpu/drm/msm/disp/mdp5/mdp5_mdss.c  | 58 ++++++++++++------
 drivers/gpu/drm/msm/dp/dp_display.c        | 10 +---
 drivers/gpu/drm/msm/dsi/dsi.c              |  6 +-
 drivers/gpu/drm/msm/edp/edp.c              |  6 +-
 drivers/gpu/drm/msm/hdmi/hdmi.c            |  7 +--
 drivers/gpu/drm/msm/msm_drv.c              | 68 +++++++++++++---------
 drivers/gpu/drm/msm/msm_kms.h              |  3 +
 11 files changed, 133 insertions(+), 98 deletions(-)

-- 
2.33.1


^ permalink raw reply	[flat|nested] 36+ messages in thread
* [PATCH] drm/msm: Initialize MDSS irq domain at probe time
@ 2021-11-25 15:09 ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 36+ messages in thread
From: AngeloGioacchino Del Regno @ 2021-11-25 15:09 UTC (permalink / raw)
  To: robdclark
  Cc: freedreno, airlied, linux-arm-msm, konrad.dybcio, linux-kernel,
	dri-devel, jami.kettunen, maxime, marijn.suijten, kernel, sean,
	AngeloGioacchino Del Regno

Since commit 8f59ee9a570c ("drm/msm/dsi: Adjust probe order"), the
DSI host gets initialized earlier, but this caused unability to probe
the entire stack of components because they all depend on interrupts
coming from the main `mdss` node (mdp5, or dpu1).

To fix this issue, also anticipate probing mdp5 or dpu1 by initializing
them at msm_pdev_probe() time: this will make sure that we add the
required interrupt controller mapping before dsi and/or other components
try to initialize, finally satisfying the dependency.

While at it, also change the allocation of msm_drm_private to use the
devm variant of kzalloc().

Fixes: 8f59ee9a570c ("drm/msm/dsi: Adjust probe order")
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/gpu/drm/msm/msm_drv.c | 81 ++++++++++++++++-------------------
 1 file changed, 38 insertions(+), 43 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 7936e8d498dd..790acf4993c0 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -512,45 +512,12 @@ static int msm_init_vram(struct drm_device *dev)
 static int msm_drm_init(struct device *dev, const struct drm_driver *drv)
 {
 	struct platform_device *pdev = to_platform_device(dev);
-	struct drm_device *ddev;
-	struct msm_drm_private *priv;
-	struct msm_kms *kms;
-	struct msm_mdss *mdss;
+	struct drm_device *ddev = platform_get_drvdata(pdev);
+	struct msm_drm_private *priv = ddev->dev_private;
+	struct msm_kms *kms = priv->kms;
+	struct msm_mdss *mdss = priv->mdss;
 	int ret, i;
 
-	ddev = drm_dev_alloc(drv, dev);
-	if (IS_ERR(ddev)) {
-		DRM_DEV_ERROR(dev, "failed to allocate drm_device\n");
-		return PTR_ERR(ddev);
-	}
-
-	platform_set_drvdata(pdev, ddev);
-
-	priv = kzalloc(sizeof(*priv), GFP_KERNEL);
-	if (!priv) {
-		ret = -ENOMEM;
-		goto err_put_drm_dev;
-	}
-
-	ddev->dev_private = priv;
-	priv->dev = ddev;
-
-	switch (get_mdp_ver(pdev)) {
-	case KMS_MDP5:
-		ret = mdp5_mdss_init(ddev);
-		break;
-	case KMS_DPU:
-		ret = dpu_mdss_init(ddev);
-		break;
-	default:
-		ret = 0;
-		break;
-	}
-	if (ret)
-		goto err_free_priv;
-
-	mdss = priv->mdss;
-
 	priv->wq = alloc_ordered_workqueue("msm", 0);
 	priv->hangcheck_period = DRM_MSM_HANGCHECK_DEFAULT_PERIOD;
 
@@ -685,11 +652,6 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv)
 err_destroy_mdss:
 	if (mdss && mdss->funcs)
 		mdss->funcs->destroy(ddev);
-err_free_priv:
-	kfree(priv);
-err_put_drm_dev:
-	drm_dev_put(ddev);
-	platform_set_drvdata(pdev, NULL);
 	return ret;
 }
 
@@ -1382,12 +1344,42 @@ static const struct component_master_ops msm_drm_ops = {
 static int msm_pdev_probe(struct platform_device *pdev)
 {
 	struct component_match *match = NULL;
+	struct msm_drm_private *priv;
+	struct drm_device *ddev;
 	int ret;
 
+	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
+	if (!priv)
+		return -ENOMEM;
+
+	ddev = drm_dev_alloc(&msm_driver, &pdev->dev);
+	if (IS_ERR(ddev)) {
+		DRM_DEV_ERROR(&pdev->dev, "failed to allocate drm_device\n");
+		return PTR_ERR(ddev);
+	}
+
+	platform_set_drvdata(pdev, ddev);
+	ddev->dev_private = priv;
+	priv->dev = ddev;
+
+	switch (get_mdp_ver(pdev)) {
+	case KMS_MDP5:
+		ret = mdp5_mdss_init(ddev);
+		break;
+	case KMS_DPU:
+		ret = dpu_mdss_init(ddev);
+		break;
+	default:
+		ret = 0;
+		break;
+	}
+	if (ret)
+		goto err_put_drm_dev;
+
 	if (get_mdp_ver(pdev)) {
 		ret = add_display_components(pdev, &match);
 		if (ret)
-			return ret;
+			goto fail;
 	}
 
 	ret = add_gpu_components(&pdev->dev, &match);
@@ -1409,6 +1401,9 @@ static int msm_pdev_probe(struct platform_device *pdev)
 
 fail:
 	of_platform_depopulate(&pdev->dev);
+err_put_drm_dev:
+	drm_dev_put(ddev);
+	platform_set_drvdata(pdev, NULL);
 	return ret;
 }
 
-- 
2.33.1


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

end of thread, other threads:[~2021-12-03 13:17 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-01 10:52 [PATCH v3 0/2] drm/msm: Fix dsi/bridge probe AngeloGioacchino Del Regno
2021-12-01 10:52 ` AngeloGioacchino Del Regno
2021-12-01 10:52 ` [PATCH v3 1/2] drm/msm: Allocate msm_drm_private early and pass it as driver data AngeloGioacchino Del Regno
2021-12-01 10:52   ` AngeloGioacchino Del Regno
2021-12-01 10:52 ` [PATCH v3 2/2] drm/msm: Initialize MDSS irq domain at probe time AngeloGioacchino Del Regno
2021-12-01 10:52   ` AngeloGioacchino Del Regno
2021-12-01 20:20   ` [PATCH] " Dmitry Baryshkov
2021-12-01 20:20     ` Dmitry Baryshkov
2021-12-03 10:43     ` AngeloGioacchino Del Regno
2021-12-03 10:43       ` AngeloGioacchino Del Regno
2021-12-03 13:14       ` Dmitry Baryshkov
2021-12-03 13:14         ` Dmitry Baryshkov
2021-12-03 13:17         ` AngeloGioacchino Del Regno
2021-12-03 13:17           ` AngeloGioacchino Del Regno
  -- strict thread matches above, loose matches on Subject: below --
2021-11-25 15:09 AngeloGioacchino Del Regno
2021-11-25 15:09 ` AngeloGioacchino Del Regno
2021-11-25 15:23 ` Dmitry Baryshkov
2021-11-25 15:23   ` Dmitry Baryshkov
2021-11-25 22:39 ` Dmitry Baryshkov
2021-11-25 22:39   ` Dmitry Baryshkov
2021-11-26  0:06 ` Dmitry Baryshkov
2021-11-26  0:06   ` Dmitry Baryshkov
2021-11-26  9:26   ` AngeloGioacchino Del Regno
2021-11-26  9:26     ` AngeloGioacchino Del Regno
2021-11-26 21:12     ` Dmitry Baryshkov
2021-11-26 21:12       ` Dmitry Baryshkov
2021-11-26 16:08   ` AngeloGioacchino Del Regno
2021-11-26 16:08     ` AngeloGioacchino Del Regno
2021-11-29  2:20 ` Dmitry Baryshkov
2021-11-29  2:20   ` Dmitry Baryshkov
2021-11-29 14:14   ` AngeloGioacchino Del Regno
2021-11-29 14:14     ` AngeloGioacchino Del Regno
2021-11-29 14:53     ` Dmitry Baryshkov
2021-11-29 14:53       ` Dmitry Baryshkov
2021-11-29 14:56       ` AngeloGioacchino Del Regno
2021-11-29 14:56         ` AngeloGioacchino Del Regno

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.