From: James Lin <[email protected]>

[why]
The IGT test igt@amdgpu/amd_mall@static-screen always fails on DCN 4.0.1
 because debugfs reports "mall enabled: no" even when MALL is
actually active. This is because the DCN 4.0.1 hubbub function table is
missing the .get_mall_en callback, so capabilities_show() always sees
mall_in_use as false.

[how]
Reuse hubbub32_get_mall_en() for DCN 4.0.1 since the DCHUBBUB_ARB_MALL_CNTL
register layout is identical to DCN 3.2:
- Register the DCHUBBUB_ARB_MALL_CNTL register offset in dcn401_resource.h
- Add MALL_PREFETCH_COMPLETE and MALL_IN_USE mask/shift definitions in
  dcn401_hubbub.h
- Wire up .get_mall_en = hubbub32_get_mall_en in hubbub4_01_funcs

Reviewed-by: ChiaHsuan (Tom) Chung <[email protected]>
Signed-off-by: James Lin <[email protected]>
Signed-off-by: George Zhang <[email protected]>
---
 drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.c  | 3 ++-
 drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.h  | 4 +++-
 .../gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.h  | 3 ++-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.c 
b/drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.c
index bf30a1bb61b7..e9ff20c02b1e 100644
--- a/drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.c
+++ b/drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.c
@@ -1250,7 +1250,8 @@ static const struct hubbub_funcs hubbub4_01_funcs = {
        .program_compbuf_segments = dcn401_program_compbuf_segments,
        .wait_for_det_update = dcn401_wait_for_det_update,
        .program_arbiter = dcn401_program_arbiter,
-       .hubbub_read_reg_state = hubbub3_read_reg_state
+       .hubbub_read_reg_state = hubbub3_read_reg_state,
+       .get_mall_en = hubbub32_get_mall_en
 };

 void hubbub401_construct(struct dcn20_hubbub *hubbub2,
diff --git a/drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.h 
b/drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.h
index f48715544429..346bead81504 100644
--- a/drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.h
+++ b/drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.h
@@ -133,7 +133,9 @@
        HUBBUB_SF(DCHUBBUB_CTRL_STATUS, ROB_OVERFLOW_STATUS, mask_sh),\
        HUBBUB_SF(DCHUBBUB_CTRL_STATUS, ROB_OVERFLOW_CLEAR, mask_sh),\
        HUBBUB_SF(DCHUBBUB_CTRL_STATUS, DCHUBBUB_HW_DEBUG, mask_sh),\
-       HUBBUB_SF(DCHUBBUB_CTRL_STATUS, CSTATE_SWATH_CHK_GOOD_MODE, mask_sh)
+       HUBBUB_SF(DCHUBBUB_CTRL_STATUS, CSTATE_SWATH_CHK_GOOD_MODE, mask_sh),\
+       HUBBUB_SF(DCHUBBUB_ARB_MALL_CNTL, MALL_PREFETCH_COMPLETE, mask_sh),\
+       HUBBUB_SF(DCHUBBUB_ARB_MALL_CNTL, MALL_IN_USE, mask_sh)

 bool hubbub401_program_urgent_watermarks(
                struct hubbub *hubbub,
diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.h 
b/drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.h
index 47f82b818262..ce96fe1ddb7c 100644
--- a/drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.h
+++ b/drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.h
@@ -622,7 +622,8 @@ int dcn401_get_power_profile(const struct dc_state 
*context);
        SR(DCHUBBUB_MEM_PWR_MODE_CTRL),                                         
 \
        SR(DCHUBBUB_TIMEOUT_DETECTION_CTRL1),                                   
 \
        SR(DCHUBBUB_TIMEOUT_DETECTION_CTRL2),                                   
                                 \
-       SR(DCHUBBUB_CTRL_STATUS)
+       SR(DCHUBBUB_CTRL_STATUS),                                               
 \
+       SR(DCHUBBUB_ARB_MALL_CNTL)

 /* DCCG */

--
2.55.0

Reply via email to