Skip to contentSkip to conversation

drm/rockchip: shutdown drm subsystem on shutdown

PATCH Applied Heiko Stuebner 5 participants 5 messages Apr 2, 2019 – Apr 18, 2019

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/rockchip: shutdown drm subsystem on shutdown

From: Vicente Bergas <[email protected]>

As explained by Robin Murphy:

Quoted 3 lines

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 <[email protected]>
Cc Robin Murphy <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Brian Norris <[email protected]>
Cc Doug Anderson <[email protected]>
[adapted commit message to explain the history]
---
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +9 -0
index 8d7a634c12c2..cb938d3cd3c2 100644
@@ -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,
Signature · 1 line
2.20.1
Tested-by on v2 1/1
#1 lore raw
Quoted 8 lines · Heiko Stuebner

From: Vicente Bergas <[email protected]>

As explained by Robin Murphy:

Quoted 3 lines

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.

Quoted 7 lines

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:

Can't vouch for kexec.

Tested-by on v2 1/1
#2 lore raw
In reply to Heiko Stuebner

Hi,

Quoted 28 lines · Heiko Stuebner

From: Vicente Bergas <[email protected]>

As explained by Robin Murphy:

Quoted 3 lines

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 <[email protected]>
Cc Robin Murphy <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Brian Norris <[email protected]>
Cc Doug Anderson <[email protected]>
[adapted commit message to explain the history]
Quoted 3 lines
---
 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:

Acked-by on v2 1/1
#3 lore raw
In reply to Heiko Stuebner

Hi Heiko,

Quoted 15 lines · Heiko Stuebner

From: Vicente Bergas <[email protected]>

As explained by Robin Murphy:

Quoted 3 lines

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.

Quoted 12 lines
Fixes 63238173b2fa ("Revert drm/rockchip: Allow driver to be shutdown on reboot/kexec")
Cc Jeffy Chen <[email protected]>
Cc Robin Murphy <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Brian Norris <[email protected]>
Cc Doug Anderson <[email protected]>
[adapted commit message to explain the history]

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:

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
maintainer Applied
#4 lore raw
In reply to Heiko Stuebner

Am Dienstag, 2. April 2019, 13:37:53 CEST schrieb Heiko Stuebner:

Quoted 15 lines

From: Vicente Bergas <[email protected]>

As explained by Robin Murphy:

Quoted 3 lines

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.

Quoted 12 lines
Fixes 63238173b2fa ("Revert drm/rockchip: Allow driver to be shutdown on reboot/kexec")
Cc Jeffy Chen <[email protected]>
Cc Robin Murphy <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Brian Norris <[email protected]>
Cc Doug Anderson <[email protected]>
[adapted commit message to explain the history]

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