Skip to contentSkip to conversation

drm/amd/pm: use dev_*** to print output in multiple GPUs

PATCH In review Guchun Chen 2 participants 4 messages Jan 21, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/pm: use dev_*** to print output in multiple GPUs

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
---
 drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c   |  4 +++-
 .../gpu/drm/amd/pm/powerplay/smumgr/smu10_smumgr.c    |  4 ++--
 drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c | 11 +++++++----
 drivers/gpu/drm/amd/pm/powerplay/smumgr/smu9_smumgr.c |  2 +-
 .../gpu/drm/amd/pm/powerplay/smumgr/vega20_smumgr.c   |  4 ++--
 5 files changed, 15 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c +3 -1
index 93a1c7248e26..5ca3c422f7d4 100644
@@ -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;
 }
drivers/gpu/drm/amd/pm/powerplay/smumgr/smu10_smumgr.c +2 -2
index 47b34c6ca924..88a5641465dc 100644
@@ -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;
 }
drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c +7 -4
index aae25243eb10..5a010cd38303 100644
@@ -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;
 }
drivers/gpu/drm/amd/pm/powerplay/smumgr/smu9_smumgr.c +1 -1
index 23e5de3c4ec1..8c9bf4940dc1 100644
@@ -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;
 }
drivers/gpu/drm/amd/pm/powerplay/smumgr/vega20_smumgr.c +2 -2
index 741fbc87467f..9ad26c285ecd 100644
@@ -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;
 }
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only]

Quoted 180 lines

-----Original Message-----
From: Chen, Guchun <[email protected]>
Sent: Friday, January 21, 2022 10:47 AM
To: [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Pan, Xinhui <[email protected]>; Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>
Cc: Chen, Guchun <[email protected]>
Subject: [PATCH] drm/amd/pm: use dev_*** to print output in multiple GPUs

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
---
 drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c   |  4 +++-
 .../gpu/drm/amd/pm/powerplay/smumgr/smu10_smumgr.c    |  4 ++--
 drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c | 11
+++++++----
 drivers/gpu/drm/amd/pm/powerplay/smumgr/smu9_smumgr.c |  2 +-
 .../gpu/drm/amd/pm/powerplay/smumgr/vega20_smumgr.c   |  4 ++--
 5 files changed, 15 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c +1 -0
index 93a1c7248e26..5ca3c422f7d4 100644
@@ -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;
 
drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c +2 -1
 	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;

}

drivers/gpu/drm/amd/pm/powerplay/smumgr/smu10_smumgr.c +1 -1
index 47b34c6ca924..88a5641465dc 100644
@@ -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;

}

drivers/gpu/drm/amd/pm/powerplay/smumgr/smu10_smumgr.c +1 -1
@@ -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;

}

drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c +1 -0
index aae25243eb10..5a010cd38303 100644
@@ -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;
 
drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c +3 -2
 	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);
drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c +3 -2
 	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);
drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c +0 -0
 	return 0;
 }
drivers/gpu/drm/amd/pm/powerplay/smumgr/smu9_smumgr.c +1 -1
index 23e5de3c4ec1..8c9bf4940dc1 100644
@@ -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);
drivers/gpu/drm/amd/pm/powerplay/smumgr/smu9_smumgr.c +0 -0
 	return 0;
 }
drivers/gpu/drm/amd/pm/powerplay/smumgr/vega20_smumgr.c +1 -1
index 741fbc87467f..9ad26c285ecd 100644
@@ -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);
drivers/gpu/drm/amd/pm/powerplay/smumgr/vega20_smumgr.c +1 -1
 	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;
}
--
2.17.1

author Reviewed-by Evan Quan
#2 lore raw

[Public]

Thank you for review, Evan. I will submit the patch with modifying the commit message a bit to align the indentation. Hope it's fine to you.

Regards,
Guchun

-----Original Message-----
From: Quan, Evan <[email protected]>
Sent: Friday, January 21, 2022 11:38 AM
To: Chen, Guchun <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Pan, Xinhui <[email protected]>; Lazar, Lijo <[email protected]>
Subject: RE: [PATCH] drm/amd/pm: use dev_*** to print output in multiple GPUs

[AMD Official Use Only]

Quoted 176 lines

