diff mbox series

drm: meson_drv add shutdown function

Message ID 20210302042202.3728113-1-art@khadas.com (mailing list archive)
State New, archived
Delegated to: Neil Armstrong
Headers show
Series drm: meson_drv add shutdown function | expand

Commit Message

Artem Lapkin March 2, 2021, 4:22 a.m. UTC
Problem: random stucks on reboot stage about 1/20 stuck/reboots
// debug kernel log
[    4.496660] reboot: kernel restart prepare CMD:(null)
[    4.498114] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown begin
[    4.503949] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown domain 0:VPU...
...STUCK...

Solution: add shutdown function to meson_drm driver 
// debug kernel log
[    5.231896] reboot: kernel restart prepare CMD:(null)
[    5.246135] [drm:meson_drv_shutdown]
...
[    5.259271] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown begin
[    5.274688] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown domain 0:VPU...
[    5.338331] reboot: Restarting system
[    5.358293] psci: PSCI_0_2_FN_SYSTEM_RESET reboot_mode:0 cmd:(null)
bl31 reboot reason: 0xd
bl31 reboot reason: 0x0
system cmd  1.
...REBOOT...

Tested: on VIM1 VIM2 VIM3 VIM3L khadas sbcs - 1000+ successful reboots
and Odroid boards, WeTek Play2 (GXBB)

Tested-by: Christian Hewitt <christianshewitt@gmail.com>
Signed-off-by: Artem Lapkin <art@khadas.com>

---
 drivers/gpu/drm/meson/meson_drv.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Neil Armstrong March 8, 2021, 9 a.m. UTC | #1
On 02/03/2021 05:22, Artem Lapkin wrote:
> Problem: random stucks on reboot stage about 1/20 stuck/reboots
> // debug kernel log
> [    4.496660] reboot: kernel restart prepare CMD:(null)
> [    4.498114] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown begin
> [    4.503949] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown domain 0:VPU...
> ...STUCK...
> 
> Solution: add shutdown function to meson_drm driver 
> // debug kernel log
> [    5.231896] reboot: kernel restart prepare CMD:(null)
> [    5.246135] [drm:meson_drv_shutdown]
> ...
> [    5.259271] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown begin
> [    5.274688] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown domain 0:VPU...
> [    5.338331] reboot: Restarting system
> [    5.358293] psci: PSCI_0_2_FN_SYSTEM_RESET reboot_mode:0 cmd:(null)
> bl31 reboot reason: 0xd
> bl31 reboot reason: 0x0
> system cmd  1.
> ...REBOOT...
> 
> Tested: on VIM1 VIM2 VIM3 VIM3L khadas sbcs - 1000+ successful reboots
> and Odroid boards, WeTek Play2 (GXBB)
> 

Fixes: bbbe775ec5b5 ("drm: Add support for Amlogic Meson Graphic Controller")

