Skip to contentSkip to conversation

drm/amd/pm: Enable sysfs required by rocm-smi tool for One VF mode

PATCH In review Marina Nikolic 3 participants 3 messages Jan 17, 2022 – Jan 18, 2022

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

PATCH 1/1 drm/amd/pm: Enable sysfs required by rocm-smi tool for One VF mode

Enable power level, power limit and fan speed information retrieval in one VF mode. This is required so that tool ROCM-SMI can provide this information to users.

---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c              | 17 ++---------------
 .../drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c |  2 +-
 2 files changed, 3 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2 -15
index 1b03ad7a21ad..bb7d03cd814c 100644
@@ -1903,8 +1903,8 @@ static struct amdgpu_device_attr amdgpu_device_attrs[] = {
 	AMDGPU_DEVICE_ATTR_RW(pp_dpm_fclk,				ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
 	AMDGPU_DEVICE_ATTR_RW(pp_dpm_vclk,				ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
 	AMDGPU_DEVICE_ATTR_RW(pp_dpm_dclk,				ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
-	AMDGPU_DEVICE_ATTR_RW(pp_dpm_dcefclk,				ATTR_FLAG_BASIC),
-	AMDGPU_DEVICE_ATTR_RW(pp_dpm_pcie,				ATTR_FLAG_BASIC),
+	AMDGPU_DEVICE_ATTR_RW(pp_dpm_dcefclk,				ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
+	AMDGPU_DEVICE_ATTR_RW(pp_dpm_pcie,				ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
 	AMDGPU_DEVICE_ATTR_RW(pp_sclk_od,				ATTR_FLAG_BASIC),
 	AMDGPU_DEVICE_ATTR_RW(pp_mclk_od,				ATTR_FLAG_BASIC),
 	AMDGPU_DEVICE_ATTR_RW(pp_power_profile_mode,			ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
@@ -3152,19 +3152,6 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,
 	if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev))
 		return 0;
 
-	/* there is no fan under pp one vf mode */
-	if (amdgpu_sriov_is_pp_one_vf(adev) &&
-	    (attr == &sensor_dev_attr_pwm1.dev_attr.attr ||
-	     attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr ||
-	     attr == &sensor_dev_attr_pwm1_max.dev_attr.attr ||
-	     attr == &sensor_dev_attr_pwm1_min.dev_attr.attr ||
-	     attr == &sensor_dev_attr_fan1_input.dev_attr.attr ||
-	     attr == &sensor_dev_attr_fan1_min.dev_attr.attr ||
-	     attr == &sensor_dev_attr_fan1_max.dev_attr.attr ||
-	     attr == &sensor_dev_attr_fan1_target.dev_attr.attr ||
-	     attr == &sensor_dev_attr_fan1_enable.dev_attr.attr))
-		return 0;
-
 	/* Skip fan attributes if fan is not present */
 	if (adev->pm.no_fan && (attr == &sensor_dev_attr_pwm1.dev_attr.attr ||
 	    attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr ||
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -1
index 4e37cd8025ed..7ea0427f65d3 100644
@@ -134,7 +134,7 @@ static struct cmn2asic_msg_mapping sienna_cichlid_message_map[SMU_MSG_MAX_COUNT]
 	MSG_MAP(PrepareMp1ForUnload,		PPSMC_MSG_PrepareMp1ForUnload,         1),
 	MSG_MAP(AllowGfxOff,			PPSMC_MSG_AllowGfxOff,                 0),
 	MSG_MAP(DisallowGfxOff,			PPSMC_MSG_DisallowGfxOff,              0),
-	MSG_MAP(GetPptLimit,			PPSMC_MSG_GetPptLimit,                 0),
+	MSG_MAP(GetPptLimit,			PPSMC_MSG_GetPptLimit,                 1),
 	MSG_MAP(GetDcModeMaxDpmFreq,		PPSMC_MSG_GetDcModeMaxDpmFreq,         1),
 	MSG_MAP(ExitBaco,			PPSMC_MSG_ExitBaco,                    0),
 	MSG_MAP(PowerUpVcn,			PPSMC_MSG_PowerUpVcn,                  0),
Signature · 1 line
2.20.1
Acked-by on v1 1/1
#1 lore raw

[AMD Official Use Only]

Quoted 94 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Marina Nikolic
Sent: Tuesday, January 18, 2022 12:22 AM
To: [email protected]
Cc: Mitrovic, Milan <[email protected]>; Veljkovic, Nikola <[email protected]>; Nikolic, Marina <[email protected]>; Kitchen, Greg <[email protected]>
Subject: [PATCH] drm/amd/pm: Enable sysfs required by rocm-smi tool for One VF mode

Enable power level, power limit and fan speed information retrieval in one VF mode. This is required so that tool ROCM-SMI can provide this information to users.

---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c              | 17 ++---------------
 .../drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c |  2 +-
 2 files changed, 3 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0 -1
index 1b03ad7a21ad..bb7d03cd814c 100644
@@ -1903,8 +1903,8 @@ static struct amdgpu_device_attr
 amdgpu_device_attrs[] = {
 	AMDGPU_DEVICE_ATTR_RW(pp_dpm_fclk,
 	ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
 	AMDGPU_DEVICE_ATTR_RW(pp_dpm_vclk,
 	ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
 	AMDGPU_DEVICE_ATTR_RW(pp_dpm_dclk,
 	ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
-	AMDGPU_DEVICE_ATTR_RW(pp_dpm_dcefclk,

ATTR_FLAG_BASIC),

drivers/gpu/drm/amd/pm/amdgpu_pm.c +0 -1
-	AMDGPU_DEVICE_ATTR_RW(pp_dpm_pcie,

ATTR_FLAG_BASIC),

drivers/gpu/drm/amd/pm/amdgpu_pm.c +1 -0
+	AMDGPU_DEVICE_ATTR_RW(pp_dpm_dcefclk,

ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),

drivers/gpu/drm/amd/pm/amdgpu_pm.c +1 -0
+	AMDGPU_DEVICE_ATTR_RW(pp_dpm_pcie,

ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF), AMDGPU_DEVICE_ATTR_RW(pp_sclk_od, ATTR_FLAG_BASIC), AMDGPU_DEVICE_ATTR_RW(pp_mclk_od, ATTR_FLAG_BASIC), AMDGPU_DEVICE_ATTR_RW(pp_power_profile_mode,
ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),

drivers/gpu/drm/amd/pm/amdgpu_pm.c +0 -13
@@ -3152,19 +3152,6 @@ static umode_t hwmon_attributes_visible(struct
 kobject *kobj,
 	if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev))
 		return 0;
 
-	/* there is no fan under pp one vf mode */
-	if (amdgpu_sriov_is_pp_one_vf(adev) &&
-	    (attr == &sensor_dev_attr_pwm1.dev_attr.attr ||
-	     attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr ||
-	     attr == &sensor_dev_attr_pwm1_max.dev_attr.attr ||
-	     attr == &sensor_dev_attr_pwm1_min.dev_attr.attr ||
-	     attr == &sensor_dev_attr_fan1_input.dev_attr.attr ||
-	     attr == &sensor_dev_attr_fan1_min.dev_attr.attr ||
-	     attr == &sensor_dev_attr_fan1_max.dev_attr.attr ||
-	     attr == &sensor_dev_attr_fan1_target.dev_attr.attr ||
-	     attr == &sensor_dev_attr_fan1_enable.dev_attr.attr))
-		return 0;
-
 	/* Skip fan attributes if fan is not present */
 	if (adev->pm.no_fan && (attr ==

&sensor_dev_attr_pwm1.dev_attr.attr ||

drivers/gpu/drm/amd/pm/amdgpu_pm.c +0 -0
 	    attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr ||
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -0
index 4e37cd8025ed..7ea0427f65d3 100644
@@ -134,7 +134,7 @@ static struct cmn2asic_msg_mapping

sienna_cichlid_message_map[SMU_MSG_MAX_COUNT]
MSG_MAP(PrepareMp1ForUnload,
PPSMC_MSG_PrepareMp1ForUnload, 1),
MSG_MAP(AllowGfxOff,
PPSMC_MSG_AllowGfxOff, 0),
MSG_MAP(DisallowGfxOff,
PPSMC_MSG_DisallowGfxOff, 0),

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -1
-	MSG_MAP(GetPptLimit,

PPSMC_MSG_GetPptLimit, 0),

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -0
+	MSG_MAP(GetPptLimit,

PPSMC_MSG_GetPptLimit, 1),
MSG_MAP(GetDcModeMaxDpmFreq,
PPSMC_MSG_GetDcModeMaxDpmFreq, 1),
MSG_MAP(ExitBaco, PPSMC_MSG_ExitBaco,
0),
MSG_MAP(PowerUpVcn,
PPSMC_MSG_PowerUpVcn, 0),
--
2.20.1

Reviewed-by on v1 1/1
#2 lore raw
In reply to Marina Nikolic

[AMD Official Use Only]

Best Regards,
Kevin
________________________________
From: amd-gfx <[email protected]> on behalf of Marina Nikolic <[email protected]>
Sent: Tuesday, January 18, 2022 12:21 AM
To: [email protected] <[email protected]>
Cc: Mitrovic, Milan <[email protected]>; Veljkovic, Nikola <[email protected]>; Nikolic, Marina <[email protected]>; Kitchen, Greg <[email protected]>
Subject: [PATCH] drm/amd/pm: Enable sysfs required by rocm-smi tool for One VF mode

Enable power level, power limit and fan speed
information retrieval in one VF mode.
This is required so that tool ROCM-SMI
can provide this information to users.

---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c              | 17 ++---------------
 .../drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c |  2 +-
 2 files changed, 3 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2 -15
index 1b03ad7a21ad..bb7d03cd814c 100644
@@ -1903,8 +1903,8 @@ static struct amdgpu_device_attr amdgpu_device_attrs[] = {
         AMDGPU_DEVICE_ATTR_RW(pp_dpm_fclk,                              ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
         AMDGPU_DEVICE_ATTR_RW(pp_dpm_vclk,                              ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
         AMDGPU_DEVICE_ATTR_RW(pp_dpm_dclk,                              ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
-       AMDGPU_DEVICE_ATTR_RW(pp_dpm_dcefclk,                           ATTR_FLAG_BASIC),
-       AMDGPU_DEVICE_ATTR_RW(pp_dpm_pcie,                              ATTR_FLAG_BASIC),
+       AMDGPU_DEVICE_ATTR_RW(pp_dpm_dcefclk,                           ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
+       AMDGPU_DEVICE_ATTR_RW(pp_dpm_pcie,                              ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
         AMDGPU_DEVICE_ATTR_RW(pp_sclk_od,                               ATTR_FLAG_BASIC),
         AMDGPU_DEVICE_ATTR_RW(pp_mclk_od,                               ATTR_FLAG_BASIC),
         AMDGPU_DEVICE_ATTR_RW(pp_power_profile_mode,                    ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
@@ -3152,19 +3152,6 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,
         if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev))
                 return 0;
 
-       /* there is no fan under pp one vf mode */
-       if (amdgpu_sriov_is_pp_one_vf(adev) &&
-           (attr == &sensor_dev_attr_pwm1.dev_attr.attr ||
-            attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr ||
-            attr == &sensor_dev_attr_pwm1_max.dev_attr.attr ||
-            attr == &sensor_dev_attr_pwm1_min.dev_attr.attr ||
-            attr == &sensor_dev_attr_fan1_input.dev_attr.attr ||
-            attr == &sensor_dev_attr_fan1_min.dev_attr.attr ||
-            attr == &sensor_dev_attr_fan1_max.dev_attr.attr ||
-            attr == &sensor_dev_attr_fan1_target.dev_attr.attr ||
-            attr == &sensor_dev_attr_fan1_enable.dev_attr.attr))
-               return 0;
-
         /* Skip fan attributes if fan is not present */
         if (adev->pm.no_fan && (attr == &sensor_dev_attr_pwm1.dev_attr.attr ||
             attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr ||
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -1
index 4e37cd8025ed..7ea0427f65d3 100644
@@ -134,7 +134,7 @@ static struct cmn2asic_msg_mapping sienna_cichlid_message_map[SMU_MSG_MAX_COUNT]
         MSG_MAP(PrepareMp1ForUnload,            PPSMC_MSG_PrepareMp1ForUnload,         1),
         MSG_MAP(AllowGfxOff,                    PPSMC_MSG_AllowGfxOff,                 0),
         MSG_MAP(DisallowGfxOff,                 PPSMC_MSG_DisallowGfxOff,              0),
-       MSG_MAP(GetPptLimit,                    PPSMC_MSG_GetPptLimit,                 0),
+       MSG_MAP(GetPptLimit,                    PPSMC_MSG_GetPptLimit,                 1),
         MSG_MAP(GetDcModeMaxDpmFreq,            PPSMC_MSG_GetDcModeMaxDpmFreq,         1),
         MSG_MAP(ExitBaco,                       PPSMC_MSG_ExitBaco,                    0),
         MSG_MAP(PowerUpVcn,                     PPSMC_MSG_PowerUpVcn,                  0),

--
2.20.1