-----Original Message-----
From: Chen, Guchun <[email protected]>
Sent: Friday, January 21, 2022 10:47 AM
To: [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Pan, Xinhui <[email protected]>; Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>
Cc: Chen, Guchun <[email protected]>
Subject: [PATCH] drm/amd/pm: use dev_*** to print output in multiple GPUs

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

---
 drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c   |  4 +++-
 .../gpu/drm/amd/pm/powerplay/smumgr/smu10_smumgr.c    |  4 ++--
 drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c | 11
+++++++----
 drivers/gpu/drm/amd/pm/powerplay/smumgr/smu9_smumgr.c |  2 +-
 .../gpu/drm/amd/pm/powerplay/smumgr/vega20_smumgr.c   |  4 ++--
 5 files changed, 15 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c +1 -0
index 93a1c7248e26..5ca3c422f7d4 100644
@@ -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)

drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c +2 -1
 	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;
 }
drivers/gpu/drm/amd/pm/powerplay/smumgr/smu10_smumgr.c +1 -1
index 47b34c6ca924..88a5641465dc 100644
@@ -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;

}

drivers/gpu/drm/amd/pm/powerplay/smumgr/smu10_smumgr.c +1 -1
@@ -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;

}

drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c +2 -0
index aae25243eb10..5a010cd38303 100644
@@ -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)

drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c +4 -2
 	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)

drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c +1 -1
 	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);

drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c +0 -1
 	else if (ret != 1)
-		pr_info("\n failed to send message %x ret is %d \n",  msg,

ret);

drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c +2 -0
+		dev_dbg(adev->dev,
+			"failed to send message %x ret is %d \n",  msg, ret);
 
 	return 0;
 }
drivers/gpu/drm/amd/pm/powerplay/smumgr/smu9_smumgr.c +1 -1
index 23e5de3c4ec1..8c9bf4940dc1 100644
@@ -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);
drivers/gpu/drm/amd/pm/powerplay/smumgr/smu9_smumgr.c +0 -0
 	return 0;
 }
drivers/gpu/drm/amd/pm/powerplay/smumgr/vega20_smumgr.c +1 -1
index 741fbc87467f..9ad26c285ecd 100644
@@ -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,

drivers/gpu/drm/amd/pm/powerplay/smumgr/vega20_smumgr.c +0 -1
 	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);

drivers/gpu/drm/amd/pm/powerplay/smumgr/vega20_smumgr.c +1 -0
+		dev_err(adev->dev, "Failed to send message 0x%x, response

0x%x\n", msg, ret);

return (ret == PPSMC_Result_OK) ? 0 : -EIO; }
--
2.17.1

#3 lore raw

[Public]

Sure, please go ahead.

BR
Evan

Quoted 221 lines

-----Original Message-----
From: Chen, Guchun <[email protected]>
Sent: Friday, January 21, 2022 3:35 PM
To: Quan, Evan <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Pan, Xinhui <[email protected]>; Lazar, Lijo <[email protected]>
Subject: RE: [PATCH] drm/amd/pm: use dev_*** to print output in multiple GPUs

[Public]

Thank you for review, Evan. I will submit the patch with modifying the commit message a bit to align the indentation. Hope it's fine to you.

Regards,
Guchun

