]> git.itanic.dy.fi Git - linux-stable/commitdiff
drm/amd/pm: use dev_*** to print output in multiple GPUs
authorGuchun Chen <guchun.chen@amd.com>
Fri, 21 Jan 2022 02:40:40 +0000 (10:40 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 25 Jan 2022 23:00:32 +0000 (18:00 -0500)
In multiple GPU configuration, when failed to send a SMU
message, it's hard to figure out which GPU has such problem.
So it's not comfortable to user.

[40190.142181] amdgpu: [powerplay]
last message was failed ret is 65535
[40190.242420] amdgpu: [powerplay]
failed to send message 201 ret is 65535
[40190.392763] amdgpu: [powerplay]
last message was failed ret is 65535
[40190.492997] amdgpu: [powerplay]
failed to send message 200 ret is 65535
[40190.743575] amdgpu: [powerplay]
last message was failed ret is 65535
[40190.843812] amdgpu: [powerplay]
failed to send message 282 ret is 65535

Signed-off-by: Guchun Chen <guchun.chen@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c
drivers/gpu/drm/amd/pm/powerplay/smumgr/smu10_smumgr.c
drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c
drivers/gpu/drm/amd/pm/powerplay/smumgr/smu9_smumgr.c
drivers/gpu/drm/amd/pm/powerplay/smumgr/vega20_smumgr.c

index 93a1c7248e26ac231e7165a8631312a623a8e0f8..5ca3c422f7d4f09940b8c8c670a7497af8651c01 100644 (file)
@@ -208,6 +208,7 @@ static int ci_read_smc_sram_dword(struct pp_hwmgr *hwmgr, uint32_t smc_addr,
 
 static int ci_send_msg_to_smc(struct pp_hwmgr *hwmgr, uint16_t msg)
 {
+       struct amdgpu_device *adev = hwmgr->adev;
        int ret;
 
        cgs_write_register(hwmgr->device, mmSMC_RESP_0, 0);
@@ -218,7 +219,8 @@ static int ci_send_msg_to_smc(struct pp_hwmgr *hwmgr, uint16_t msg)
        ret = PHM_READ_FIELD(hwmgr->device, SMC_RESP_0, SMC_RESP);
 
        if (ret != 1)
-               pr_info("\n failed to send message %x ret is %d\n",  msg, ret);
+               dev_info(adev->dev,
+                       "failed to send message %x ret is %d\n", msg,ret);
 
        return 0;
 }
index 47b34c6ca924ea17e41bf1fb48a25bcf36c41f89..88a5641465dcf5efbcbd87f9e35b79ee0ec7c797 100644 (file)
@@ -87,7 +87,7 @@ static int smu10_send_msg_to_smc(struct pp_hwmgr *hwmgr, uint16_t msg)
        smu10_send_msg_to_smc_without_waiting(hwmgr, msg);
 
        if (smu10_wait_for_response(hwmgr) == 0)
-               printk("Failed to send Message %x.\n", msg);
+               dev_err(adev->dev, "Failed to send Message %x.\n", msg);
 
        return 0;
 }
@@ -108,7 +108,7 @@ static int smu10_send_msg_to_smc_with_parameter(struct pp_hwmgr *hwmgr,
 
 
        if (smu10_wait_for_response(hwmgr) == 0)
-               printk("Failed to send Message %x.\n", msg);
+               dev_err(adev->dev, "Failed to send Message %x.\n", msg);
 
        return 0;
 }
index aae25243eb10d33a5ea84903ea790e2daa0213d3..5a010cd3830373731abf594a190054ac998d035f 100644 (file)
@@ -165,6 +165,7 @@ bool smu7_is_smc_ram_running(struct pp_hwmgr *hwmgr)
 
 int smu7_send_msg_to_smc(struct pp_hwmgr *hwmgr, uint16_t msg)
 {
+       struct amdgpu_device *adev = hwmgr->adev;
        int ret;
 
        PHM_WAIT_FIELD_UNEQUAL(hwmgr, SMC_RESP_0, SMC_RESP, 0);
@@ -172,9 +173,10 @@ int smu7_send_msg_to_smc(struct pp_hwmgr *hwmgr, uint16_t msg)
        ret = PHM_READ_FIELD(hwmgr->device, SMC_RESP_0, SMC_RESP);
 
        if (ret == 0xFE)
-               pr_debug("last message was not supported\n");
+               dev_dbg(adev->dev, "last message was not supported\n");
        else if (ret != 1)
-               pr_info("\n last message was failed ret is %d\n", ret);
+               dev_info(adev->dev,
+                       "\nlast message was failed ret is %d\n", ret);
 
        cgs_write_register(hwmgr->device, mmSMC_RESP_0, 0);
        cgs_write_register(hwmgr->device, mmSMC_MESSAGE_0, msg);
@@ -184,9 +186,10 @@ int smu7_send_msg_to_smc(struct pp_hwmgr *hwmgr, uint16_t msg)
        ret = PHM_READ_FIELD(hwmgr->device, SMC_RESP_0, SMC_RESP);
 
        if (ret == 0xFE)
-               pr_debug("message %x was not supported\n", msg);
+               dev_dbg(adev->dev, "message %x was not supported\n", msg);
        else if (ret != 1)
-               pr_info("\n failed to send message %x ret is %d \n",  msg, ret);
+               dev_dbg(adev->dev,
+                       "failed to send message %x ret is %d \n",  msg, ret);
 
        return 0;
 }
index 23e5de3c4ec166fc743b31f00fa1b118d9313425..8c9bf4940dc15b265a6da4af981aaf31c09047db 100644 (file)
@@ -126,7 +126,7 @@ int smu9_send_msg_to_smc(struct pp_hwmgr *hwmgr, uint16_t msg)
 
        ret = smu9_wait_for_response(hwmgr);
        if (ret != 1)
-               pr_err("Failed to send message: 0x%x, ret value: 0x%x\n", msg, ret);
+               dev_err(adev->dev, "Failed to send message: 0x%x, ret value: 0x%x\n", msg, ret);
 
        return 0;
 }
index 741fbc87467f9236730723f9231c094d44c34d48..9ad26c285ecd6d337749bc6b07fbe4b17be92b82 100644 (file)
@@ -115,7 +115,7 @@ static int vega20_send_msg_to_smc(struct pp_hwmgr *hwmgr, uint16_t msg)
 
        ret = vega20_wait_for_response(hwmgr);
        if (ret != PPSMC_Result_OK)
-               pr_err("Failed to send message 0x%x, response 0x%x\n", msg, ret);
+               dev_err(adev->dev, "Failed to send message 0x%x, response 0x%x\n", msg, ret);
 
        return (ret == PPSMC_Result_OK) ? 0 : -EIO;
 }
@@ -143,7 +143,7 @@ static int vega20_send_msg_to_smc_with_parameter(struct pp_hwmgr *hwmgr,
 
        ret = vega20_wait_for_response(hwmgr);
        if (ret != PPSMC_Result_OK)
-               pr_err("Failed to send message 0x%x, response 0x%x\n", msg, ret);
+               dev_err(adev->dev, "Failed to send message 0x%x, response 0x%x\n", msg, ret);
 
        return (ret == PPSMC_Result_OK) ? 0 : -EIO;
 }