linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] drm: mcde: Fix display initialization problem
@ 2020-06-13 22:30 Linus Walleij
  2020-06-13 22:30 ` [PATCH 2/2] drm: mcde: Fix forgotten user of drm->dev_private Linus Walleij
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Linus Walleij @ 2020-06-13 22:30 UTC (permalink / raw)
  To: dri-devel, Maarten Lankhorst, Maxime Ripard, Sean Paul
  Cc: Linus Walleij, linux-arm-kernel

The following bug appeared in the MCDE driver/display
initialization during the recent merge window.

First the place we call drm_fbdev_generic_setup() in the
wrong place: this needs to be called AFTER calling
drm_dev_register() else we get this splat:

 ------------[ cut here ]------------
WARNING: CPU: 0 PID: 1 at ../drivers/gpu/drm/drm_fb_helper.c:2198 drm_fbdev_generic_setup+0x164/0x1a8
mcde a0350000.mcde: Device has not been registered.
Modules linked in:
Hardware name: ST-Ericsson Ux5x0 platform (Device Tree Support)
[<c010e704>] (unwind_backtrace) from [<c010a86c>] (show_stack+0x10/0x14)
[<c010a86c>] (show_stack) from [<c0414f38>] (dump_stack+0x9c/0xb0)
[<c0414f38>] (dump_stack) from [<c0121c8c>] (__warn+0xb8/0xd0)
[<c0121c8c>] (__warn) from [<c0121d18>] (warn_slowpath_fmt+0x74/0xb8)
[<c0121d18>] (warn_slowpath_fmt) from [<c04b154c>] (drm_fbdev_generic_setup+0x164/0x1a8)
[<c04b154c>] (drm_fbdev_generic_setup) from [<c04ed278>] (mcde_drm_bind+0xc4/0x160)
[<c04ed278>] (mcde_drm_bind) from [<c04f06b8>] (try_to_bring_up_master+0x15c/0x1a4)
(...)

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/gpu/drm/mcde/mcde_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mcde/mcde_drv.c b/drivers/gpu/drm/mcde/mcde_drv.c
index 84f3e2dbd77b..80082d6dce3a 100644
--- a/drivers/gpu/drm/mcde/mcde_drv.c
+++ b/drivers/gpu/drm/mcde/mcde_drv.c
@@ -209,7 +209,6 @@ static int mcde_modeset_init(struct drm_device *drm)
 
 	drm_mode_config_reset(drm);
 	drm_kms_helper_poll_init(drm);
-	drm_fbdev_generic_setup(drm, 32);
 
 	return 0;
 }
@@ -264,6 +263,8 @@ static int mcde_drm_bind(struct device *dev)
 	if (ret < 0)
 		goto unbind;
 
+	drm_fbdev_generic_setup(drm, 32);
+
 	return 0;
 
 unbind:
-- 
2.26.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 2/2] drm: mcde: Fix forgotten user of drm->dev_private
  2020-06-13 22:30 [PATCH 1/2] drm: mcde: Fix display initialization problem Linus Walleij
@ 2020-06-13 22:30 ` Linus Walleij
  2020-06-14  7:48   ` Sam Ravnborg
  2020-06-14  7:44 ` [PATCH 1/2] drm: mcde: Fix display initialization problem Sam Ravnborg
  2020-06-15 23:31 ` Emil Velikov
  2 siblings, 1 reply; 7+ messages in thread
From: Linus Walleij @ 2020-06-13 22:30 UTC (permalink / raw)
  To: dri-devel, Maarten Lankhorst, Maxime Ripard, Sean Paul
  Cc: Daniel Vetter, Linus Walleij, linux-arm-kernel

We forgot one call site directly using drm->dev_private.
This leads to a crash like this:

8<--- cut here ---
Unable to handle kernel NULL pointer dereference at virtual address 00000918
pgd = (ptrval)
[00000918] *pgd=00000000
Internal error: Oops: 5 [#1] SMP ARM
Modules linked in:
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.7.0-15001-gfa384b50b96b-dirty #514
Hardware name: ST-Ericsson Ux5x0 platform (Device Tree Support)
PC is at mcde_display_enable+0x78/0x7c0
LR is at mcde_display_enable+0x78/0x7c0

Fix this by using to_mcde() as in other functions.

Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Fixes: fd7ee85cfe7b ("drm/mcde: Don't use drm_device->dev_private")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/gpu/drm/mcde/mcde_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mcde/mcde_display.c b/drivers/gpu/drm/mcde/mcde_display.c
index b319a474f801..212aee60cf61 100644
--- a/drivers/gpu/drm/mcde/mcde_display.c
+++ b/drivers/gpu/drm/mcde/mcde_display.c
@@ -838,7 +838,7 @@ static void mcde_display_enable(struct drm_simple_display_pipe *pipe,
 	struct drm_crtc *crtc = &pipe->crtc;
 	struct drm_plane *plane = &pipe->plane;
 	struct drm_device *drm = crtc->dev;
-	struct mcde *mcde = drm->dev_private;
+	struct mcde *mcde = to_mcde(drm);
 	const struct drm_display_mode *mode = &cstate->mode;
 	struct drm_framebuffer *fb = plane->state->fb;
 	u32 format = fb->format->format;
-- 
2.26.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 1/2] drm: mcde: Fix display initialization problem
  2020-06-13 22:30 [PATCH 1/2] drm: mcde: Fix display initialization problem Linus Walleij
  2020-06-13 22:30 ` [PATCH 2/2] drm: mcde: Fix forgotten user of drm->dev_private Linus Walleij
@ 2020-06-14  7:44 ` Sam Ravnborg
  2020-06-14 21:29   ` Linus Walleij
  2020-06-15 23:31 ` Emil Velikov
  2 siblings, 1 reply; 7+ messages in thread
From: Sam Ravnborg @ 2020-06-14  7:44 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-arm-kernel, Sean Paul, Maarten Lankhorst, Maxime Ripard, dri-devel

Hi Linus.

On Sun, Jun 14, 2020 at 12:30:26AM +0200, Linus Walleij wrote:
> The following bug appeared in the MCDE driver/display
> initialization during the recent merge window.
> 
> First the place we call drm_fbdev_generic_setup() in the
> wrong place: this needs to be called AFTER calling
> drm_dev_register() else we get this splat:
> 
>  ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 1 at ../drivers/gpu/drm/drm_fb_helper.c:2198 drm_fbdev_generic_setup+0x164/0x1a8
> mcde a0350000.mcde: Device has not been registered.
> Modules linked in:
> Hardware name: ST-Ericsson Ux5x0 platform (Device Tree Support)
> [<c010e704>] (unwind_backtrace) from [<c010a86c>] (show_stack+0x10/0x14)
> [<c010a86c>] (show_stack) from [<c0414f38>] (dump_stack+0x9c/0xb0)
> [<c0414f38>] (dump_stack) from [<c0121c8c>] (__warn+0xb8/0xd0)
> [<c0121c8c>] (__warn) from [<c0121d18>] (warn_slowpath_fmt+0x74/0xb8)
> [<c0121d18>] (warn_slowpath_fmt) from [<c04b154c>] (drm_fbdev_generic_setup+0x164/0x1a8)
> [<c04b154c>] (drm_fbdev_generic_setup) from [<c04ed278>] (mcde_drm_bind+0xc4/0x160)
> [<c04ed278>] (mcde_drm_bind) from [<c04f06b8>] (try_to_bring_up_master+0x15c/0x1a4)
> (...)
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Yup, this is the right way to do it.

Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

One small thing to consider, see below. But for another patch.

> ---
>  drivers/gpu/drm/mcde/mcde_drv.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/mcde/mcde_drv.c b/drivers/gpu/drm/mcde/mcde_drv.c
> index 84f3e2dbd77b..80082d6dce3a 100644
> --- a/drivers/gpu/drm/mcde/mcde_drv.c
> +++ b/drivers/gpu/drm/mcde/mcde_drv.c
> @@ -209,7 +209,6 @@ static int mcde_modeset_init(struct drm_device *drm)
>  
>  	drm_mode_config_reset(drm);
>  	drm_kms_helper_poll_init(drm);
> -	drm_fbdev_generic_setup(drm, 32);
>  
>  	return 0;
>  }
> @@ -264,6 +263,8 @@ static int mcde_drm_bind(struct device *dev)
>  	if (ret < 0)
>  		goto unbind;
>  
> +	drm_fbdev_generic_setup(drm, 32);
Consider using mode_config.preferred_depth, then you can pass 0 here.


> +
>  	return 0;
>  
>  unbind:
> -- 
> 2.26.2
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 2/2] drm: mcde: Fix forgotten user of drm->dev_private
  2020-06-13 22:30 ` [PATCH 2/2] drm: mcde: Fix forgotten user of drm->dev_private Linus Walleij
@ 2020-06-14  7:48   ` Sam Ravnborg
  0 siblings, 0 replies; 7+ messages in thread
From: Sam Ravnborg @ 2020-06-14  7:48 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Daniel Vetter, Maarten Lankhorst, Maxime Ripard, dri-devel,
	Sean Paul, linux-arm-kernel

On Sun, Jun 14, 2020 at 12:30:27AM +0200, Linus Walleij wrote:
> We forgot one call site directly using drm->dev_private.
> This leads to a crash like this:
> 
> 8<--- cut here ---
> Unable to handle kernel NULL pointer dereference at virtual address 00000918
> pgd = (ptrval)
> [00000918] *pgd=00000000
> Internal error: Oops: 5 [#1] SMP ARM
> Modules linked in:
> CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.7.0-15001-gfa384b50b96b-dirty #514
> Hardware name: ST-Ericsson Ux5x0 platform (Device Tree Support)
> PC is at mcde_display_enable+0x78/0x7c0
> LR is at mcde_display_enable+0x78/0x7c0
> 
> Fix this by using to_mcde() as in other functions.
> 
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Fixes: fd7ee85cfe7b ("drm/mcde: Don't use drm_device->dev_private")
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

This is the last hit for "git grep dev_private".
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

> ---
>  drivers/gpu/drm/mcde/mcde_display.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/mcde/mcde_display.c b/drivers/gpu/drm/mcde/mcde_display.c
> index b319a474f801..212aee60cf61 100644
> --- a/drivers/gpu/drm/mcde/mcde_display.c
> +++ b/drivers/gpu/drm/mcde/mcde_display.c
> @@ -838,7 +838,7 @@ static void mcde_display_enable(struct drm_simple_display_pipe *pipe,
>  	struct drm_crtc *crtc = &pipe->crtc;
>  	struct drm_plane *plane = &pipe->plane;
>  	struct drm_device *drm = crtc->dev;
> -	struct mcde *mcde = drm->dev_private;
> +	struct mcde *mcde = to_mcde(drm);
>  	const struct drm_display_mode *mode = &cstate->mode;
>  	struct drm_framebuffer *fb = plane->state->fb;
>  	u32 format = fb->format->format;
> -- 
> 2.26.2
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 1/2] drm: mcde: Fix display initialization problem
  2020-06-14  7:44 ` [PATCH 1/2] drm: mcde: Fix display initialization problem Sam Ravnborg
@ 2020-06-14 21:29   ` Linus Walleij
  2020-06-15 15:51     ` Daniel Vetter
  0 siblings, 1 reply; 7+ messages in thread
From: Linus Walleij @ 2020-06-14 21:29 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Linux ARM, Sean Paul, Maarten Lankhorst, Maxime Ripard,
	open list:DRM PANEL DRIVERS

On Sun, Jun 14, 2020 at 9:44 AM Sam Ravnborg <sam@ravnborg.org> wrote:

> Hi Linus.
>
> On Sun, Jun 14, 2020 at 12:30:26AM +0200, Linus Walleij wrote:
> > The following bug appeared in the MCDE driver/display
> > initialization during the recent merge window.
> >
> > First the place we call drm_fbdev_generic_setup() in the
> > wrong place: this needs to be called AFTER calling
> > drm_dev_register() else we get this splat:
> >
> >  ------------[ cut here ]------------
> > WARNING: CPU: 0 PID: 1 at ../drivers/gpu/drm/drm_fb_helper.c:2198 drm_fbdev_generic_setup+0x164/0x1a8
> > mcde a0350000.mcde: Device has not been registered.
> > Modules linked in:
> > Hardware name: ST-Ericsson Ux5x0 platform (Device Tree Support)
> > [<c010e704>] (unwind_backtrace) from [<c010a86c>] (show_stack+0x10/0x14)
> > [<c010a86c>] (show_stack) from [<c0414f38>] (dump_stack+0x9c/0xb0)
> > [<c0414f38>] (dump_stack) from [<c0121c8c>] (__warn+0xb8/0xd0)
> > [<c0121c8c>] (__warn) from [<c0121d18>] (warn_slowpath_fmt+0x74/0xb8)
> > [<c0121d18>] (warn_slowpath_fmt) from [<c04b154c>] (drm_fbdev_generic_setup+0x164/0x1a8)
> > [<c04b154c>] (drm_fbdev_generic_setup) from [<c04ed278>] (mcde_drm_bind+0xc4/0x160)
> > [<c04ed278>] (mcde_drm_bind) from [<c04f06b8>] (try_to_bring_up_master+0x15c/0x1a4)
> > (...)
> >
> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
>
> Yup, this is the right way to do it.
>
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

Hm I can't seem to apply these because drm-misc-fixes isn't
rebased to v5.8-rc1 or something (wrong ancestor).

Does anyone know if ther is a special trick for this or do I
need to wait for someone else to rebase that branch?

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 1/2] drm: mcde: Fix display initialization problem
  2020-06-14 21:29   ` Linus Walleij
@ 2020-06-15 15:51     ` Daniel Vetter
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Vetter @ 2020-06-15 15:51 UTC (permalink / raw)
  To: Linus Walleij, Thomas Zimmermann
  Cc: Sean Paul, Sam Ravnborg, open list:DRM PANEL DRIVERS, Linux ARM

On Sun, Jun 14, 2020 at 11:29 PM Linus Walleij <linus.walleij@linaro.org> wrote:
>
> On Sun, Jun 14, 2020 at 9:44 AM Sam Ravnborg <sam@ravnborg.org> wrote:
>
> > Hi Linus.
> >
> > On Sun, Jun 14, 2020 at 12:30:26AM +0200, Linus Walleij wrote:
> > > The following bug appeared in the MCDE driver/display
> > > initialization during the recent merge window.
> > >
> > > First the place we call drm_fbdev_generic_setup() in the
> > > wrong place: this needs to be called AFTER calling
> > > drm_dev_register() else we get this splat:
> > >
> > >  ------------[ cut here ]------------
> > > WARNING: CPU: 0 PID: 1 at ../drivers/gpu/drm/drm_fb_helper.c:2198 drm_fbdev_generic_setup+0x164/0x1a8
> > > mcde a0350000.mcde: Device has not been registered.
> > > Modules linked in:
> > > Hardware name: ST-Ericsson Ux5x0 platform (Device Tree Support)
> > > [<c010e704>] (unwind_backtrace) from [<c010a86c>] (show_stack+0x10/0x14)
> > > [<c010a86c>] (show_stack) from [<c0414f38>] (dump_stack+0x9c/0xb0)
> > > [<c0414f38>] (dump_stack) from [<c0121c8c>] (__warn+0xb8/0xd0)
> > > [<c0121c8c>] (__warn) from [<c0121d18>] (warn_slowpath_fmt+0x74/0xb8)
> > > [<c0121d18>] (warn_slowpath_fmt) from [<c04b154c>] (drm_fbdev_generic_setup+0x164/0x1a8)
> > > [<c04b154c>] (drm_fbdev_generic_setup) from [<c04ed278>] (mcde_drm_bind+0xc4/0x160)
> > > [<c04ed278>] (mcde_drm_bind) from [<c04f06b8>] (try_to_bring_up_master+0x15c/0x1a4)
> > > (...)
> > >
> > > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> >
> > Yup, this is the right way to do it.
> >
> > Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
>
> Hm I can't seem to apply these because drm-misc-fixes isn't
> rebased to v5.8-rc1 or something (wrong ancestor).
>
> Does anyone know if ther is a special trick for this or do I
> need to wait for someone else to rebase that branch?

Thomas Zimmermann (added) as current -fixes handler needs to roll the
branch forward (and make sure nothing got lost).
-Daniel

>
> Yours,
> Linus Walleij
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel



-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 1/2] drm: mcde: Fix display initialization problem
  2020-06-13 22:30 [PATCH 1/2] drm: mcde: Fix display initialization problem Linus Walleij
  2020-06-13 22:30 ` [PATCH 2/2] drm: mcde: Fix forgotten user of drm->dev_private Linus Walleij
  2020-06-14  7:44 ` [PATCH 1/2] drm: mcde: Fix display initialization problem Sam Ravnborg
@ 2020-06-15 23:31 ` Emil Velikov
  2 siblings, 0 replies; 7+ messages in thread
From: Emil Velikov @ 2020-06-15 23:31 UTC (permalink / raw)
  To: Linus Walleij
  Cc: LAKML, Sean Paul, Maarten Lankhorst, Maxime Ripard, ML dri-devel

Hi Linus,

On Sat, 13 Jun 2020 at 23:30, Linus Walleij <linus.walleij@linaro.org> wrote:
>
> The following bug appeared in the MCDE driver/display
> initialization during the recent merge window.
>
> First the place we call drm_fbdev_generic_setup() in the
> wrong place: this needs to be called AFTER calling
> drm_dev_register() else we get this splat:
>
>  ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 1 at ../drivers/gpu/drm/drm_fb_helper.c:2198 drm_fbdev_generic_setup+0x164/0x1a8
> mcde a0350000.mcde: Device has not been registered.
> Modules linked in:
> Hardware name: ST-Ericsson Ux5x0 platform (Device Tree Support)
> [<c010e704>] (unwind_backtrace) from [<c010a86c>] (show_stack+0x10/0x14)
> [<c010a86c>] (show_stack) from [<c0414f38>] (dump_stack+0x9c/0xb0)
> [<c0414f38>] (dump_stack) from [<c0121c8c>] (__warn+0xb8/0xd0)
> [<c0121c8c>] (__warn) from [<c0121d18>] (warn_slowpath_fmt+0x74/0xb8)
> [<c0121d18>] (warn_slowpath_fmt) from [<c04b154c>] (drm_fbdev_generic_setup+0x164/0x1a8)
> [<c04b154c>] (drm_fbdev_generic_setup) from [<c04ed278>] (mcde_drm_bind+0xc4/0x160)
> [<c04ed278>] (mcde_drm_bind) from [<c04f06b8>] (try_to_bring_up_master+0x15c/0x1a4)
> (...)
>

Worth adding Cc: stable or Fixes tag, so this lands in the stable branches?
If anything I'm slightly worried that w/o such a tag, the AI bot (as
used by the stable team) might auto-nominate this even where it's not
applicable.

HTH
Emil

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2020-06-15 23:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-13 22:30 [PATCH 1/2] drm: mcde: Fix display initialization problem Linus Walleij
2020-06-13 22:30 ` [PATCH 2/2] drm: mcde: Fix forgotten user of drm->dev_private Linus Walleij
2020-06-14  7:48   ` Sam Ravnborg
2020-06-14  7:44 ` [PATCH 1/2] drm: mcde: Fix display initialization problem Sam Ravnborg
2020-06-14 21:29   ` Linus Walleij
2020-06-15 15:51     ` Daniel Vetter
2020-06-15 23:31 ` Emil Velikov

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