Skip to contentSkip to conversation

HDMI breakage just before poweroff

regression In review Vicente Bergas 6 participants 30 messages May 2, 2018 – Sep 10, 2018 22 messages not in the archive

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

Hello,
on rk3399-sapphire there is a missing feature: the poweroff command is unable to poweroff the system and the display stays on. When the system is halted, power needs to be removed manually.

With Linux kernel 4.16, when reaching the halted state, the HDMI console shows the last messages before halting.

With 4.17.0-rc3, when reaching the halted state, the HDMI console shows colorful static noise.

Regards,
Vicente.

A message that is not in the archive (sent off-list or not yet received): CAAMcf8D86ssM+YeFAXaYDm9QwwAQLdaOgWyC2F8yQ-_-UNyY+A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#2 lore raw

Hi Vincente,

Thanks for your mail.

Quoted 4 lines · Vicente Bergas

Hello,
on rk3399-sapphire there is a missing feature: the poweroff command is unable to poweroff the system and the display stays on. When the system is halted, power needs to be removed manually.

according to the dtsi, the rk3399-sapphire is using rk808 pimc right?

i think the power off flow would be:
1/ rk808 set the pm_power_off callback:
drivers/mfd/rk808.c

        switch (rk808->variant) {
        case RK805_ID:
	...
                pm_pwroff_fn = rk805_device_shutdown;
	...

        pm_off = of_property_read_bool(np,
                                "rockchip,system-power-controller");
        if (pm_off && !pm_power_off) {
                rk808_i2c_client = client;
                pm_power_off = pm_pwroff_fn;
        }

2/ the poweroff command would call kernel_power_off:
kernel/reboot.c:
void kernel_power_off(void)
{
...

        machine_power_off();
}

3/ arm64's machine_power_off() would call pm_power_off to let rk808 cutoff the power.

Quoted 3 lines

With Linux kernel 4.16, when reaching the halted state, the HDMI console shows the last messages before halting.

if it ends up halted, maybe something wrong during setup the pm_power_off? kernel/reboot.c:

        /* Instead of trying to make the power_off code look like
         * halt when pm_power_off is not set do it the easy way.
         */
        if ((cmd == LINUX_REBOOT_CMD_POWER_OFF) && !pm_power_off)
                cmd = LINUX_REBOOT_CMD_HALT;
Quoted 4 lines

With 4.17.0-rc3, when reaching the halted state, the HDMI console shows colorful static noise.

we've added a shutdown() to the iommu driver:
https://patchwork.kernel.org/patch/10230817/

any chance related?

Quoted 5 lines

Regards,
Vicente.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 35 lines · JeffyChen

Hi Vincente,

Thanks for your mail.

Quoted 4 lines · Vicente Bergas

Hello,
on rk3399-sapphire there is a missing feature: the poweroff command is unable to poweroff the system and the display stays on. When the system is halted, power needs to be removed manually.

according to the dtsi, the rk3399-sapphire is using rk808 pimc right?

i think the power off flow would be:
1/ rk808 set the pm_power_off callback:
drivers/mfd/rk808.c
        switch (rk808->variant) {
        case RK805_ID:
    ...
                pm_pwroff_fn = rk805_device_shutdown;
    ...

        pm_off = of_property_read_bool(np, "rockchip,system-power-controller"); if (pm_off && !pm_power_off) {
                rk808_i2c_client = client;
                pm_power_off = pm_pwroff_fn;
        }

2/ the poweroff command would call kernel_power_off:
kernel/reboot.c:
void kernel_power_off(void)
{
...
        machine_power_off();
}

Quoted 1 line

3/ arm64's machine_power_off() would call pm_power_off to let rk808 cutoff the power.

Doesn't PSCI's pm_power_off take precedence, though? This sounds similar to what my RK3328 does - I looked into that briefly a while ago, and from what I remember it appeared that the firmware SYSTEM_OFF handler tries to turn off the PMIC by driving the SLEEP pin, but the kernel driver never actually configures it into the correct mode for that to work. Thus the box just ends up spinning in the firmware until you pull the plug manually.

Quoted 11 lines
Quoted 2 lines

With Linux kernel 4.16, when reaching the halted state, the HDMI console shows the last messages before halting.

if it ends up halted, maybe something wrong during setup the pm_power_off? kernel/reboot.c:
        /* Instead of trying to make the power_off code look like
         * halt when pm_power_off is not set do it the easy way. */
        if ((cmd == LINUX_REBOOT_CMD_POWER_OFF) && !pm_power_off) cmd = LINUX_REBOOT_CMD_HALT;

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

With 4.17.0-rc3, when reaching the halted state, the HDMI console shows colorful static noise.

we've added a shutdown() to the iommu driver:
https://patchwork.kernel.org/patch/10230817/

any chance related?

For sure - 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. Between the RK3399 memory map and the way the IOVA allocator works, that probably means it's reading from all over the peripherals region, which, er, isn't ideal.

Robin.

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

A message that is not in the archive (sent off-list or not yet received): 0284fa4f-abd6-26f6-31e2-1a6d24777733-5wv7dgnIgG8@public.gmane.org

#6 lore raw

Hi Robin,

Quoted 39 lines · Robin Murphy
Quoted 32 lines · JeffyChen

Hi Vincente,

Thanks for your mail.

Quoted 4 lines · Vicente Bergas

Hello,
on rk3399-sapphire there is a missing feature: the poweroff command is unable to poweroff the system and the display stays on. When the system is halted, power needs to be removed manually.

according to the dtsi, the rk3399-sapphire is using rk808 pimc right?

i think the power off flow would be:
1/ rk808 set the pm_power_off callback:
drivers/mfd/rk808.c

         switch (rk808->variant) {
         case RK805_ID:
     ...
                 pm_pwroff_fn = rk805_device_shutdown;
     ...

         pm_off = of_property_read_bool(np,
                                 "rockchip,system-power-controller");
         if (pm_off && !pm_power_off) {
                 rk808_i2c_client = client;
                 pm_power_off = pm_pwroff_fn;
         }

2/ the poweroff command would call kernel_power_off:
kernel/reboot.c:
void kernel_power_off(void)
{
...

Quoted 5 lines
         machine_power_off();
}

3/ arm64's machine_power_off() would call pm_power_off to let rk808 cutoff the power.

Quoted 7 lines

Doesn't PSCI's pm_power_off take precedence, though? This sounds similar to what my RK3328 does - I looked into that briefly a while ago, and from what I remember it appeared that the firmware SYSTEM_OFF handler tries to turn off the PMIC by driving the SLEEP pin, but the kernel driver never actually configures it into the correct mode for that to work. Thus the box just ends up spinning in the firmware until you pull the plug manually.

hmmm, right, it should be psci's power off.

and i checked the BSP kernel, the rk808 driver switched to use pm_power_off_prepare and syscore_ops->shutdown there

Quoted 32 lines
Quoted 13 lines
Quoted 3 lines

With Linux kernel 4.16, when reaching the halted state, the HDMI console shows the last messages before halting.

if it ends up halted, maybe something wrong during setup the pm_power_off?
kernel/reboot.c:

         /* Instead of trying to make the power_off code look like
          * halt when pm_power_off is not set do it the easy way.
          */
         if ((cmd == LINUX_REBOOT_CMD_POWER_OFF) && !pm_power_off)
                 cmd = LINUX_REBOOT_CMD_HALT;
Quoted 1 line
Quoted 7 lines
Quoted 3 lines

With 4.17.0-rc3, when reaching the halted state, the HDMI console shows colorful static noise.

we've added a shutdown() to the iommu driver:
https://patchwork.kernel.org/patch/10230817/

any chance related?

For sure - 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. Between the RK3399 memory map and the way the IOVA allocator works, that probably means it's reading from all over the peripherals region, which, er, isn't ideal.

Robin.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw

Hi,

Quoted 57 lines · JeffyChen

Hi Robin,

Quoted 44 lines · Robin Murphy
Quoted 35 lines · JeffyChen

Hi Vincente,

Thanks for your mail.

Quoted 5 lines · Vicente Bergas

Hello,
on rk3399-sapphire there is a missing feature: the poweroff command is unable to poweroff the system and the display stays on. When the system is halted, power needs to be removed manually.

according to the dtsi, the rk3399-sapphire is using rk808 pimc right?

i think the power off flow would be:
1/ rk808 set the pm_power_off callback:
drivers/mfd/rk808.c

         switch (rk808->variant) {
         case RK805_ID:
     ...
                 pm_pwroff_fn = rk805_device_shutdown;
     ...

         pm_off = of_property_read_bool(np,
                                 "rockchip,system-power-controller");
         if (pm_off && !pm_power_off) {
                 rk808_i2c_client = client;
                 pm_power_off = pm_pwroff_fn;
         }

2/ the poweroff command would call kernel_power_off:
kernel/reboot.c:
void kernel_power_off(void)
{
...

Quoted 5 lines
         machine_power_off();
}

3/ arm64's machine_power_off() would call pm_power_off to let rk808 cutoff the power.

Quoted 7 lines

Doesn't PSCI's pm_power_off take precedence, though? This sounds similar to what my RK3328 does - I looked into that briefly a while ago, and from what I remember it appeared that the firmware SYSTEM_OFF handler tries to turn off the PMIC by driving the SLEEP pin, but the kernel driver never actually configures it into the correct mode for that to work. Thus the box just ends up spinning in the firmware until you pull the plug manually.

Quoted 5 lines

hmmm, right, it should be psci's power off.

and i checked the BSP kernel, the rk808 driver switched to use pm_power_off_prepare and syscore_ops->shutdown there

PSCI? that is provided by the ATF (ARM Trusted Firmware), right? The Sapphire board this issue appears on has:
1.- As first stage loader the SPL (Secondary Program Loader) from rkbin [1]. 2.- As second stage loader the the ATF from rkbin [1].
3.- As third stage loader mainline u-boot.

I would strongly like to use open source and preferably mainline SPL and ATF, but had no success when trying a few months back.

Regards,
Vicente.

[1] https://github.com/rockchip-linux/rkbin

Quoted 37 lines
Quoted 35 lines
Quoted 15 lines
Quoted 4 lines

With Linux kernel 4.16, when reaching the halted state, the HDMI console shows the last messages before halting.

if it ends up halted, maybe something wrong during setup the pm_power_off?
kernel/reboot.c:

         /* Instead of trying to make the power_off code look like
          * halt when pm_power_off is not set do it the easy way.
          */
         if ((cmd == LINUX_REBOOT_CMD_POWER_OFF) && !pm_power_off)
                 cmd = LINUX_REBOOT_CMD_HALT;
Quoted 1 line
Quoted 7 lines
Quoted 3 lines

With 4.17.0-rc3, when reaching the halted state, the HDMI console shows colorful static noise.

we've added a shutdown() to the iommu driver:
https://patchwork.kernel.org/patch/10230817/

any chance related?

For sure - 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. Between the RK3399 memory map and the way the IOVA allocator works, that probably means it's reading from all over the peripherals region, which, er, isn't ideal.

Robin.

#9 lore raw
In reply to a message not in the archive
Quoted 71 lines · Robin Murphy
Quoted 35 lines · JeffyChen

Hi Vincente,

Thanks for your mail.

Quoted 5 lines · Vicente Bergas

Hello,
on rk3399-sapphire there is a missing feature: the poweroff command is unable to poweroff the system and the display stays on. When the system is halted, power needs to be removed manually.

according to the dtsi, the rk3399-sapphire is using rk808 pimc right?

i think the power off flow would be:
1/ rk808 set the pm_power_off callback:
drivers/mfd/rk808.c

         switch (rk808->variant) {
         case RK805_ID:
     ...
                 pm_pwroff_fn = rk805_device_shutdown;
     ...

         pm_off = of_property_read_bool(np,
                                 "rockchip,system-power-controller");
         if (pm_off && !pm_power_off) {
                 rk808_i2c_client = client;
                 pm_power_off = pm_pwroff_fn;
         }

2/ the poweroff command would call kernel_power_off:
kernel/reboot.c:
void kernel_power_off(void)
{
...

Quoted 5 lines
         machine_power_off();
}

3/ arm64's machine_power_off() would call pm_power_off to let rk808 cutoff the power.

Doesn't PSCI's pm_power_off take precedence, though? This sounds similar to what my RK3328 does - I looked into that briefly a while ago, and from what I remember it appeared that the firmware SYSTEM_OFF handler tries to turn off the PMIC by driving the SLEEP pin, but the kernel driver never actually configures it into the correct mode for that to work. Thus the box just ends up spinning in the firmware until you pull the plug manually.

Quoted 12 lines
Quoted 2 lines

With Linux kernel 4.16, when reaching the halted state, the HDMI console shows the last messages before halting.

if it ends up halted, maybe something wrong during setup the pm_power_off? kernel/reboot.c:

         /* Instead of trying to make the power_off code look like
          * halt when pm_power_off is not set do it the easy way.
          */
         if ((cmd == LINUX_REBOOT_CMD_POWER_OFF) && !pm_power_off)
                 cmd = LINUX_REBOOT_CMD_HALT;
Quoted 1 line
Quoted 7 lines
Quoted 3 lines

With 4.17.0-rc3, when reaching the halted state, the HDMI console shows colorful static noise.

we've added a shutdown() to the iommu driver:
https://patchwork.kernel.org/patch/10230817/

any chance related?

Quoted 7 lines

For sure - 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. Between the RK3399 memory map and the way the IOVA allocator works, that probably means it's reading from all over the peripherals region, which, er, isn't ideal.

Robin.

I can confirm that

drivers/iommu/rockchip-iommu.c +0 -1
@@ -1269,7 +1264,6 @@ MODULE_DEVICE_TABLE(of, rk_iommu_dt_ids);
 
 static struct platform_driver rk_iommu_driver = {
     .probe = rk_iommu_probe,
-    .shutdown = rk_iommu_shutdown,
     .driver = {
            .name = "rk_iommu",
            .of_match_table = rk_iommu_dt_ids,

fixes the HDMI issue.

Regards,
Vicente.

#10 lore raw
In reply to a message not in the archive
Quoted 2 lines · Robin Murphy
Quoted 1 line · JeffyChen

On 05/03/2018 03:36 AM, Vicente Bergas wrote:

[snip]

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

With 4.17.0-rc3, when reaching the halted state, the HDMI console shows colorful static noise.

we've added a shutdown() to the iommu driver:
https://patchwork.kernel.org/patch/10230817/

Quoted 7 lines
Quoted 1 line

any chance related?

For sure - 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. Between the RK3399 memory map and the way the IOVA allocator works, that probably means it's reading from all over the peripherals region, which, er, isn't ideal.

Hi,
just wondering if there has been any progress on that front?

Regards,
Vicente.

A message that is not in the archive (sent off-list or not yet received): CAAMcf8BJ1skbmR7AazyTPkkdyMoyuA0ihj=Gbnhb9nKWf3FSGg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#12 lore raw

Hi Vicente,

Quoted 12 lines · Vicente Bergas
Quoted 2 lines · Robin Murphy
Quoted 1 line · JeffyChen

On 05/03/2018 03:36 AM, Vicente Bergas wrote:

[snip]

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

With 4.17.0-rc3, when reaching the halted state, the HDMI console shows colorful static noise.

we've added a shutdown() to the iommu driver:
https://patchwork.kernel.org/patch/10230817/

any chance related?

Quoted 9 lines
Quoted 5 lines

For sure - 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. Between the RK3399 memory map and the way the IOVA allocator works, that probably means it's reading from all over the peripherals region, which, er, isn't ideal.

Hi,
just wondering if there has been any progress on that front?

maybe we can add .shutdown() to rockchip_drm_drv too? (maybe just call drm_atomic_helper_shutdown())

could you help to try this hack:

+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -451,6 +451,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_remove,

Quoted 5 lines

Regards,
Vicente.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#14 lore raw
Quoted 32 lines · JeffyChen

Hi Vicente,

Quoted 12 lines · Vicente Bergas
Quoted 2 lines · Robin Murphy
Quoted 1 line · JeffyChen

On 05/03/2018 03:36 AM, Vicente Bergas wrote:

[snip]

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

With 4.17.0-rc3, when reaching the halted state, the HDMI console shows colorful static noise.

we've added a shutdown() to the iommu driver:
https://patchwork.kernel.org/patch/10230817/

any chance related?

Quoted 9 lines
Quoted 5 lines

For sure - 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. Between the RK3399 memory map and the way the IOVA allocator works, that probably means it's reading from all over the peripherals region, which, er, isn't ideal.

Hi,
just wondering if there has been any progress on that front?

maybe we can add .shutdown() to rockchip_drm_drv too? (maybe just call drm_atomic_helper_shutdown())

could you help to try this hack:

+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c

Review MODULE_DEVICE_TABLE(of, rockchip_drm_dt_ids); · line 455

Quoted 5 lines
(quoted diff) +1 -0
@@ -451,6 +451,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_remove,
 

Is there any mechanism guaranteeing the ordering of shutdown between VOP and IOMMU?

Thanks,

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...

A message that is not in the archive (sent off-list or not yet received): 77e4c6e1-015f-5fac-66b6-c942bb2dc9d8-5wv7dgnIgG8@public.gmane.org

#16 lore raw

Hi Marc,

Quoted 31 lines · Marc Zyngier
Quoted 30 lines · JeffyChen

Hi Vicente,

Quoted 12 lines · Vicente Bergas
Quoted 2 lines · Robin Murphy
Quoted 1 line · JeffyChen

On 05/03/2018 03:36 AM, Vicente Bergas wrote:

[snip]

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

With 4.17.0-rc3, when reaching the halted state, the HDMI console shows colorful static noise.

we've added a shutdown() to the iommu driver:
https://patchwork.kernel.org/patch/10230817/

any chance related?

Quoted 9 lines
Quoted 5 lines

For sure - 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. Between the RK3399 memory map and the way the IOVA allocator works, that probably means it's reading from all over the peripherals region, which, er, isn't ideal.

Hi,
just wondering if there has been any progress on that front?

maybe we can add .shutdown() to rockchip_drm_drv too? (maybe just call drm_atomic_helper_shutdown())

could you help to try this hack:

Quoted 10 lines

Review MODULE_DEVICE_TABLE(of, rockchip_drm_dt_ids); · line 455

Quoted 7 lines

+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c

(quoted diff) +1 -0
@@ -451,6 +451,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_remove,
 

Is there any mechanism guaranteeing the ordering of shutdown between VOP and IOMMU?

it seems like the device_shutdown() will walk the devices_kset->list backward.

and the devices_kset->list's order is based on the probe order(drivers/base/dd.c -> really_probe() -> devices_kset_move_last())

and we are using of_iommu for rockchip-iommu, which would make sure iommu probed before iommu master, so the vop iommu would be shutdown after vop

Quoted 5 lines

Thanks,

	M.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#18 lore raw
Quoted 49 lines · JeffyChen

Hi Marc,

Quoted 31 lines · Marc Zyngier
Quoted 30 lines · JeffyChen

Hi Vicente,

Quoted 12 lines · Vicente Bergas
Quoted 2 lines · Robin Murphy
Quoted 1 line · JeffyChen

On 05/03/2018 03:36 AM, Vicente Bergas wrote:

[snip]

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

With 4.17.0-rc3, when reaching the halted state, the HDMI console shows colorful static noise.

we've added a shutdown() to the iommu driver:
https://patchwork.kernel.org/patch/10230817/

any chance related?

Quoted 9 lines
Quoted 5 lines

For sure - 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. Between the RK3399 memory map and the way the IOVA allocator works, that probably means it's reading from all over the peripherals region, which, er, isn't ideal.

Hi,
just wondering if there has been any progress on that front?

maybe we can add .shutdown() to rockchip_drm_drv too? (maybe just call drm_atomic_helper_shutdown())

could you help to try this hack:

Quoted 10 lines

Review MODULE_DEVICE_TABLE(of, rockchip_drm_dt_ids); · line 455

Quoted 7 lines

+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c

(quoted diff) +1 -0
@@ -451,6 +451,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_remove,
 

Is there any mechanism guaranteeing the ordering of shutdown between VOP and IOMMU?

it seems like the device_shutdown() will walk the devices_kset->list backward.

Quoted 6 lines

and the devices_kset->list's order is based on the probe order(drivers/base/dd.c -> really_probe() -> devices_kset_move_last())

and we are using of_iommu for rockchip-iommu, which would make sure iommu probed before iommu master, so the vop iommu would be shutdown after vop

Rather than shutting down the IOMMU, shouldn't we shut down all the respective master? The latter would automatically imply shutting down the IOMMUs, so we could remove the shutdown callback from the IOMMU driver.

Best regards,
Tomasz

A message that is not in the archive (sent off-list or not yet received): CAAFQd5D__ArEYSVoWL5A40X6vbYxJ-vOYpsXxiLujC-XK9u2+A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#20 lore raw
Quoted 54 lines · Tomasz Figa
Quoted 52 lines · JeffyChen

Hi Marc,

Quoted 31 lines · Marc Zyngier
Quoted 30 lines · JeffyChen

Hi Vicente,

Quoted 12 lines · Vicente Bergas
Quoted 2 lines · Robin Murphy
Quoted 1 line · JeffyChen

On 05/03/2018 03:36 AM, Vicente Bergas wrote:

[snip]

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

With 4.17.0-rc3, when reaching the halted state, the HDMI console shows colorful static noise.

we've added a shutdown() to the iommu driver:
https://patchwork.kernel.org/patch/10230817/

any chance related?

Quoted 9 lines
Quoted 5 lines

For sure - 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. Between the RK3399 memory map and the way the IOVA allocator works, that probably means it's reading from all over the peripherals region, which, er, isn't ideal.

Hi,
just wondering if there has been any progress on that front?

maybe we can add .shutdown() to rockchip_drm_drv too? (maybe just call drm_atomic_helper_shutdown())

could you help to try this hack:

Quoted 10 lines

Review MODULE_DEVICE_TABLE(of, rockchip_drm_dt_ids); · line 455

Quoted 7 lines

+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c

(quoted diff) +1 -0
@@ -451,6 +451,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_remove,
 

Is there any mechanism guaranteeing the ordering of shutdown between VOP and IOMMU?

it seems like the device_shutdown() will walk the devices_kset->list backward.

and the devices_kset->list's order is based on the probe order(drivers/base/dd.c -> really_probe() -> devices_kset_move_last())

Quoted 8 lines
Quoted 3 lines

and we are using of_iommu for rockchip-iommu, which would make sure iommu probed before iommu master, so the vop iommu would be shutdown after vop

Rather than shutting down the IOMMU, shouldn't we shut down all the respective master? The latter would automatically imply shutting down the IOMMUs, so we could remove the shutdown callback from the IOMMU driver.

As long as you can definitely ensure that you cannot have a active IOMMU by the time you hit reboot/halt/kexec, that should work. But experience seems to indicate that this is not a universal truth.

I'd be more confident if we had some form of fallback that would work in the kexec/kdump use case.

Thanks,

	M.
Signature · 1 line
Jazz is not dead, it just smell funny.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#22 lore raw
Quoted 72 lines · Marc Zyngier
Quoted 54 lines · Tomasz Figa
Quoted 52 lines · JeffyChen

Hi Marc,

Quoted 31 lines · Marc Zyngier
Quoted 30 lines · JeffyChen

Hi Vicente,

Quoted 12 lines · Vicente Bergas
Quoted 2 lines · Robin Murphy
Quoted 1 line · JeffyChen

On 05/03/2018 03:36 AM, Vicente Bergas wrote:

[snip]

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

With 4.17.0-rc3, when reaching the halted state, the HDMI console shows colorful static noise.

we've added a shutdown() to the iommu driver:
https://patchwork.kernel.org/patch/10230817/

any chance related?

Quoted 9 lines
Quoted 5 lines

For sure - 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. Between the RK3399 memory map and the way the IOVA allocator works, that probably means it's reading from all over the peripherals region, which, er, isn't ideal.

Hi,
just wondering if there has been any progress on that front?

maybe we can add .shutdown() to rockchip_drm_drv too? (maybe just call drm_atomic_helper_shutdown())

could you help to try this hack:

Quoted 10 lines

Review MODULE_DEVICE_TABLE(of, rockchip_drm_dt_ids); · line 455

Quoted 7 lines

+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c

(quoted diff) +1 -0
@@ -451,6 +451,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_remove,
 

Is there any mechanism guaranteeing the ordering of shutdown between VOP and IOMMU?

it seems like the device_shutdown() will walk the devices_kset->list backward.

and the devices_kset->list's order is based on the probe order(drivers/base/dd.c -> really_probe() -> devices_kset_move_last())

Quoted 8 lines
Quoted 3 lines

and we are using of_iommu for rockchip-iommu, which would make sure iommu probed before iommu master, so the vop iommu would be shutdown after vop

Rather than shutting down the IOMMU, shouldn't we shut down all the respective master? The latter would automatically imply shutting down the IOMMUs, so we could remove the shutdown callback from the IOMMU driver.

As long as you can definitely ensure that you cannot have a active IOMMU by the time you hit reboot/halt/kexec, that should work. But experience seems to indicate that this is not a universal truth.

I'd be more confident if we had some form of fallback that would work in the kexec/kdump use case.

Quoted 6 lines

Thanks,

        M.

--
Jazz is not dead, it just smell funny.

Hi,
just tested it.
There was an issue because of 'incompatible pointer type', see the proper patch at the bottom.

It seems to do what it is expected to do, that is, it shuts down the display. I am not sure that this is what is wanted.
When the system is in the halted state, should not it show the last messages? For this, the display needs to be operational.

Regards,
Vicente.

drivers/gpu/drm/rockchip/rockchip_drm_drv.c +1 -0
@@ -451,6 +451,7 @@
 static struct platform_driver rockchip_drm_platform_driver = {
     .probe = rockchip_drm_platform_probe,
     .remove = rockchip_drm_platform_remove,
+    .shutdown = (void (*)(struct platform_device

*))rockchip_drm_platform_remove,

     .driver = {
         .name = "rockchip-drm",
         .of_match_table = rockchip_drm_dt_ids,

A message that is not in the archive (sent off-list or not yet received): CAAMcf8AmuMStdSUHGEQhii7BUtTRHOSyLhop43rf_nX0GROnnw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#24 lore raw
Quoted 85 lines · Vicente Bergas
Quoted 72 lines · Marc Zyngier
Quoted 54 lines · Tomasz Figa
Quoted 52 lines · JeffyChen

Hi Marc,

Quoted 31 lines · Marc Zyngier
Quoted 30 lines · JeffyChen

Hi Vicente,

Quoted 12 lines · Vicente Bergas
Quoted 2 lines · Robin Murphy
Quoted 1 line · JeffyChen

On 05/03/2018 03:36 AM, Vicente Bergas wrote:

[snip]

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

With 4.17.0-rc3, when reaching the halted state, the HDMI console shows colorful static noise.

we've added a shutdown() to the iommu driver:
https://patchwork.kernel.org/patch/10230817/

any chance related?

Quoted 9 lines
Quoted 5 lines

For sure - 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. Between the RK3399 memory map and the way the IOVA allocator works, that probably means it's reading from all over the peripherals region, which, er, isn't ideal.

Hi,
just wondering if there has been any progress on that front?

maybe we can add .shutdown() to rockchip_drm_drv too? (maybe just call drm_atomic_helper_shutdown())

could you help to try this hack:

Quoted 10 lines

drivers/gpu/drm/rockchip/rockchip_drm_drv.c MODULE_DEVICE_TABLE(of, rockchip_drm_dt_ids); · line 455

Quoted 7 lines

+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c

drivers/gpu/drm/rockchip/rockchip_drm_drv.c +1 -0
@@ -451,6 +451,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_remove,
 

Is there any mechanism guaranteeing the ordering of shutdown between VOP and IOMMU?

it seems like the device_shutdown() will walk the devices_kset->list backward.

and the devices_kset->list's order is based on the probe order(drivers/base/dd.c -> really_probe() -> devices_kset_move_last())

Quoted 8 lines
Quoted 3 lines

and we are using of_iommu for rockchip-iommu, which would make sure iommu probed before iommu master, so the vop iommu would be shutdown after vop

Rather than shutting down the IOMMU, shouldn't we shut down all the respective master? The latter would automatically imply shutting down the IOMMUs, so we could remove the shutdown callback from the IOMMU driver.

As long as you can definitely ensure that you cannot have a active IOMMU by the time you hit reboot/halt/kexec, that should work. But experience seems to indicate that this is not a universal truth.

I'd be more confident if we had some form of fallback that would work in the kexec/kdump use case.

Quoted 6 lines

Thanks,

        M.

--
Jazz is not dead, it just smell funny.

Hi,
just tested it.
There was an issue because of 'incompatible pointer type', see the proper patch at the bottom.

Quoted 4 lines

It seems to do what it is expected to do, that is, it shuts down the display. I am not sure that this is what is wanted.
When the system is in the halted state, should not it show the last messages? For this, the display needs to be operational.

Well, we can't have everything, unfortunately. We definitely need to stop the IOMMU in order to kexec safely, which is an important use-case.

A possibility would be to switch to a directly mapped buffer on shutdown, but I'm not sure how we can enforce that at this stage.

drivers/gpu/drm/rockchip/rockchip_drm_drv.c line 455

Quoted 12 lines

Regards,
Vicente.

drivers/gpu/drm/rockchip/rockchip_drm_drv.c +1 -0
@@ -451,6 +451,7 @@
 static struct platform_driver rockchip_drm_platform_driver = {
     .probe = rockchip_drm_platform_probe,
     .remove = rockchip_drm_platform_remove,
+    .shutdown = (void (*)(struct platform_device
 *))rockchip_drm_platform_remove,

No, please... :-( Provide a wrapper that returns void instead.

Quoted 4 lines
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +0 -0
     .driver = {
         .name = "rockchip-drm",

.of_match_table = rockchip_drm_dt_ids,

Thanks,

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...

A message that is not in the archive (sent off-list or not yet received): cc147c40-dbad-b714-3fe6-858854a56004-5wv7dgnIgG8@public.gmane.org

#26 lore raw

Hi Marc & Vicente,

Quoted 10 lines · Marc Zyngier
Quoted 9 lines

drivers/gpu/drm/rockchip/rockchip_drm_drv.c line 455

Quoted 9 lines
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +1 -0
@@ -451,6 +451,7 @@
 static struct platform_driver rockchip_drm_platform_driver = {
     .probe = rockchip_drm_platform_probe,
     .remove = rockchip_drm_platform_remove,
+    .shutdown = (void (*)(struct platform_device
 *))rockchip_drm_platform_remove,

No, please...:-( Provide a wrapper that returns void instead.

hmmm, this is just a test only hack, i am thinking maybe drm_atomic_helper_shutdown is enough for shutdown() ?

something like:
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -442,6 +442,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);
+}
+

Quoted 1 line

A message that is not in the archive (sent off-list or not yet received): [email protected]

#28 lore raw
Quoted 27 lines · JeffyChen

Hi Marc & Vicente,

Quoted 12 lines · Marc Zyngier
Quoted 10 lines

drivers/gpu/drm/rockchip/rockchip_drm_drv.c line 455

Quoted 10 lines
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +1 -0
@@ -451,6 +451,7 @@
 static struct platform_driver rockchip_drm_platform_driver = {
     .probe = rockchip_drm_platform_probe,
     .remove = rockchip_drm_platform_remove,
+    .shutdown = (void (*)(struct platform_device
 *))rockchip_drm_platform_remove,

No, please...:-( Provide a wrapper that returns void instead.

hmmm, this is just a test only hack, i am thinking maybe drm_atomic_helper_shutdown is enough for shutdown() ?

something like:
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c

(quoted diff) +0 -0
@@ -442,6 +442,14 @@ static int rockchip_drm_platform_remove(struct
 platform_device *pdev)
        return 0;
 }

Review static int rockchip_drm_platform_remove(struct · line 454

Quoted 10 lines
(quoted diff) +8 -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);
+}
+
 

Hi,
I can confirm that rockchip_drm_platform_shutdown works as fine as rockchip_drm_platform_remove.
Just a note: The first time I noticed this error was because it appeared on display, now that the display is off, are we sure the error is fixed?
Also, could there be other peripherals that need to be powered off before the iommu?
For curiosity: why is the iommu disabled before kexec instead of resetting it after kexec?

Regards,
Vicente.

A message that is not in the archive (sent off-list or not yet received): CAAMcf8D1-7YvOeOMd+rJOWX7XNQwKeAYjfmyAHOR8TC6vc=G1w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#30 lore raw
Quoted 40 lines · Vicente Bergas
Quoted 27 lines · JeffyChen

Hi Marc & Vicente,

Quoted 12 lines · Marc Zyngier
Quoted 10 lines

drivers/gpu/drm/rockchip/rockchip_drm_drv.c line 455

Quoted 10 lines
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +1 -0
@@ -451,6 +451,7 @@
 static struct platform_driver rockchip_drm_platform_driver = {
     .probe = rockchip_drm_platform_probe,
     .remove = rockchip_drm_platform_remove,
+    .shutdown = (void (*)(struct platform_device
 *))rockchip_drm_platform_remove,

No, please...:-( Provide a wrapper that returns void instead.

hmmm, this is just a test only hack, i am thinking maybe drm_atomic_helper_shutdown is enough for shutdown() ?

something like:
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c

(quoted diff) +0 -0
@@ -442,6 +442,14 @@ static int rockchip_drm_platform_remove(struct
 platform_device *pdev)
        return 0;
 }

Review static int rockchip_drm_platform_remove(struct · line 454

Quoted 10 lines
(quoted diff) +8 -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);
+}
+
 

Hi,
I can confirm that rockchip_drm_platform_shutdown works as fine as

Quoted 8 lines

rockchip_drm_platform_remove.
Just a note: The first time I noticed this error was because it appeared on display, now that the display is off, are we sure the error is fixed?
Also, could there be other peripherals that need to be powered off before the iommu?
For curiosity: why is the iommu disabled before kexec instead of resetting it after kexec?

Because by the time you're in the new kernel, you've corrupted the page tables, accessed peripheral address space, and set the system on fire.

In general, having a DMA master active across something like kexec is a pretty fatal issue. And when your boot loader is a Linux kernel using kexec, you're really insisting that kexec works correctly.

Thanks,

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...

A message that is not in the archive (sent off-list or not yet received): 7ce78e65-51b6-9204-5bb4-e515e36576d4-5wv7dgnIgG8@public.gmane.org

#32 lore raw
Quoted 50 lines · Marc Zyngier
Quoted 40 lines · Vicente Bergas
Quoted 27 lines · JeffyChen

Hi Marc & Vicente,

Quoted 12 lines · Marc Zyngier
Quoted 10 lines

drivers/gpu/drm/rockchip/rockchip_drm_drv.c line 455

Quoted 10 lines
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +1 -0
@@ -451,6 +451,7 @@
 static struct platform_driver rockchip_drm_platform_driver = {
     .probe = rockchip_drm_platform_probe,
     .remove = rockchip_drm_platform_remove,
+    .shutdown = (void (*)(struct platform_device
 *))rockchip_drm_platform_remove,

No, please...:-( Provide a wrapper that returns void instead.

hmmm, this is just a test only hack, i am thinking maybe drm_atomic_helper_shutdown is enough for shutdown() ?

something like:
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c

(quoted diff) +0 -0
@@ -442,6 +442,14 @@ static int rockchip_drm_platform_remove(struct
 platform_device *pdev)
        return 0;
 }

Review static int rockchip_drm_platform_remove(struct · line 454

Quoted 10 lines
(quoted diff) +8 -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);
+}
+
 

Hi,
I can confirm that rockchip_drm_platform_shutdown works as fine as

Quoted 8 lines

rockchip_drm_platform_remove.
Just a note: The first time I noticed this error was because it appeared on display, now that the display is off, are we sure the error is fixed?
Also, could there be other peripherals that need to be powered off before the iommu?
For curiosity: why is the iommu disabled before kexec instead of resetting it after kexec?

Quoted 6 lines

Because by the time you're in the new kernel, you've corrupted the page tables, accessed peripheral address space, and set the system on fire.

In general, having a DMA master active across something like kexec is a pretty fatal issue. And when your boot loader is a Linux kernel using kexec, you're really insisting that kexec works correctly.

Is it feasible to place the display memory at a virtual address that matches the physical address?

A message that is not in the archive (sent off-list or not yet received): CAAMcf8C3fS1SdZVKrsu9zRMn69BcAtFL44QvWMJ8zn4CySnfcw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#34 lore raw
Quoted 7 lines · Vicente Bergas
Quoted 5 lines · Marc Zyngier
Quoted 4 lines · Vicente Bergas
Quoted 3 lines · JeffyChen

Hi Marc & Vicente,

On 06/13/2018 06:26 PM, Marc Zyngier wrote:

[...]

Quoted 13 lines
Quoted 13 lines
Quoted 9 lines

I can confirm that rockchip_drm_platform_shutdown works as fine as rockchip_drm_platform_remove.
Just a note: The first time I noticed this error was because it appeared on display, now that the display is off, are we sure the error is fixed?
Also, could there be other peripherals that need to be powered off before the iommu?
For curiosity: why is the iommu disabled before kexec instead of resetting it after kexec?

Because by the time you're in the new kernel, you've corrupted the page tables, accessed peripheral address space, and set the system on fire.

Quoted 6 lines
Quoted 3 lines

In general, having a DMA master active across something like kexec is a pretty fatal issue. And when your boot loader is a Linux kernel using kexec, you're really insisting that kexec works correctly.

Is it feasible to place the display memory at a virtual address that matches the physical address?

That depends on the addressing capability of the end-point, and on the kernel ability to allocate a large, contiguous range of physical memory. I'm not sure it is worth the hassle just to get the display working all the way through shutdown (knowing that the most likely event after that is a power off).

	M.
Signature · 1 line
Jazz is not dead, it just smell funny.
#35 lore raw

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

In reply to a message not in the archive

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.

---
 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 f814d37b1db2..00a06768edb2 100644
@@ -442,6 +442,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 */ },
@@ -451,6 +459,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.18.0

A message that is not in the archive (sent off-list or not yet received): 20180805140911.19205-1-vicencb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#37 lore raw

Re: [PATCH] drm/rockchip: shutdown drm subsystem on shutdown

Hi Vicente,

Quoted 17 lines · On Sun, 5 Aug 2018 16:09:11 +0200 Vicente Bergas…

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.

---
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +0 -0
index f814d37b1db2..00a06768edb2 100644

drivers/gpu/drm/rockchip/rockchip_drm_drv.c static int rockchip_drm_platform_remove(struct platform_device *pdev) · line 450

Quoted 9 lines
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +6 -0
@@ -442,6 +442,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);

I'm not completely sure this is the right thing to do here. We want shutdown to teardown the whole thing, not just the DRM context.

The driver already calls drm_atomic_helper_shutdown as part of the unbind sequence, which looks very much like what we're trying to achieve here.

I've already posted a patch[1] which calls the .remove handler, ensuring that the whole infrastructure gets torn down at shutdown time.

Thanks,

	M.

[1] https://www.spinics.net/lists/arm-kernel/msg670229.html

Signature · 1 line
Without deviation from the norm, progress is not possible.

A message that is not in the archive (sent off-list or not yet received): 20180805175038.1d3a0c5e-Fmn/x+r+pSA9//[email protected]

#39 lore raw

Re: [PATCH] drm/rockchip: shutdown drm subsystem on shutdown

Quoted 35 lines · Marc Zyngier

Hi Vicente,

Quoted 17 lines · On Sun, 5 Aug 2018 16:09:11 +0200 Vicente Bergas…

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.

---
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +0 -0
index f814d37b1db2..00a06768edb2 100644

drivers/gpu/drm/rockchip/rockchip_drm_drv.c static int rockchip_drm_platform_remove(struct platform_device *pdev) · line 450

Quoted 9 lines
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +6 -0
@@ -442,6 +442,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);

I'm not completely sure this is the right thing to do here. We want shutdown to teardown the whole thing, not just the DRM context.

Quoted 3 lines

The driver already calls drm_atomic_helper_shutdown as part of the unbind sequence, which looks very much like what we're trying to achieve here.

OK, but maybe it is calling drm_atomic_helper_shutdown too late because this patch makes a difference and does indeed fix the issue. Anyways, please, apply your version if you have reasons to think it is better suited to do the task.

Quoted 3 lines

I've already posted a patch[1] which calls the .remove handler, ensuring that the whole infrastructure gets torn down at shutdown time.

That is funny: after months of having reported the issue, we both sent a patch to fix it in less than 3 hours difference!

Regards,
Vicente.

Quoted 8 lines

Thanks,

        M.

[1] https://www.spinics.net/lists/arm-kernel/msg670229.html
--
Without deviation from the norm, progress is not possible.

A message that is not in the archive (sent off-list or not yet received): CAAMcf8CyUri0LigtJWvahLK62ihPUYa_UvA+2q_EA8m+TL2cqw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#41 lore raw

Re: [PATCH] drm/rockchip: shutdown drm subsystem on shutdown

Quoted 37 lines · Vicente Bergas
Quoted 35 lines · Marc Zyngier

Hi Vicente,

Quoted 17 lines · On Sun, 5 Aug 2018 16:09:11 +0200 Vicente Bergas…

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.

---
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +0 -0
index f814d37b1db2..00a06768edb2 100644

drivers/gpu/drm/rockchip/rockchip_drm_drv.c static int rockchip_drm_platform_remove(struct platform_device *pdev) · line 450

Quoted 9 lines
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +6 -0
@@ -442,6 +442,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);

I'm not completely sure this is the right thing to do here. We want shutdown to teardown the whole thing, not just the DRM context.

Quoted 6 lines
Quoted 3 lines

The driver already calls drm_atomic_helper_shutdown as part of the unbind sequence, which looks very much like what we're trying to achieve here.

OK, but maybe it is calling drm_atomic_helper_shutdown too late because this patch makes a difference and does indeed fix the issue.

I'm not saying it doesn't fix your issue. All I'm saying is that we may want something that is closer to a full remove than just a shallow DRM teardown. At the moment, unbind is simply *never* called.

Quoted 2 lines

Anyways, please, apply your version if you have reasons to think it is better suited to do the task.

That would be for the DRM maintainers to decide. For that particular subsystem, I'm just a random contributor.

Quoted 5 lines
Quoted 2 lines

I've already posted a patch[1] which calls the .remove handler, ensuring that the whole infrastructure gets torn down at shutdown time.

That is funny: after months of having reported the issue, we both sent a patch to fix it in less than 3 hours difference!

I was hoping you'd do that earlier, but given that 4.18 is just a week away and that we still don't have a proper fix for this, I've taken the matter into my own hands. Without this, I cannot reliably use kexec anymore, which is just the same as not being able to boot at all.

Thanks,

	M.
Signature · 1 line
Jazz is not dead, it just smell funny.
#42 lore raw

Re: [PATCH] drm/rockchip: shutdown drm subsystem on shutdown

In reply to a message not in the archive

Hi Vicente,

Am Sonntag, 5. August 2018, 16:09:11 CEST schrieb Vicente Bergas:

Quoted 17 lines

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.

---
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +0 -0
index f814d37b1db2..00a06768edb2 100644

drivers/gpu/drm/rockchip/rockchip_drm_drv.c static int rockchip_drm_platform_remove(struct platform_device *pdev) · line 450

Quoted 9 lines
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +6 -0
@@ -442,6 +442,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);

I tend to side with Marc's more drastic approach, especially as this one should also nicely unbind the encoders used. Are you ok with us going with Marc's patch or do you have concerns?

Providing a Tested-by tag would also be great ;-)

Thanks
Heiko

#43 lore raw

Re: [PATCH] drm/rockchip: shutdown drm subsystem on shutdown

Hi Heiko, Jeffy, Marc,

Quoted 23 lines · Heiko Stuebner

Hi Vicente,

Am Sonntag, 5. August 2018, 16:09:11 CEST schrieb Vicente Bergas:

Quoted 20 lines

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.

---
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +0 -0
index f814d37b1db2..00a06768edb2 100644
@@ -442,6 +442,14 @@ static int rockchip_drm_platform_remove(struct platform_device *pdev)
      return 0;
 }
 
Quoted 10 lines

drivers/gpu/drm/rockchip/rockchip_drm_drv.c static int rockchip_drm_platform_remove(struct platform_device *pdev) · line 450

Quoted 6 lines
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +6 -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);

I tend to side with Marc's more drastic approach, especially as this one should also nicely unbind the encoders used. Are you ok with us going with Marc's patch or do you have concerns?

The patch i posted comes from Jeffy, as is, no modifications. So, if he has no concerns about it, then it is also fine for me.

Quoted 2 lines

Providing a Tested-by tag would also be great ;-)

OK, i'll reply to his patch with a Tested-by tag, but i was only aware of this issue affecting hdmi on power-off, so, the only testing performed was checking only this. I have done no kexec-related test.

Only one issue related to this: Marc, how can i reply to your patch if i was not a recipient?

Regards,
Vicente.

Quoted 6 lines

Thanks
Heiko

A message that is not in the archive (sent off-list or not yet received): CAAMcf8D8Vwgi-Amqt8ou9LbDrsRTePjCvwDXWo1JUTGTxLyn_w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#45 lore raw

Re: [PATCH] drm/rockchip: shutdown drm subsystem on shutdown

Am Dienstag, 7. August 2018, 18:05:13 CEST schrieb Vicente Bergas:

Quoted 41 lines

Hi Heiko, Jeffy, Marc,

Quoted 23 lines · Heiko Stuebner

Hi Vicente,

Am Sonntag, 5. August 2018, 16:09:11 CEST schrieb Vicente Bergas:

Quoted 20 lines

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.

---
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +0 -0
index f814d37b1db2..00a06768edb2 100644
@@ -442,6 +442,14 @@ static int rockchip_drm_platform_remove(struct platform_device *pdev)
      return 0;
 }
 
Quoted 10 lines

drivers/gpu/drm/rockchip/rockchip_drm_drv.c static int rockchip_drm_platform_remove(struct platform_device *pdev) · line 450

Quoted 6 lines
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +6 -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);

I tend to side with Marc's more drastic approach, especially as this one should also nicely unbind the encoders used. Are you ok with us going with Marc's patch or do you have concerns?

The patch i posted comes from Jeffy, as is, no modifications. So, if he has no concerns about it, then it is also fine for me.

Quoted 1 line
Quoted 8 lines
Quoted 1 line

Providing a Tested-by tag would also be great ;-)

