From: Wenjing Liu Date: Fri, 17 Apr 2026 19:46:02 +0000 (-0400) Subject: drm/amd/display: add memory bandwidth override debug interface X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=d05a1c347ca54c02dbcf6a6d32f6b2d9998ceae4;p=thirdparty%2Flinux.git drm/amd/display: add memory bandwidth override debug interface [Why & How] Add override_memory_bandwidth_request to clk_mgr_funcs and get_utm_qos_model callback to soc_and_ip_translator_funcs for future test use. Reviewed-by: Dillon Varone Signed-off-by: Wenjing Liu Signed-off-by: James Lin Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c index bed7cefe871c..2cb1d1bf0376 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -7624,6 +7624,17 @@ bool dc_get_qos_info(struct dc *dc, struct dc_qos_info *info) return true; } +unsigned int dc_override_memory_bandwidth_request( + struct dc *dc, + unsigned int bw_mbps) +{ + if (!dc->clk_mgr || !dc->clk_mgr->funcs) + return 0; + + return dc->clk_mgr->funcs->override_memory_bandwidth_request( + dc->clk_mgr, bw_mbps * 1000) / 1000; +} + enum update_v3_flow { UPDATE_V3_FLOW_INVALID, UPDATE_V3_FLOW_NO_NEW_CONTEXT_CONTEXT_FAST, diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h index ddaf4fee3b63..73901ac94b7d 100644 --- a/drivers/gpu/drm/amd/display/dc/dc.h +++ b/drivers/gpu/drm/amd/display/dc/dc.h @@ -3383,4 +3383,17 @@ bool dc_capture_register_software_state(struct dc *dc, struct dc_register_softwa */ bool dc_get_qos_info(struct dc *dc, struct dc_qos_info *info); +/** + * dc_override_memory_bandwidth_request - Override the DCN nominal memory + * bandwidth request sent to PMFW, independent of the current display mode. + * For debug use only. + * @dc: DC instance + * @bw_mbps: requested bandwidth in MB/s; 0 clears the override + * + * Return: capped bandwidth value actually applied (MB/s) + */ +unsigned int dc_override_memory_bandwidth_request( + struct dc *dc, + unsigned int bw_mbps); + #endif /* DC_INTERFACE_H_ */ diff --git a/drivers/gpu/drm/amd/display/dc/inc/hw/clk_mgr.h b/drivers/gpu/drm/amd/display/dc/inc/hw/clk_mgr.h index 21224fd6b36d..eab25efea76b 100644 --- a/drivers/gpu/drm/amd/display/dc/inc/hw/clk_mgr.h +++ b/drivers/gpu/drm/amd/display/dc/inc/hw/clk_mgr.h @@ -362,6 +362,18 @@ struct clk_mgr_funcs { uint32_t (*set_smartmux_switch)(struct clk_mgr *clk_mgr, uint32_t pins_to_set); unsigned int (*get_max_clock_khz)(struct clk_mgr *clk_mgr_base, enum clk_type clk_type); + /** + * override_memory_bandwidth_request - Override the DCN nominal memory + * bandwidth request sent to PMFW, independent of the current display + * mode. For debug use only. + * @clk_mgr: clock manager instance + * @bw_kbps: requested bandwidth in kbps; 0 clears the override + * + * Return: capped bandwidth value actually applied (kbps) + */ + unsigned int (*override_memory_bandwidth_request)( + struct clk_mgr *clk_mgr, + unsigned int bw_kbps); }; struct clk_mgr { diff --git a/drivers/gpu/drm/amd/display/dc/inc/soc_and_ip_translator.h b/drivers/gpu/drm/amd/display/dc/inc/soc_and_ip_translator.h index 23daf98b8aa8..6a97a3e28bd2 100644 --- a/drivers/gpu/drm/amd/display/dc/inc/soc_and_ip_translator.h +++ b/drivers/gpu/drm/amd/display/dc/inc/soc_and_ip_translator.h @@ -8,9 +8,26 @@ #include "dc.h" #include "dml_top_soc_parameter_types.h" +/* Forward declarations — callers that dereference these structs must include + * the full UTM model headers themselves. */ +struct utm_qos_model; +struct utm_qos_model_dchub_v2; + struct soc_and_ip_translator_funcs { - void (*get_soc_bb)(struct dml2_soc_bb *soc_bb, const struct dc *dc, const struct dml2_configuration_options *config); + void (*get_soc_bb)( + struct dml2_soc_bb *soc_bb, + const struct dc *dc, + const struct dml2_configuration_options *config); void (*get_ip_caps)(struct dml2_ip_capabilities *dml_ip_caps); + /** + * get_utm_qos_model - Return the static UTM QoS model for this DCN + * generation. Caller provides storage for @qos_model and @dchub. + * @qos_model: output — populated with SoC bounding box and SOP table + * @dchub: output — populated with DCHUB client extension data + */ + void (*get_utm_qos_model)( + struct utm_qos_model *qos_model, + struct utm_qos_model_dchub_v2 *dchub); }; struct soc_and_ip_translator {