Skip to content

Commit

Permalink
drm/amd/display: Add SMU logging code
Browse files Browse the repository at this point in the history
commit 4b33b5f upstream.

[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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Saaem Rizvi authored and Greg Kroah-Hartman committed Sep 15, 2022
1 parent 32e4b8d commit 56bd559
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@
#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
Expand Down Expand Up @@ -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);

Expand Down
12 changes: 12 additions & 0 deletions drivers/gpu/drm/amd/display/dc/clk_mgr/dcn301/dcn301_smu.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@
#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
Expand Down Expand Up @@ -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);

Expand Down
8 changes: 8 additions & 0 deletions drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_smu.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
#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
Expand Down Expand Up @@ -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;
}
Expand Down
8 changes: 8 additions & 0 deletions drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_smu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
8 changes: 8 additions & 0 deletions drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_smu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 56bd559

Please sign in to comment.