OK, i'll reply to his patch with a Tested-by tag, but i was only aware of this issue affecting hdmi on power-off, so, the only testing performed was checking only this. I have done no kexec-related test.

Only one issue related to this: Marc, how can i reply to your patch if i was not a recipient?

You can also just post it here. Together with Sandy I'm carrying the drm-maintainer hat, so I'm probably the one that applies either one of the patches and can pick up a tag from here as well :-D

Heiko

author Tested-by
#46 lore raw

Re: [PATCH] drm/rockchip: shutdown drm subsystem on shutdown

Quoted 51 lines · Heiko Stuebner

Am Dienstag, 7. August 2018, 18:05:13 CEST schrieb Vicente Bergas:

Quoted 41 lines

Hi Heiko, Jeffy, Marc,

Quoted 23 lines · Heiko Stuebner

Hi Vicente,

Am Sonntag, 5. August 2018, 16:09:11 CEST schrieb Vicente Bergas:

Quoted 20 lines

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.

---
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +0 -0
index f814d37b1db2..00a06768edb2 100644
@@ -442,6 +442,14 @@ static int rockchip_drm_platform_remove(struct platform_device *pdev)
      return 0;
 }
 
Quoted 10 lines

drivers/gpu/drm/rockchip/rockchip_drm_drv.c static int rockchip_drm_platform_remove(struct platform_device *pdev) · line 450

