drm/amdgpu/display: adjust msleep limit in dp_wait_for_training_aux_rd_interval
Subsystems (3)
Alex Deucher
maintainerPATCH 1/2 drm/amdgpu/display: adjust msleep limit in dp_wait_for_training_aux_rd_interval
Some architectures (e.g., ARM) have relatively low udelay limits. On most architectures, anything longer than 2000us is not recommended. Change the check to align with other similar checks in DC.
--- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +1 -1
@@ -202,7 +202,7 @@ void dp_wait_for_training_aux_rd_interval( uint32_t wait_in_micro_secs) {#if defined(CONFIG_DRM_AMD_DC_DCN ) -if (wait_in_micro_secs >16000 ) +if (wait_in_micro_secs >1000 )msleep (wait_in_micro_secs/1000 );else udelay (wait_in_micro_secs);
Signature · 1 line
2.34.1
Alex Deucher
maintainerPATCH 2/2 drm/amdgpu/display: use msleep rather than udelay for long delays
Some architectures (e.g., ARM) throw an compilation error if the udelay is too long. In general udelays of longer than 2000us are not recommended on any architecture. Switch to msleep in these cases.
--- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +2 -2
@@ -6941,7 +6941,7 @@ bool dpcd_write_128b_132b_sst_payload_allocation_table( } } retries++; -udelay (5000 ); +msleep (5 ); }if (!result && retries == max_retries) {
@@ -6993,7 +6993,7 @@ bool dpcd_poll_for_allocation_change_trigger(struct dc_link *link)break ; } -udelay (5000 ); +msleep (5 ); }if (result ==ACT_FAILED ) {
Signature · 1 line
2.34.1
Re: [PATCH 2/2] drm/amdgpu/display: use msleep rather than udelay for long delays
Quoted 6 lines · Alex Deucher
Some architectures (e.g., ARM) throw an compilation error if the udelay is too long. In general udelays of longer than 2000us are not recommended on any architecture. Switch to msleep in these cases.
Signed-off-by Alex Deucher <[email protected]>
Series is
Harry
Quoted 26 lines
--- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +2
-2@@ -6941,7 +6941,7 @@ bool dpcd_write_128b_132b_sst_payload_allocation_table( } } retries++; -udelay (5000 ); +msleep (5 ); }if (!result && retries == max_retries) {@@ -6993,7 +6993,7 @@ bool dpcd_poll_for_allocation_change_trigger(struct dc_link *link)break ; } -udelay (5000 ); +msleep (5 ); }if (result ==ACT_FAILED ) {
[Public]
If we change if condition, how about the division by "wait_in_micro_secs/1000", as the sleep time is less now. Shall we adjust it as well?
Regards,
Guchun
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Friday, January 21, 2022 2:04 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu/display: adjust msleep limit in dp_wait_for_training_aux_rd_interval
Some architectures (e.g., ARM) have relatively low udelay limits. On most architectures, anything longer than 2000us is not recommended. Change the check to align with other similar checks in DC.
--- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +1 -1
@@ -202,7 +202,7 @@ void dp_wait_for_training_aux_rd_interval( uint32_t wait_in_micro_secs) {#if defined(CONFIG_DRM_AMD_DC_DCN ) -if (wait_in_micro_secs >16000 ) +if (wait_in_micro_secs >1000 )msleep (wait_in_micro_secs/1000 );else udelay (wait_in_micro_secs);
Signature · 1 line
2.34.1
Deucher, Alexander
maintainer[Public]
It just changes the limit for when we use msleep vs udelay, not the units.
Alex
________________________________
From: Chen, Guchun <[email protected]>
Sent: Thursday, January 20, 2022 8:49 PM
To: Deucher, Alexander <[email protected]>; [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>
Subject: RE: [PATCH 1/2] drm/amdgpu/display: adjust msleep limit in dp_wait_for_training_aux_rd_interval
[Public]
If we change if condition, how about the division by "wait_in_micro_secs/1000", as the sleep time is less now. Shall we adjust it as well?
Regards,
Guchun
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Friday, January 21, 2022 2:04 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu/display: adjust msleep limit in dp_wait_for_training_aux_rd_interval
Some architectures (e.g., ARM) have relatively low udelay limits. On most architectures, anything longer than 2000us is not recommended. Change the check to align with other similar checks in DC.
--- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +1 -1
@@ -202,7 +202,7 @@ void dp_wait_for_training_aux_rd_interval( uint32_t wait_in_micro_secs) {#if defined(CONFIG_DRM_AMD_DC_DCN ) -if (wait_in_micro_secs >16000 ) +if (wait_in_micro_secs >1000 )msleep (wait_in_micro_secs/1000 );else udelay (wait_in_micro_secs);
--
2.34.1
[Public]
Series is: Reviewed-by: Guchun Chen [email protected]<mailto:[email protected]>
Regards,
Guchun
From: Deucher, Alexander <[email protected]>
Sent: Saturday, January 22, 2022 1:00 AM
To: Chen, Guchun <[email protected]>; [email protected]
Subject: Re: [PATCH 1/2] drm/amdgpu/display: adjust msleep limit in dp_wait_for_training_aux_rd_interval
[Public]
It just changes the limit for when we use msleep vs udelay, not the units.
Alex
________________________________
From: Chen, Guchun <[email protected]<mailto:[email protected]>>
Sent: Thursday, January 20, 2022 8:49 PM
To: Deucher, Alexander <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Deucher, Alexander <[email protected]<mailto:[email protected]>>
Subject: RE: [PATCH 1/2] drm/amdgpu/display: adjust msleep limit in dp_wait_for_training_aux_rd_interval
[Public]
If we change if condition, how about the division by "wait_in_micro_secs/1000", as the sleep time is less now. Shall we adjust it as well?
Regards,
Guchun
-----Original Message-----
From: amd-gfx <[email protected]<mailto:[email protected]>> On Behalf Of Alex Deucher
Sent: Friday, January 21, 2022 2:04 AM
To: [email protected]<mailto:[email protected]>
Cc: Deucher, Alexander <[email protected]<mailto:[email protected]>>
Subject: [PATCH 1/2] drm/amdgpu/display: adjust msleep limit in dp_wait_for_training_aux_rd_interval
Some architectures (e.g., ARM) have relatively low udelay limits. On most architectures, anything longer than 2000us is not recommended. Change the check to align with other similar checks in DC.
--- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +1 -1
@@ -202,7 +202,7 @@ void dp_wait_for_training_aux_rd_interval( uint32_t wait_in_micro_secs) {#if defined(CONFIG_DRM_AMD_DC_DCN ) -if (wait_in_micro_secs >16000 ) +if (wait_in_micro_secs >1000 )msleep (wait_in_micro_secs/1000 );else udelay (wait_in_micro_secs);
--
2.34.1
Re: [PATCH 2/2] drm/amdgpu/display: use msleep rather than udelay for long delays
In reply to Alex DeucherQuoted 15 lines · Alex Deucher
Some architectures (e.g., ARM) throw an compilation error if the udelay is too long. In general udelays of longer than 2000us are not recommended on any architecture. Switch to msleep in these cases.
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +0
-0
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c bool dpcd_write_128b_132b_sst_payload_allocation_table( · line 6944
Quoted 5 lines
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +1
-1@@ -6941,7 +6941,7 @@ bool dpcd_write_128b_132b_sst_payload_allocation_table( } } retries++; -udelay (5000 ); +msleep (5 );
msleep is not recommended for sleeps < 20ms. The original code (modified in patch 1) seems to do such a check. As per kernel doc, if precision matters recommendation is to use usleep_range().
Thanks,
Lijo
Quoted 13 lines
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +1
-1}if (!result && retries == max_retries) {@@ -6993,7 +6993,7 @@ bool dpcd_poll_for_allocation_change_trigger(struct dc_link *link)break ; } -udelay (5000 ); +msleep (5 ); }if (result ==ACT_FAILED ) {
Harry Wentland
maintainerRe: [PATCH 2/2] drm/amdgpu/display: use msleep rather than udelay for long delays
Quoted 13 lines · Lijo
Quoted 10 lines · Alex Deucher
Some architectures (e.g., ARM) throw an compilation error if the udelay is too long. In general udelays of longer than 2000us are not recommended on any architecture. Switch to msleep in these cases.
Signed-off-by Alex Deucher <[email protected]>---
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 13 lines
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c bool dpcd_write_128b_132b_sst_payload_allocation_table( · line 6944
Quoted 10 lines
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +1
-1@@ -6941,7 +6941,7 @@ bool dpcd_write_128b_132b_sst_payload_allocation_table( } } retries++; - udelay(5000); + msleep(5);msleep is not recommended for sleeps < 20ms. The original code (modified in patch 1) seems to do such a check. As per kernel doc, if precision matters recommendation is to use
usleep_range().
If I remember right the sleep (non-polling) function can take (significantly) longer than the requested time, but never shorter. This should be fine in this case.
Harry
Quoted 13 lines
Thanks,
LijoQuoted 10 lines
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +1
-0} if (!result && retries == max_retries) {@@ -6993,7 +6993,7 @@ bool dpcd_poll_for_allocation_change_trigger(struct dc_link *link) break; } - udelay(5000); + msleep(5); } if (result == ACT_FAILED) {
Re: [PATCH 2/2] drm/amdgpu/display: use msleep rather than udelay for long delays
In reply to Lazar, LijoQuoted 14 lines · Lijo
Quoted 10 lines · Alex Deucher
Some architectures (e.g., ARM) throw an compilation error if the udelay is too long. In general udelays of longer than 2000us are not recommended on any architecture. Switch to msleep in these cases.
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 14 lines
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c bool dpcd_write_128b_132b_sst_payload_allocation_table( · line 6944
Quoted 10 lines
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +1
-1@@ -6941,7 +6941,7 @@ bool dpcd_write_128b_132b_sst_payload_allocation_table( } } retries++; -udelay (5000 ); +msleep (5 );msleep is not recommended for sleeps < 20ms. The original code (modified in patch 1) seems to do such a check. As per kernel doc, if precision matters recommendation is to use
usleep_range().
I'm not sure what to use here. ARM32 doesn't allow udelay longer than 2000us.
Alex
Quoted 17 lines
Thanks,
LijoQuoted 13 lines
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +1
-1}if (!result && retries == max_retries) {@@ -6993,7 +6993,7 @@ bool dpcd_poll_for_allocation_change_trigger(struct dc_link *link)break ; } -udelay (5000 ); +msleep (5 ); }if (result ==ACT_FAILED ) {