From: Cruise Hung <[email protected]>

[WHY & HOW]
The BW zero allocation patch is no longer required.
Add a debug option to enable it in case we encounter an issue.

Reviewed-by: Wenjing Liu <[email protected]>
Signed-off-by: Cruise Hung <[email protected]>
Signed-off-by: Alex Hung <[email protected]>
---
 drivers/gpu/drm/amd/display/dc/dc.h            |  3 ++-
 .../dc/link/protocols/link_dp_dpia_bw.c        | 18 ++++++++++--------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dc.h 
b/drivers/gpu/drm/amd/display/dc/dc.h
index 5c01a535b4fa..83ee6ddaddb7 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -824,7 +824,8 @@ union dpia_debug_options {
                uint32_t disable_mst_dsc_work_around:1; /* bit 3 */
                uint32_t enable_force_tbt3_work_around:1; /* bit 4 */
                uint32_t disable_usb4_pm_support:1; /* bit 5 */
-               uint32_t reserved:26;
+               uint32_t enable_usb4_bw_zero_alloc_patch:1; /* bit 6 */
+               uint32_t reserved:25;
        } bits;
        uint32_t raw;
 };
diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c 
b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c
index 3af7564a84f1..642feac5a673 100644
--- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c
+++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c
@@ -304,14 +304,16 @@ bool link_dpia_enable_usb4_dp_bw_alloc_mode(struct 
dc_link *link)
                        link->dpia_bw_alloc_config.bw_alloc_enabled = true;
                        ret = true;
 
-                       /*
-                        * During DP tunnel creation, CM preallocates BW and 
reduces estimated BW of other
-                        * DPIA. CM release preallocation only when allocation 
is complete. Do zero alloc
-                        * to make the CM to release preallocation and update 
estimated BW correctly for
-                        * all DPIAs per host router
-                        */
-                       // TODO: Zero allocation can be removed once the MSFT 
CM fix has been released
-                       link_dp_dpia_allocate_usb4_bandwidth_for_stream(link, 
0);
+                       if 
(link->dc->debug.dpia_debug.bits.enable_usb4_bw_zero_alloc_patch) {
+                               /*
+                                * During DP tunnel creation, the CM 
preallocates BW
+                                * and reduces the estimated BW of other DPIAs.
+                                * The CM releases the preallocation only when 
the allocation is complete.
+                                * Perform a zero allocation to make the CM 
release the preallocation
+                                * and correctly update the estimated BW for 
all DPIAs per host router.
+                                */
+                               
link_dp_dpia_allocate_usb4_bandwidth_for_stream(link, 0);
+                       }
                } else
                        DC_LOG_DEBUG("%s:  link[%d] failed to enable DPTX BW 
allocation mode", __func__, link->link_index);
        }
-- 
2.43.0

Reply via email to