drm/amd/display: enable dchub request limit for DCN 3.2.x
authorJun Lei <jun.lei@amd.com>
Wed, 2 Nov 2022 19:19:37 +0000 (15:19 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 15 Nov 2022 18:34:42 +0000 (13:34 -0500)
[why]
HW recommend we enable this for better DF QoS for DCN 3.2.x

[how]
Add interfaces to hubbub to program register
Add initialization as part of init_hw
Add default settings for DCN 3.2.x
Add registry override for debug/tuning

Reviewed-by: Alvin Lee <Alvin.Lee2@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Jun Lei <jun.lei@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dc.h
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.h
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hubbub.c
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hubbub.h
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.h
drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h

index caed559..009dab9 100644 (file)
@@ -408,6 +408,7 @@ struct dc_config {
        bool use_default_clock_table;
        bool force_bios_enable_lttpr;
        uint8_t force_bios_fixed_vs;
+       int sdpif_request_limit_words_per_umc;
 
 };
 
index e48fd04..ba1c062 100644 (file)
@@ -171,6 +171,7 @@ struct dcn_hubbub_registers {
        uint32_t DCHUBBUB_ARB_FCLK_PSTATE_CHANGE_WATERMARK_B;
        uint32_t DCHUBBUB_ARB_FCLK_PSTATE_CHANGE_WATERMARK_C;
        uint32_t DCHUBBUB_ARB_FCLK_PSTATE_CHANGE_WATERMARK_D;
+       uint32_t SDPIF_REQUEST_RATE_LIMIT;
 };
 
 #define HUBBUB_REG_FIELD_LIST_DCN32(type) \
@@ -360,7 +361,8 @@ struct dcn_hubbub_registers {
                type DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_Z8_C;\
                type DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_Z8_C;\
                type DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_Z8_D;\
-               type DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_Z8_D
+               type DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_Z8_D;\
+               type SDPIF_REQUEST_RATE_LIMIT
 
 
 struct dcn_hubbub_shift {
index a88a714..5947c2c 100644 (file)
@@ -72,6 +72,23 @@ static void dcn32_init_crb(struct hubbub *hubbub)
        REG_UPDATE(DCHUBBUB_DEBUG_CTRL_0, DET_DEPTH, 0x47F);
 }
 
+void hubbub32_set_request_limit(struct hubbub *hubbub, int memory_channel_count, int words_per_channel)
+{
+       struct dcn20_hubbub *hubbub2 = TO_DCN20_HUBBUB(hubbub);
+
+       uint32_t request_limit = 3 * memory_channel_count * words_per_channel / 4;
+
+       ASSERT((request_limit & (~0xFFF)) == 0); //field is only 24 bits long
+       ASSERT(request_limit > 0); //field is only 24 bits long
+
+       if (request_limit > 0xFFF)
+               request_limit = 0xFFF;
+
+       if (request_limit > 0)
+               REG_UPDATE(SDPIF_REQUEST_RATE_LIMIT, SDPIF_REQUEST_RATE_LIMIT, request_limit);
+}
+
+
 void dcn32_program_det_size(struct hubbub *hubbub, int hubp_inst, unsigned int det_buffer_size_in_kbyte)
 {
        struct dcn20_hubbub *hubbub2 = TO_DCN20_HUBBUB(hubbub);
@@ -949,6 +966,7 @@ static const struct hubbub_funcs hubbub32_funcs = {
        .init_crb = dcn32_init_crb,
        .hubbub_read_state = hubbub2_read_state,
        .force_usr_retraining_allow = hubbub32_force_usr_retraining_allow,
+       .set_request_limit = hubbub32_set_request_limit
 };
 
 void hubbub32_construct(struct dcn20_hubbub *hubbub2,
index cda94e0..786f9ce 100644 (file)
@@ -82,7 +82,8 @@
        SR(DCN_VM_FAULT_ADDR_MSB),\
        SR(DCN_VM_FAULT_ADDR_LSB),\
        SR(DCN_VM_FAULT_CNTL),\
-       SR(DCN_VM_FAULT_STATUS)
+       SR(DCN_VM_FAULT_STATUS),\
+       SR(SDPIF_REQUEST_RATE_LIMIT)
 
 #define HUBBUB_MASK_SH_LIST_DCN32(mask_sh)\
        HUBBUB_SF(DCHUBBUB_GLOBAL_TIMER_CNTL, DCHUBBUB_GLOBAL_TIMER_ENABLE, mask_sh), \
        HUBBUB_SF(DCN_VM_FAULT_STATUS, DCN_VM_ERROR_VMID, mask_sh), \
        HUBBUB_SF(DCN_VM_FAULT_STATUS, DCN_VM_ERROR_TABLE_LEVEL, mask_sh), \
        HUBBUB_SF(DCN_VM_FAULT_STATUS, DCN_VM_ERROR_PIPE, mask_sh), \
-       HUBBUB_SF(DCN_VM_FAULT_STATUS, DCN_VM_ERROR_INTERRUPT_STATUS, mask_sh)
+       HUBBUB_SF(DCN_VM_FAULT_STATUS, DCN_VM_ERROR_INTERRUPT_STATUS, mask_sh),\
+       HUBBUB_SF(SDPIF_REQUEST_RATE_LIMIT, SDPIF_REQUEST_RATE_LIMIT, mask_sh)
 
 bool hubbub32_program_urgent_watermarks(
                struct hubbub *hubbub,
@@ -200,4 +202,6 @@ void hubbub32_construct(struct dcn20_hubbub *hubbub2,
        int pixel_chunk_size_kb,
        int config_return_buffer_size_kb);
 
+void hubbub32_set_request_limit(struct hubbub *hubbub, int umc_count, int words_per_umc);
+
 #endif
index 5e0018e..c8fb28f 100644 (file)
@@ -984,6 +984,9 @@ void dcn32_init_hw(struct dc *dc)
        if (dc->res_pool->hubbub->funcs->init_crb)
                dc->res_pool->hubbub->funcs->init_crb(dc->res_pool->hubbub);
 
+       if (dc->res_pool->hubbub->funcs->set_request_limit && dc->config.sdpif_request_limit_words_per_umc > 0)
+               dc->res_pool->hubbub->funcs->set_request_limit(dc->res_pool->hubbub, dc->ctx->dc_bios->vram_info.num_chans, dc->config.sdpif_request_limit_words_per_umc);
+
        // Get DMCUB capabilities
        if (dc->ctx->dmub_srv) {
                dc_dmub_srv_query_caps_cmd(dc->ctx->dmub_srv->dmub);
index f7fea35..ae52935 100644 (file)
@@ -2414,6 +2414,9 @@ static bool dcn32_resource_construct(
                pool->base.oem_device = NULL;
        }
 
+       if (ASICREV_IS_GC_11_0_3(dc->ctx->asic_id.hw_internal_rev) && (dc->config.sdpif_request_limit_words_per_umc == 0))
+               dc->config.sdpif_request_limit_words_per_umc = 16;
+
        DC_FP_END();
 
        return true;
index f76120e..f6bc9bd 100644 (file)
@@ -1244,7 +1244,8 @@ void dcn32_restore_mall_state(struct dc *dc,
       SR(DCHUBBUB_ARB_FCLK_PSTATE_CHANGE_WATERMARK_C),                         \
       SR(DCHUBBUB_ARB_FCLK_PSTATE_CHANGE_WATERMARK_D),                         \
       SR(DCN_VM_FAULT_ADDR_MSB), SR(DCN_VM_FAULT_ADDR_LSB),                    \
-      SR(DCN_VM_FAULT_CNTL), SR(DCN_VM_FAULT_STATUS)                           \
+      SR(DCN_VM_FAULT_CNTL), SR(DCN_VM_FAULT_STATUS),                          \
+      SR(SDPIF_REQUEST_RATE_LIMIT)                                             \
   )
 
 /* DCCG */
index 58f758f..f2e1fcb 100644 (file)
@@ -186,6 +186,7 @@ struct hubbub_funcs {
        void (*program_compbuf_size)(struct hubbub *hubbub, unsigned compbuf_size_kb, bool safe_to_increase);
        void (*init_crb)(struct hubbub *hubbub);
        void (*force_usr_retraining_allow)(struct hubbub *hubbub, bool allow);
+       void (*set_request_limit)(struct hubbub *hubbub, int memory_channel_count, int words_per_channel);
 };
 
 struct hubbub {