Quoted 6 lines
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +6 -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);

I tend to side with Marc's more drastic approach, especially as this one should also nicely unbind the encoders used. Are you ok with us going with Marc's patch or do you have concerns?

The patch i posted comes from Jeffy, as is, no modifications. So, if he has no concerns about it, then it is also fine for me.

Quoted 1 line
Quoted 8 lines
Quoted 1 line

Providing a Tested-by tag would also be great ;-)

OK, i'll reply to his patch with a Tested-by tag, but i was only aware of this issue affecting hdmi on power-off, so, the only testing performed was checking only this. I have done no kexec-related test.

Only one issue related to this: Marc, how can i reply to your patch if i was not a recipient?

Quoted 6 lines

You can also just post it here. Together with Sandy I'm carrying the drm-maintainer hat, so I'm probably the one that applies either one of the patches and can pick up a tag from here as well :-D

Heiko

OK, perfect, so, for this patch:
https://www.spinics.net/lists/arm-kernel/msg670229.html
here is my

tag.
As said, i only tested that on shutdown, the hdmi output is also shut down instead of showing random noise.

Regards,
Vicente.

A message that is not in the archive (sent off-list or not yet received): CAAMcf8DJhBk8rG65SmQR4vwtj1zfm7jfKJJ4nAx6OsAeu52T2A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#48 lore raw