-----Original Message-----
From: Quan, Evan <[email protected]>
Sent: Friday, January 21, 2022 11:38 AM
To: Chen, Guchun <[email protected]>; amd- [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Pan, Xinhui <[email protected]>; Lazar, Lijo <[email protected]>
Subject: RE: [PATCH] drm/amd/pm: use dev_*** to print output in multiple GPUs

[AMD Official Use Only]

drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c static int ci_read_smc_sram_dword(struct

Quoted 44 lines

-----Original Message-----
From: Chen, Guchun <[email protected]>
Sent: Friday, January 21, 2022 10:47 AM
To: [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Pan, Xinhui <[email protected]>; Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>
Cc: Chen, Guchun <[email protected]>
Subject: [PATCH] drm/amd/pm: use dev_*** to print output in multiple GPUs

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

---
 drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c   |  4 +++-
 .../gpu/drm/amd/pm/powerplay/smumgr/smu10_smumgr.c    |  4 ++--
 drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c | 11
+++++++----
 drivers/gpu/drm/amd/pm/powerplay/smumgr/smu9_smumgr.c |  2 +-
 .../gpu/drm/amd/pm/powerplay/smumgr/vega20_smumgr.c   |  4 ++--
 5 files changed, 15 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c +0 -0
index 93a1c7248e26..5ca3c422f7d4 100644
@@ -208,6 +208,7 @@ static int ci_read_smc_sram_dword(struct

pp_hwmgr

drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c static int ci_read_smc_sram_dword(struct pp_hwmgr *hwmgr, uint32_t smc_addr,

Quoted 7 lines
drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c +1 -0
 *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

Quoted 1 line

@@ static int ci_send_msg_to_smc(struct pp_hwmgr *hwmgr, uint16_t

msg)

Quoted 10 lines
drivers/gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c +2 -1
 	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;
 }

diff --git

a/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu10_smumgr.c

Quoted 23 lines

b/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu10_smumgr.c index 47b34c6ca924..88a5641465dc 100644

drivers/gpu/drm/amd/pm/powerplay/smumgr/smu10_smumgr.c +1 -1
@@ -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;

}

drivers/gpu/drm/amd/pm/powerplay/smumgr/smu10_smumgr.c +1 -1
@@ -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;
Quoted 2 lines

}
diff --git

a/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c

drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c bool smu7_is_smc_ram_running(struct pp_hwmgr · line 171

Quoted 12 lines

b/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c index aae25243eb10..5a010cd38303 100644

drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c +1 -0
@@ -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

Quoted 1 line

+173,10 @@ int smu7_send_msg_to_smc(struct pp_hwmgr *hwmgr,

uint16_t

drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c int smu7_send_msg_to_smc(struct pp_hwmgr *hwmgr, uint16_t msg) · line 182

Quoted 13 lines

msg)

drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c +3 -2
 	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

Quoted 1 line

+186,10 @@ int smu7_send_msg_to_smc(struct pp_hwmgr *hwmgr,

uint16_t

Quoted 15 lines

msg)

drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c +1 -1
 	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);

drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c +0 -1
 	else if (ret != 1)
-		pr_info("\n failed to send message %x ret is %d \n",  msg,

ret);

drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c +2 -0
+		dev_dbg(adev->dev,
+			"failed to send message %x ret is %d \n",  msg, ret);
 
 	return 0;
 }
Quoted 1 line

diff --git

a/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu9_smumgr.c

drivers/gpu/drm/amd/pm/powerplay/smumgr/smu9_smumgr.c int smu9_send_msg_to_smc(struct pp_hwmgr

Quoted 5 lines

b/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu9_smumgr.c index 23e5de3c4ec1..8c9bf4940dc1 100644

drivers/gpu/drm/amd/pm/powerplay/smumgr/smu9_smumgr.c +0 -0
@@ -126,7 +126,7 @@ int smu9_send_msg_to_smc(struct pp_hwmgr

*hwmgr,

Quoted 9 lines
drivers/gpu/drm/amd/pm/powerplay/smumgr/smu9_smumgr.c +1 -1
 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);
Quoted 3 lines

return 0;
}
diff --git

a/drivers/gpu/drm/amd/pm/powerplay/smumgr/vega20_smumgr.c

drivers/gpu/drm/amd/pm/powerplay/smumgr/vega20_smumgr.c static int vega20_send_msg_to_smc(struct

Quoted 5 lines

b/drivers/gpu/drm/amd/pm/powerplay/smumgr/vega20_smumgr.c index 741fbc87467f..9ad26c285ecd 100644

drivers/gpu/drm/amd/pm/powerplay/smumgr/vega20_smumgr.c +0 -0
@@ -115,7 +115,7 @@ static int vega20_send_msg_to_smc(struct

pp_hwmgr

Quoted 23 lines
drivers/gpu/drm/amd/pm/powerplay/smumgr/vega20_smumgr.c +1 -1
 *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,

drivers/gpu/drm/amd/pm/powerplay/smumgr/vega20_smumgr.c +0 -1
 	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);

drivers/gpu/drm/amd/pm/powerplay/smumgr/vega20_smumgr.c +1 -0
+		dev_err(adev->dev, "Failed to send message 0x%x, response

0x%x\n", msg, ret);

return (ret == PPSMC_Result_OK) ? 0 : -EIO; }
--
2.17.1