> Tested-by: Christian Hewitt <christianshewitt@gmail.com>
> Signed-off-by: Artem Lapkin <art@khadas.com>
> 
> ---
>  drivers/gpu/drm/meson/meson_drv.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
> index 42c5d3246..693bb1293 100644
> --- a/drivers/gpu/drm/meson/meson_drv.c
> +++ b/drivers/gpu/drm/meson/meson_drv.c
> @@ -482,6 +482,16 @@ static int meson_probe_remote(struct platform_device *pdev,
>  	return count;
>  }
>  
> +static void meson_drv_shutdown(struct platform_device *pdev)
> +{
> +	struct meson_drm *priv = dev_get_drvdata(&pdev->dev);
> +	struct drm_device *drm = priv->drm;
> +
> +	DRM_DEBUG_DRIVER("\n");
> +	drm_kms_helper_poll_fini(drm);
> +	drm_atomic_helper_shutdown(drm);
> +}
> +
>  static int meson_drv_probe(struct platform_device *pdev)
>  {
>  	struct component_match *match = NULL;
> @@ -553,6 +563,7 @@ static const struct dev_pm_ops meson_drv_pm_ops = {
>  
>  static struct platform_driver meson_drm_platform_driver = {
>  	.probe      = meson_drv_probe,
> +	.shutdown   = meson_drv_shutdown,
>  	.driver     = {
>  		.name	= "meson-drm",
>  		.of_match_table = dt_match,
> 

Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Kevin Hilman March 8, 2021, 5:30 p.m. UTC | #2
Artem Lapkin <email2tema@gmail.com> writes:

> Problem: random stucks on reboot stage about 1/20 stuck/reboots
> // debug kernel log
> [    4.496660] reboot: kernel restart prepare CMD:(null)
> [    4.498114] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown begin
> [    4.503949] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown domain 0:VPU...
> ...STUCK...
>
> Solution: add shutdown function to meson_drm driver 
> // debug kernel log
> [    5.231896] reboot: kernel restart prepare CMD:(null)
> [    5.246135] [drm:meson_drv_shutdown]
> ...
> [    5.259271] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown begin
> [    5.274688] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown domain 0:VPU...
> [    5.338331] reboot: Restarting system
> [    5.358293] psci: PSCI_0_2_FN_SYSTEM_RESET reboot_mode:0 cmd:(null)
> bl31 reboot reason: 0xd
> bl31 reboot reason: 0x0
> system cmd  1.
> ...REBOOT...
>
> Tested: on VIM1 VIM2 VIM3 VIM3L khadas sbcs - 1000+ successful reboots
> and Odroid boards, WeTek Play2 (GXBB)
>
> Tested-by: Christian Hewitt <christianshewitt@gmail.com>
> Signed-off-by: Artem Lapkin <art@khadas.com>

Acked-by: Kevin Hilman <khilman@baylibre.com>
Neil Armstrong March 9, 2021, 8:23 a.m. UTC | #3
On 02/03/2021 05:22, Artem Lapkin wrote:
> Problem: random stucks on reboot stage about 1/20 stuck/reboots
> // debug kernel log
> [    4.496660] reboot: kernel restart prepare CMD:(null)
> [    4.498114] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown begin
> [    4.503949] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown domain 0:VPU...
> ...STUCK...
> 
> Solution: add shutdown function to meson_drm driver 
> // debug kernel log
> [    5.231896] reboot: kernel restart prepare CMD:(null)
> [    5.246135] [drm:meson_drv_shutdown]
> ...
> [    5.259271] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown begin
> [    5.274688] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown domain 0:VPU...
> [    5.338331] reboot: Restarting system
> [    5.358293] psci: PSCI_0_2_FN_SYSTEM_RESET reboot_mode:0 cmd:(null)
> bl31 reboot reason: 0xd
> bl31 reboot reason: 0x0
> system cmd  1.
> ...REBOOT...
> 
> Tested: on VIM1 VIM2 VIM3 VIM3L khadas sbcs - 1000+ successful reboots
> and Odroid boards, WeTek Play2 (GXBB)
> 
> Tested-by: Christian Hewitt <christianshewitt@gmail.com>
> Signed-off-by: Artem Lapkin <art@khadas.com>
> 
> ---
>  drivers/gpu/drm/meson/meson_drv.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
> index 42c5d3246..693bb1293 100644
> --- a/drivers/gpu/drm/meson/meson_drv.c
> +++ b/drivers/gpu/drm/meson/meson_drv.c
> @@ -482,6 +482,16 @@ static int meson_probe_remote(struct platform_device *pdev,
>  	return count;
>  }
>  
> +static void meson_drv_shutdown(struct platform_device *pdev)
> +{
> +	struct meson_drm *priv = dev_get_drvdata(&pdev->dev);
> +	struct drm_device *drm = priv->drm;
> +
> +	DRM_DEBUG_DRIVER("\n");
> +	drm_kms_helper_poll_fini(drm);
> +	drm_atomic_helper_shutdown(drm);
> +}
> +
>  static int meson_drv_probe(struct platform_device *pdev)
>  {
>  	struct component_match *match = NULL;
> @@ -553,6 +563,7 @@ static const struct dev_pm_ops meson_drv_pm_ops = {
>  
>  static struct platform_driver meson_drm_platform_driver = {
>  	.probe      = meson_drv_probe,
> +	.shutdown   = meson_drv_shutdown,
>  	.driver     = {
>  		.name	= "meson-drm",
>  		.of_match_table = dt_match,
> 

Applied to drm-misc-fixes,

Thanks !
Kevin Hilman March 9, 2021, 5:13 p.m. UTC | #4
Hi Neil,

Neil Armstrong <narmstrong@baylibre.com> writes:

> On 02/03/2021 05:22, Artem Lapkin wrote:
>> Problem: random stucks on reboot stage about 1/20 stuck/reboots
>> // debug kernel log
>> [    4.496660] reboot: kernel restart prepare CMD:(null)
>> [    4.498114] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown begin
>> [    4.503949] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown domain 0:VPU...
>> ...STUCK...
>> 
>> Solution: add shutdown function to meson_drm driver 
>> // debug kernel log
>> [    5.231896] reboot: kernel restart prepare CMD:(null)
>> [    5.246135] [drm:meson_drv_shutdown]
>> ...
>> [    5.259271] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown begin
>> [    5.274688] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown domain 0:VPU...
>> [    5.338331] reboot: Restarting system
>> [    5.358293] psci: PSCI_0_2_FN_SYSTEM_RESET reboot_mode:0 cmd:(null)
>> bl31 reboot reason: 0xd
>> bl31 reboot reason: 0x0
>> system cmd  1.
>> ...REBOOT...
>> 
>> Tested: on VIM1 VIM2 VIM3 VIM3L khadas sbcs - 1000+ successful reboots
>> and Odroid boards, WeTek Play2 (GXBB)
>> 
>> Tested-by: Christian Hewitt <christianshewitt@gmail.com>
>> Signed-off-by: Artem Lapkin <art@khadas.com>
>> 
>> ---
>>  drivers/gpu/drm/meson/meson_drv.c | 11 +++++++++++
>>  1 file changed, 11 insertions(+)
>> 
>> diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
>> index 42c5d3246..693bb1293 100644
>> --- a/drivers/gpu/drm/meson/meson_drv.c
>> +++ b/drivers/gpu/drm/meson/meson_drv.c
>> @@ -482,6 +482,16 @@ static int meson_probe_remote(struct platform_device *pdev,
>>  	return count;
>>  }
>>  
>> +static void meson_drv_shutdown(struct platform_device *pdev)
>> +{
>> +	struct meson_drm *priv = dev_get_drvdata(&pdev->dev);
>> +	struct drm_device *drm = priv->drm;
>> +
>> +	DRM_DEBUG_DRIVER("\n");
>> +	drm_kms_helper_poll_fini(drm);
>> +	drm_atomic_helper_shutdown(drm);
>> +}
>> +
>>  static int meson_drv_probe(struct platform_device *pdev)
>>  {
>>  	struct component_match *match = NULL;
>> @@ -553,6 +563,7 @@ static const struct dev_pm_ops meson_drv_pm_ops = {
>>  
>>  static struct platform_driver meson_drm_platform_driver = {
>>  	.probe      = meson_drv_probe,
>> +	.shutdown   = meson_drv_shutdown,
>>  	.driver     = {
>>  		.name	= "meson-drm",
>>  		.of_match_table = dt_match,
>> 
>
> Applied to drm-misc-fixes,

Could you submit this as a fix to stable (v5.10+) also?

Thanks,

Kevin
Neil Armstrong March 9, 2021, 5:22 p.m. UTC | #5
On 09/03/2021 18:13, Kevin Hilman wrote:
> Hi Neil,
> 
> Neil Armstrong <narmstrong@baylibre.com> writes:
> 
>> On 02/03/2021 05:22, Artem Lapkin wrote:
>>> Problem: random stucks on reboot stage about 1/20 stuck/reboots
>>> // debug kernel log
>>> [    4.496660] reboot: kernel restart prepare CMD:(null)
>>> [    4.498114] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown begin
>>> [    4.503949] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown domain 0:VPU...
>>> ...STUCK...
>>>
>>> Solution: add shutdown function to meson_drm driver 
>>> // debug kernel log
>>> [    5.231896] reboot: kernel restart prepare CMD:(null)
>>> [    5.246135] [drm:meson_drv_shutdown]
>>> ...
>>> [    5.259271] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown begin
>>> [    5.274688] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown domain 0:VPU...
>>> [    5.338331] reboot: Restarting system
>>> [    5.358293] psci: PSCI_0_2_FN_SYSTEM_RESET reboot_mode:0 cmd:(null)
>>> bl31 reboot reason: 0xd
>>> bl31 reboot reason: 0x0
>>> system cmd  1.
>>> ...REBOOT...
>>>
>>> Tested: on VIM1 VIM2 VIM3 VIM3L khadas sbcs - 1000+ successful reboots
>>> and Odroid boards, WeTek Play2 (GXBB)
>>>
>>> Tested-by: Christian Hewitt <christianshewitt@gmail.com>
>>> Signed-off-by: Artem Lapkin <art@khadas.com>
>>>
>>> ---
>>>  drivers/gpu/drm/meson/meson_drv.c | 11 +++++++++++
>>>  1 file changed, 11 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
>>> index 42c5d3246..693bb1293 100644
>>> --- a/drivers/gpu/drm/meson/meson_drv.c
>>> +++ b/drivers/gpu/drm/meson/meson_drv.c
>>> @@ -482,6 +482,16 @@ static int meson_probe_remote(struct platform_device *pdev,
>>>  	return count;
>>>  }
>>>  
>>> +static void meson_drv_shutdown(struct platform_device *pdev)
>>> +{
>>> +	struct meson_drm *priv = dev_get_drvdata(&pdev->dev);
>>> +	struct drm_device *drm = priv->drm;
>>> +
>>> +	DRM_DEBUG_DRIVER("\n");
>>> +	drm_kms_helper_poll_fini(drm);
>>> +	drm_atomic_helper_shutdown(drm);
>>> +}
>>> +
>>>  static int meson_drv_probe(struct platform_device *pdev)
>>>  {
>>>  	struct component_match *match = NULL;
>>> @@ -553,6 +563,7 @@ static const struct dev_pm_ops meson_drv_pm_ops = {
>>>  
>>>  static struct platform_driver meson_drm_platform_driver = {
>>>  	.probe      = meson_drv_probe,
>>> +	.shutdown   = meson_drv_shutdown,
>>>  	.driver     = {
>>>  		.name	= "meson-drm",
>>>  		.of_match_table = dt_match,
>>>
>>
>> Applied to drm-misc-fixes,
> 
> Could you submit this as a fix to stable (v5.10+) also?

It should be done automagically since I added the Fixes tag

neil

> 
> Thanks,
> 
> Kevin
>
Kevin Hilman March 9, 2021, 5:50 p.m. UTC | #6
Neil Armstrong <narmstrong@baylibre.com> writes:

> On 09/03/2021 18:13, Kevin Hilman wrote:
>> Hi Neil,
>> 
>> Neil Armstrong <narmstrong@baylibre.com> writes:
>> 
>>> On 02/03/2021 05:22, Artem Lapkin wrote:
>>>> Problem: random stucks on reboot stage about 1/20 stuck/reboots
>>>> // debug kernel log
>>>> [    4.496660] reboot: kernel restart prepare CMD:(null)
>>>> [    4.498114] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown begin
>>>> [    4.503949] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown domain 0:VPU...
>>>> ...STUCK...
>>>>
>>>> Solution: add shutdown function to meson_drm driver 
>>>> // debug kernel log
>>>> [    5.231896] reboot: kernel restart prepare CMD:(null)
>>>> [    5.246135] [drm:meson_drv_shutdown]
>>>> ...
>>>> [    5.259271] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown begin
>>>> [    5.274688] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown domain 0:VPU...
>>>> [    5.338331] reboot: Restarting system
>>>> [    5.358293] psci: PSCI_0_2_FN_SYSTEM_RESET reboot_mode:0 cmd:(null)
>>>> bl31 reboot reason: 0xd
>>>> bl31 reboot reason: 0x0
>>>> system cmd  1.
>>>> ...REBOOT...
>>>>
>>>> Tested: on VIM1 VIM2 VIM3 VIM3L khadas sbcs - 1000+ successful reboots
>>>> and Odroid boards, WeTek Play2 (GXBB)
>>>>
>>>> Tested-by: Christian Hewitt <christianshewitt@gmail.com>
>>>> Signed-off-by: Artem Lapkin <art@khadas.com>
>>>>
>>>> ---
>>>>  drivers/gpu/drm/meson/meson_drv.c | 11 +++++++++++
>>>>  1 file changed, 11 insertions(+)
>>>>
>>>> diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
>>>> index 42c5d3246..693bb1293 100644
>>>> --- a/drivers/gpu/drm/meson/meson_drv.c
>>>> +++ b/drivers/gpu/drm/meson/meson_drv.c
>>>> @@ -482,6 +482,16 @@ static int meson_probe_remote(struct platform_device *pdev,
>>>>  	return count;
>>>>  }
>>>>  
>>>> +static void meson_drv_shutdown(struct platform_device *pdev)
>>>> +{
>>>> +	struct meson_drm *priv = dev_get_drvdata(&pdev->dev);
>>>> +	struct drm_device *drm = priv->drm;
>>>> +
>>>> +	DRM_DEBUG_DRIVER("\n");
>>>> +	drm_kms_helper_poll_fini(drm);
>>>> +	drm_atomic_helper_shutdown(drm);
>>>> +}
>>>> +
>>>>  static int meson_drv_probe(struct platform_device *pdev)
>>>>  {
>>>>  	struct component_match *match = NULL;
>>>> @@ -553,6 +563,7 @@ static const struct dev_pm_ops meson_drv_pm_ops = {
>>>>  
>>>>  static struct platform_driver meson_drm_platform_driver = {
>>>>  	.probe      = meson_drv_probe,
>>>> +	.shutdown   = meson_drv_shutdown,
>>>>  	.driver     = {
>>>>  		.name	= "meson-drm",
>>>>  		.of_match_table = dt_match,
>>>>
>>>
>>> Applied to drm-misc-fixes,
>> 
>> Could you submit this as a fix to stable (v5.10+) also?
>
> It should be done automagically since I added the Fixes tag

Oh, I didn't see the fixes tag, sorry.

Thanks!

Kevin
diff mbox series

Patch

diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
index 42c5d3246..693bb1293 100644
--- a/drivers/gpu/drm/meson/meson_drv.c
+++ b/drivers/gpu/drm/meson/meson_drv.c
@@ -482,6 +482,16 @@  static int meson_probe_remote(struct platform_device *pdev,
 	return count;
 }
 
+static void meson_drv_shutdown(struct platform_device *pdev)
+{
+	struct meson_drm *priv = dev_get_drvdata(&pdev->dev);
+	struct drm_device *drm = priv->drm;
+
+	DRM_DEBUG_DRIVER("\n");
+	drm_kms_helper_poll_fini(drm);
+	drm_atomic_helper_shutdown(drm);
+}
+
 static int meson_drv_probe(struct platform_device *pdev)
 {
 	struct component_match *match = NULL;
@@ -553,6 +563,7 @@  static const struct dev_pm_ops meson_drv_pm_ops = {
 
 static struct platform_driver meson_drm_platform_driver = {
 	.probe      = meson_drv_probe,
+	.shutdown   = meson_drv_shutdown,
 	.driver     = {
 		.name	= "meson-drm",
 		.of_match_table = dt_match,