drm/amd/display: Add SMU logging code
authorSaaem Rizvi <SyedSaaem.Rizvi@amd.com>
Thu, 9 Jun 2022 19:34:43 +0000 (15:34 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 21 Jun 2022 22:17:23 +0000 (18:17 -0400)
[WHY]
Logging for SMU response value after the wait allows us to know
immediately what the response value was. Makes it easier to debug should
the value be anything other than OK.

[HOW]
Using the the already available DC SMU logging functions.

Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Reviewed-by: Charlene Liu <Charlene.Liu@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Saaem Rizvi <SyedSaaem.Rizvi@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr_vbios_smu.c
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn301/dcn301_smu.c
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_smu.c
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_smu.c
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_smu.c

index 30c6f9cd717f3d2193e22fbe01f71a838ba2e6ac..4137394a6ace9184d7f616d1d4114bc211bf5198 100644 (file)
 #define FN(reg_name, field) \
        FD(reg_name##__##field)
 
+#include "logger_types.h"
+#undef DC_LOGGER
+#define DC_LOGGER \
+       CTX->logger
+#define smu_print(str, ...) {DC_LOG_SMU(str, ##__VA_ARGS__); }
+
 #define VBIOSSMC_MSG_TestMessage                  0x1
 #define VBIOSSMC_MSG_GetSmuVersion                0x2
 #define VBIOSSMC_MSG_PowerUpGfx                   0x3
@@ -97,6 +103,12 @@ static int rn_vbios_smu_send_msg_with_param(struct clk_mgr_internal *clk_mgr,
        result = rn_smu_wait_for_response(clk_mgr, 10, 200000);
        ASSERT(result == VBIOSSMC_Result_OK);
 
+       smu_print("SMU response after wait: %d\n", result);
+
+       if (result == VBIOSSMC_Status_BUSY) {
+               return -1;
+       }
+
        /* First clear response register */
        REG_WRITE(MP1_SMN_C2PMSG_91, VBIOSSMC_Status_BUSY);
 
index 1cae01a91a69dd2c06a0348b6018fd12e57a2b2f..d8f03328558b489a0fd55b21383e3ee84f1cac80 100644 (file)
 #define FN(reg_name, field) \
        FD(reg_name##__##field)
 
+#include "logger_types.h"
+#undef DC_LOGGER
+#define DC_LOGGER \
+       CTX->logger
+#define smu_print(str, ...) {DC_LOG_SMU(str, ##__VA_ARGS__); }
+
 #define VBIOSSMC_MSG_GetSmuVersion                0x2
 #define VBIOSSMC_MSG_SetDispclkFreq               0x4
 #define VBIOSSMC_MSG_SetDprefclkFreq              0x5
@@ -96,6 +102,12 @@ static int dcn301_smu_send_msg_with_param(struct clk_mgr_internal *clk_mgr,
 
        result = dcn301_smu_wait_for_response(clk_mgr, 10, 200000);
 
+       smu_print("SMU response after wait: %d\n", result);
+
+       if (result == VBIOSSMC_Status_BUSY) {
+               return -1;
+       }
+
        /* First clear response register */
        REG_WRITE(MP1_SMN_C2PMSG_91, VBIOSSMC_Status_BUSY);
 
index c5d7d075026f31d886bafe8733afbea062d7d257..6a17f7ed4d01e4f8fc75108c6ccd8b2bbf8e0ef4 100644 (file)
 #define FN(reg_name, field) \
        FD(reg_name##__##field)
 
+#include "logger_types.h"
+#undef DC_LOGGER
+#define DC_LOGGER \
+       CTX->logger
+#define smu_print(str, ...) {DC_LOG_SMU(str, ##__VA_ARGS__); }
+
 #define VBIOSSMC_MSG_TestMessage                  0x1
 #define VBIOSSMC_MSG_GetSmuVersion                0x2
 #define VBIOSSMC_MSG_PowerUpGfx                   0x3
@@ -104,6 +110,8 @@ static int dcn31_smu_send_msg_with_param(struct clk_mgr_internal *clk_mgr,
        result = dcn31_smu_wait_for_response(clk_mgr, 10, 200000);
        ASSERT(result == VBIOSSMC_Result_OK);
 
+       smu_print("SMU response after wait: %d\n", result);
+
        if (result == VBIOSSMC_Status_BUSY) {
                return -1;
        }
index 2600313fea5797321a81688a20f028721cd2fcfb..74a78fda62fb04382e2ea6d6f6101ceb57fc374e 100644 (file)
@@ -70,6 +70,12 @@ static const struct IP_BASE NBIO_BASE = { { { { 0x00000000, 0x00000014, 0x00000D
 #define REG_NBIO(reg_name) \
        (NBIO_BASE.instance[0].segment[regBIF_BX_PF2_ ## reg_name ## _BASE_IDX] + regBIF_BX_PF2_ ## reg_name)
 
+#include "logger_types.h"
+#undef DC_LOGGER
+#define DC_LOGGER \
+       CTX->logger
+#define smu_print(str, ...) {DC_LOG_SMU(str, ##__VA_ARGS__); }
+
 #define mmMP1_C2PMSG_3                            0x3B1050C
 
 #define VBIOSSMC_MSG_TestMessage                  0x01 ///< To check if PMFW is alive and responding. Requirement specified by PMFW team
@@ -132,6 +138,8 @@ static int dcn315_smu_send_msg_with_param(
        result = dcn315_smu_wait_for_response(clk_mgr, 10, 200000);
        ASSERT(result == VBIOSSMC_Result_OK);
 
+       smu_print("SMU response after wait: %d\n", result);
+
        if (result == VBIOSSMC_Status_BUSY) {
                return -1;
        }
index dceec4b960527645d50d6898f3a2e1f879c3cc05..b2d1f24cfb804794b0a356f265e41ca46f33d119 100644 (file)
@@ -58,6 +58,12 @@ static const struct IP_BASE MP0_BASE = { { { { 0x00016000, 0x00DC0000, 0x00E0000
 #define FN(reg_name, field) \
        FD(reg_name##__##field)
 
+#include "logger_types.h"
+#undef DC_LOGGER
+#define DC_LOGGER \
+       CTX->logger
+#define smu_print(str, ...) {DC_LOG_SMU(str, ##__VA_ARGS__); }
+
 #define VBIOSSMC_MSG_TestMessage                  0x01 ///< To check if PMFW is alive and responding. Requirement specified by PMFW team
 #define VBIOSSMC_MSG_GetPmfwVersion               0x02 ///< Get PMFW version
 #define VBIOSSMC_MSG_Spare0                       0x03 ///< Spare0
@@ -120,6 +126,8 @@ static int dcn316_smu_send_msg_with_param(
        result = dcn316_smu_wait_for_response(clk_mgr, 10, 200000);
        ASSERT(result == VBIOSSMC_Result_OK);
 
+       smu_print("SMU response after wait: %d\n", result);
+
        if (result == VBIOSSMC_Status_BUSY) {
                return -1;
        }