]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/display: Deprecate Loading Bounding Box From DMUB On DCN4
authorAustin Zheng <Austin.Zheng@amd.com>
Tue, 6 May 2025 14:35:49 +0000 (10:35 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 18 Jun 2025 16:19:16 +0000 (12:19 -0400)
[WHY]
dml2_soc_bb struct can continuously receive updates for future ASICs.
Alignment issues may arise since VBIOS DMCUB contains an older version of
the SOC BB.

Populating the bounding box with values from DMCUB is no longer necessary
since values such as UCLK will be overridden by values acquired by PMFW
anyways.

[HOW]
Use bb_from_dmub to store DCN specific bounding box parameters in DMCUB.
Add helpers to translate DCN specific struct to the corresponding
dml2_soc_bb field.

To avoid alignment issues:
Deprecate applying DMCUB SoC BB for DCN4

For future projects:
Create a flattened struct containing all sensitive parameters in the
bounding box. New parameters can be added to the bottom of the new struct
as needed.

Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Signed-off-by: Austin Zheng <Austin.Zheng@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
drivers/gpu/drm/amd/display/dc/dc.h
drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_translation_helper.c
drivers/gpu/drm/amd/display/dc/dml2/dml21/inc/dml_top_soc_parameter_types.h
drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.h
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h

index 78816712afbbf82b46e0093d7f598c1e05bc9336..6c23aec44295e20e37278c446b491343a1b5b63d 100644 (file)
@@ -1758,10 +1758,11 @@ dm_dmub_send_vbios_gpint_command(struct amdgpu_device *adev,
        return DMUB_STATUS_TIMEOUT;
 }
 
-static struct dml2_soc_bb *dm_dmub_get_vbios_bounding_box(struct amdgpu_device *adev)
+static void *dm_dmub_get_vbios_bounding_box(struct amdgpu_device *adev)
 {
-       struct dml2_soc_bb *bb;
+       void *bb;
        long long addr;
+       unsigned int bb_size;
        int i = 0;
        uint16_t chunk;
        enum dmub_gpint_command send_addrs[] = {
@@ -1774,6 +1775,7 @@ static struct dml2_soc_bb *dm_dmub_get_vbios_bounding_box(struct amdgpu_device *
 
        switch (amdgpu_ip_version(adev, DCE_HWIP, 0)) {
        case IP_VERSION(4, 0, 1):
+               bb_size = sizeof(struct dml2_soc_bb);
                break;
        default:
                return NULL;
@@ -1781,7 +1783,7 @@ static struct dml2_soc_bb *dm_dmub_get_vbios_bounding_box(struct amdgpu_device *
 
        bb =  dm_allocate_gpu_mem(adev,
                                  DC_MEM_ALLOC_TYPE_GART,
-                                 sizeof(struct dml2_soc_bb),
+                                 bb_size,
                                  &addr);
        if (!bb)
                return NULL;
index d7d92f9911e465d46c01acd97d18982eed2471ee..b937da0a4e4a002d3b599efb9d3689e0f0335eec 100644 (file)
@@ -636,8 +636,9 @@ struct amdgpu_display_manager {
         * @bb_from_dmub:
         *
         * Bounding box data read from dmub during early initialization for DCN4+
+        * Data is stored as a byte array that should be casted to the appropriate bb struct
         */
-       struct dml2_soc_bb *bb_from_dmub;
+       void *bb_from_dmub;
 
        /**
         * @oem_i2c:
index 4f162905475d178acd9efe00953f86cbff9d6d77..33209e056a0ba1d892869c99713e405ce60a6341 100644 (file)
@@ -1188,7 +1188,7 @@ struct dc_init_data {
        uint32_t *dcn_reg_offsets;
        uint32_t *nbio_reg_offsets;
        uint32_t *clk_reg_offsets;
-       struct dml2_soc_bb *bb_from_dmub;
+       void *bb_from_dmub;
 };
 
 struct dc_callback_init {
index 8b45b0bcc396d90735ab6b8c36b6a222117356a2..13a12f38eb3bb265f57cfaa4334436fc79edad7c 100644 (file)
 #include "dml21_translation_helper.h"
 #include "bounding_boxes/dcn4_soc_bb.h"
 
+static void dml21_apply_dmub_bb_params(struct dml2_soc_bb *soc_bb, const void *dmub_bb_params, const struct dc *in_dc)
+{
+       switch (in_dc->ctx->dce_version) {
+       case DCN_VERSION_4_01:
+       default:
+               break;
+       }
+}
+
 static void dml21_init_socbb_params(struct dml2_initialize_instance_in_out *dml_init,
                const struct dml2_configuration_options *config,
                const struct dc *in_dc)
@@ -21,10 +30,7 @@ static void dml21_init_socbb_params(struct dml2_initialize_instance_in_out *dml_
        switch (in_dc->ctx->dce_version) {
        case DCN_VERSION_4_01:
        default:
-               if (config->bb_from_dmub)
-                       soc_bb = config->bb_from_dmub;
-               else
-                       soc_bb = &dml2_socbb_dcn401;
+               soc_bb = &dml2_socbb_dcn401;
 
                qos_params = &dml_dcn4_variant_a_soc_qos_params;
        }
@@ -32,6 +38,9 @@ static void dml21_init_socbb_params(struct dml2_initialize_instance_in_out *dml_
        /* patch soc bb */
        memcpy(&dml_init->soc_bb, soc_bb, sizeof(struct dml2_soc_bb));
 
+       if (config->bb_from_dmub)
+               dml21_apply_dmub_bb_params(&dml_init->soc_bb, config->bb_from_dmub, in_dc);
+
        /* patch qos params */
        memcpy(&dml_init->soc_bb.qos_parameters, qos_params, sizeof(struct dml2_soc_qos_parameters));
 }
index 5f0bc42d1d2f7757d235ae7b504d34f21e7746f8..1f5eaf79a8d1405277e51d1a02dce0f0cba395d7 100644 (file)
@@ -99,6 +99,8 @@ struct dml2_soc_power_management_parameters {
        double z8_stutter_exit_latency_us;
        double z8_min_idle_time;
        double g6_temp_read_blackout_us[DML_MAX_CLK_TABLE_SIZE];
+       double type_b_dram_clk_change_blackout_us;
+       double type_b_ppt_blackout_us;
 };
 
 struct dml2_clk_table {
@@ -130,6 +132,7 @@ struct dml2_soc_state_table {
 
 struct dml2_soc_vmin_clock_limits {
        unsigned long dispclk_khz;
+       unsigned long dcfclk_khz;
 };
 
 struct dml2_soc_bb {
@@ -138,6 +141,7 @@ struct dml2_soc_bb {
        struct dml2_soc_power_management_parameters power_management_parameters;
        struct dml2_soc_vmin_clock_limits vmin_limit;
 
+       double lower_bound_bandwidth_dchub;
        unsigned int dprefclk_mhz;
        unsigned int xtalclk_mhz;
        unsigned int pcie_refclk_mhz;
index ff52301bcfc021b7aa309f98137f7af89aa97b42..c384e141cebc8f750ca7451ca5b5016780a1598f 100644 (file)
@@ -240,7 +240,7 @@ struct dml2_configuration_options {
        bool use_clock_dc_limits;
        bool gpuvm_enable;
        bool force_tdlut_enable;
-       struct dml2_soc_bb *bb_from_dmub;
+       void *bb_from_dmub;
 };
 
 /*
index dc4a8b83e6c626098c81d068c7f06077a3bec74b..4cdc75adadb2bc1e5418fdf4bfdde331d49083c5 100644 (file)
@@ -299,6 +299,29 @@ union dmub_addr {
        } u; /*<< Low/high bit access */
        uint64_t quad_part; /*<< 64 bit address */
 };
+
+/* Flattened structure containing SOC BB parameters stored in the VBIOS
+ * It is not practical to store the entire bounding box in VBIOS since the bounding box struct can gain new parameters.
+ * This also prevents alighment issues when new parameters are added to the SoC BB.
+ */
+struct dmub_soc_bb_params {
+       /* dml2_soc_power_management_parameters */
+       uint32_t dram_clk_change_blackout_ns;
+       uint32_t dram_clk_change_read_only_ns;
+       uint32_t dram_clk_change_write_only_ns;
+       uint32_t fclk_change_blackout_ns;
+       uint32_t g7_ppt_blackout_ns;
+       uint32_t stutter_enter_plus_exit_latency_ns;
+       uint32_t stutter_exit_latency_ns;
+       uint32_t z8_stutter_enter_plus_exit_latency_ns;
+       uint32_t z8_stutter_exit_latency_ns;
+       uint32_t z8_min_idle_time_ns;
+       uint32_t type_b_dram_clk_change_blackout_ns;
+       uint32_t type_b_ppt_blackout_ns;
+       /* dml2_soc_vmin_clock_limits */
+       uint32_t vmin_limit_dispclk_khz;
+       uint32_t vmin_limit_dcfclk_khz;
+};
 #pragma pack(pop)
 
 /**