Re: [PATCH] drm/rockchip: shutdown drm subsystem on shutdown

Quoted 59 lines · On Tue, 7 Aug 2018 18:20:15 +0200 Vicente Bergas…
Quoted 51 lines · Heiko Stuebner

Am Dienstag, 7. August 2018, 18:05:13 CEST schrieb Vicente Bergas:

Quoted 41 lines

Hi Heiko, Jeffy, Marc,

Quoted 23 lines · Heiko Stuebner

Hi Vicente,

Am Sonntag, 5. August 2018, 16:09:11 CEST schrieb Vicente Bergas:

Quoted 20 lines

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.

---
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +0 -0
index f814d37b1db2..00a06768edb2 100644
@@ -442,6 +442,14 @@ static int rockchip_drm_platform_remove(struct platform_device *pdev)
      return 0;
 }
 
Quoted 10 lines

drivers/gpu/drm/rockchip/rockchip_drm_drv.c static int rockchip_drm_platform_remove(struct platform_device *pdev) · line 450

Quoted 6 lines
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +6 -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);  

I tend to side with Marc's more drastic approach, especially as this one should also nicely unbind the encoders used. Are you ok with us going with Marc's patch or do you have concerns?

The patch i posted comes from Jeffy, as is, no modifications. So, if he has no concerns about it, then it is also fine for me.

Quoted 1 line
Quoted 8 lines
Quoted 1 line

Providing a Tested-by tag would also be great ;-)

OK, i'll reply to his patch with a Tested-by tag, but i was only aware of this issue affecting hdmi on power-off, so, the only testing performed was checking only this. I have done no kexec-related test.

Only one issue related to this: Marc, how can i reply to your patch if i was not a recipient?

Quoted 6 lines

You can also just post it here. Together with Sandy I'm carrying the drm-maintainer hat, so I'm probably the one that applies either one of the patches and can pick up a tag from here as well :-D

Heiko

Quoted 7 lines

OK, perfect, so, for this patch:
https://www.spinics.net/lists/arm-kernel/msg670229.html
here is my

tag.
As said, i only tested that on shutdown, the hdmi output is also shut down instead of showing random noise.

Any update on this patch? I was hoping to see it in 4.18, but so far nothing has happened.

Thanks,

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.

A message that is not in the archive (sent off-list or not yet received): 20180909144300.3908a11b-Fmn/x+r+pSA9//[email protected]

#50 lore raw

Re: [PATCH] drm/rockchip: shutdown drm subsystem on shutdown

Am Sonntag, 9. September 2018, 15:43:00 CEST schrieb Marc Zyngier:

Quoted 70 lines
Quoted 59 lines · On Tue, 7 Aug 2018 18:20:15 +0200 Vicente Bergas…
Quoted 51 lines · Heiko Stuebner

Am Dienstag, 7. August 2018, 18:05:13 CEST schrieb Vicente Bergas:

Quoted 41 lines

Hi Heiko, Jeffy, Marc,

Quoted 23 lines · Heiko Stuebner

Hi Vicente,

Am Sonntag, 5. August 2018, 16:09:11 CEST schrieb Vicente Bergas:

Quoted 20 lines

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.

---
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +0 -0
index f814d37b1db2..00a06768edb2 100644
@@ -442,6 +442,14 @@ static int rockchip_drm_platform_remove(struct platform_device *pdev)
      return 0;
 }
 
Quoted 10 lines

drivers/gpu/drm/rockchip/rockchip_drm_drv.c static int rockchip_drm_platform_remove(struct platform_device *pdev) · line 450

Quoted 6 lines
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +6 -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);  

I tend to side with Marc's more drastic approach, especially as this one should also nicely unbind the encoders used. Are you ok with us going with Marc's patch or do you have concerns?

The patch i posted comes from Jeffy, as is, no modifications. So, if he has no concerns about it, then it is also fine for me.

Quoted 1 line
Quoted 8 lines
Quoted 1 line

Providing a Tested-by tag would also be great ;-)

OK, i'll reply to his patch with a Tested-by tag, but i was only aware of this issue affecting hdmi on power-off, so, the only testing performed was checking only this. I have done no kexec-related test.

Only one issue related to this: Marc, how can i reply to your patch if i was not a recipient?

Quoted 6 lines

You can also just post it here. Together with Sandy I'm carrying the drm-maintainer hat, so I'm probably the one that applies either one of the patches and can pick up a tag from here as well :-D

Heiko

Quoted 7 lines

OK, perfect, so, for this patch:
https://www.spinics.net/lists/arm-kernel/msg670229.html
here is my

tag.
As said, i only tested that on shutdown, the hdmi output is also shut down instead of showing random noise.

Quoted 2 lines

Any update on this patch? I was hoping to see it in 4.18, but so far nothing has happened.

it somehow slipped through my grasp, but I've applied it now. With a stable tag added so it should also trickle down to some stable kernels hopefully.

Sorry for the holdup
Heiko

#51 lore raw

Re: [PATCH] drm/rockchip: shutdown drm subsystem on shutdown

Quoted 74 lines · Heiko Stuebner

Am Sonntag, 9. September 2018, 15:43:00 CEST schrieb Marc Zyngier:

Quoted 70 lines
Quoted 59 lines · On Tue, 7 Aug 2018 18:20:15 +0200 Vicente Bergas…
Quoted 51 lines · Heiko Stuebner

Am Dienstag, 7. August 2018, 18:05:13 CEST schrieb Vicente Bergas:

