drm/amdgpu/powerplay/smu10: add support for gpu busy query
Subsystems (3)
Alex Deucher
maintainerPATCH 1/1 drm/amdgpu/powerplay/smu10: add support for gpu busy query
Was added in newer versions of the firmware. Add support for it.
--- drivers/gpu/drm/amd/pm/inc/rv_ppsmc.h | 1 + .../drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c | 30 ++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/inc/rv_ppsmc.h +1 -0
@@ -84,6 +84,7 @@#define PPSMC_MSG_PowerGateMmHub 0x35#define PPSMC_MSG_SetRccPfcPmeRestoreRegister 0x36#define PPSMC_MSG_GpuChangeState 0x37 +#define PPSMC_MSG_GetGfxBusy 0x3D#define PPSMC_Message_Count 0x42typedef uint16_t PPSMC_Result ;
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c +29 -1
@@ -1261,9 +1261,21 @@ static int smu10_read_sensor(struct pp_hwmgr *hwmgr, int idx, void *value, int *size) { struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend); -uint32_t sclk, mclk; +struct amdgpu_device *adev = hwmgr->adev; +uint32_t sclk, mclk, activity_percent; +bool has_gfx_busy;int ret =0 ; +/* GetGfxBusy support was added on RV SMU FW 30.85.00 and PCO 4.30.59 */ +if ((adev->apu_flags &AMD_APU_IS_PICASSO ) && + (hwmgr->smu_version >=0x41e3b )) + has_gfx_busy = true; +else if ((adev->apu_flags &AMD_APU_IS_RAVEN ) && + (hwmgr->smu_version >=0x1e5500 )) + has_gfx_busy = true; +else + has_gfx_busy = false; +switch (idx) {case AMDGPU_PP_SENSOR_GFX_SCLK :smum_send_msg_to_smc (hwmgr, PPSMC_MSG_GetGfxclkFrequency, &sclk);
@@ -1284,6 +1296,22 @@ static int smu10_read_sensor(struct pp_hwmgr *hwmgr, int idx, *(uint32_t *)value = smu10_data->vcn_power_gated ?0 :1 ; *size =4 ;break ; +case AMDGPU_PP_SENSOR_GPU_LOAD : +if (has_gfx_busy) { + ret =smum_send_msg_to_smc (hwmgr, + PPSMC_MSG_GetGfxBusy, + &activity_percent); +if (!ret) { + activity_percent = activity_percent >100 ?100 : activity_percent; + }else { + activity_percent =50 ; + } + *((uint32_t *)value) = activity_percent; +return 0 ; + }else { +return -EOPNOTSUPP ; + } +break ;default : ret = -EOPNOTSUPP ;break ;
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[AMD Public Use]
+ } else {
+ return -EOPNOTSUPP;
+ }
+ break;
The 'break' looks useless, as no chance arriving here.
Regards,
Guchun
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Wednesday, March 10, 2021 12:12 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amdgpu/powerplay/smu10: add support for gpu busy query
Was added in newer versions of the firmware. Add support for it.
--- drivers/gpu/drm/amd/pm/inc/rv_ppsmc.h | 1 + .../drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c | 30 ++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/inc/rv_ppsmc.h +1 -0
@@ -84,6 +84,7 @@#define PPSMC_MSG_PowerGateMmHub 0x35#define PPSMC_MSG_SetRccPfcPmeRestoreRegister 0x36#define PPSMC_MSG_GpuChangeState 0x37 +#define PPSMC_MSG_GetGfxBusy 0x3D#define PPSMC_Message_Count 0x42typedef uint16_t PPSMC_Result ;
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c +13 -1
@@ -1261,9 +1261,21 @@ static int smu10_read_sensor(struct pp_hwmgr *hwmgr, int idx, void *value, int *size) { struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend); -uint32_t sclk, mclk; +struct amdgpu_device *adev = hwmgr->adev; +uint32_t sclk, mclk, activity_percent; +bool has_gfx_busy;int ret =0 ; +/* GetGfxBusy support was added on RV SMU FW 30.85.00 and PCO 4.30.59 */ +if ((adev->apu_flags &AMD_APU_IS_PICASSO ) && + (hwmgr->smu_version >=0x41e3b )) + has_gfx_busy = true; +else if ((adev->apu_flags &AMD_APU_IS_RAVEN ) && + (hwmgr->smu_version >=0x1e5500 )) + has_gfx_busy = true; +else + has_gfx_busy = false; +switch (idx) {case AMDGPU_PP_SENSOR_GFX_SCLK : smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetGfxclkFrequency, &sclk); @@ -1284,6 +1296,22 @@ static int smu10_read_sensor(struct pp_hwmgr *hwmgr, int idx,
*(uint32_t *)value = smu10_data->vcn_power_gated ? 0 : 1; *size = 4;
break;
+ case AMDGPU_PP_SENSOR_GPU_LOAD:
+ if (has_gfx_busy) {
+ ret = smum_send_msg_to_smc(hwmgr,
+ PPSMC_MSG_GetGfxBusy,
+ &activity_percent);
+ if (!ret) {
+ activity_percent = activity_percent > 100 ? 100 : activity_percent;
+ } else {
+ activity_percent = 50;
+ }
+ *((uint32_t *)value) = activity_percent;
+ return 0;
+ } else {
+ return -EOPNOTSUPP;
+ }
+ break;
default:
ret = -EOPNOTSUPP;
break;
--
2.29.2
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Cguchun.chen%40amd.com%7C4ae33de1e1cb46155eef08d8e37aaf58%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637509463372230606%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=MuROLcwbCeFRI8RWtgPSnrz5J4CEfG6R8yvbk8mqy%2Bg%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[AMD Public Use]
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Wednesday, March 10, 2021 12:12 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amdgpu/powerplay/smu10: add support for gpu busy query
Was added in newer versions of the firmware. Add support for it.
--- drivers/gpu/drm/amd/pm/inc/rv_ppsmc.h | 1 + .../drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c | 30 ++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/inc/rv_ppsmc.h +1 -0
@@ -84,6 +84,7 @@#define PPSMC_MSG_PowerGateMmHub 0x35#define PPSMC_MSG_SetRccPfcPmeRestoreRegister 0x36#define PPSMC_MSG_GpuChangeState 0x37 +#define PPSMC_MSG_GetGfxBusy 0x3D#define PPSMC_Message_Count 0x42typedef uint16_t PPSMC_Result ;
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c +13 -1
@@ -1261,9 +1261,21 @@ static int smu10_read_sensor(struct pp_hwmgr *hwmgr, int idx, void *value, int *size) { struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend); -uint32_t sclk, mclk; +struct amdgpu_device *adev = hwmgr->adev; +uint32_t sclk, mclk, activity_percent; +bool has_gfx_busy;int ret =0 ; +/* GetGfxBusy support was added on RV SMU FW 30.85.00 and PCO 4.30.59 */ +if ((adev->apu_flags &AMD_APU_IS_PICASSO ) && + (hwmgr->smu_version >=0x41e3b )) + has_gfx_busy = true; +else if ((adev->apu_flags &AMD_APU_IS_RAVEN ) && + (hwmgr->smu_version >=0x1e5500 )) + has_gfx_busy = true; +else + has_gfx_busy = false; +switch (idx) {case AMDGPU_PP_SENSOR_GFX_SCLK : smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetGfxclkFrequency, &sclk); @@ -1284,6 +1296,22 @@ static int smu10_read_sensor(struct pp_hwmgr *hwmgr, int idx,
*(uint32_t *)value = smu10_data->vcn_power_gated ? 0 : 1; *size = 4;
break;
+ case AMDGPU_PP_SENSOR_GPU_LOAD:
+ if (has_gfx_busy) {
+ ret = smum_send_msg_to_smc(hwmgr,
+ PPSMC_MSG_GetGfxBusy,
+ &activity_percent);
+ if (!ret) {
+ activity_percent = activity_percent > 100 ? 100 : activity_percent;
+ } else {
+ activity_percent = 50;
+ }
+ *((uint32_t *)value) = activity_percent;
+ return 0;
+ } else {
+ return -EOPNOTSUPP;
+ }
+ break;
default:
ret = -EOPNOTSUPP;
break;
--
2.29.2
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Cevan.quan%40amd.com%7C4ae33de1e1cb46155eef08d8e37aaf58%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637509463371167218%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=mqAGA9lYO8lu5ZLC6CI7Cc7In6v7%2BWiyUwcaG6iQI%2F4%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Regards,
Shirish S
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Quan, Evan
Sent: Wednesday, March 10, 2021 1:11 PM
To: Deucher, Alexander <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: RE: [PATCH] drm/amdgpu/powerplay/smu10: add support for gpu busy query
[AMD Public Use]
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Wednesday, March 10, 2021 12:12 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amdgpu/powerplay/smu10: add support for gpu busy query
Was added in newer versions of the firmware. Add support for it.
--- drivers/gpu/drm/amd/pm/inc/rv_ppsmc.h | 1 + .../drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c | 30 ++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/inc/rv_ppsmc.h +1 -0
@@ -84,6 +84,7 @@#define PPSMC_MSG_PowerGateMmHub 0x35#define PPSMC_MSG_SetRccPfcPmeRestoreRegister 0x36#define PPSMC_MSG_GpuChangeState 0x37 +#define PPSMC_MSG_GetGfxBusy 0x3D#define PPSMC_Message_Count 0x42typedef uint16_t PPSMC_Result ;
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c +13 -1
@@ -1261,9 +1261,21 @@ static int smu10_read_sensor(struct pp_hwmgr *hwmgr, int idx, void *value, int *size) { struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend); -uint32_t sclk, mclk; +struct amdgpu_device *adev = hwmgr->adev; +uint32_t sclk, mclk, activity_percent; +bool has_gfx_busy;int ret =0 ; +/* GetGfxBusy support was added on RV SMU FW 30.85.00 and PCO 4.30.59 */ +if ((adev->apu_flags &AMD_APU_IS_PICASSO ) && + (hwmgr->smu_version >=0x41e3b )) + has_gfx_busy = true; +else if ((adev->apu_flags &AMD_APU_IS_RAVEN ) && + (hwmgr->smu_version >=0x1e5500 )) + has_gfx_busy = true; +else + has_gfx_busy = false; +switch (idx) {case AMDGPU_PP_SENSOR_GFX_SCLK : smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetGfxclkFrequency, &sclk); @@ -1284,6 +1296,22 @@ static int smu10_read_sensor(struct pp_hwmgr *hwmgr, int idx,
*(uint32_t *)value = smu10_data->vcn_power_gated ? 0 : 1; *size = 4;
break;
+ case AMDGPU_PP_SENSOR_GPU_LOAD:
+ if (has_gfx_busy) {
+ ret = smum_send_msg_to_smc(hwmgr,
+ PPSMC_MSG_GetGfxBusy,
+ &activity_percent);
+ if (!ret) {
+ activity_percent = activity_percent > 100 ? 100 : activity_percent;
+ } else {
+ activity_percent = 50;
+ }
+ *((uint32_t *)value) = activity_percent;
+ return 0;
+ } else {
+ return -EOPNOTSUPP;
+ }
+ break;
default:
ret = -EOPNOTSUPP;
break;
--
2.29.2
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7CShirish.S%40amd.com%7C91ec8f556727479d060408d8e397d498%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637509588548327792%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=rQknLutpWSubH5e1T29n2hIpYT048FFfd8gf8bAQgEQ%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7CShirish.S%40amd.com%7C91ec8f556727479d060408d8e397d498%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637509588548327792%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=rQknLutpWSubH5e1T29n2hIpYT048FFfd8gf8bAQgEQ%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[AMD Public Use]
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Wednesday, March 10, 2021 9:42 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amdgpu/powerplay/smu10: add support for gpu busy query
Was added in newer versions of the firmware. Add support for it.
--- drivers/gpu/drm/amd/pm/inc/rv_ppsmc.h | 1 + .../drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c | 30 ++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/inc/rv_ppsmc.h +1 -0
@@ -84,6 +84,7 @@#define PPSMC_MSG_PowerGateMmHub 0x35#define PPSMC_MSG_SetRccPfcPmeRestoreRegister 0x36#define PPSMC_MSG_GpuChangeState 0x37 +#define PPSMC_MSG_GetGfxBusy 0x3D#define PPSMC_Message_Count 0x42typedef uint16_t PPSMC_Result ;
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c +13 -1
@@ -1261,9 +1261,21 @@ static int smu10_read_sensor(struct pp_hwmgr *hwmgr, int idx, void *value, int *size) { struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend); -uint32_t sclk, mclk; +struct amdgpu_device *adev = hwmgr->adev; +uint32_t sclk, mclk, activity_percent; +bool has_gfx_busy;int ret =0 ; +/* GetGfxBusy support was added on RV SMU FW 30.85.00 and PCO 4.30.59 */ +if ((adev->apu_flags &AMD_APU_IS_PICASSO ) && + (hwmgr->smu_version >=0x41e3b )) + has_gfx_busy = true; +else if ((adev->apu_flags &AMD_APU_IS_RAVEN ) && + (hwmgr->smu_version >=0x1e5500 )) + has_gfx_busy = true; +else + has_gfx_busy = false; +switch (idx) {case AMDGPU_PP_SENSOR_GFX_SCLK : smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetGfxclkFrequency, &sclk); @@ -1284,6 +1296,22 @@ static int smu10_read_sensor(struct pp_hwmgr *hwmgr, int idx,
*(uint32_t *)value = smu10_data->vcn_power_gated ? 0 : 1; *size = 4;
break;
+ case AMDGPU_PP_SENSOR_GPU_LOAD:
+ if (has_gfx_busy) {
+ ret = smum_send_msg_to_smc(hwmgr,
+ PPSMC_MSG_GetGfxBusy,
+ &activity_percent);
+ if (!ret) {
+ activity_percent = activity_percent > 100 ? 100 : activity_percent;
+ } else {
+ activity_percent = 50;
<> Why this is assumed? Isn't this as good as not supported?
Thanks,
Lijo
+ }
+ *((uint32_t *)value) = activity_percent;
+ return 0;
+ } else {
+ return -EOPNOTSUPP;
+ }
+ break;
default:
ret = -EOPNOTSUPP;
break;
--
2.29.2
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Clijo.lazar%40amd.com%7C4ae33de1e1cb46155eef08d8e37aaf58%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637509463368911804%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=2KX02OYjW4d7%2FFK3dOUz6kiBb8MUItOSOqoDEnu8Lrk%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 72 lines · Lijo
[AMD Public Use]
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Wednesday, March 10, 2021 9:42 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amdgpu/powerplay/smu10: add support for gpu busy queryWas added in newer versions of the firmware. Add support for it.
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/pm/inc/rv_ppsmc.h | 1 + .../drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c | 30 ++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/pm/inc/rv_ppsmc.h +1
-0@@ -84,6 +84,7 @@#define PPSMC_MSG_PowerGateMmHub 0x35#define PPSMC_MSG_SetRccPfcPmeRestoreRegister 0x36#define PPSMC_MSG_GpuChangeState 0x37 +#define PPSMC_MSG_GetGfxBusy 0x3D#define PPSMC_Message_Count 0x42typedef uint16_t PPSMC_Result ;drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c +13
-1@@ -1261,9 +1261,21 @@ static int smu10_read_sensor(struct pp_hwmgr *hwmgr, int idx, void *value, int *size) { struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend); -uint32_t sclk, mclk; +struct amdgpu_device *adev = hwmgr->adev; +uint32_t sclk, mclk, activity_percent; +bool has_gfx_busy;int ret =0 ; +/* GetGfxBusy support was added on RV SMU FW 30.85.00 and PCO 4.30.59 */ +if ((adev->apu_flags &AMD_APU_IS_PICASSO ) && + (hwmgr->smu_version >=0x41e3b )) + has_gfx_busy = true; +else if ((adev->apu_flags &AMD_APU_IS_RAVEN ) && + (hwmgr->smu_version >=0x1e5500 )) + has_gfx_busy = true; +else + has_gfx_busy = false; +switch (idx) {case AMDGPU_PP_SENSOR_GFX_SCLK : smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetGfxclkFrequency, &sclk); @@ -1284,6 +1296,22 @@ static int smu10_read_sensor(struct pp_hwmgr *hwmgr, int idx,*(uint32_t *)value = smu10_data->vcn_power_gated ? 0 : 1; *size = 4; break;drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c +9
-0+case AMDGPU_PP_SENSOR_GPU_LOAD : +if (has_gfx_busy) { + ret =smum_send_msg_to_smc (hwmgr, + PPSMC_MSG_GetGfxBusy, + &activity_percent); +if (!ret) { + activity_percent = activity_percent >100 ?100 : activity_percent; + }else { + activity_percent =50 ;
Quoted 1 line
<> Why this is assumed? Isn't this as good as not supported?
I was just to be consistent with what we did for carrizo/stoney. I can return an error if you prefer.
Alex
Quoted 17 lines
Thanks,
Lijodrivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c +7
-1+ } + *((uint32_t *)value) = activity_percent; +return 0 ; + }else { +return -EOPNOTSUPP ; + } +break ;default : ret = -EOPNOTSUPP ;break ; --2.29.2
Quoted 8 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Clijo.lazar%40amd.com%7C4ae33de1e1cb46155eef08d8e37aaf58%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637509463368911804%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=2KX02OYjW4d7%2FFK3dOUz6kiBb8MUItOSOqoDEnu8Lrk%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[AMD Public Use]
Quoted 1 line
Quoted 1 line
I was just to be consistent with what we did for carrizo/stoney. I can return an error if you prefer.
Since they support GFXOFF (or 0 %), personally error is preferrable to reporting 50% activity.
Thanks,
Lijo
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, March 10, 2021 9:47 PM
To: Lazar, Lijo <[email protected]>
Cc: Deucher, Alexander <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu/powerplay/smu10: add support for gpu busy query
Quoted 76 lines · Lijo
[AMD Public Use]
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Wednesday, March 10, 2021 9:42 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amdgpu/powerplay/smu10: add support for gpu busy queryWas added in newer versions of the firmware. Add support for it.
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/pm/inc/rv_ppsmc.h | 1 + .../drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c | 30 ++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/pm/inc/rv_ppsmc.h +1
-0@@ -84,6 +84,7 @@#define PPSMC_MSG_PowerGateMmHub 0x35#define PPSMC_MSG_SetRccPfcPmeRestoreRegister 0x36#define PPSMC_MSG_GpuChangeState 0x37 +#define PPSMC_MSG_GetGfxBusy 0x3D#define PPSMC_Message_Count 0x42typedef uint16_t PPSMC_Result ;drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c +13
-1@@ -1261,9 +1261,21 @@ static int smu10_read_sensor(struct pp_hwmgr *hwmgr, int idx, void *value, int *size) { struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend); -uint32_t sclk, mclk; +struct amdgpu_device *adev = hwmgr->adev; +uint32_t sclk, mclk, activity_percent; +bool has_gfx_busy;int ret =0 ; +/* GetGfxBusy support was added on RV SMU FW 30.85.00 and PCO 4.30.59 */ +if ((adev->apu_flags &AMD_APU_IS_PICASSO ) && + (hwmgr->smu_version >=0x41e3b )) + has_gfx_busy = true; +else if ((adev->apu_flags &AMD_APU_IS_RAVEN ) && + (hwmgr->smu_version >=0x1e5500 )) + has_gfx_busy = true; +else + has_gfx_busy = false; +switch (idx) {case AMDGPU_PP_SENSOR_GFX_SCLK : smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetGfxclkFrequency, &sclk); @@ -1284,6 +1296,22 @@ static int smu10_read_sensor(struct pp_hwmgr *hwmgr, int idx, *(uint32_t *)value = smu10_data->vcn_power_gated ? 0 : 1;*size = 4; break;drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c +9
-0+case AMDGPU_PP_SENSOR_GPU_LOAD : +if (has_gfx_busy) { + ret =smum_send_msg_to_smc (hwmgr, + PPSMC_MSG_GetGfxBusy, + &activity_percent); +if (!ret) { + activity_percent = activity_percent >100 ?100 : activity_percent; + }else { + activity_percent =50 ;
Quoted 1 line
<> Why this is assumed? Isn't this as good as not supported?
I was just to be consistent with what we did for carrizo/stoney. I can return an error if you prefer.
Alex
Quoted 28 lines
Thanks,
Lijodrivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c +7
-1+ } + *((uint32_t *)value) = activity_percent; +return 0 ; + }else { +return -EOPNOTSUPP ; + } +break ;default : ret = -EOPNOTSUPP ;break ; --2.29.2
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7CLi jo.Lazar%40amd.com%7C28ef84f65ef9493a458608d8e3e000d4%7C3dd8961fe4884e 608e11a82d994e183d%7C0%7C0%7C637509898542174621%7CUnknown%7CTWFpbGZsb3 d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7 C1000&sdata=ndOr1uoQSRjph%2F%2F07aa0fU%2Ft4oMBboTuu8rjRr3fnfY%3D&a mp;reserved=0 _______________________________________________ amd-gfx mailing list
Quoted 8 lines
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7CLi jo.Lazar%40amd.com%7C28ef84f65ef9493a458608d8e3e000d4%7C3dd8961fe4884e 608e11a82d994e183d%7C0%7C0%7C637509898542174621%7CUnknown%7CTWFpbGZsb3 d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7 C1000&sdata=ndOr1uoQSRjph%2F%2F07aa0fU%2Ft4oMBboTuu8rjRr3fnfY%3D&a mp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx