All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/rockchip: shutdown drm subsystem on shutdown
@ 2019-04-02 11:37 ` Heiko Stuebner
  0 siblings, 0 replies; 6+ messages in thread
From: Heiko Stuebner @ 2019-04-02 11:37 UTC (permalink / raw)
  To: hjc
  Cc: dri-devel, linux-rockchip, Vicente Bergas, Jeffy Chen,
	Robin Murphy, Marc Zyngier, Brian Norris, Doug Anderson, stable,
	Heiko Stuebner

From: Vicente Bergas <vicencb@gmail.com>

As explained by Robin Murphy:
> the IOMMU shutdown disables paging, so if the VOP is still
> scanning out then that will result in whatever IOVAs it was using now going
> straight out onto the bus as physical addresses.

We had a more radical approach before in commit
7f3ef5dedb14 ("drm/rockchip: Allow driver to be shutdown on reboot/kexec")
but that resulted in new warnings and oopses on shutdown on rk3399
chromeos devices.

So second try is resurrecting Vicentes shutdown change which should
achieve the same result but in a less drastic way.

Fixes: 63238173b2fa ("Revert drm/rockchip: Allow driver to be shutdown on reboot/kexec")
Cc: Jeffy Chen <jeffy.chen@rock-chips.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Brian Norris <briannorris@chromium.org>
Cc: Doug Anderson <dianders@chromium.org>
Cc: stable@vger.kernel.org
Suggested-by: JeffyChen <jeffy.chen@rock-chips.com>
Suggested-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Vicente Bergas <vicencb@gmail.com>
[adapted commit message to explain the history]
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
index 8d7a634c12c2..cb938d3cd3c2 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -448,6 +448,14 @@ static int rockchip_drm_platform_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static void rockchip_drm_platform_shutdown(struct platform_device *pdev)
+{
+	struct drm_device *drm = platform_get_drvdata(pdev);
+
+	if (drm)
+		drm_atomic_helper_shutdown(drm);
+}
+
 static const struct of_device_id rockchip_drm_dt_ids[] = {
 	{ .compatible = "rockchip,display-subsystem", },
 	{ /* sentinel */ },
@@ -457,6 +465,7 @@ MODULE_DEVICE_TABLE(of, rockchip_drm_dt_ids);
 static struct platform_driver rockchip_drm_platform_driver = {
 	.probe = rockchip_drm_platform_probe,
 	.remove = rockchip_drm_platform_remove,
+	.shutdown = rockchip_drm_platform_shutdown,
 	.driver = {
 		.name = "rockchip-drm",
 		.of_match_table = rockchip_drm_dt_ids,
-- 
2.20.1


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

* [PATCH v2] drm/rockchip: shutdown drm subsystem on shutdown
@ 2019-04-02 11:37 ` Heiko Stuebner
  0 siblings, 0 replies; 6+ messages in thread
From: Heiko Stuebner @ 2019-04-02 11:37 UTC (permalink / raw)
  To: hjc-TNX95d0MmH7DzftRWevZcw
  Cc: Brian Norris, Heiko Stuebner, Marc Zyngier, Jeffy Chen,
	Doug Anderson, Vicente Bergas,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	stable-u79uwXL29TY76Z2rM5mHXA, Robin Murphy

From: Vicente Bergas <vicencb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

As explained by Robin Murphy:
> the IOMMU shutdown disables paging, so if the VOP is still
> scanning out then that will result in whatever IOVAs it was using now going
> straight out onto the bus as physical addresses.

We had a more radical approach before in commit
7f3ef5dedb14 ("drm/rockchip: Allow driver to be shutdown on reboot/kexec")
but that resulted in new warnings and oopses on shutdown on rk3399
chromeos devices.

So second try is resurrecting Vicentes shutdown change which should
achieve the same result but in a less drastic way.

Fixes: 63238173b2fa ("Revert drm/rockchip: Allow driver to be shutdown on reboot/kexec")
Cc: Jeffy Chen <jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
Cc: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>
Cc: Marc Zyngier <marc.zyngier-5wv7dgnIgG8@public.gmane.org>
Cc: Brian Norris <briannorris-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Cc: Doug Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Suggested-by: JeffyChen <jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
Suggested-by: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>
Signed-off-by: Vicente Bergas <vicencb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
[adapted commit message to explain the history]
Signed-off-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
---
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
index 8d7a634c12c2..cb938d3cd3c2 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -448,6 +448,14 @@ static int rockchip_drm_platform_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static void rockchip_drm_platform_shutdown(struct platform_device *pdev)
+{
+	struct drm_device *drm = platform_get_drvdata(pdev);
+
+	if (drm)
+		drm_atomic_helper_shutdown(drm);
+}
+
 static const struct of_device_id rockchip_drm_dt_ids[] = {
 	{ .compatible = "rockchip,display-subsystem", },
 	{ /* sentinel */ },
@@ -457,6 +465,7 @@ MODULE_DEVICE_TABLE(of, rockchip_drm_dt_ids);
 static struct platform_driver rockchip_drm_platform_driver = {
 	.probe = rockchip_drm_platform_probe,
 	.remove = rockchip_drm_platform_remove,
+	.shutdown = rockchip_drm_platform_shutdown,
 	.driver = {
 		.name = "rockchip-drm",
 		.of_match_table = rockchip_drm_dt_ids,
-- 
2.20.1

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

* Re: [PATCH v2] drm/rockchip: shutdown drm subsystem on shutdown
  2019-04-02 11:37 ` Heiko Stuebner
  (?)
@ 2019-04-12  1:54 ` Brian Norris
  -1 siblings, 0 replies; 6+ messages in thread
From: Brian Norris @ 2019-04-12  1:54 UTC (permalink / raw)
  To: Heiko Stuebner
  Cc: Sandy Huang, dri-devel, open list:ARM/Rockchip SoC...,
	Vicente Bergas, Jeffy Chen, Robin Murphy, Marc Zyngier,
	Doug Anderson, stable

On Tue, Apr 2, 2019 at 4:38 AM Heiko Stuebner <heiko@sntech.de> wrote:
>
> From: Vicente Bergas <vicencb@gmail.com>
>
> As explained by Robin Murphy:
> > the IOMMU shutdown disables paging, so if the VOP is still
> > scanning out then that will result in whatever IOVAs it was using now going
> > straight out onto the bus as physical addresses.
>
> We had a more radical approach before in commit
> 7f3ef5dedb14 ("drm/rockchip: Allow driver to be shutdown on reboot/kexec")
> but that resulted in new warnings and oopses on shutdown on rk3399
> chromeos devices.
>
> So second try is resurrecting Vicentes shutdown change which should
> achieve the same result but in a less drastic way.

Works without complaints on RK3399 Scarlet devices:

Tested-by: Brian Norris <briannorris@chromium.org>

Can't vouch for kexec.

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

* Re: [PATCH v2] drm/rockchip: shutdown drm subsystem on shutdown
  2019-04-02 11:37 ` Heiko Stuebner
  (?)
  (?)
@ 2019-04-12 17:43 ` Doug Anderson
  -1 siblings, 0 replies; 6+ messages in thread
From: Doug Anderson @ 2019-04-12 17:43 UTC (permalink / raw)
  To: Heiko Stuebner
  Cc: Sandy Huang, dri-devel, open list:ARM/Rockchip SoC...,
	Vicente Bergas, Jeffy Chen, Robin Murphy, Marc Zyngier,
	Brian Norris, Doug Anderson, stable

Hi,

On Tue, Apr 2, 2019 at 4:38 AM Heiko Stuebner <heiko@sntech.de> wrote:
>
> From: Vicente Bergas <vicencb@gmail.com>
>
> As explained by Robin Murphy:
> > the IOMMU shutdown disables paging, so if the VOP is still
> > scanning out then that will result in whatever IOVAs it was using now going
> > straight out onto the bus as physical addresses.
>
> We had a more radical approach before in commit
> 7f3ef5dedb14 ("drm/rockchip: Allow driver to be shutdown on reboot/kexec")
> but that resulted in new warnings and oopses on shutdown on rk3399
> chromeos devices.
>
> So second try is resurrecting Vicentes shutdown change which should
> achieve the same result but in a less drastic way.
>
> Fixes: 63238173b2fa ("Revert drm/rockchip: Allow driver to be shutdown on reboot/kexec")
> Cc: Jeffy Chen <jeffy.chen@rock-chips.com>
> Cc: Robin Murphy <robin.murphy@arm.com>
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> Cc: Brian Norris <briannorris@chromium.org>
> Cc: Doug Anderson <dianders@chromium.org>
> Cc: stable@vger.kernel.org
> Suggested-by: JeffyChen <jeffy.chen@rock-chips.com>
> Suggested-by: Robin Murphy <robin.murphy@arm.com>
> Signed-off-by: Vicente Bergas <vicencb@gmail.com>
> [adapted commit message to explain the history]
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> ---
>  drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 9 +++++++++
>  1 file changed, 9 insertions(+)

I picked this back to the Chrome OS 4.19 kernel and tried it on
rk3288-veyron-jerry.  Rebooting caused no complaints (I confirmed this
code was running by adding a printk).

I plugged in to an HDMI monitor.  Rebooting caused no complaints.

I then let the display idle off (just in case that mattered).  Again
no complaints.

Thus, in case it's helpful:

Tested-by: Douglas Anderson <dianders@chromium.org>

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

* Re: [PATCH v2] drm/rockchip: shutdown drm subsystem on shutdown
  2019-04-02 11:37 ` Heiko Stuebner
                   ` (2 preceding siblings ...)
  (?)
@ 2019-04-17 10:05 ` Marc Zyngier
  -1 siblings, 0 replies; 6+ messages in thread
From: Marc Zyngier @ 2019-04-17 10:05 UTC (permalink / raw)
  To: Heiko Stuebner, hjc
  Cc: dri-devel, linux-rockchip, Vicente Bergas, Jeffy Chen,
	Robin Murphy, Brian Norris, Doug Anderson, stable

Hi Heiko,

On 02/04/2019 12:37, Heiko Stuebner wrote:
> From: Vicente Bergas <vicencb@gmail.com>
> 
> As explained by Robin Murphy:
>> the IOMMU shutdown disables paging, so if the VOP is still
>> scanning out then that will result in whatever IOVAs it was using now going
>> straight out onto the bus as physical addresses.
> 
> We had a more radical approach before in commit
> 7f3ef5dedb14 ("drm/rockchip: Allow driver to be shutdown on reboot/kexec")
> but that resulted in new warnings and oopses on shutdown on rk3399
> chromeos devices.
> 
> So second try is resurrecting Vicentes shutdown change which should
> achieve the same result but in a less drastic way.
> 
> Fixes: 63238173b2fa ("Revert drm/rockchip: Allow driver to be shutdown on reboot/kexec")
> Cc: Jeffy Chen <jeffy.chen@rock-chips.com>
> Cc: Robin Murphy <robin.murphy@arm.com>
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> Cc: Brian Norris <briannorris@chromium.org>
> Cc: Doug Anderson <dianders@chromium.org>
> Cc: stable@vger.kernel.org
> Suggested-by: JeffyChen <jeffy.chen@rock-chips.com>
> Suggested-by: Robin Murphy <robin.murphy@arm.com>
> Signed-off-by: Vicente Bergas <vicencb@gmail.com>
> [adapted commit message to explain the history]
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>

Sorry it took so long to test this. I've just given it a go on kevin,
and managed to kexec into a secondary kernel. So FWIW:

Acked-by: Marc Zyngier <marc.zyngier@arm.com>

	M.
-- 
Jazz is not dead. It just smells funny...

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

* Re: [PATCH v2] drm/rockchip: shutdown drm subsystem on shutdown
  2019-04-02 11:37 ` Heiko Stuebner
                   ` (3 preceding siblings ...)
  (?)
@ 2019-04-18  8:32 ` Heiko Stuebner
  -1 siblings, 0 replies; 6+ messages in thread
From: Heiko Stuebner @ 2019-04-18  8:32 UTC (permalink / raw)
  To: hjc
  Cc: dri-devel, linux-rockchip, Vicente Bergas, Jeffy Chen,
	Robin Murphy, Marc Zyngier, Brian Norris, Doug Anderson, stable

Am Dienstag, 2. April 2019, 13:37:53 CEST schrieb Heiko Stuebner:
> From: Vicente Bergas <vicencb@gmail.com>
> 
> As explained by Robin Murphy:
> > the IOMMU shutdown disables paging, so if the VOP is still
> > scanning out then that will result in whatever IOVAs it was using now going
> > straight out onto the bus as physical addresses.
> 
> We had a more radical approach before in commit
> 7f3ef5dedb14 ("drm/rockchip: Allow driver to be shutdown on reboot/kexec")
> but that resulted in new warnings and oopses on shutdown on rk3399
> chromeos devices.
> 
> So second try is resurrecting Vicentes shutdown change which should
> achieve the same result but in a less drastic way.
> 
> Fixes: 63238173b2fa ("Revert drm/rockchip: Allow driver to be shutdown on reboot/kexec")
> Cc: Jeffy Chen <jeffy.chen@rock-chips.com>
> Cc: Robin Murphy <robin.murphy@arm.com>
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> Cc: Brian Norris <briannorris@chromium.org>
> Cc: Doug Anderson <dianders@chromium.org>
> Cc: stable@vger.kernel.org
> Suggested-by: JeffyChen <jeffy.chen@rock-chips.com>
> Suggested-by: Robin Murphy <robin.murphy@arm.com>
> Signed-off-by: Vicente Bergas <vicencb@gmail.com>
> [adapted commit message to explain the history]
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>

applied to drm-misc-next

Not fixes, to give it more exposure this time. It still has a stable tag
so should nevertheless trickle down to stable in time as well.

Thanks for all the testing
Heiko



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

end of thread, other threads:[~2019-04-18  8:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-02 11:37 [PATCH v2] drm/rockchip: shutdown drm subsystem on shutdown Heiko Stuebner
2019-04-02 11:37 ` Heiko Stuebner
2019-04-12  1:54 ` Brian Norris
2019-04-12 17:43 ` Doug Anderson
2019-04-17 10:05 ` Marc Zyngier
2019-04-18  8:32 ` Heiko Stuebner

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.