From: Hemalatha Pinnamreddy <[email protected]>

[Why]
Aux engines across multiple GPUs share single static
dce_aux_funcs. When an engine supporting configurable
AUX timeout is initialized, it updates the shared table,
causing unsupported engines, including DCN1, to inherit
the configure_timeout callback. As a result, these engines
incorrectly attempt to program the AUX_RX timeout.

[How]
Embed dce_aux_funcs in each dce_aux instance to maintain a
separate callback table per engine. Set configure_timeout
only for engines that support configurable AUX timeout.

Signed-off-by: Hemalatha Pinnamreddy <[email protected]>
---
 drivers/gpu/drm/amd/display/dc/dce/dce_aux.c   | 11 ++++-------
 drivers/gpu/drm/amd/display/dc/dce/dce_aux.h   | 18 +++++++++---------
 .../amd/display/dc/link/protocols/link_ddc.c   |  8 ++++----
 3 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_aux.c 
b/drivers/gpu/drm/amd/display/dc/dce/dce_aux.c
index 4abf51c8ab52..10eac67ac784 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_aux.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_aux.c
@@ -602,11 +602,6 @@ static uint32_t dce_aux_configure_timeout(struct 
ddc_service *ddc,
        return prev_timeout_val;
 }
 
-static struct dce_aux_funcs aux_functions = {
-       .configure_timeout = NULL,
-       .destroy = NULL,
-};
-
 struct dce_aux *dce110_aux_engine_construct(struct aux_engine_dce110 
*aux_engine110,
                struct dc_context *ctx,
                uint32_t inst,
@@ -626,9 +621,11 @@ struct dce_aux *dce110_aux_engine_construct(struct 
aux_engine_dce110 *aux_engine
 
        aux_engine110->mask = mask;
        aux_engine110->shift = shift;
-       aux_engine110->base.funcs = &aux_functions;
+       aux_engine110->base.funcs.configure_timeout = NULL;
+       aux_engine110->base.funcs.destroy = NULL;
+
        if (is_ext_aux_timeout_configurable)
-               aux_engine110->base.funcs->configure_timeout = 
&dce_aux_configure_timeout;
+               aux_engine110->base.funcs.configure_timeout = 
&dce_aux_configure_timeout;
 
        return &aux_engine110->base;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_aux.h 
b/drivers/gpu/drm/amd/display/dc/dce/dce_aux.h
index b2153cb03b51..126768f098c3 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_aux.h
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_aux.h
@@ -238,6 +238,14 @@ enum {     /* This is the timeout as defined in DP 1.2a,
        SW_AUX_TIMEOUT_PERIOD_MULTIPLIER = 6
 };
 
+struct dce_aux_funcs {
+       uint32_t (*configure_timeout)
+               (struct ddc_service *ddc,
+                uint32_t timeout);
+       void (*destroy)
+               (struct aux_engine **ptr);
+};
+
 struct dce_aux {
        uint32_t inst;
        struct ddc *ddc;
@@ -247,7 +255,7 @@ struct dce_aux {
        uint32_t max_defer_write_retry;
 
        bool acquire_reset;
-       struct dce_aux_funcs *funcs;
+       struct dce_aux_funcs funcs;
 };
 
 struct dce110_aux_registers_mask {
@@ -318,12 +326,4 @@ int dce_aux_transfer_dmub_raw(struct ddc_service *ddc,
 bool dce_aux_transfer_with_retries(struct ddc_service *ddc,
                struct aux_payload *cmd);
 
-struct dce_aux_funcs {
-       uint32_t (*configure_timeout)
-               (struct ddc_service *ddc,
-                uint32_t timeout);
-       void (*destroy)
-               (struct aux_engine **ptr);
-};
-
 #endif
diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_ddc.c 
b/drivers/gpu/drm/amd/display/dc/link/protocols/link_ddc.c
index db798656c8a8..0a44382ccfa2 100644
--- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_ddc.c
+++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_ddc.c
@@ -549,13 +549,13 @@ bool try_to_configure_aux_timeout(struct ddc_service *ddc,
                return true;
 
        if (ddc->link->force_to_use_aux) {
-               if 
(ddc->ctx->dc->res_pool->engines[ddc->link->aux_hw_inst]->funcs->configure_timeout)
 {
-                       
ddc->ctx->dc->res_pool->engines[ddc->link->aux_hw_inst]->funcs->configure_timeout(ddc,
 timeout);
+               if 
(ddc->ctx->dc->res_pool->engines[ddc->link->aux_hw_inst]->funcs.configure_timeout)
 {
+                       
ddc->ctx->dc->res_pool->engines[ddc->link->aux_hw_inst]->funcs.configure_timeout(ddc,
 timeout);
                        result = true;
                }
        } else {
-               if 
(ddc->ctx->dc->res_pool->engines[ddc_pin->pin_data->en]->funcs->configure_timeout)
 {
-                       
ddc->ctx->dc->res_pool->engines[ddc_pin->pin_data->en]->funcs->configure_timeout(ddc,
 timeout);
+               if 
(ddc->ctx->dc->res_pool->engines[ddc_pin->pin_data->en]->funcs.configure_timeout)
 {
+                       
ddc->ctx->dc->res_pool->engines[ddc_pin->pin_data->en]->funcs.configure_timeout(ddc,
 timeout);
                        result = true;
                }
 
-- 
2.17.1

Reply via email to