Quoted 41 lines

Hi Heiko, Jeffy, Marc,

Quoted 23 lines · Heiko Stuebner

Hi Vicente,

Am Sonntag, 5. August 2018, 16:09:11 CEST schrieb Vicente Bergas:

Quoted 20 lines

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.

---
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +0 -0
index f814d37b1db2..00a06768edb2 100644
@@ -442,6 +442,14 @@ static int rockchip_drm_platform_remove(struct platform_device *pdev)
      return 0;
 }
 
Quoted 10 lines

drivers/gpu/drm/rockchip/rockchip_drm_drv.c static int rockchip_drm_platform_remove(struct platform_device *pdev) · line 450

Quoted 6 lines
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +6 -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);  

I tend to side with Marc's more drastic approach, especially as this one should also nicely unbind the encoders used. Are you ok with us going with Marc's patch or do you have concerns?

The patch i posted comes from Jeffy, as is, no modifications. So, if he has no concerns about it, then it is also fine for me.

Quoted 1 line
Quoted 8 lines
Quoted 1 line

Providing a Tested-by tag would also be great ;-)

OK, i'll reply to his patch with a Tested-by tag, but i was only aware of this issue affecting hdmi on power-off, so, the only testing performed was checking only this. I have done no kexec-related test.

Only one issue related to this: Marc, how can i reply to your patch if i was not a recipient?

Quoted 6 lines

You can also just post it here. Together with Sandy I'm carrying the drm-maintainer hat, so I'm probably the one that applies either one of the patches and can pick up a tag from here as well :-D

Heiko

Quoted 7 lines

OK, perfect, so, for this patch:
https://www.spinics.net/lists/arm-kernel/msg670229.html
here is my

tag.
As said, i only tested that on shutdown, the hdmi output is also shut down instead of showing random noise.

Quoted 2 lines

Any update on this patch? I was hoping to see it in 4.18, but so far nothing has happened.

Quoted 6 lines

it somehow slipped through my grasp, but I've applied it now. With a stable tag added so it should also trickle down to some stable kernels hopefully.

Sorry for the holdup

No worries, and thanks for the stable tag! :-)

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...