Skip to contentSkip to conversation

drm/amd/powerplay: move smu types to smu_types.h

PATCH In review Wang, Kevin(Yang) 6 participants 22 messages Jul 25, 2019 – Jul 26, 2019 14 messages not in the archive

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

PATCH 1/5 drm/amd/powerplay: move smu types to smu_types.h

move some enum type (message, feature, clock) to smu_types.h. these types is too long in amdgpu_smu.h, and not clearly.

---
 .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    | 186 +---------------
 drivers/gpu/drm/amd/powerplay/inc/smu_types.h | 210 ++++++++++++++++++
 2 files changed, 211 insertions(+), 185 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu_types.h
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +1 -185
index 33d2d75ba903..397040a4d1b4 100644
@@ -26,6 +26,7 @@
 #include "kgd_pp_interface.h"
 #include "dm_pp_interface.h"
 #include "dm_pp_smu.h"
+#include "smu_types.h"
 
 #define SMU_THERMAL_MINIMUM_ALERT_TEMP		0
 #define SMU_THERMAL_MAXIMUM_ALERT_TEMP		255
@@ -150,134 +151,6 @@ struct smu_power_state {
 	struct smu_hw_power_state                     hardware;
 };
 
-enum smu_message_type
-{
-	SMU_MSG_TestMessage = 0,
-	SMU_MSG_GetSmuVersion,
-	SMU_MSG_GetDriverIfVersion,
-	SMU_MSG_SetAllowedFeaturesMaskLow,
-	SMU_MSG_SetAllowedFeaturesMaskHigh,
-	SMU_MSG_EnableAllSmuFeatures,
-	SMU_MSG_DisableAllSmuFeatures,
-	SMU_MSG_EnableSmuFeaturesLow,
-	SMU_MSG_EnableSmuFeaturesHigh,
-	SMU_MSG_DisableSmuFeaturesLow,
-	SMU_MSG_DisableSmuFeaturesHigh,
-	SMU_MSG_GetEnabledSmuFeaturesLow,
-	SMU_MSG_GetEnabledSmuFeaturesHigh,
-	SMU_MSG_SetWorkloadMask,
-	SMU_MSG_SetPptLimit,
-	SMU_MSG_SetDriverDramAddrHigh,
-	SMU_MSG_SetDriverDramAddrLow,
-	SMU_MSG_SetToolsDramAddrHigh,
-	SMU_MSG_SetToolsDramAddrLow,
-	SMU_MSG_TransferTableSmu2Dram,
-	SMU_MSG_TransferTableDram2Smu,
-	SMU_MSG_UseDefaultPPTable,
-	SMU_MSG_UseBackupPPTable,
-	SMU_MSG_RunBtc,
-	SMU_MSG_RequestI2CBus,
-	SMU_MSG_ReleaseI2CBus,
-	SMU_MSG_SetFloorSocVoltage,
-	SMU_MSG_SoftReset,
-	SMU_MSG_StartBacoMonitor,
-	SMU_MSG_CancelBacoMonitor,
-	SMU_MSG_EnterBaco,
-	SMU_MSG_SetSoftMinByFreq,
-	SMU_MSG_SetSoftMaxByFreq,
-	SMU_MSG_SetHardMinByFreq,
-	SMU_MSG_SetHardMaxByFreq,
-	SMU_MSG_GetMinDpmFreq,
-	SMU_MSG_GetMaxDpmFreq,
-	SMU_MSG_GetDpmFreqByIndex,
-	SMU_MSG_GetDpmClockFreq,
-	SMU_MSG_GetSsVoltageByDpm,
-	SMU_MSG_SetMemoryChannelConfig,
-	SMU_MSG_SetGeminiMode,
-	SMU_MSG_SetGeminiApertureHigh,
-	SMU_MSG_SetGeminiApertureLow,
-	SMU_MSG_SetMinLinkDpmByIndex,
-	SMU_MSG_OverridePcieParameters,
-	SMU_MSG_OverDriveSetPercentage,
-	SMU_MSG_SetMinDeepSleepDcefclk,
-	SMU_MSG_ReenableAcDcInterrupt,
-	SMU_MSG_NotifyPowerSource,
-	SMU_MSG_SetUclkFastSwitch,
-	SMU_MSG_SetUclkDownHyst,
-	SMU_MSG_GfxDeviceDriverReset,
-	SMU_MSG_GetCurrentRpm,
-	SMU_MSG_SetVideoFps,
-	SMU_MSG_SetTjMax,
-	SMU_MSG_SetFanTemperatureTarget,
-	SMU_MSG_PrepareMp1ForUnload,
-	SMU_MSG_DramLogSetDramAddrHigh,
-	SMU_MSG_DramLogSetDramAddrLow,
-	SMU_MSG_DramLogSetDramSize,
-	SMU_MSG_SetFanMaxRpm,
-	SMU_MSG_SetFanMinPwm,
-	SMU_MSG_ConfigureGfxDidt,
-	SMU_MSG_NumOfDisplays,
-	SMU_MSG_RemoveMargins,
-	SMU_MSG_ReadSerialNumTop32,
-	SMU_MSG_ReadSerialNumBottom32,
-	SMU_MSG_SetSystemVirtualDramAddrHigh,
-	SMU_MSG_SetSystemVirtualDramAddrLow,
-	SMU_MSG_WaflTest,
-	SMU_MSG_SetFclkGfxClkRatio,
-	SMU_MSG_AllowGfxOff,
-	SMU_MSG_DisallowGfxOff,
-	SMU_MSG_GetPptLimit,
-	SMU_MSG_GetDcModeMaxDpmFreq,
-	SMU_MSG_GetDebugData,
-	SMU_MSG_SetXgmiMode,
-	SMU_MSG_RunAfllBtc,
-	SMU_MSG_ExitBaco,
-	SMU_MSG_PrepareMp1ForReset,
-	SMU_MSG_PrepareMp1ForShutdown,
-	SMU_MSG_SetMGpuFanBoostLimitRpm,
-	SMU_MSG_GetAVFSVoltageByDpm,
-	SMU_MSG_PowerUpVcn,
-	SMU_MSG_PowerDownVcn,
-	SMU_MSG_PowerUpJpeg,
-	SMU_MSG_PowerDownJpeg,
-	SMU_MSG_BacoAudioD3PME,
-	SMU_MSG_ArmD3,
-	SMU_MSG_RunGfxDcBtc,
-	SMU_MSG_RunSocDcBtc,
-	SMU_MSG_SetMemoryChannelEnable,
-	SMU_MSG_SetDfSwitchType,
-	SMU_MSG_GetVoltageByDpm,
-	SMU_MSG_GetVoltageByDpmOverdrive,
-	SMU_MSG_PowerUpVcn0,
-	SMU_MSG_PowerDownVcn01,
-	SMU_MSG_PowerUpVcn1,
-	SMU_MSG_PowerDownVcn1,
-	SMU_MSG_MAX_COUNT,
-};
-
-enum smu_clk_type
-{
-	SMU_GFXCLK,
-	SMU_VCLK,
-	SMU_DCLK,
-	SMU_ECLK,
-	SMU_SOCCLK,
-	SMU_UCLK,
-	SMU_DCEFCLK,
-	SMU_DISPCLK,
-	SMU_PIXCLK,
-	SMU_PHYCLK,
-	SMU_FCLK,
-	SMU_SCLK,
-	SMU_MCLK,
-	SMU_PCIE,
-	SMU_OD_SCLK,
-	SMU_OD_MCLK,
-	SMU_OD_VDDC_CURVE,
-	SMU_OD_RANGE,
-	SMU_CLK_COUNT,
-};
-
 enum smu_power_src_type
 {
 	SMU_POWER_SOURCE_AC,
@@ -285,63 +158,6 @@ enum smu_power_src_type
 	SMU_POWER_SOURCE_COUNT,
 };
 
-enum smu_feature_mask
-{
-	SMU_FEATURE_DPM_PREFETCHER_BIT,
-	SMU_FEATURE_DPM_GFXCLK_BIT,
-	SMU_FEATURE_DPM_UCLK_BIT,
-	SMU_FEATURE_DPM_SOCCLK_BIT,
-	SMU_FEATURE_DPM_UVD_BIT,
-	SMU_FEATURE_DPM_VCE_BIT,
-	SMU_FEATURE_ULV_BIT,
-	SMU_FEATURE_DPM_MP0CLK_BIT,
-	SMU_FEATURE_DPM_LINK_BIT,
-	SMU_FEATURE_DPM_DCEFCLK_BIT,
-	SMU_FEATURE_DS_GFXCLK_BIT,
-	SMU_FEATURE_DS_SOCCLK_BIT,
-	SMU_FEATURE_DS_LCLK_BIT,
-	SMU_FEATURE_PPT_BIT,
-	SMU_FEATURE_TDC_BIT,
-	SMU_FEATURE_THERMAL_BIT,
-	SMU_FEATURE_GFX_PER_CU_CG_BIT,
-	SMU_FEATURE_RM_BIT,
-	SMU_FEATURE_DS_DCEFCLK_BIT,
-	SMU_FEATURE_ACDC_BIT,
-	SMU_FEATURE_VR0HOT_BIT,
-	SMU_FEATURE_VR1HOT_BIT,
-	SMU_FEATURE_FW_CTF_BIT,
-	SMU_FEATURE_LED_DISPLAY_BIT,
-	SMU_FEATURE_FAN_CONTROL_BIT,
-	SMU_FEATURE_GFX_EDC_BIT,
-	SMU_FEATURE_GFXOFF_BIT,
-	SMU_FEATURE_CG_BIT,
-	SMU_FEATURE_DPM_FCLK_BIT,
-	SMU_FEATURE_DS_FCLK_BIT,
-	SMU_FEATURE_DS_MP1CLK_BIT,
-	SMU_FEATURE_DS_MP0CLK_BIT,
-	SMU_FEATURE_XGMI_BIT,
-	SMU_FEATURE_DPM_GFX_PACE_BIT,
-	SMU_FEATURE_MEM_VDDCI_SCALING_BIT,
-	SMU_FEATURE_MEM_MVDD_SCALING_BIT,
-	SMU_FEATURE_DS_UCLK_BIT,
-	SMU_FEATURE_GFX_ULV_BIT,
-	SMU_FEATURE_FW_DSTATE_BIT,
-	SMU_FEATURE_BACO_BIT,
-	SMU_FEATURE_VCN_PG_BIT,
-	SMU_FEATURE_JPEG_PG_BIT,
-	SMU_FEATURE_USB_PG_BIT,
-	SMU_FEATURE_RSMU_SMN_CG_BIT,
-	SMU_FEATURE_APCC_PLUS_BIT,
-	SMU_FEATURE_GTHR_BIT,
-	SMU_FEATURE_GFX_DCS_BIT,
-	SMU_FEATURE_GFX_SS_BIT,
-	SMU_FEATURE_OUT_OF_BAND_MONITOR_BIT,
-	SMU_FEATURE_TEMP_DEPENDENT_VMIN_BIT,
-	SMU_FEATURE_MMHUB_PG_BIT,
-	SMU_FEATURE_ATHUB_PG_BIT,
-	SMU_FEATURE_COUNT,
-};
-
 enum smu_memory_pool_size
 {
     SMU_MEMORY_POOL_SIZE_ZERO   = 0,
drivers/gpu/drm/amd/powerplay/inc/smu_types.h new file +210 -0

210 lines not on this page · raw message

Signature · 6 lines
2.22.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

PATCH 2/5 drm/amd/powerplay: add smu message name support

add smu_get_message_name support in smu.

---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c    |  13 ++
 .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    |   1 +
 drivers/gpu/drm/amd/powerplay/inc/smu_types.h | 205 +++++++++---------
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c     |  12 +-
 4 files changed, 124 insertions(+), 107 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +13 -0
index 6935a00cd389..4604b6af56bb 100644
@@ -29,6 +29,19 @@
 #include "smu_v11_0.h"
 #include "atom.h"
 
+#undef __SMU_DUMMY_MAP
+#define __SMU_DUMMY_MAP(type)	#type
+static const char* __smu_message_names[] = {
+	SMU_MESSAGE_TYPES
+};
+
+const char *smu_get_message_name(struct smu_context *smu, enum smu_message_type type)
+{
+	if (type < 0 || type > SMU_MSG_MAX_COUNT)
+		return "unknow smu message";
+	return __smu_message_names[type];
+}
+
 int smu_get_smc_version(struct smu_context *smu, uint32_t *if_version, uint32_t *smu_version)
 {
 	int ret = 0;
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +1 -0
index 397040a4d1b4..035f857922ec 100644
@@ -804,5 +804,6 @@ enum amd_dpm_forced_level smu_get_performance_level(struct smu_context *smu);
 int smu_force_performance_level(struct smu_context *smu, enum amd_dpm_forced_level level);
 int smu_set_display_count(struct smu_context *smu, uint32_t count);
 bool smu_clk_dpm_is_enabled(struct smu_context *smu, enum smu_clk_type clk_type);
+const char *smu_get_message_name(struct smu_context *smu, enum smu_message_type type);
 
 #endif
drivers/gpu/drm/amd/powerplay/inc/smu_types.h +104 -101

216 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/smu_v11_0.c +6 -6
index 745b35a1600d..ccf6af055d03 100644
@@ -102,8 +102,8 @@ static int smu_v11_0_send_msg(struct smu_context *smu, uint16_t msg)
 	ret = smu_v11_0_wait_for_response(smu);
 
 	if (ret)
-		pr_err("Failed to send message 0x%x, response 0x%x\n", index,
-		       ret);
+		pr_err("failed send message: %10s (%d) response %#x\n",
+		       smu_get_message_name(smu, msg), index, ret);
 
 	return ret;
 
@@ -123,8 +123,8 @@ smu_v11_0_send_msg_with_param(struct smu_context *smu, uint16_t msg,
 
 	ret = smu_v11_0_wait_for_response(smu);
 	if (ret)
-		pr_err("Failed to send message 0x%x, response 0x%x, param 0x%x\n",
-		       index, ret, param);
+		pr_err("failed send message: %10s (%d) \tparam: 0x%08x response %#x\n",
+		       smu_get_message_name(smu, msg), index, param, ret);
 
 	WREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_90, 0);
 
@@ -134,8 +134,8 @@ smu_v11_0_send_msg_with_param(struct smu_context *smu, uint16_t msg,
 
 	ret = smu_v11_0_wait_for_response(smu);
 	if (ret)
-		pr_err("Failed to send message 0x%x, response 0x%x param 0x%x\n",
-		       index, ret, param);
+		pr_err("failed send message: %10s (%d) \tparam: 0x%08x response %#x\n",
+		       smu_get_message_name(smu, msg), index, param, ret);
 
 	return ret;
 }
Signature · 6 lines
2.22.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

Reviewed-by Kenneth Feng
#4 lore raw

RE: [PATCH 2/5] drm/amd/powerplay: add smu message name support

A little difficult for me to understand, but the logic is ok.

-----Original Message-----
From: Wang, Kevin(Yang)
Sent: Thursday, July 25, 2019 1:11 PM
To: [email protected]
Cc: Feng, Kenneth <[email protected]>; Huang, Ray <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Kevin(Yang) <[email protected]>
Subject: [PATCH 2/5] drm/amd/powerplay: add smu message name support

add smu_get_message_name support in smu.

---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c    |  13 ++
 .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    |   1 +
 drivers/gpu/drm/amd/powerplay/inc/smu_types.h | 205 +++++++++---------
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c     |  12 +-
 4 files changed, 124 insertions(+), 107 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +13 -0
index 6935a00cd389..4604b6af56bb 100644
@@ -29,6 +29,19 @@
 #include "smu_v11_0.h"
 #include "atom.h"
 
+#undef __SMU_DUMMY_MAP
+#define __SMU_DUMMY_MAP(type)	#type
+static const char* __smu_message_names[] = {
+	SMU_MESSAGE_TYPES
+};
+
+const char *smu_get_message_name(struct smu_context *smu, enum 
+smu_message_type type) {
+	if (type < 0 || type > SMU_MSG_MAX_COUNT)
+		return "unknow smu message";
+	return __smu_message_names[type];
+}
+
 int smu_get_smc_version(struct smu_context *smu, uint32_t *if_version, uint32_t *smu_version)  {
 	int ret = 0;
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +2 -0
index 397040a4d1b4..035f857922ec 100644
@@ -804,5 +804,6 @@ enum amd_dpm_forced_level smu_get_performance_level(struct smu_context *smu);  int smu_force_performance_level(struct smu_context *smu, enum amd_dpm_forced_level level);  int smu_set_display_count(struct smu_context *smu, uint32_t count);  bool smu_clk_dpm_is_enabled(struct smu_context *smu, enum smu_clk_type clk_type);
+const char *smu_get_message_name(struct smu_context *smu, enum 
+smu_message_type type);
 
 #endif
drivers/gpu/drm/amd/powerplay/inc/smu_types.h +104 -101

215 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/smu_v11_0.c +6 -6
index 745b35a1600d..ccf6af055d03 100644
@@ -102,8 +102,8 @@ static int smu_v11_0_send_msg(struct smu_context *smu, uint16_t msg)
 	ret = smu_v11_0_wait_for_response(smu);
 
 	if (ret)
-		pr_err("Failed to send message 0x%x, response 0x%x\n", index,
-		       ret);
+		pr_err("failed send message: %10s (%d) response %#x\n",
+		       smu_get_message_name(smu, msg), index, ret);
 
 	return ret;
 
@@ -123,8 +123,8 @@ smu_v11_0_send_msg_with_param(struct smu_context *smu, uint16_t msg,
 
 	ret = smu_v11_0_wait_for_response(smu);
 	if (ret)
-		pr_err("Failed to send message 0x%x, response 0x%x, param 0x%x\n",
-		       index, ret, param);
+		pr_err("failed send message: %10s (%d) \tparam: 0x%08x response %#x\n",
+		       smu_get_message_name(smu, msg), index, param, ret);
 
 	WREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_90, 0);
 
@@ -134,8 +134,8 @@ smu_v11_0_send_msg_with_param(struct smu_context *smu, uint16_t msg,
 
 	ret = smu_v11_0_wait_for_response(smu);
 	if (ret)
-		pr_err("Failed to send message 0x%x, response 0x%x param 0x%x\n",
-		       index, ret, param);
+		pr_err("failed send message: %10s (%d) \tparam: 0x%08x response %#x\n",
+		       smu_get_message_name(smu, msg), index, param, ret);
 
 	return ret;
 }

--
2.22.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#5 lore raw

PATCH 3/5 drm/amd/powerplay: add smu feature name support

In reply to a message not in the archive

add smu_get_feature_name support in smu.

---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c    |  13 +++
 .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    |   1 +
 drivers/gpu/drm/amd/powerplay/inc/smu_types.h | 109 +++++++++---------
 3 files changed, 71 insertions(+), 52 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +13 -0
index 4604b6af56bb..8563f9083f4e 100644
@@ -42,6 +42,19 @@ const char *smu_get_message_name(struct smu_context *smu, enum smu_message_type
 	return __smu_message_names[type];
 }
 
+#undef __SMU_DUMMY_MAP
+#define __SMU_DUMMY_MAP(fea)	#fea
+static const char* __smu_feature_names[] = {
+	SMU_FEATURE_MASKS
+};
+
+const char *smu_get_feature_name(struct smu_context *smu, enum smu_feature_mask feature)
+{
+	if (feature < 0 || feature > SMU_FEATURE_COUNT)
+		return "unknow smu feature";
+	return __smu_feature_names[feature];
+}
+
 int smu_get_smc_version(struct smu_context *smu, uint32_t *if_version, uint32_t *smu_version)
 {
 	int ret = 0;
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +1 -0
index 035f857922ec..ba2385026b89 100644
@@ -805,5 +805,6 @@ int smu_force_performance_level(struct smu_context *smu, enum amd_dpm_forced_lev
 int smu_set_display_count(struct smu_context *smu, uint32_t count);
 bool smu_clk_dpm_is_enabled(struct smu_context *smu, enum smu_clk_type clk_type);
 const char *smu_get_message_name(struct smu_context *smu, enum smu_message_type type);
+const char *smu_get_feature_name(struct smu_context *smu, enum smu_feature_mask feature);
 
 #endif
drivers/gpu/drm/amd/powerplay/inc/smu_types.h +57 -52

116 lines not on this page · raw message

Signature · 6 lines
2.22.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw

RE: [PATCH 3/5] drm/amd/powerplay: add smu feature name support

For patch2 and patch3, __SMU_DUMMY_MAP has several different defines.
It's not sure what it is defined as and that's why you need "#undef __SMU_DUMMY_MAP" before each use. Please give them separate names and avoid this confusing.

Regards,
Evan

Quoted 187 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Wang, Kevin(Yang)
Sent: Thursday, July 25, 2019 1:11 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>; Feng, Kenneth <[email protected]>; Wang, Kevin(Yang) <[email protected]>
Subject: [PATCH 3/5] drm/amd/powerplay: add smu feature name support

add smu_get_feature_name support in smu.

---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c    |  13 +++
 .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    |   1 +
 drivers/gpu/drm/amd/powerplay/inc/smu_types.h | 109 +++++++++--------
(quoted diff) +0 -1
-
 3 files changed, 71 insertions(+), 52 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0 -0
index 4604b6af56bb..8563f9083f4e 100644
@@ -42,6 +42,19 @@ const char *smu_get_message_name(struct

smu_context *smu, enum smu_message_type

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +13 -0
 	return __smu_message_names[type];
 }
 
+#undef __SMU_DUMMY_MAP
+#define __SMU_DUMMY_MAP(fea)	#fea
+static const char* __smu_feature_names[] = {
+	SMU_FEATURE_MASKS
+};
+
+const char *smu_get_feature_name(struct smu_context *smu, enum
+smu_feature_mask feature) {
+	if (feature < 0 || feature > SMU_FEATURE_COUNT)
+		return "unknow smu feature";
+	return __smu_feature_names[feature];
+}
+
 int smu_get_smc_version(struct smu_context *smu, uint32_t *if_version,

uint32_t *smu_version) {

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0 -0
 	int ret = 0;
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -0
index 035f857922ec..ba2385026b89 100644
@@ -805,5 +805,6 @@ int smu_force_performance_level(struct

smu_context *smu, enum amd_dpm_forced_lev int smu_set_display_count(struct smu_context *smu, uint32_t count); bool smu_clk_dpm_is_enabled(struct smu_context *smu, enum smu_clk_type clk_type); const char *smu_get_message_name(struct smu_context *smu, enum smu_message_type type);

drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +2 -0
+const char *smu_get_feature_name(struct smu_context *smu, enum
+smu_feature_mask feature);
 
 #endif
drivers/gpu/drm/amd/powerplay/inc/smu_types.h +57 -53
index d42e3424e704..8793c8d0dc52 100644
@@ -154,59 +154,64 @@ enum smu_clk_type {
 	SMU_CLK_COUNT,
 };
 
+#define SMU_FEATURE_MASKS				\
+       __SMU_DUMMY_MAP(DPM_PREFETCHER),			\
+       __SMU_DUMMY_MAP(DPM_GFXCLK),                    	\
+       __SMU_DUMMY_MAP(DPM_UCLK),                      	\
+       __SMU_DUMMY_MAP(DPM_SOCCLK),                    	\
+       __SMU_DUMMY_MAP(DPM_UVD),                       	\
+       __SMU_DUMMY_MAP(DPM_VCE),                       	\
+       __SMU_DUMMY_MAP(ULV),                           	\
+       __SMU_DUMMY_MAP(DPM_MP0CLK),                    	\
+       __SMU_DUMMY_MAP(DPM_LINK),                      	\
+       __SMU_DUMMY_MAP(DPM_DCEFCLK),                   	\
+       __SMU_DUMMY_MAP(DS_GFXCLK),                     	\
+       __SMU_DUMMY_MAP(DS_SOCCLK),                     	\
+       __SMU_DUMMY_MAP(DS_LCLK),                       	\
+       __SMU_DUMMY_MAP(PPT),                           	\
+       __SMU_DUMMY_MAP(TDC),                           	\
+       __SMU_DUMMY_MAP(THERMAL),                       	\
+       __SMU_DUMMY_MAP(GFX_PER_CU_CG),                 	\
+       __SMU_DUMMY_MAP(RM),                            	\
+       __SMU_DUMMY_MAP(DS_DCEFCLK),                    	\
+       __SMU_DUMMY_MAP(ACDC),                          	\
+       __SMU_DUMMY_MAP(VR0HOT),                        	\
+       __SMU_DUMMY_MAP(VR1HOT),                        	\
+       __SMU_DUMMY_MAP(FW_CTF),                        	\
+       __SMU_DUMMY_MAP(LED_DISPLAY),                   	\
+       __SMU_DUMMY_MAP(FAN_CONTROL),                   	\
+       __SMU_DUMMY_MAP(GFX_EDC),                       	\
+       __SMU_DUMMY_MAP(GFXOFF),                        	\
+       __SMU_DUMMY_MAP(CG),                            	\
+       __SMU_DUMMY_MAP(DPM_FCLK),                      	\
+       __SMU_DUMMY_MAP(DS_FCLK),                       	\
+       __SMU_DUMMY_MAP(DS_MP1CLK),                     	\
+       __SMU_DUMMY_MAP(DS_MP0CLK),                     	\
+       __SMU_DUMMY_MAP(XGMI),                          	\
+       __SMU_DUMMY_MAP(DPM_GFX_PACE),                  	\
+       __SMU_DUMMY_MAP(MEM_VDDCI_SCALING),             	\
+       __SMU_DUMMY_MAP(MEM_MVDD_SCALING),              	\
+       __SMU_DUMMY_MAP(DS_UCLK),                       	\
+       __SMU_DUMMY_MAP(GFX_ULV),                       	\
+       __SMU_DUMMY_MAP(FW_DSTATE),                     	\
+       __SMU_DUMMY_MAP(BACO),                          	\
+       __SMU_DUMMY_MAP(VCN_PG),                        	\
+       __SMU_DUMMY_MAP(JPEG_PG),                       	\
+       __SMU_DUMMY_MAP(USB_PG),                        	\
+       __SMU_DUMMY_MAP(RSMU_SMN_CG),                   	\
+       __SMU_DUMMY_MAP(APCC_PLUS),                     	\
+       __SMU_DUMMY_MAP(GTHR),                          	\
+       __SMU_DUMMY_MAP(GFX_DCS),                       	\
+       __SMU_DUMMY_MAP(GFX_SS),                        	\
+       __SMU_DUMMY_MAP(OUT_OF_BAND_MONITOR),           	\
+       __SMU_DUMMY_MAP(TEMP_DEPENDENT_VMIN),           	\
+       __SMU_DUMMY_MAP(MMHUB_PG),                      	\
+       __SMU_DUMMY_MAP(ATHUB_PG),                      	\
+
+#undef __SMU_DUMMY_MAP
+#define __SMU_DUMMY_MAP(feature)
 	SMU_FEATURE_##feature##_BIT
 enum smu_feature_mask {
-	SMU_FEATURE_DPM_PREFETCHER_BIT,
-	SMU_FEATURE_DPM_GFXCLK_BIT,
-	SMU_FEATURE_DPM_UCLK_BIT,
-	SMU_FEATURE_DPM_SOCCLK_BIT,
-	SMU_FEATURE_DPM_UVD_BIT,
-	SMU_FEATURE_DPM_VCE_BIT,
-	SMU_FEATURE_ULV_BIT,
-	SMU_FEATURE_DPM_MP0CLK_BIT,
-	SMU_FEATURE_DPM_LINK_BIT,
-	SMU_FEATURE_DPM_DCEFCLK_BIT,
-	SMU_FEATURE_DS_GFXCLK_BIT,
-	SMU_FEATURE_DS_SOCCLK_BIT,
-	SMU_FEATURE_DS_LCLK_BIT,
-	SMU_FEATURE_PPT_BIT,
-	SMU_FEATURE_TDC_BIT,
-	SMU_FEATURE_THERMAL_BIT,
-	SMU_FEATURE_GFX_PER_CU_CG_BIT,
-	SMU_FEATURE_RM_BIT,
-	SMU_FEATURE_DS_DCEFCLK_BIT,
-	SMU_FEATURE_ACDC_BIT,
-	SMU_FEATURE_VR0HOT_BIT,
-	SMU_FEATURE_VR1HOT_BIT,
-	SMU_FEATURE_FW_CTF_BIT,
-	SMU_FEATURE_LED_DISPLAY_BIT,
-	SMU_FEATURE_FAN_CONTROL_BIT,
-	SMU_FEATURE_GFX_EDC_BIT,
-	SMU_FEATURE_GFXOFF_BIT,
-	SMU_FEATURE_CG_BIT,
-	SMU_FEATURE_DPM_FCLK_BIT,
-	SMU_FEATURE_DS_FCLK_BIT,
-	SMU_FEATURE_DS_MP1CLK_BIT,
-	SMU_FEATURE_DS_MP0CLK_BIT,
-	SMU_FEATURE_XGMI_BIT,
-	SMU_FEATURE_DPM_GFX_PACE_BIT,
-	SMU_FEATURE_MEM_VDDCI_SCALING_BIT,
-	SMU_FEATURE_MEM_MVDD_SCALING_BIT,
-	SMU_FEATURE_DS_UCLK_BIT,
-	SMU_FEATURE_GFX_ULV_BIT,
-	SMU_FEATURE_FW_DSTATE_BIT,
-	SMU_FEATURE_BACO_BIT,
-	SMU_FEATURE_VCN_PG_BIT,
-	SMU_FEATURE_JPEG_PG_BIT,
-	SMU_FEATURE_USB_PG_BIT,
-	SMU_FEATURE_RSMU_SMN_CG_BIT,
-	SMU_FEATURE_APCC_PLUS_BIT,
-	SMU_FEATURE_GTHR_BIT,
-	SMU_FEATURE_GFX_DCS_BIT,
-	SMU_FEATURE_GFX_SS_BIT,
-	SMU_FEATURE_OUT_OF_BAND_MONITOR_BIT,
-	SMU_FEATURE_TEMP_DEPENDENT_VMIN_BIT,
-	SMU_FEATURE_MMHUB_PG_BIT,
-	SMU_FEATURE_ATHUB_PG_BIT,
+	SMU_FEATURE_MASKS
 	SMU_FEATURE_COUNT,
 };
 
--

2.22.0

Quoted 4 lines

_______________________________________________
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

A message that is not in the archive (sent off-list or not yet received): MN2PR12MB3344FF4A8126C0263C3D2E7CE4C10-rweVpJHSKToDMgCC8P//[email protected]

#9 lore raw

Re: [PATCH 3/5] drm/amd/powerplay: add smu feature name support

this is my intention,
i think we should to keep the macro name of __SMU_DUMMY_MAP. the smu driver code will use macro SMU_MESSAGE_TYPES and SMU_FEATURE_MASKS. the __SMU_DUMMY_MAP just a placeholder, the driver shouldn't add more one.

Best Regards,
Kevin
________________________________
From: Quan, Evan <[email protected]>
Sent: Thursday, July 25, 2019 5:35 PM
To: Wang, Kevin(Yang) <[email protected]>; [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>; Feng, Kenneth <[email protected]>; Wang, Kevin(Yang) <[email protected]>
Subject: RE: [PATCH 3/5] drm/amd/powerplay: add smu feature name support

For patch2 and patch3, __SMU_DUMMY_MAP has several different defines.
It's not sure what it is defined as and that's why you need "#undef __SMU_DUMMY_MAP" before each use. Please give them separate names and avoid this confusing.

Regards,
Evan

Quoted 187 lines

-----Original Message-----
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> On Behalf Of Wang, Kevin(Yang)
Sent: Thursday, July 25, 2019 1:11 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>; Feng, Kenneth <[email protected]>; Wang, Kevin(Yang) <[email protected]>
Subject: [PATCH 3/5] drm/amd/powerplay: add smu feature name support

add smu_get_feature_name support in smu.

---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c    |  13 +++
 .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    |   1 +
 drivers/gpu/drm/amd/powerplay/inc/smu_types.h | 109 +++++++++--------
(quoted diff) +0 -1
-
 3 files changed, 71 insertions(+), 52 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0 -0
index 4604b6af56bb..8563f9083f4e 100644
@@ -42,6 +42,19 @@ const char *smu_get_message_name(struct

smu_context *smu, enum smu_message_type

       return __smu_message_names[type];

}

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +13 -0
+#undef __SMU_DUMMY_MAP
+#define __SMU_DUMMY_MAP(fea) #fea
+static const char* __smu_feature_names[] = {
+     SMU_FEATURE_MASKS
+};
+
+const char *smu_get_feature_name(struct smu_context *smu, enum
+smu_feature_mask feature) {
+     if (feature < 0 || feature > SMU_FEATURE_COUNT)
+             return "unknow smu feature";
+     return __smu_feature_names[feature];
+}
+
 int smu_get_smc_version(struct smu_context *smu, uint32_t *if_version,
uint32_t *smu_version)  {
       int ret = 0;
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -0
index 035f857922ec..ba2385026b89 100644
@@ -805,5 +805,6 @@ int smu_force_performance_level(struct

smu_context *smu, enum amd_dpm_forced_lev int smu_set_display_count(struct smu_context *smu, uint32_t count); bool smu_clk_dpm_is_enabled(struct smu_context *smu, enum smu_clk_type clk_type); const char *smu_get_message_name(struct smu_context *smu, enum smu_message_type type);

drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +2 -0
+const char *smu_get_feature_name(struct smu_context *smu, enum
+smu_feature_mask feature);
 
 #endif
drivers/gpu/drm/amd/powerplay/inc/smu_types.h +57 -53
index d42e3424e704..8793c8d0dc52 100644
@@ -154,59 +154,64 @@ enum smu_clk_type {
       SMU_CLK_COUNT,
 };
 
+#define SMU_FEATURE_MASKS                            \
+       __SMU_DUMMY_MAP(DPM_PREFETCHER),                      \
+       __SMU_DUMMY_MAP(DPM_GFXCLK),                           \
+       __SMU_DUMMY_MAP(DPM_UCLK),                             \
+       __SMU_DUMMY_MAP(DPM_SOCCLK),                           \
+       __SMU_DUMMY_MAP(DPM_UVD),                              \
+       __SMU_DUMMY_MAP(DPM_VCE),                              \
+       __SMU_DUMMY_MAP(ULV),                                  \
+       __SMU_DUMMY_MAP(DPM_MP0CLK),                           \
+       __SMU_DUMMY_MAP(DPM_LINK),                             \
+       __SMU_DUMMY_MAP(DPM_DCEFCLK),                          \
+       __SMU_DUMMY_MAP(DS_GFXCLK),                            \
+       __SMU_DUMMY_MAP(DS_SOCCLK),                            \
+       __SMU_DUMMY_MAP(DS_LCLK),                              \
+       __SMU_DUMMY_MAP(PPT),                                  \
+       __SMU_DUMMY_MAP(TDC),                                  \
+       __SMU_DUMMY_MAP(THERMAL),                              \
+       __SMU_DUMMY_MAP(GFX_PER_CU_CG),                        \
+       __SMU_DUMMY_MAP(RM),                                   \
+       __SMU_DUMMY_MAP(DS_DCEFCLK),                           \
+       __SMU_DUMMY_MAP(ACDC),                                 \
+       __SMU_DUMMY_MAP(VR0HOT),                               \
+       __SMU_DUMMY_MAP(VR1HOT),                               \
+       __SMU_DUMMY_MAP(FW_CTF),                               \
+       __SMU_DUMMY_MAP(LED_DISPLAY),                          \
+       __SMU_DUMMY_MAP(FAN_CONTROL),                          \
+       __SMU_DUMMY_MAP(GFX_EDC),                              \
+       __SMU_DUMMY_MAP(GFXOFF),                               \
+       __SMU_DUMMY_MAP(CG),                                   \
+       __SMU_DUMMY_MAP(DPM_FCLK),                             \
+       __SMU_DUMMY_MAP(DS_FCLK),                              \
+       __SMU_DUMMY_MAP(DS_MP1CLK),                            \
+       __SMU_DUMMY_MAP(DS_MP0CLK),                            \
+       __SMU_DUMMY_MAP(XGMI),                                 \
+       __SMU_DUMMY_MAP(DPM_GFX_PACE),                         \
+       __SMU_DUMMY_MAP(MEM_VDDCI_SCALING),                    \
+       __SMU_DUMMY_MAP(MEM_MVDD_SCALING),                     \
+       __SMU_DUMMY_MAP(DS_UCLK),                              \
+       __SMU_DUMMY_MAP(GFX_ULV),                              \
+       __SMU_DUMMY_MAP(FW_DSTATE),                            \
+       __SMU_DUMMY_MAP(BACO),                                 \
+       __SMU_DUMMY_MAP(VCN_PG),                               \
+       __SMU_DUMMY_MAP(JPEG_PG),                              \
+       __SMU_DUMMY_MAP(USB_PG),                               \
+       __SMU_DUMMY_MAP(RSMU_SMN_CG),                          \
+       __SMU_DUMMY_MAP(APCC_PLUS),                            \
+       __SMU_DUMMY_MAP(GTHR),                                 \
+       __SMU_DUMMY_MAP(GFX_DCS),                              \
+       __SMU_DUMMY_MAP(GFX_SS),                               \
+       __SMU_DUMMY_MAP(OUT_OF_BAND_MONITOR),                  \
+       __SMU_DUMMY_MAP(TEMP_DEPENDENT_VMIN),                  \
+       __SMU_DUMMY_MAP(MMHUB_PG),                             \
+       __SMU_DUMMY_MAP(ATHUB_PG),                             \
+
+#undef __SMU_DUMMY_MAP
+#define __SMU_DUMMY_MAP(feature)
       SMU_FEATURE_##feature##_BIT
 enum smu_feature_mask {
-     SMU_FEATURE_DPM_PREFETCHER_BIT,
-     SMU_FEATURE_DPM_GFXCLK_BIT,
-     SMU_FEATURE_DPM_UCLK_BIT,
-     SMU_FEATURE_DPM_SOCCLK_BIT,
-     SMU_FEATURE_DPM_UVD_BIT,
-     SMU_FEATURE_DPM_VCE_BIT,
-     SMU_FEATURE_ULV_BIT,
-     SMU_FEATURE_DPM_MP0CLK_BIT,
-     SMU_FEATURE_DPM_LINK_BIT,
-     SMU_FEATURE_DPM_DCEFCLK_BIT,
-     SMU_FEATURE_DS_GFXCLK_BIT,
-     SMU_FEATURE_DS_SOCCLK_BIT,
-     SMU_FEATURE_DS_LCLK_BIT,
-     SMU_FEATURE_PPT_BIT,
-     SMU_FEATURE_TDC_BIT,
-     SMU_FEATURE_THERMAL_BIT,
-     SMU_FEATURE_GFX_PER_CU_CG_BIT,
-     SMU_FEATURE_RM_BIT,
-     SMU_FEATURE_DS_DCEFCLK_BIT,
-     SMU_FEATURE_ACDC_BIT,
-     SMU_FEATURE_VR0HOT_BIT,
-     SMU_FEATURE_VR1HOT_BIT,
-     SMU_FEATURE_FW_CTF_BIT,
-     SMU_FEATURE_LED_DISPLAY_BIT,
-     SMU_FEATURE_FAN_CONTROL_BIT,
-     SMU_FEATURE_GFX_EDC_BIT,
-     SMU_FEATURE_GFXOFF_BIT,
-     SMU_FEATURE_CG_BIT,
-     SMU_FEATURE_DPM_FCLK_BIT,
-     SMU_FEATURE_DS_FCLK_BIT,
-     SMU_FEATURE_DS_MP1CLK_BIT,
-     SMU_FEATURE_DS_MP0CLK_BIT,
-     SMU_FEATURE_XGMI_BIT,
-     SMU_FEATURE_DPM_GFX_PACE_BIT,
-     SMU_FEATURE_MEM_VDDCI_SCALING_BIT,
-     SMU_FEATURE_MEM_MVDD_SCALING_BIT,
-     SMU_FEATURE_DS_UCLK_BIT,
-     SMU_FEATURE_GFX_ULV_BIT,
-     SMU_FEATURE_FW_DSTATE_BIT,
-     SMU_FEATURE_BACO_BIT,
-     SMU_FEATURE_VCN_PG_BIT,
-     SMU_FEATURE_JPEG_PG_BIT,
-     SMU_FEATURE_USB_PG_BIT,
-     SMU_FEATURE_RSMU_SMN_CG_BIT,
-     SMU_FEATURE_APCC_PLUS_BIT,
-     SMU_FEATURE_GTHR_BIT,
-     SMU_FEATURE_GFX_DCS_BIT,
-     SMU_FEATURE_GFX_SS_BIT,
-     SMU_FEATURE_OUT_OF_BAND_MONITOR_BIT,
-     SMU_FEATURE_TEMP_DEPENDENT_VMIN_BIT,
-     SMU_FEATURE_MMHUB_PG_BIT,
-     SMU_FEATURE_ATHUB_PG_BIT,
+     SMU_FEATURE_MASKS
       SMU_FEATURE_COUNT,
 };
 
--

2.22.0

Quoted 4 lines

_______________________________________________
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

#10 lore raw

PATCH 4/5 drm/amd/powerplay: move smu_feature_update_enable_state to up level

In reply to a message not in the archive

this function is not ip or asic related function,
so move it to top level as public api in smu.

---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c    | 40 ++++++++++++++++++-
 .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    |  4 +-
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c     | 39 ------------------
 3 files changed, 40 insertions(+), 43 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +39 -1
index 8563f9083f4e..e881de955388 100644
@@ -507,6 +507,41 @@ int smu_feature_init_dpm(struct smu_context *smu)
 
 	return ret;
 }
+int smu_feature_update_enable_state(struct smu_context *smu, uint64_t feature_mask, bool enabled)
+{
+	uint32_t feature_low = 0, feature_high = 0;
+	int ret = 0;
+
+	if (!smu->pm_enabled)
+		return ret;
+
+	feature_low = (feature_mask >> 0 ) & 0xffffffff;
+	feature_high = (feature_mask >> 32) & 0xffffffff;
+
+	if (enabled) {
+		ret = smu_send_smc_msg_with_param(smu, SMU_MSG_EnableSmuFeaturesLow,
+						  feature_low);
+		if (ret)
+			return ret;
+		ret = smu_send_smc_msg_with_param(smu, SMU_MSG_EnableSmuFeaturesHigh,
+						  feature_high);
+		if (ret)
+			return ret;
+
+	} else {
+		ret = smu_send_smc_msg_with_param(smu, SMU_MSG_DisableSmuFeaturesLow,
+						  feature_low);
+		if (ret)
+			return ret;
+		ret = smu_send_smc_msg_with_param(smu, SMU_MSG_DisableSmuFeaturesHigh,
+						  feature_high);
+		if (ret)
+			return ret;
+
+	}
+
+	return ret;
+}
 
 int smu_feature_is_enabled(struct smu_context *smu, enum smu_feature_mask mask)
 {
@@ -532,6 +567,7 @@ int smu_feature_set_enabled(struct smu_context *smu, enum smu_feature_mask mask,
 {
 	struct smu_feature *feature = &smu->smu_feature;
 	int feature_id;
+	uint64_t feature_mask = 0;
 	int ret = 0;
 
 	feature_id = smu_feature_get_index(smu, mask);
@@ -540,8 +576,10 @@ int smu_feature_set_enabled(struct smu_context *smu, enum smu_feature_mask mask,
 
 	WARN_ON(feature_id > feature->feature_num);
 
+	feature_mask = 1UL << feature_id;
+
 	mutex_lock(&feature->mutex);
-	ret = smu_feature_update_enable_state(smu, feature_id, enable);
+	ret = smu_feature_update_enable_state(smu, feature_mask, enable);
 	if (ret)
 		goto failed;
 
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +1 -3
index ba2385026b89..abc2644b4c07 100644
@@ -479,7 +479,6 @@ struct smu_funcs
 	int (*init_display_count)(struct smu_context *smu, uint32_t count);
 	int (*set_allowed_mask)(struct smu_context *smu);
 	int (*get_enabled_mask)(struct smu_context *smu, uint32_t *feature_mask, uint32_t num);
-	int (*update_feature_enable_state)(struct smu_context *smu, uint32_t feature_id, bool enabled);
 	int (*notify_display_change)(struct smu_context *smu);
 	int (*get_power_limit)(struct smu_context *smu, uint32_t *limit, bool def);
 	int (*set_power_limit)(struct smu_context *smu, uint32_t n);
@@ -595,8 +594,6 @@ struct smu_funcs
 	((smu)->funcs->get_enabled_mask? (smu)->funcs->get_enabled_mask((smu), (mask), (num)) : 0)
 #define smu_is_dpm_running(smu) \
 	((smu)->ppt_funcs->is_dpm_running ? (smu)->ppt_funcs->is_dpm_running((smu)) : 0)
-#define smu_feature_update_enable_state(smu, feature_id, enabled) \
-	((smu)->funcs->update_feature_enable_state? (smu)->funcs->update_feature_enable_state((smu), (feature_id), (enabled)) : 0)
 #define smu_notify_display_change(smu) \
 	((smu)->funcs->notify_display_change? (smu)->funcs->notify_display_change((smu)) : 0)
 #define smu_store_powerplay_table(smu) \
@@ -804,6 +801,7 @@ enum amd_dpm_forced_level smu_get_performance_level(struct smu_context *smu);
 int smu_force_performance_level(struct smu_context *smu, enum amd_dpm_forced_level level);
 int smu_set_display_count(struct smu_context *smu, uint32_t count);
 bool smu_clk_dpm_is_enabled(struct smu_context *smu, enum smu_clk_type clk_type);
+int smu_feature_update_enable_state(struct smu_context *smu, uint64_t feature_mask, bool enabled);
 const char *smu_get_message_name(struct smu_context *smu, enum smu_message_type type);
 const char *smu_get_feature_name(struct smu_context *smu, enum smu_feature_mask feature);
 
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0 -39
index ccf6af055d03..93f3ffb8b471 100644
@@ -795,44 +795,6 @@ static int smu_v11_0_init_display_count(struct smu_context *smu, uint32_t count)
 	return ret;
 }
 
-static int smu_v11_0_update_feature_enable_state(struct smu_context *smu, uint32_t feature_id, bool enabled)
-{
-	uint32_t feature_low = 0, feature_high = 0;
-	int ret = 0;
-
-	if (!smu->pm_enabled)
-		return ret;
-	if (feature_id >= 0 && feature_id < 31)
-		feature_low = (1 << feature_id);
-	else if (feature_id > 31 && feature_id < 63)
-		feature_high = (1 << feature_id);
-	else
-		return -EINVAL;
-
-	if (enabled) {
-		ret = smu_send_smc_msg_with_param(smu, SMU_MSG_EnableSmuFeaturesLow,
-						  feature_low);
-		if (ret)
-			return ret;
-		ret = smu_send_smc_msg_with_param(smu, SMU_MSG_EnableSmuFeaturesHigh,
-						  feature_high);
-		if (ret)
-			return ret;
-
-	} else {
-		ret = smu_send_smc_msg_with_param(smu, SMU_MSG_DisableSmuFeaturesLow,
-						  feature_low);
-		if (ret)
-			return ret;
-		ret = smu_send_smc_msg_with_param(smu, SMU_MSG_DisableSmuFeaturesHigh,
-						  feature_high);
-		if (ret)
-			return ret;
-
-	}
-
-	return ret;
-}
 
 static int smu_v11_0_set_allowed_mask(struct smu_context *smu)
 {
@@ -1781,7 +1743,6 @@ static const struct smu_funcs smu_v11_0_funcs = {
 	.set_allowed_mask = smu_v11_0_set_allowed_mask,
 	.get_enabled_mask = smu_v11_0_get_enabled_mask,
 	.system_features_control = smu_v11_0_system_features_control,
-	.update_feature_enable_state = smu_v11_0_update_feature_enable_state,
 	.notify_display_change = smu_v11_0_notify_display_change,
 	.get_power_limit = smu_v11_0_get_power_limit,
 	.set_power_limit = smu_v11_0_set_power_limit,
Signature · 6 lines
2.22.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

#12 lore raw

RE: [PATCH 4/5] drm/amd/powerplay: move smu_feature_update_enable_state to up level

+ feature_mask = 1UL << feature_id;
Use "ULL" here. That can guard it to be 64bits long even on 32bits target. With that fixed, reviewed-by: Evan Quan <[email protected]>

Quoted 210 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Wang, Kevin(Yang)
Sent: Thursday, July 25, 2019 1:11 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>; Feng, Kenneth <[email protected]>; Wang, Kevin(Yang) <[email protected]>
Subject: [PATCH 4/5] drm/amd/powerplay: move smu_feature_update_enable_state to up level

this function is not ip or asic related function,
so move it to top level as public api in smu.

---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c    | 40
++++++++++++++++++-
 .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    |  4 +-
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c     | 39 ------------------
 3 files changed, 40 insertions(+), 43 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +17 -0
index 8563f9083f4e..e881de955388 100644
@@ -507,6 +507,41 @@ int smu_feature_init_dpm(struct smu_context
 *smu)
 
 	return ret;
 }
+int smu_feature_update_enable_state(struct smu_context *smu, uint64_t
 feature_mask, bool enabled)
+{
+	uint32_t feature_low = 0, feature_high = 0;
+	int ret = 0;
+
+	if (!smu->pm_enabled)
+		return ret;
+
+	feature_low = (feature_mask >> 0 ) & 0xffffffff;
+	feature_high = (feature_mask >> 32) & 0xffffffff;
+
+	if (enabled) {
+		ret = smu_send_smc_msg_with_param(smu,
 SMU_MSG_EnableSmuFeaturesLow,
+						  feature_low);
+		if (ret)
+			return ret;
+		ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_EnableSmuFeaturesHigh,

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +6 -0
+						  feature_high);
+		if (ret)
+			return ret;
+
+	} else {
+		ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_DisableSmuFeaturesLow,

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +4 -0
+						  feature_low);
+		if (ret)
+			return ret;
+		ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_DisableSmuFeaturesHigh,

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +8 -0
+						  feature_high);
+		if (ret)
+			return ret;
+
+	}
+
+	return ret;
+}
 
 int smu_feature_is_enabled(struct smu_context *smu, enum

smu_feature_mask mask)
{

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +1 -0
@@ -532,6 +567,7 @@ int smu_feature_set_enabled(struct smu_context
 *smu, enum smu_feature_mask mask,
 {
 	struct smu_feature *feature = &smu->smu_feature;
 	int feature_id;
+	uint64_t feature_mask = 0;
 	int ret = 0;
 
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +3 -1
 	feature_id = smu_feature_get_index(smu, mask);
@@ -540,8 +576,10 @@ int smu_feature_set_enabled(struct smu_context
 *smu, enum smu_feature_mask mask,
 
 	WARN_ON(feature_id > feature->feature_num);
 
+	feature_mask = 1UL << feature_id;
+
 	mutex_lock(&feature->mutex);
-	ret = smu_feature_update_enable_state(smu, feature_id, enable);
+	ret = smu_feature_update_enable_state(smu, feature_mask,
 enable);
 	if (ret)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0 -0
 		goto failed;
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -1
index ba2385026b89..abc2644b4c07 100644
@@ -479,7 +479,6 @@ struct smu_funcs
 	int (*init_display_count)(struct smu_context *smu, uint32_t count);
 	int (*set_allowed_mask)(struct smu_context *smu);
 	int (*get_enabled_mask)(struct smu_context *smu, uint32_t
 *feature_mask, uint32_t num);
-	int (*update_feature_enable_state)(struct smu_context *smu,
 uint32_t feature_id, bool enabled);
 	int (*notify_display_change)(struct smu_context *smu);

int (*get_power_limit)(struct smu_context *smu, uint32_t *limit,
bool def);

drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -2
 	int (*set_power_limit)(struct smu_context *smu, uint32_t n);
@@ -595,8 +594,6 @@ struct smu_funcs
 	((smu)->funcs->get_enabled_mask? (smu)->funcs-
 >get_enabled_mask((smu), (mask), (num)) : 0)
 #define smu_is_dpm_running(smu) \
 	((smu)->ppt_funcs->is_dpm_running ? (smu)->ppt_funcs-
 >is_dpm_running((smu)) : 0)
-#define smu_feature_update_enable_state(smu, feature_id, enabled) \
-	((smu)->funcs->update_feature_enable_state? (smu)->funcs-
 >update_feature_enable_state((smu), (feature_id), (enabled)) : 0)

#define smu_notify_display_change(smu) \
((smu)->funcs->notify_display_change? (smu)->funcs-

Quoted 1 line

notify_display_change((smu)) : 0)

#define smu_store_powerplay_table(smu) \

drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +1 -0
@@ -804,6 +801,7 @@ enum amd_dpm_forced_level
 smu_get_performance_level(struct smu_context *smu);
 int smu_force_performance_level(struct smu_context *smu, enum
 amd_dpm_forced_level level);
 int smu_set_display_count(struct smu_context *smu, uint32_t count);
 bool smu_clk_dpm_is_enabled(struct smu_context *smu, enum
 smu_clk_type clk_type);
+int smu_feature_update_enable_state(struct smu_context *smu, uint64_t

feature_mask, bool enabled);
const char *smu_get_message_name(struct smu_context *smu, enum
smu_message_type type);
const char *smu_get_feature_name(struct smu_context *smu, enum
smu_feature_mask feature);

drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0 -20
index ccf6af055d03..93f3ffb8b471 100644
@@ -795,44 +795,6 @@ static int smu_v11_0_init_display_count(struct
 smu_context *smu, uint32_t count)
 	return ret;
 }
 
-static int smu_v11_0_update_feature_enable_state(struct smu_context
 *smu, uint32_t feature_id, bool enabled)
-{
-	uint32_t feature_low = 0, feature_high = 0;
-	int ret = 0;
-
-	if (!smu->pm_enabled)
-		return ret;
-	if (feature_id >= 0 && feature_id < 31)
-		feature_low = (1 << feature_id);
-	else if (feature_id > 31 && feature_id < 63)
-		feature_high = (1 << feature_id);
-	else
-		return -EINVAL;
-
-	if (enabled) {
-		ret = smu_send_smc_msg_with_param(smu,
 SMU_MSG_EnableSmuFeaturesLow,
-						  feature_low);
-		if (ret)
-			return ret;
-		ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_EnableSmuFeaturesHigh,

drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0 -6
-						  feature_high);
-		if (ret)
-			return ret;
-
-	} else {
-		ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_DisableSmuFeaturesLow,

drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0 -4
-						  feature_low);
-		if (ret)
-			return ret;
-		ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_DisableSmuFeaturesHigh,

drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0 -9
-						  feature_high);
-		if (ret)
-			return ret;
-
-	}
-
-	return ret;
-}
 
 static int smu_v11_0_set_allowed_mask(struct smu_context *smu)
 {
@@ -1781,7 +1743,6 @@ static const struct smu_funcs smu_v11_0_funcs = {
 	.set_allowed_mask = smu_v11_0_set_allowed_mask,
 	.get_enabled_mask = smu_v11_0_get_enabled_mask,
 	.system_features_control = smu_v11_0_system_features_control,
-	.update_feature_enable_state =
 smu_v11_0_update_feature_enable_state,
 	.notify_display_change = smu_v11_0_notify_display_change,
 	.get_power_limit = smu_v11_0_get_power_limit,

.set_power_limit = smu_v11_0_set_power_limit,
--
2.22.0

Quoted 4 lines

_______________________________________________
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

A message that is not in the archive (sent off-list or not yet received): MN2PR12MB334402CBE2CB315E0205EC3BE4C10-rweVpJHSKToDMgCC8P//[email protected]

#14 lore raw

Re: [PATCH 4/5] drm/amd/powerplay: move smu_feature_update_enable_state to up level

i will addressed it before submit patch.
thanks.

Best Regards,
Kevin
________________________________
From: Quan, Evan <[email protected]>
Sent: Thursday, July 25, 2019 5:29 PM
To: Wang, Kevin(Yang) <[email protected]>; [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>; Feng, Kenneth <[email protected]>; Wang, Kevin(Yang) <[email protected]>
Subject: RE: [PATCH 4/5] drm/amd/powerplay: move smu_feature_update_enable_state to up level

+ feature_mask = 1UL << feature_id;
Use "ULL" here. That can guard it to be 64bits long even on 32bits target. With that fixed, reviewed-by: Evan Quan <[email protected]>

Quoted 207 lines

-----Original Message-----
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> On Behalf Of Wang, Kevin(Yang)
Sent: Thursday, July 25, 2019 1:11 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>; Feng, Kenneth <[email protected]>; Wang, Kevin(Yang) <[email protected]>
Subject: [PATCH 4/5] drm/amd/powerplay: move
smu_feature_update_enable_state to up level

this function is not ip or asic related function,
so move it to top level as public api in smu.

---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c    | 40
++++++++++++++++++-
 .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    |  4 +-
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c     | 39 ------------------
 3 files changed, 40 insertions(+), 43 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +17 -0
index 8563f9083f4e..e881de955388 100644
@@ -507,6 +507,41 @@ int smu_feature_init_dpm(struct smu_context
 *smu)
 
       return ret;
 }
+int smu_feature_update_enable_state(struct smu_context *smu, uint64_t
 feature_mask, bool enabled)
+{
+     uint32_t feature_low = 0, feature_high = 0;
+     int ret = 0;
+
+     if (!smu->pm_enabled)
+             return ret;
+
+     feature_low = (feature_mask >> 0 ) & 0xffffffff;
+     feature_high = (feature_mask >> 32) & 0xffffffff;
+
+     if (enabled) {
+             ret = smu_send_smc_msg_with_param(smu,
 SMU_MSG_EnableSmuFeaturesLow,
+                                               feature_low);
+             if (ret)
+                     return ret;
+             ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_EnableSmuFeaturesHigh,

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +6 -0
+                                               feature_high);
+             if (ret)
+                     return ret;
+
+     } else {
+             ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_DisableSmuFeaturesLow,

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +4 -0
+                                               feature_low);
+             if (ret)
+                     return ret;
+             ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_DisableSmuFeaturesHigh,

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +8 -0
+                                               feature_high);
+             if (ret)
+                     return ret;
+
+     }
+
+     return ret;
+}
 
 int smu_feature_is_enabled(struct smu_context *smu, enum

smu_feature_mask mask)
{

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +1 -0
@@ -532,6 +567,7 @@ int smu_feature_set_enabled(struct smu_context
 *smu, enum smu_feature_mask mask,
 {
       struct smu_feature *feature = &smu->smu_feature;
       int feature_id;
+     uint64_t feature_mask = 0;
       int ret = 0;
 
       feature_id = smu_feature_get_index(smu, mask);
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +3 -1
@@ -540,8 +576,10 @@ int smu_feature_set_enabled(struct smu_context
 *smu, enum smu_feature_mask mask,
 
       WARN_ON(feature_id > feature->feature_num);
 
+     feature_mask = 1UL << feature_id;
+
       mutex_lock(&feature->mutex);
-     ret = smu_feature_update_enable_state(smu, feature_id, enable);
+     ret = smu_feature_update_enable_state(smu, feature_mask,
 enable);
       if (ret)
               goto failed;
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -1
index ba2385026b89..abc2644b4c07 100644
@@ -479,7 +479,6 @@ struct smu_funcs
       int (*init_display_count)(struct smu_context *smu, uint32_t count);
       int (*set_allowed_mask)(struct smu_context *smu);
       int (*get_enabled_mask)(struct smu_context *smu, uint32_t
 *feature_mask, uint32_t num);
-     int (*update_feature_enable_state)(struct smu_context *smu,
 uint32_t feature_id, bool enabled);
       int (*notify_display_change)(struct smu_context *smu);

int (*get_power_limit)(struct smu_context *smu, uint32_t *limit,

bool def);
       int (*set_power_limit)(struct smu_context *smu, uint32_t n);
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -2
@@ -595,8 +594,6 @@ struct smu_funcs
       ((smu)->funcs->get_enabled_mask? (smu)->funcs-
 >get_enabled_mask((smu), (mask), (num)) : 0)
 #define smu_is_dpm_running(smu) \
       ((smu)->ppt_funcs->is_dpm_running ? (smu)->ppt_funcs-
 >is_dpm_running((smu)) : 0)
-#define smu_feature_update_enable_state(smu, feature_id, enabled) \
-     ((smu)->funcs->update_feature_enable_state? (smu)->funcs-
 >update_feature_enable_state((smu), (feature_id), (enabled)) : 0)
 #define smu_notify_display_change(smu) \
       ((smu)->funcs->notify_display_change? (smu)->funcs-
Quoted 1 line

notify_display_change((smu)) : 0)

#define smu_store_powerplay_table(smu) \

drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +1 -0
@@ -804,6 +801,7 @@ enum amd_dpm_forced_level
 smu_get_performance_level(struct smu_context *smu);
 int smu_force_performance_level(struct smu_context *smu, enum
 amd_dpm_forced_level level);
 int smu_set_display_count(struct smu_context *smu, uint32_t count);
 bool smu_clk_dpm_is_enabled(struct smu_context *smu, enum
 smu_clk_type clk_type);
+int smu_feature_update_enable_state(struct smu_context *smu, uint64_t

feature_mask, bool enabled);
const char *smu_get_message_name(struct smu_context *smu, enum
smu_message_type type);
const char *smu_get_feature_name(struct smu_context *smu, enum
smu_feature_mask feature);

drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0 -20
index ccf6af055d03..93f3ffb8b471 100644
@@ -795,44 +795,6 @@ static int smu_v11_0_init_display_count(struct
 smu_context *smu, uint32_t count)
       return ret;
 }
 
-static int smu_v11_0_update_feature_enable_state(struct smu_context
 *smu, uint32_t feature_id, bool enabled)
-{
-     uint32_t feature_low = 0, feature_high = 0;
-     int ret = 0;
-
-     if (!smu->pm_enabled)
-             return ret;
-     if (feature_id >= 0 && feature_id < 31)
-             feature_low = (1 << feature_id);
-     else if (feature_id > 31 && feature_id < 63)
-             feature_high = (1 << feature_id);
-     else
-             return -EINVAL;
-
-     if (enabled) {
-             ret = smu_send_smc_msg_with_param(smu,
 SMU_MSG_EnableSmuFeaturesLow,
-                                               feature_low);
-             if (ret)
-                     return ret;
-             ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_EnableSmuFeaturesHigh,

drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0 -6
-                                               feature_high);
-             if (ret)
-                     return ret;
-
-     } else {
-             ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_DisableSmuFeaturesLow,

drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0 -4
-                                               feature_low);
-             if (ret)
-                     return ret;
-             ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_DisableSmuFeaturesHigh,

drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0 -9
-                                               feature_high);
-             if (ret)
-                     return ret;
-
-     }
-
-     return ret;
-}
 
 static int smu_v11_0_set_allowed_mask(struct smu_context *smu)
 {
@@ -1781,7 +1743,6 @@ static const struct smu_funcs smu_v11_0_funcs = {
       .set_allowed_mask = smu_v11_0_set_allowed_mask,
       .get_enabled_mask = smu_v11_0_get_enabled_mask,
       .system_features_control = smu_v11_0_system_features_control,
-     .update_feature_enable_state =
 smu_v11_0_update_feature_enable_state,
       .notify_display_change = smu_v11_0_notify_display_change,
       .get_power_limit = smu_v11_0_get_power_limit,
       .set_power_limit = smu_v11_0_set_power_limit,
Quoted 7 lines

--
2.22.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

#15 lore raw

PATCH 5/5 drm/amd/powerplay: implment sysfs feature status function in smu

In reply to a message not in the archive

1. Unified feature enable status format in sysfs
2. Rename ppfeature to pp_features to adapt other pp sysfs node name
3. this function support all asic, not asic related function.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c        |  24 +--
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c    |  61 +++++++
 .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    |   8 +-
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c    | 165 ------------------
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c    | 153 ----------------
 5 files changed, 75 insertions(+), 336 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +12 -12
index 866097d5cf26..9e8e8a65d9bf 100644
@@ -788,10 +788,10 @@ static ssize_t amdgpu_get_pp_od_clk_voltage(struct device *dev,
 }
 
 /**
- * DOC: ppfeatures
+ * DOC: pp_features
  *
  * The amdgpu driver provides a sysfs API for adjusting what powerplay
- * features to be enabled. The file ppfeatures is used for this. And
+ * features to be enabled. The file pp_features is used for this. And
  * this is only available for Vega10 and later dGPUs.
  *
  * Reading back the file will show you the followings:
@@ -803,7 +803,7 @@ static ssize_t amdgpu_get_pp_od_clk_voltage(struct device *dev,
  * the corresponding bit from original ppfeature masks and input the
  * new ppfeature masks.
  */
-static ssize_t amdgpu_set_ppfeature_status(struct device *dev,
+static ssize_t amdgpu_set_pp_feature_status(struct device *dev,
 		struct device_attribute *attr,
 		const char *buf,
 		size_t count)
@@ -820,7 +820,7 @@ static ssize_t amdgpu_set_ppfeature_status(struct device *dev,
 	pr_debug("featuremask = 0x%llx\n", featuremask);
 
 	if (is_support_sw_smu(adev)) {
-		ret = smu_set_ppfeature_status(&adev->smu, featuremask);
+		ret = smu_sys_set_pp_feature_mask(&adev->smu, featuremask);
 		if (ret)
 			return -EINVAL;
 	} else if (adev->powerplay.pp_funcs->set_ppfeature_status) {
@@ -832,7 +832,7 @@ static ssize_t amdgpu_set_ppfeature_status(struct device *dev,
 	return count;
 }
 
-static ssize_t amdgpu_get_ppfeature_status(struct device *dev,
+static ssize_t amdgpu_get_pp_feature_status(struct device *dev,
 		struct device_attribute *attr,
 		char *buf)
 {
@@ -840,7 +840,7 @@ static ssize_t amdgpu_get_ppfeature_status(struct device *dev,
 	struct amdgpu_device *adev = ddev->dev_private;
 
 	if (is_support_sw_smu(adev)) {
-		return smu_get_ppfeature_status(&adev->smu, buf);
+		return smu_sys_get_pp_feature_mask(&adev->smu, buf);
 	} else if (adev->powerplay.pp_funcs->get_ppfeature_status)
 		return amdgpu_dpm_get_ppfeature_status(adev, buf);
 
@@ -1500,9 +1500,9 @@ static DEVICE_ATTR(gpu_busy_percent, S_IRUGO,
 static DEVICE_ATTR(mem_busy_percent, S_IRUGO,
 		amdgpu_get_memory_busy_percent, NULL);
 static DEVICE_ATTR(pcie_bw, S_IRUGO, amdgpu_get_pcie_bw, NULL);
-static DEVICE_ATTR(ppfeatures, S_IRUGO | S_IWUSR,
-		amdgpu_get_ppfeature_status,
-		amdgpu_set_ppfeature_status);
+static DEVICE_ATTR(pp_features, S_IRUGO | S_IWUSR,
+		amdgpu_get_pp_feature_status,
+		amdgpu_set_pp_feature_status);
 static DEVICE_ATTR(unique_id, S_IRUGO, amdgpu_get_unique_id, NULL);
 
 static ssize_t amdgpu_hwmon_show_temp(struct device *dev,
@@ -2960,10 +2960,10 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)
 	if ((adev->asic_type >= CHIP_VEGA10) &&
 	    !(adev->flags & AMD_IS_APU)) {
 		ret = device_create_file(adev->dev,
-				&dev_attr_ppfeatures);
+				&dev_attr_pp_features);
 		if (ret) {
 			DRM_ERROR("failed to create device file	"
-					"ppfeatures\n");
+					"pp_features\n");
 			return ret;
 		}
 	}
@@ -3017,7 +3017,7 @@ void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev)
 		device_remove_file(adev->dev, &dev_attr_unique_id);
 	if ((adev->asic_type >= CHIP_VEGA10) &&
 	    !(adev->flags & AMD_IS_APU))
-		device_remove_file(adev->dev, &dev_attr_ppfeatures);
+		device_remove_file(adev->dev, &dev_attr_pp_features);
 }
 
 void amdgpu_pm_compute_clocks(struct amdgpu_device *adev)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +61 -0

67 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +2 -6
index abc2644b4c07..ac9e9d5d8a5c 100644
@@ -432,8 +432,6 @@ struct pptable_funcs {
 				      uint32_t *mclk_mask,
 				      uint32_t *soc_mask);
 	int (*set_cpu_power_state)(struct smu_context *smu);
-	int (*set_ppfeature_status)(struct smu_context *smu, uint64_t ppfeatures);
-	int (*get_ppfeature_status)(struct smu_context *smu, char *buf);
 	bool (*is_dpm_running)(struct smu_context *smu);
 	int (*tables_init)(struct smu_context *smu, struct smu_table *tables);
 	int (*set_thermal_fan_table)(struct smu_context *smu);
@@ -713,10 +711,6 @@ struct smu_funcs
 	((smu)->ppt_funcs->dpm_set_vce_enable ? (smu)->ppt_funcs->dpm_set_vce_enable((smu), (enable)) : 0)
 #define smu_set_xgmi_pstate(smu, pstate) \
 		((smu)->funcs->set_xgmi_pstate ? (smu)->funcs->set_xgmi_pstate((smu), (pstate)) : 0)
-#define smu_set_ppfeature_status(smu, ppfeatures) \
-	((smu)->ppt_funcs->set_ppfeature_status ? (smu)->ppt_funcs->set_ppfeature_status((smu), (ppfeatures)) : -EINVAL)
-#define smu_get_ppfeature_status(smu, buf) \
-	((smu)->ppt_funcs->get_ppfeature_status ? (smu)->ppt_funcs->get_ppfeature_status((smu), (buf)) : -EINVAL)
 #define smu_set_watermarks_table(smu, tab, clock_ranges) \
 	((smu)->ppt_funcs->set_watermarks_table ? (smu)->ppt_funcs->set_watermarks_table((smu), (tab), (clock_ranges)) : 0)
 #define smu_get_current_clk_freq_by_table(smu, clk_type, value) \
@@ -804,5 +798,7 @@ bool smu_clk_dpm_is_enabled(struct smu_context *smu, enum smu_clk_type clk_type)
 int smu_feature_update_enable_state(struct smu_context *smu, uint64_t feature_mask, bool enabled);
 const char *smu_get_message_name(struct smu_context *smu, enum smu_message_type type);
 const char *smu_get_feature_name(struct smu_context *smu, enum smu_feature_mask feature);
+size_t smu_sys_get_pp_feature_mask(struct smu_context *smu, char *buf);
+int smu_sys_set_pp_feature_mask(struct smu_context *smu, uint64_t new_mask);
 
 #endif
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -165

177 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -153

165 lines not on this page · raw message

Signature · 6 lines
2.22.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

#17 lore raw

Re: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

add sample data from sysfs pp_features with this patch.

print format:
index. feature name (Hardware Message ID): state

sudo find /sys -name "pp_features" -exec cat {} \; features high: 0x00000623 low: 0xb3cdaffb

00. DPM_PREFETCHER       ( 0) : enabeld
01. DPM_GFXCLK           ( 1) : enabeld
02. DPM_UCLK             ( 3) : enabeld
03. DPM_SOCCLK           ( 4) : enabeld
04. DPM_MP0CLK           ( 5) : enabeld
05. DPM_LINK             ( 6) : enabeld
06. DPM_DCEFCLK          ( 7) : enabeld
07. DS_GFXCLK            (10) : enabeld
08. DS_SOCCLK            (11) : enabeld
09. DS_LCLK              (12) : disabled
10. PPT                  (23) : enabeld
11. TDC                  (24) : enabeld
12. THERMAL              (33) : enabeld
13. RM                   (35) : disabled
14. DS_DCEFCLK           (13) : enabeld
15. ACDC                 (28) : enabeld
16. VR0HOT               (29) : enabeld
17. VR1HOT               (30) : disabled
18. FW_CTF               (31) : enabeld
19. LED_DISPLAY          (36) : disabled
20. FAN_CONTROL          (32) : enabeld
21. GFX_EDC              (25) : enabeld
22. GFXOFF               (17) : disabled
23. DPM_GFX_PACE         ( 2) : disabled
24. MEM_VDDCI_SCALING    ( 8) : enabeld
25. MEM_MVDD_SCALING     ( 9) : enabeld
26. DS_UCLK              (14) : disabled
27. GFX_ULV              (15) : enabeld
28. FW_DSTATE            (16) : enabeld
29. BACO                 (18) : enabeld
30. VCN_PG               (19) : enabeld
31. JPEG_PG              (20) : disabled
32. USB_PG               (21) : disabled
33. RSMU_SMN_CG          (22) : enabeld
34. APCC_PLUS            (26) : disabled
35. GTHR                 (27) : disabled
36. GFX_DCS              (34) : disabled
37. GFX_SS               (37) : enabeld
38. OUT_OF_BAND_MONITOR  (38) : disabled
39. TEMP_DEPENDENT_VMIN  (39) : disabled
40. MMHUB_PG             (40) : disabled
41. ATHUB_PG             (41) : enabeld

________________________________
From: Wang, Kevin(Yang) <[email protected]>
Sent: Thursday, July 25, 2019 1:11 PM
To: [email protected] <[email protected]>
Cc: Feng, Kenneth <[email protected]>; Huang, Ray <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Kevin(Yang) <[email protected]>
Subject: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

1. Unified feature enable status format in sysfs
2. Rename ppfeature to pp_features to adapt other pp sysfs node name
3. this function support all asic, not asic related function.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c        |  24 +--
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c    |  61 +++++++
 .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    |   8 +-
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c    | 165 ------------------
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c    | 153 ----------------
 5 files changed, 75 insertions(+), 336 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +12 -12
index 866097d5cf26..9e8e8a65d9bf 100644
@@ -788,10 +788,10 @@ static ssize_t amdgpu_get_pp_od_clk_voltage(struct device *dev,
 }
 
 /**
- * DOC: ppfeatures
+ * DOC: pp_features
  *
  * The amdgpu driver provides a sysfs API for adjusting what powerplay
- * features to be enabled. The file ppfeatures is used for this. And
+ * features to be enabled. The file pp_features is used for this. And
  * this is only available for Vega10 and later dGPUs.
  *
  * Reading back the file will show you the followings:
@@ -803,7 +803,7 @@ static ssize_t amdgpu_get_pp_od_clk_voltage(struct device *dev,
  * the corresponding bit from original ppfeature masks and input the
  * new ppfeature masks.
  */
-static ssize_t amdgpu_set_ppfeature_status(struct device *dev,
+static ssize_t amdgpu_set_pp_feature_status(struct device *dev,
                 struct device_attribute *attr,
                 const char *buf,
                 size_t count)
@@ -820,7 +820,7 @@ static ssize_t amdgpu_set_ppfeature_status(struct device *dev,
         pr_debug("featuremask = 0x%llx\n", featuremask);
 
         if (is_support_sw_smu(adev)) {
-               ret = smu_set_ppfeature_status(&adev->smu, featuremask);
+               ret = smu_sys_set_pp_feature_mask(&adev->smu, featuremask);
                 if (ret)
                         return -EINVAL;
         } else if (adev->powerplay.pp_funcs->set_ppfeature_status) {
@@ -832,7 +832,7 @@ static ssize_t amdgpu_set_ppfeature_status(struct device *dev,
         return count;
 }
 
-static ssize_t amdgpu_get_ppfeature_status(struct device *dev,
+static ssize_t amdgpu_get_pp_feature_status(struct device *dev,
                 struct device_attribute *attr,
                 char *buf)
 {
@@ -840,7 +840,7 @@ static ssize_t amdgpu_get_ppfeature_status(struct device *dev,
         struct amdgpu_device *adev = ddev->dev_private;
 
         if (is_support_sw_smu(adev)) {
-               return smu_get_ppfeature_status(&adev->smu, buf);
+               return smu_sys_get_pp_feature_mask(&adev->smu, buf);
         } else if (adev->powerplay.pp_funcs->get_ppfeature_status)
                 return amdgpu_dpm_get_ppfeature_status(adev, buf);
 
@@ -1500,9 +1500,9 @@ static DEVICE_ATTR(gpu_busy_percent, S_IRUGO,
 static DEVICE_ATTR(mem_busy_percent, S_IRUGO,
                 amdgpu_get_memory_busy_percent, NULL);
 static DEVICE_ATTR(pcie_bw, S_IRUGO, amdgpu_get_pcie_bw, NULL);
-static DEVICE_ATTR(ppfeatures, S_IRUGO | S_IWUSR,
-               amdgpu_get_ppfeature_status,
-               amdgpu_set_ppfeature_status);
+static DEVICE_ATTR(pp_features, S_IRUGO | S_IWUSR,
+               amdgpu_get_pp_feature_status,
+               amdgpu_set_pp_feature_status);
 static DEVICE_ATTR(unique_id, S_IRUGO, amdgpu_get_unique_id, NULL);
 
 static ssize_t amdgpu_hwmon_show_temp(struct device *dev,
@@ -2960,10 +2960,10 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)
         if ((adev->asic_type >= CHIP_VEGA10) &&
             !(adev->flags & AMD_IS_APU)) {
                 ret = device_create_file(adev->dev,
-                               &dev_attr_ppfeatures);
+                               &dev_attr_pp_features);
                 if (ret) {
                         DRM_ERROR("failed to create device file "
-                                       "ppfeatures\n");
+                                       "pp_features\n");
                         return ret;
                 }
         }
@@ -3017,7 +3017,7 @@ void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev)
                 device_remove_file(adev->dev, &dev_attr_unique_id);
         if ((adev->asic_type >= CHIP_VEGA10) &&
             !(adev->flags & AMD_IS_APU))
-               device_remove_file(adev->dev, &dev_attr_ppfeatures);
+               device_remove_file(adev->dev, &dev_attr_pp_features);
 }
 
 void amdgpu_pm_compute_clocks(struct amdgpu_device *adev)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +61 -0

67 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +2 -6
index abc2644b4c07..ac9e9d5d8a5c 100644
@@ -432,8 +432,6 @@ struct pptable_funcs {
                                       uint32_t *mclk_mask,
                                       uint32_t *soc_mask);
         int (*set_cpu_power_state)(struct smu_context *smu);
-       int (*set_ppfeature_status)(struct smu_context *smu, uint64_t ppfeatures);
-       int (*get_ppfeature_status)(struct smu_context *smu, char *buf);
         bool (*is_dpm_running)(struct smu_context *smu);
         int (*tables_init)(struct smu_context *smu, struct smu_table *tables);
         int (*set_thermal_fan_table)(struct smu_context *smu);
@@ -713,10 +711,6 @@ struct smu_funcs
         ((smu)->ppt_funcs->dpm_set_vce_enable ? (smu)->ppt_funcs->dpm_set_vce_enable((smu), (enable)) : 0)
 #define smu_set_xgmi_pstate(smu, pstate) \
                 ((smu)->funcs->set_xgmi_pstate ? (smu)->funcs->set_xgmi_pstate((smu), (pstate)) : 0)
-#define smu_set_ppfeature_status(smu, ppfeatures) \
-       ((smu)->ppt_funcs->set_ppfeature_status ? (smu)->ppt_funcs->set_ppfeature_status((smu), (ppfeatures)) : -EINVAL)
-#define smu_get_ppfeature_status(smu, buf) \
-       ((smu)->ppt_funcs->get_ppfeature_status ? (smu)->ppt_funcs->get_ppfeature_status((smu), (buf)) : -EINVAL)
 #define smu_set_watermarks_table(smu, tab, clock_ranges) \
         ((smu)->ppt_funcs->set_watermarks_table ? (smu)->ppt_funcs->set_watermarks_table((smu), (tab), (clock_ranges)) : 0)
 #define smu_get_current_clk_freq_by_table(smu, clk_type, value) \
@@ -804,5 +798,7 @@ bool smu_clk_dpm_is_enabled(struct smu_context *smu, enum smu_clk_type clk_type)
 int smu_feature_update_enable_state(struct smu_context *smu, uint64_t feature_mask, bool enabled);
 const char *smu_get_message_name(struct smu_context *smu, enum smu_message_type type);
 const char *smu_get_feature_name(struct smu_context *smu, enum smu_feature_mask feature);
+size_t smu_sys_get_pp_feature_mask(struct smu_context *smu, char *buf);
+int smu_sys_set_pp_feature_mask(struct smu_context *smu, uint64_t new_mask);
 
 #endif
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -165

177 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -153

165 lines not on this page · raw message

--
2.22.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): MN2PR12MB32966C19A3EF83A1E868B25CA2C10-rweVpJHSKTqAm9ToKNQgFgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#19 lore raw

RE: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

Series are Reviewed-by: Kenneth Feng <[email protected]<mailto:[email protected]>>

From: Wang, Kevin(Yang)
Sent: Thursday, July 25, 2019 4:10 PM
To: [email protected]
Cc: Feng, Kenneth <[email protected]>; Huang, Ray <[email protected]>; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

add sample data from sysfs pp_features with this patch.

print format:
index. feature name (Hardware Message ID): state

sudo find /sys -name "pp_features" -exec cat {} \; features high: 0x00000623 low: 0xb3cdaffb

00. DPM_PREFETCHER       ( 0) : enabeld
01. DPM_GFXCLK           ( 1) : enabeld
02. DPM_UCLK             ( 3) : enabeld
03. DPM_SOCCLK           ( 4) : enabeld
04. DPM_MP0CLK           ( 5) : enabeld
05. DPM_LINK             ( 6) : enabeld
06. DPM_DCEFCLK          ( 7) : enabeld
07. DS_GFXCLK            (10) : enabeld
08. DS_SOCCLK            (11) : enabeld
09. DS_LCLK              (12) : disabled
10. PPT                  (23) : enabeld
11. TDC                  (24) : enabeld
12. THERMAL              (33) : enabeld
13. RM                   (35) : disabled
14. DS_DCEFCLK           (13) : enabeld
15. ACDC                 (28) : enabeld
16. VR0HOT               (29) : enabeld
17. VR1HOT               (30) : disabled
18. FW_CTF               (31) : enabeld
19. LED_DISPLAY          (36) : disabled
20. FAN_CONTROL          (32) : enabeld
21. GFX_EDC              (25) : enabeld
22. GFXOFF               (17) : disabled
23. DPM_GFX_PACE         ( 2) : disabled
24. MEM_VDDCI_SCALING    ( 8) : enabeld
25. MEM_MVDD_SCALING     ( 9) : enabeld
26. DS_UCLK              (14) : disabled
27. GFX_ULV              (15) : enabeld
28. FW_DSTATE            (16) : enabeld
29. BACO                 (18) : enabeld
30. VCN_PG               (19) : enabeld
31. JPEG_PG              (20) : disabled
32. USB_PG               (21) : disabled
33. RSMU_SMN_CG          (22) : enabeld
34. APCC_PLUS            (26) : disabled
35. GTHR                 (27) : disabled
36. GFX_DCS              (34) : disabled
37. GFX_SS               (37) : enabeld
38. OUT_OF_BAND_MONITOR  (38) : disabled
39. TEMP_DEPENDENT_VMIN  (39) : disabled
40. MMHUB_PG             (40) : disabled
41. ATHUB_PG             (41) : enabeld

________________________________
From: Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Sent: Thursday, July 25, 2019 1:11 PM
To: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Feng, Kenneth <[email protected]<mailto:[email protected]>>; Huang, Ray <[email protected]<mailto:[email protected]>>; Deucher, Alexander <[email protected]<mailto:[email protected]>>; Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Subject: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

1. Unified feature enable status format in sysfs
2. Rename ppfeature to pp_features to adapt other pp sysfs node name
3. this function support all asic, not asic related function.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c        |  24 +--
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c    |  61 +++++++
 .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    |   8 +-
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c    | 165 ------------------
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c    | 153 ----------------
 5 files changed, 75 insertions(+), 336 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +12 -12
index 866097d5cf26..9e8e8a65d9bf 100644
@@ -788,10 +788,10 @@ static ssize_t amdgpu_get_pp_od_clk_voltage(struct device *dev,
 }
 
 /**
- * DOC: ppfeatures
+ * DOC: pp_features
  *
  * The amdgpu driver provides a sysfs API for adjusting what powerplay
- * features to be enabled. The file ppfeatures is used for this. And
+ * features to be enabled. The file pp_features is used for this. And
  * this is only available for Vega10 and later dGPUs.
  *
  * Reading back the file will show you the followings:
@@ -803,7 +803,7 @@ static ssize_t amdgpu_get_pp_od_clk_voltage(struct device *dev,
  * the corresponding bit from original ppfeature masks and input the
  * new ppfeature masks.
  */
-static ssize_t amdgpu_set_ppfeature_status(struct device *dev,
+static ssize_t amdgpu_set_pp_feature_status(struct device *dev,
                 struct device_attribute *attr,
                 const char *buf,
                 size_t count)
@@ -820,7 +820,7 @@ static ssize_t amdgpu_set_ppfeature_status(struct device *dev,
         pr_debug("featuremask = 0x%llx\n", featuremask);
 
         if (is_support_sw_smu(adev)) {
-               ret = smu_set_ppfeature_status(&adev->smu, featuremask);
+               ret = smu_sys_set_pp_feature_mask(&adev->smu, featuremask);
                 if (ret)
                         return -EINVAL;
         } else if (adev->powerplay.pp_funcs->set_ppfeature_status) {
@@ -832,7 +832,7 @@ static ssize_t amdgpu_set_ppfeature_status(struct device *dev,
         return count;
 }
 
-static ssize_t amdgpu_get_ppfeature_status(struct device *dev,
+static ssize_t amdgpu_get_pp_feature_status(struct device *dev,
                 struct device_attribute *attr,
                 char *buf)
 {
@@ -840,7 +840,7 @@ static ssize_t amdgpu_get_ppfeature_status(struct device *dev,
         struct amdgpu_device *adev = ddev->dev_private;
 
         if (is_support_sw_smu(adev)) {
-               return smu_get_ppfeature_status(&adev->smu, buf);
+               return smu_sys_get_pp_feature_mask(&adev->smu, buf);
         } else if (adev->powerplay.pp_funcs->get_ppfeature_status)
                 return amdgpu_dpm_get_ppfeature_status(adev, buf);
 
@@ -1500,9 +1500,9 @@ static DEVICE_ATTR(gpu_busy_percent, S_IRUGO,
 static DEVICE_ATTR(mem_busy_percent, S_IRUGO,
                 amdgpu_get_memory_busy_percent, NULL);
 static DEVICE_ATTR(pcie_bw, S_IRUGO, amdgpu_get_pcie_bw, NULL);
-static DEVICE_ATTR(ppfeatures, S_IRUGO | S_IWUSR,
-               amdgpu_get_ppfeature_status,
-               amdgpu_set_ppfeature_status);
+static DEVICE_ATTR(pp_features, S_IRUGO | S_IWUSR,
+               amdgpu_get_pp_feature_status,
+               amdgpu_set_pp_feature_status);
 static DEVICE_ATTR(unique_id, S_IRUGO, amdgpu_get_unique_id, NULL);
 
 static ssize_t amdgpu_hwmon_show_temp(struct device *dev,
@@ -2960,10 +2960,10 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)
         if ((adev->asic_type >= CHIP_VEGA10) &&
             !(adev->flags & AMD_IS_APU)) {
                 ret = device_create_file(adev->dev,
-                               &dev_attr_ppfeatures);
+                               &dev_attr_pp_features);
                 if (ret) {
                         DRM_ERROR("failed to create device file "
-                                       "ppfeatures\n");
+                                       "pp_features\n");
                         return ret;
                 }
         }
@@ -3017,7 +3017,7 @@ void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev)
                 device_remove_file(adev->dev, &dev_attr_unique_id);
         if ((adev->asic_type >= CHIP_VEGA10) &&
             !(adev->flags & AMD_IS_APU))
-               device_remove_file(adev->dev, &dev_attr_ppfeatures);
+               device_remove_file(adev->dev, &dev_attr_pp_features);
 }
 
 void amdgpu_pm_compute_clocks(struct amdgpu_device *adev)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +61 -0

67 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +2 -6
index abc2644b4c07..ac9e9d5d8a5c 100644
@@ -432,8 +432,6 @@ struct pptable_funcs {
                                       uint32_t *mclk_mask,
                                       uint32_t *soc_mask);
         int (*set_cpu_power_state)(struct smu_context *smu);
-       int (*set_ppfeature_status)(struct smu_context *smu, uint64_t ppfeatures);
-       int (*get_ppfeature_status)(struct smu_context *smu, char *buf);
         bool (*is_dpm_running)(struct smu_context *smu);
         int (*tables_init)(struct smu_context *smu, struct smu_table *tables);
         int (*set_thermal_fan_table)(struct smu_context *smu);
@@ -713,10 +711,6 @@ struct smu_funcs
         ((smu)->ppt_funcs->dpm_set_vce_enable ? (smu)->ppt_funcs->dpm_set_vce_enable((smu), (enable)) : 0)
 #define smu_set_xgmi_pstate(smu, pstate) \
                 ((smu)->funcs->set_xgmi_pstate ? (smu)->funcs->set_xgmi_pstate((smu), (pstate)) : 0)
-#define smu_set_ppfeature_status(smu, ppfeatures) \
-       ((smu)->ppt_funcs->set_ppfeature_status ? (smu)->ppt_funcs->set_ppfeature_status((smu), (ppfeatures)) : -EINVAL)
-#define smu_get_ppfeature_status(smu, buf) \
-       ((smu)->ppt_funcs->get_ppfeature_status ? (smu)->ppt_funcs->get_ppfeature_status((smu), (buf)) : -EINVAL)
 #define smu_set_watermarks_table(smu, tab, clock_ranges) \
         ((smu)->ppt_funcs->set_watermarks_table ? (smu)->ppt_funcs->set_watermarks_table((smu), (tab), (clock_ranges)) : 0)
 #define smu_get_current_clk_freq_by_table(smu, clk_type, value) \
@@ -804,5 +798,7 @@ bool smu_clk_dpm_is_enabled(struct smu_context *smu, enum smu_clk_type clk_type)
 int smu_feature_update_enable_state(struct smu_context *smu, uint64_t feature_mask, bool enabled);
 const char *smu_get_message_name(struct smu_context *smu, enum smu_message_type type);
 const char *smu_get_feature_name(struct smu_context *smu, enum smu_feature_mask feature);
+size_t smu_sys_get_pp_feature_mask(struct smu_context *smu, char *buf);
+int smu_sys_set_pp_feature_mask(struct smu_context *smu, uint64_t new_mask);
 
 #endif
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -165

177 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -153

165 lines not on this page · raw message

--
2.22.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#20 lore raw

RE: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

In reply to a message not in the archive

To keep backward compatibility, we cannot change the sysfs file naming. But it's a good idea to summarize these as common APIs.

Regards,
Evan
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> On Behalf Of Wang, Kevin(Yang)
Sent: Thursday, July 25, 2019 4:10 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>; Feng, Kenneth <[email protected]>
Subject: Re: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

add sample data from sysfs pp_features with this patch.

print format:
index. feature name (Hardware Message ID): state

sudo find /sys -name "pp_features" -exec cat {} \; features high: 0x00000623 low: 0xb3cdaffb

00. DPM_PREFETCHER       ( 0) : enabeld
01. DPM_GFXCLK           ( 1) : enabeld
02. DPM_UCLK             ( 3) : enabeld
03. DPM_SOCCLK           ( 4) : enabeld
04. DPM_MP0CLK           ( 5) : enabeld
05. DPM_LINK             ( 6) : enabeld
06. DPM_DCEFCLK          ( 7) : enabeld
07. DS_GFXCLK            (10) : enabeld
08. DS_SOCCLK            (11) : enabeld
09. DS_LCLK              (12) : disabled
10. PPT                  (23) : enabeld
11. TDC                  (24) : enabeld
12. THERMAL              (33) : enabeld
13. RM                   (35) : disabled
14. DS_DCEFCLK           (13) : enabeld
15. ACDC                 (28) : enabeld
16. VR0HOT               (29) : enabeld
17. VR1HOT               (30) : disabled
18. FW_CTF               (31) : enabeld
19. LED_DISPLAY          (36) : disabled
20. FAN_CONTROL          (32) : enabeld
21. GFX_EDC              (25) : enabeld
22. GFXOFF               (17) : disabled
23. DPM_GFX_PACE         ( 2) : disabled
24. MEM_VDDCI_SCALING    ( 8) : enabeld
25. MEM_MVDD_SCALING     ( 9) : enabeld
26. DS_UCLK              (14) : disabled
27. GFX_ULV              (15) : enabeld
28. FW_DSTATE            (16) : enabeld
29. BACO                 (18) : enabeld
30. VCN_PG               (19) : enabeld
31. JPEG_PG              (20) : disabled
32. USB_PG               (21) : disabled
33. RSMU_SMN_CG          (22) : enabeld
34. APCC_PLUS            (26) : disabled
35. GTHR                 (27) : disabled
36. GFX_DCS              (34) : disabled
37. GFX_SS               (37) : enabeld
38. OUT_OF_BAND_MONITOR  (38) : disabled
39. TEMP_DEPENDENT_VMIN  (39) : disabled
40. MMHUB_PG             (40) : disabled
41. ATHUB_PG             (41) : enabeld

________________________________
From: Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Sent: Thursday, July 25, 2019 1:11 PM
To: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Feng, Kenneth <[email protected]<mailto:[email protected]>>; Huang, Ray <[email protected]<mailto:[email protected]>>; Deucher, Alexander <[email protected]<mailto:[email protected]>>; Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Subject: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

1. Unified feature enable status format in sysfs
2. Rename ppfeature to pp_features to adapt other pp sysfs node name
3. this function support all asic, not asic related function.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c        |  24 +--
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c    |  61 +++++++
 .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    |   8 +-
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c    | 165 ------------------
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c    | 153 ----------------
 5 files changed, 75 insertions(+), 336 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +12 -12
index 866097d5cf26..9e8e8a65d9bf 100644
@@ -788,10 +788,10 @@ static ssize_t amdgpu_get_pp_od_clk_voltage(struct device *dev,
 }
 
 /**
- * DOC: ppfeatures
+ * DOC: pp_features
  *
  * The amdgpu driver provides a sysfs API for adjusting what powerplay
- * features to be enabled. The file ppfeatures is used for this. And
+ * features to be enabled. The file pp_features is used for this. And
  * this is only available for Vega10 and later dGPUs.
  *
  * Reading back the file will show you the followings:
@@ -803,7 +803,7 @@ static ssize_t amdgpu_get_pp_od_clk_voltage(struct device *dev,
  * the corresponding bit from original ppfeature masks and input the
  * new ppfeature masks.
  */
-static ssize_t amdgpu_set_ppfeature_status(struct device *dev,
+static ssize_t amdgpu_set_pp_feature_status(struct device *dev,
                 struct device_attribute *attr,
                 const char *buf,
                 size_t count)
@@ -820,7 +820,7 @@ static ssize_t amdgpu_set_ppfeature_status(struct device *dev,
         pr_debug("featuremask = 0x%llx\n", featuremask);
 
         if (is_support_sw_smu(adev)) {
-               ret = smu_set_ppfeature_status(&adev->smu, featuremask);
+               ret = smu_sys_set_pp_feature_mask(&adev->smu, featuremask);
                 if (ret)
                         return -EINVAL;
         } else if (adev->powerplay.pp_funcs->set_ppfeature_status) {
@@ -832,7 +832,7 @@ static ssize_t amdgpu_set_ppfeature_status(struct device *dev,
         return count;
 }
 
-static ssize_t amdgpu_get_ppfeature_status(struct device *dev,
+static ssize_t amdgpu_get_pp_feature_status(struct device *dev,
                 struct device_attribute *attr,
                 char *buf)
 {
@@ -840,7 +840,7 @@ static ssize_t amdgpu_get_ppfeature_status(struct device *dev,
         struct amdgpu_device *adev = ddev->dev_private;
 
         if (is_support_sw_smu(adev)) {
-               return smu_get_ppfeature_status(&adev->smu, buf);
+               return smu_sys_get_pp_feature_mask(&adev->smu, buf);
         } else if (adev->powerplay.pp_funcs->get_ppfeature_status)
                 return amdgpu_dpm_get_ppfeature_status(adev, buf);
 
@@ -1500,9 +1500,9 @@ static DEVICE_ATTR(gpu_busy_percent, S_IRUGO,
 static DEVICE_ATTR(mem_busy_percent, S_IRUGO,
                 amdgpu_get_memory_busy_percent, NULL);
 static DEVICE_ATTR(pcie_bw, S_IRUGO, amdgpu_get_pcie_bw, NULL);
-static DEVICE_ATTR(ppfeatures, S_IRUGO | S_IWUSR,
-               amdgpu_get_ppfeature_status,
-               amdgpu_set_ppfeature_status);
+static DEVICE_ATTR(pp_features, S_IRUGO | S_IWUSR,
+               amdgpu_get_pp_feature_status,
+               amdgpu_set_pp_feature_status);
 static DEVICE_ATTR(unique_id, S_IRUGO, amdgpu_get_unique_id, NULL);
 
 static ssize_t amdgpu_hwmon_show_temp(struct device *dev,
@@ -2960,10 +2960,10 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)
         if ((adev->asic_type >= CHIP_VEGA10) &&
             !(adev->flags & AMD_IS_APU)) {
                 ret = device_create_file(adev->dev,
-                               &dev_attr_ppfeatures);
+                               &dev_attr_pp_features);
                 if (ret) {
                         DRM_ERROR("failed to create device file "
-                                       "ppfeatures\n");
+                                       "pp_features\n");
                         return ret;
                 }
         }
@@ -3017,7 +3017,7 @@ void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev)
                 device_remove_file(adev->dev, &dev_attr_unique_id);
         if ((adev->asic_type >= CHIP_VEGA10) &&
             !(adev->flags & AMD_IS_APU))
-               device_remove_file(adev->dev, &dev_attr_ppfeatures);
+               device_remove_file(adev->dev, &dev_attr_pp_features);
 }
 
 void amdgpu_pm_compute_clocks(struct amdgpu_device *adev)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +61 -0

67 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +2 -6
index abc2644b4c07..ac9e9d5d8a5c 100644
@@ -432,8 +432,6 @@ struct pptable_funcs {
                                       uint32_t *mclk_mask,
                                       uint32_t *soc_mask);
         int (*set_cpu_power_state)(struct smu_context *smu);
-       int (*set_ppfeature_status)(struct smu_context *smu, uint64_t ppfeatures);
-       int (*get_ppfeature_status)(struct smu_context *smu, char *buf);
         bool (*is_dpm_running)(struct smu_context *smu);
         int (*tables_init)(struct smu_context *smu, struct smu_table *tables);
         int (*set_thermal_fan_table)(struct smu_context *smu);
@@ -713,10 +711,6 @@ struct smu_funcs
         ((smu)->ppt_funcs->dpm_set_vce_enable ? (smu)->ppt_funcs->dpm_set_vce_enable((smu), (enable)) : 0)
 #define smu_set_xgmi_pstate(smu, pstate) \
                 ((smu)->funcs->set_xgmi_pstate ? (smu)->funcs->set_xgmi_pstate((smu), (pstate)) : 0)
-#define smu_set_ppfeature_status(smu, ppfeatures) \
-       ((smu)->ppt_funcs->set_ppfeature_status ? (smu)->ppt_funcs->set_ppfeature_status((smu), (ppfeatures)) : -EINVAL)
-#define smu_get_ppfeature_status(smu, buf) \
-       ((smu)->ppt_funcs->get_ppfeature_status ? (smu)->ppt_funcs->get_ppfeature_status((smu), (buf)) : -EINVAL)
 #define smu_set_watermarks_table(smu, tab, clock_ranges) \
         ((smu)->ppt_funcs->set_watermarks_table ? (smu)->ppt_funcs->set_watermarks_table((smu), (tab), (clock_ranges)) : 0)
 #define smu_get_current_clk_freq_by_table(smu, clk_type, value) \
@@ -804,5 +798,7 @@ bool smu_clk_dpm_is_enabled(struct smu_context *smu, enum smu_clk_type clk_type)
 int smu_feature_update_enable_state(struct smu_context *smu, uint64_t feature_mask, bool enabled);
 const char *smu_get_message_name(struct smu_context *smu, enum smu_message_type type);
 const char *smu_get_feature_name(struct smu_context *smu, enum smu_feature_mask feature);
+size_t smu_sys_get_pp_feature_mask(struct smu_context *smu, char *buf);
+int smu_sys_set_pp_feature_mask(struct smu_context *smu, uint64_t new_mask);
 
 #endif
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -165

177 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -153

165 lines not on this page · raw message

--
2.22.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): MN2PR12MB334476A964852FD3B092B385E4C10-rweVpJHSKToDMgCC8P//[email protected]

#22 lore raw

Re: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

in fact, i don't want to change this sysfs name from "ppfeatures" to "pp_features",
but it seems that don't have same name format with other pp sysfs node.
the other powerplay sysfs name have "pp_" prefix, i think we'd better to change it name to "pp_features"

eg:

pp_cur_state    pp_dpm_fclk  pp_dpm_pcie  pp_dpm_socclk  pp_force_state  pp_num_states          pp_sclk_od
pp_dpm_dcefclk  pp_dpm_mclk  pp_dpm_sclk  pp_features    pp_mclk_od      pp_power_profile_mode  pp_table

@Deucher, Alexander<mailto:[email protected]> @Zhang, Hawking<mailto:[email protected]>

Could you give us some idea about it,
Thanks.

Best Regards,
Kevin
________________________________
From: Quan, Evan <[email protected]>
Sent: Thursday, July 25, 2019 4:30 PM
To: Wang, Kevin(Yang) <[email protected]>; [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>; Feng, Kenneth <[email protected]>
Subject: RE: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

To keep backward compatibility, we cannot change the sysfs file naming.

But it’s a good idea to summarize these as common APIs.

Regards,

Evan

From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> On Behalf Of Wang, Kevin(Yang)
Sent: Thursday, July 25, 2019 4:10 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>; Feng, Kenneth <[email protected]>
Subject: Re: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

add sample data from sysfs pp_features with this patch.

print format:

index. feature name (Hardware Message ID): state

sudo find /sys -name "pp_features" -exec cat {} \;

features high: 0x00000623 low: 0xb3cdaffb

00. DPM_PREFETCHER ( 0) : enabeld

01. DPM_GFXCLK ( 1) : enabeld

02. DPM_UCLK ( 3) : enabeld

03. DPM_SOCCLK ( 4) : enabeld

04. DPM_MP0CLK ( 5) : enabeld

05. DPM_LINK ( 6) : enabeld

06. DPM_DCEFCLK ( 7) : enabeld

07. DS_GFXCLK (10) : enabeld

08. DS_SOCCLK (11) : enabeld

09. DS_LCLK (12) : disabled

10. PPT (23) : enabeld

11. TDC (24) : enabeld

12. THERMAL (33) : enabeld

13. RM (35) : disabled

14. DS_DCEFCLK (13) : enabeld

15. ACDC (28) : enabeld

16. VR0HOT (29) : enabeld

17. VR1HOT (30) : disabled

18. FW_CTF (31) : enabeld

19. LED_DISPLAY (36) : disabled

20. FAN_CONTROL (32) : enabeld

21. GFX_EDC (25) : enabeld

22. GFXOFF (17) : disabled

23. DPM_GFX_PACE ( 2) : disabled

24. MEM_VDDCI_SCALING ( 8) : enabeld

25. MEM_MVDD_SCALING ( 9) : enabeld

26. DS_UCLK (14) : disabled

27. GFX_ULV (15) : enabeld

28. FW_DSTATE (16) : enabeld

29. BACO (18) : enabeld

30. VCN_PG (19) : enabeld

31. JPEG_PG (20) : disabled

32. USB_PG (21) : disabled

33. RSMU_SMN_CG (22) : enabeld

34. APCC_PLUS (26) : disabled

35. GTHR (27) : disabled

36. GFX_DCS (34) : disabled

37. GFX_SS (37) : enabeld

38. OUT_OF_BAND_MONITOR (38) : disabled

39. TEMP_DEPENDENT_VMIN (39) : disabled

40. MMHUB_PG (40) : disabled

41. ATHUB_PG (41) : enabeld

________________________________

From: Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Sent: Thursday, July 25, 2019 1:11 PM
To: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Feng, Kenneth <[email protected]<mailto:[email protected]>>; Huang, Ray <[email protected]<mailto:[email protected]>>; Deucher, Alexander <[email protected]<mailto:[email protected]>>; Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Subject: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

1. Unified feature enable status format in sysfs
2. Rename ppfeature to pp_features to adapt other pp sysfs node name
3. this function support all asic, not asic related function.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c        |  24 +--
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c    |  61 +++++++
 .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    |   8 +-
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c    | 165 ------------------
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c    | 153 ----------------
 5 files changed, 75 insertions(+), 336 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +12 -12
index 866097d5cf26..9e8e8a65d9bf 100644
@@ -788,10 +788,10 @@ static ssize_t amdgpu_get_pp_od_clk_voltage(struct device *dev,
 }
 
 /**
- * DOC: ppfeatures
+ * DOC: pp_features
  *
  * The amdgpu driver provides a sysfs API for adjusting what powerplay
- * features to be enabled. The file ppfeatures is used for this. And
+ * features to be enabled. The file pp_features is used for this. And
  * this is only available for Vega10 and later dGPUs.
  *
  * Reading back the file will show you the followings:
@@ -803,7 +803,7 @@ static ssize_t amdgpu_get_pp_od_clk_voltage(struct device *dev,
  * the corresponding bit from original ppfeature masks and input the
  * new ppfeature masks.
  */
-static ssize_t amdgpu_set_ppfeature_status(struct device *dev,
+static ssize_t amdgpu_set_pp_feature_status(struct device *dev,
                 struct device_attribute *attr,
                 const char *buf,
                 size_t count)
@@ -820,7 +820,7 @@ static ssize_t amdgpu_set_ppfeature_status(struct device *dev,
         pr_debug("featuremask = 0x%llx\n", featuremask);
 
         if (is_support_sw_smu(adev)) {
-               ret = smu_set_ppfeature_status(&adev->smu, featuremask);
+               ret = smu_sys_set_pp_feature_mask(&adev->smu, featuremask);
                 if (ret)
                         return -EINVAL;
         } else if (adev->powerplay.pp_funcs->set_ppfeature_status) {
@@ -832,7 +832,7 @@ static ssize_t amdgpu_set_ppfeature_status(struct device *dev,
         return count;
 }
 
-static ssize_t amdgpu_get_ppfeature_status(struct device *dev,
+static ssize_t amdgpu_get_pp_feature_status(struct device *dev,
                 struct device_attribute *attr,
                 char *buf)
 {
@@ -840,7 +840,7 @@ static ssize_t amdgpu_get_ppfeature_status(struct device *dev,
         struct amdgpu_device *adev = ddev->dev_private;
 
         if (is_support_sw_smu(adev)) {
-               return smu_get_ppfeature_status(&adev->smu, buf);
+               return smu_sys_get_pp_feature_mask(&adev->smu, buf);
         } else if (adev->powerplay.pp_funcs->get_ppfeature_status)
                 return amdgpu_dpm_get_ppfeature_status(adev, buf);
 
@@ -1500,9 +1500,9 @@ static DEVICE_ATTR(gpu_busy_percent, S_IRUGO,
 static DEVICE_ATTR(mem_busy_percent, S_IRUGO,
                 amdgpu_get_memory_busy_percent, NULL);
 static DEVICE_ATTR(pcie_bw, S_IRUGO, amdgpu_get_pcie_bw, NULL);
-static DEVICE_ATTR(ppfeatures, S_IRUGO | S_IWUSR,
-               amdgpu_get_ppfeature_status,
-               amdgpu_set_ppfeature_status);
+static DEVICE_ATTR(pp_features, S_IRUGO | S_IWUSR,
+               amdgpu_get_pp_feature_status,
+               amdgpu_set_pp_feature_status);
 static DEVICE_ATTR(unique_id, S_IRUGO, amdgpu_get_unique_id, NULL);
 
 static ssize_t amdgpu_hwmon_show_temp(struct device *dev,
@@ -2960,10 +2960,10 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)
         if ((adev->asic_type >= CHIP_VEGA10) &&
             !(adev->flags & AMD_IS_APU)) {
                 ret = device_create_file(adev->dev,
-                               &dev_attr_ppfeatures);
+                               &dev_attr_pp_features);
                 if (ret) {
                         DRM_ERROR("failed to create device file "
-                                       "ppfeatures\n");
+                                       "pp_features\n");
                         return ret;
                 }
         }
@@ -3017,7 +3017,7 @@ void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev)
                 device_remove_file(adev->dev, &dev_attr_unique_id);
         if ((adev->asic_type >= CHIP_VEGA10) &&
             !(adev->flags & AMD_IS_APU))
-               device_remove_file(adev->dev, &dev_attr_ppfeatures);
+               device_remove_file(adev->dev, &dev_attr_pp_features);
 }
 
 void amdgpu_pm_compute_clocks(struct amdgpu_device *adev)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +61 -0

67 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +2 -6
index abc2644b4c07..ac9e9d5d8a5c 100644
@@ -432,8 +432,6 @@ struct pptable_funcs {
                                       uint32_t *mclk_mask,
                                       uint32_t *soc_mask);
         int (*set_cpu_power_state)(struct smu_context *smu);
-       int (*set_ppfeature_status)(struct smu_context *smu, uint64_t ppfeatures);
-       int (*get_ppfeature_status)(struct smu_context *smu, char *buf);
         bool (*is_dpm_running)(struct smu_context *smu);
         int (*tables_init)(struct smu_context *smu, struct smu_table *tables);
         int (*set_thermal_fan_table)(struct smu_context *smu);
@@ -713,10 +711,6 @@ struct smu_funcs
         ((smu)->ppt_funcs->dpm_set_vce_enable ? (smu)->ppt_funcs->dpm_set_vce_enable((smu), (enable)) : 0)
 #define smu_set_xgmi_pstate(smu, pstate) \
                 ((smu)->funcs->set_xgmi_pstate ? (smu)->funcs->set_xgmi_pstate((smu), (pstate)) : 0)
-#define smu_set_ppfeature_status(smu, ppfeatures) \
-       ((smu)->ppt_funcs->set_ppfeature_status ? (smu)->ppt_funcs->set_ppfeature_status((smu), (ppfeatures)) : -EINVAL)
-#define smu_get_ppfeature_status(smu, buf) \
-       ((smu)->ppt_funcs->get_ppfeature_status ? (smu)->ppt_funcs->get_ppfeature_status((smu), (buf)) : -EINVAL)
 #define smu_set_watermarks_table(smu, tab, clock_ranges) \
         ((smu)->ppt_funcs->set_watermarks_table ? (smu)->ppt_funcs->set_watermarks_table((smu), (tab), (clock_ranges)) : 0)
 #define smu_get_current_clk_freq_by_table(smu, clk_type, value) \
@@ -804,5 +798,7 @@ bool smu_clk_dpm_is_enabled(struct smu_context *smu, enum smu_clk_type clk_type)
 int smu_feature_update_enable_state(struct smu_context *smu, uint64_t feature_mask, bool enabled);
 const char *smu_get_message_name(struct smu_context *smu, enum smu_message_type type);
 const char *smu_get_feature_name(struct smu_context *smu, enum smu_feature_mask feature);
+size_t smu_sys_get_pp_feature_mask(struct smu_context *smu, char *buf);
+int smu_sys_set_pp_feature_mask(struct smu_context *smu, uint64_t new_mask);
 
 #endif
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -165

177 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -153

165 lines not on this page · raw message

--
2.22.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): MN2PR12MB32968D539CA68CCE3E4AFFB6A2C10-rweVpJHSKTqAm9ToKNQgFgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#24 lore raw

RE: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

Any other user mode tool use the "ppfeature" sysfs interface?

Thanks,
Ray

From: Wang, Kevin(Yang) <[email protected]>
Sent: Thursday, July 25, 2019 4:44 PM
To: Quan, Evan <[email protected]>; [email protected]; Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>
Cc: Huang, Ray <[email protected]>; Feng, Kenneth <[email protected]>
Subject: Re: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

in fact, i don't want to change this sysfs name from "ppfeatures" to "pp_features",
but it seems that don't have same name format with other pp sysfs node.
the other powerplay sysfs name have "pp_" prefix, i think we'd better to change it name to "pp_features"

eg:

pp_cur_state    pp_dpm_fclk  pp_dpm_pcie  pp_dpm_socclk  pp_force_state  pp_num_states          pp_sclk_od
pp_dpm_dcefclk  pp_dpm_mclk  pp_dpm_sclk  pp_features    pp_mclk_od      pp_power_profile_mode  pp_table

@Deucher, Alexander<mailto:[email protected]> @Zhang, Hawking<mailto:[email protected]>

Could you give us some idea about it,
Thanks.

Best Regards,
Kevin
________________________________
From: Quan, Evan <[email protected]<mailto:[email protected]>>
Sent: Thursday, July 25, 2019 4:30 PM
To: Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Deucher, Alexander <[email protected]<mailto:[email protected]>>; Huang, Ray <[email protected]<mailto:[email protected]>>; Feng, Kenneth <[email protected]<mailto:[email protected]>>
Subject: RE: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

To keep backward compatibility, we cannot change the sysfs file naming.

But it's a good idea to summarize these as common APIs.

Regards,

Evan

From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:[email protected]>> On Behalf Of Wang, Kevin(Yang)
Sent: Thursday, July 25, 2019 4:10 PM
To: [email protected]<mailto:[email protected]>
Cc: Deucher, Alexander <[email protected]<mailto:[email protected]>>; Huang, Ray <[email protected]<mailto:[email protected]>>; Feng, Kenneth <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

add sample data from sysfs pp_features with this patch.

print format:

index. feature name (Hardware Message ID): state

sudo find /sys -name "pp_features" -exec cat {} \;

features high: 0x00000623 low: 0xb3cdaffb

00. DPM_PREFETCHER ( 0) : enabeld

01. DPM_GFXCLK ( 1) : enabeld

02. DPM_UCLK ( 3) : enabeld

03. DPM_SOCCLK ( 4) : enabeld

04. DPM_MP0CLK ( 5) : enabeld

05. DPM_LINK ( 6) : enabeld

06. DPM_DCEFCLK ( 7) : enabeld

07. DS_GFXCLK (10) : enabeld

08. DS_SOCCLK (11) : enabeld

09. DS_LCLK (12) : disabled

10. PPT (23) : enabeld

11. TDC (24) : enabeld

12. THERMAL (33) : enabeld

13. RM (35) : disabled

14. DS_DCEFCLK (13) : enabeld

15. ACDC (28) : enabeld

16. VR0HOT (29) : enabeld

17. VR1HOT (30) : disabled

18. FW_CTF (31) : enabeld

19. LED_DISPLAY (36) : disabled

20. FAN_CONTROL (32) : enabeld

21. GFX_EDC (25) : enabeld

22. GFXOFF (17) : disabled

23. DPM_GFX_PACE ( 2) : disabled

24. MEM_VDDCI_SCALING ( 8) : enabeld

25. MEM_MVDD_SCALING ( 9) : enabeld

26. DS_UCLK (14) : disabled

27. GFX_ULV (15) : enabeld

28. FW_DSTATE (16) : enabeld

29. BACO (18) : enabeld

30. VCN_PG (19) : enabeld

31. JPEG_PG (20) : disabled

32. USB_PG (21) : disabled

33. RSMU_SMN_CG (22) : enabeld

34. APCC_PLUS (26) : disabled

35. GTHR (27) : disabled

36. GFX_DCS (34) : disabled

37. GFX_SS (37) : enabeld

38. OUT_OF_BAND_MONITOR (38) : disabled

39. TEMP_DEPENDENT_VMIN (39) : disabled

40. MMHUB_PG (40) : disabled

41. ATHUB_PG (41) : enabeld

________________________________

From: Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Sent: Thursday, July 25, 2019 1:11 PM
To: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Feng, Kenneth <[email protected]<mailto:[email protected]>>; Huang, Ray <[email protected]<mailto:[email protected]>>; Deucher, Alexander <[email protected]<mailto:[email protected]>>; Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Subject: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

1. Unified feature enable status format in sysfs
2. Rename ppfeature to pp_features to adapt other pp sysfs node name
3. this function support all asic, not asic related function.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c        |  24 +--
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c    |  61 +++++++
 .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    |   8 +-
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c    | 165 ------------------
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c    | 153 ----------------
 5 files changed, 75 insertions(+), 336 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +12 -12
index 866097d5cf26..9e8e8a65d9bf 100644
@@ -788,10 +788,10 @@ static ssize_t amdgpu_get_pp_od_clk_voltage(struct device *dev,
 }
 
 /**
- * DOC: ppfeatures
+ * DOC: pp_features
  *
  * The amdgpu driver provides a sysfs API for adjusting what powerplay
- * features to be enabled. The file ppfeatures is used for this. And
+ * features to be enabled. The file pp_features is used for this. And
  * this is only available for Vega10 and later dGPUs.
  *
  * Reading back the file will show you the followings:
@@ -803,7 +803,7 @@ static ssize_t amdgpu_get_pp_od_clk_voltage(struct device *dev,
  * the corresponding bit from original ppfeature masks and input the
  * new ppfeature masks.
  */
-static ssize_t amdgpu_set_ppfeature_status(struct device *dev,
+static ssize_t amdgpu_set_pp_feature_status(struct device *dev,
                 struct device_attribute *attr,
                 const char *buf,
                 size_t count)
@@ -820,7 +820,7 @@ static ssize_t amdgpu_set_ppfeature_status(struct device *dev,
         pr_debug("featuremask = 0x%llx\n", featuremask);
 
         if (is_support_sw_smu(adev)) {
-               ret = smu_set_ppfeature_status(&adev->smu, featuremask);
+               ret = smu_sys_set_pp_feature_mask(&adev->smu, featuremask);
                 if (ret)
                         return -EINVAL;
         } else if (adev->powerplay.pp_funcs->set_ppfeature_status) {
@@ -832,7 +832,7 @@ static ssize_t amdgpu_set_ppfeature_status(struct device *dev,
         return count;
 }
 
-static ssize_t amdgpu_get_ppfeature_status(struct device *dev,
+static ssize_t amdgpu_get_pp_feature_status(struct device *dev,
                 struct device_attribute *attr,
                 char *buf)
 {
@@ -840,7 +840,7 @@ static ssize_t amdgpu_get_ppfeature_status(struct device *dev,
         struct amdgpu_device *adev = ddev->dev_private;
 
         if (is_support_sw_smu(adev)) {
-               return smu_get_ppfeature_status(&adev->smu, buf);
+               return smu_sys_get_pp_feature_mask(&adev->smu, buf);
         } else if (adev->powerplay.pp_funcs->get_ppfeature_status)
                 return amdgpu_dpm_get_ppfeature_status(adev, buf);
 
@@ -1500,9 +1500,9 @@ static DEVICE_ATTR(gpu_busy_percent, S_IRUGO,
 static DEVICE_ATTR(mem_busy_percent, S_IRUGO,
                 amdgpu_get_memory_busy_percent, NULL);
 static DEVICE_ATTR(pcie_bw, S_IRUGO, amdgpu_get_pcie_bw, NULL);
-static DEVICE_ATTR(ppfeatures, S_IRUGO | S_IWUSR,
-               amdgpu_get_ppfeature_status,
-               amdgpu_set_ppfeature_status);
+static DEVICE_ATTR(pp_features, S_IRUGO | S_IWUSR,
+               amdgpu_get_pp_feature_status,
+               amdgpu_set_pp_feature_status);
 static DEVICE_ATTR(unique_id, S_IRUGO, amdgpu_get_unique_id, NULL);
 
 static ssize_t amdgpu_hwmon_show_temp(struct device *dev,
@@ -2960,10 +2960,10 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)
         if ((adev->asic_type >= CHIP_VEGA10) &&
             !(adev->flags & AMD_IS_APU)) {
                 ret = device_create_file(adev->dev,
-                               &dev_attr_ppfeatures);
+                               &dev_attr_pp_features);
                 if (ret) {
                         DRM_ERROR("failed to create device file "
-                                       "ppfeatures\n");
+                                       "pp_features\n");
                         return ret;
                 }
         }
@@ -3017,7 +3017,7 @@ void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev)
                 device_remove_file(adev->dev, &dev_attr_unique_id);
         if ((adev->asic_type >= CHIP_VEGA10) &&
             !(adev->flags & AMD_IS_APU))
-               device_remove_file(adev->dev, &dev_attr_ppfeatures);
+               device_remove_file(adev->dev, &dev_attr_pp_features);
 }
 
 void amdgpu_pm_compute_clocks(struct amdgpu_device *adev)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +61 -0

67 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +2 -6
index abc2644b4c07..ac9e9d5d8a5c 100644
@@ -432,8 +432,6 @@ struct pptable_funcs {
                                       uint32_t *mclk_mask,
                                       uint32_t *soc_mask);
         int (*set_cpu_power_state)(struct smu_context *smu);
-       int (*set_ppfeature_status)(struct smu_context *smu, uint64_t ppfeatures);
-       int (*get_ppfeature_status)(struct smu_context *smu, char *buf);
         bool (*is_dpm_running)(struct smu_context *smu);
         int (*tables_init)(struct smu_context *smu, struct smu_table *tables);
         int (*set_thermal_fan_table)(struct smu_context *smu);
@@ -713,10 +711,6 @@ struct smu_funcs
         ((smu)->ppt_funcs->dpm_set_vce_enable ? (smu)->ppt_funcs->dpm_set_vce_enable((smu), (enable)) : 0)
 #define smu_set_xgmi_pstate(smu, pstate) \
                 ((smu)->funcs->set_xgmi_pstate ? (smu)->funcs->set_xgmi_pstate((smu), (pstate)) : 0)
-#define smu_set_ppfeature_status(smu, ppfeatures) \
-       ((smu)->ppt_funcs->set_ppfeature_status ? (smu)->ppt_funcs->set_ppfeature_status((smu), (ppfeatures)) : -EINVAL)
-#define smu_get_ppfeature_status(smu, buf) \
-       ((smu)->ppt_funcs->get_ppfeature_status ? (smu)->ppt_funcs->get_ppfeature_status((smu), (buf)) : -EINVAL)
 #define smu_set_watermarks_table(smu, tab, clock_ranges) \
         ((smu)->ppt_funcs->set_watermarks_table ? (smu)->ppt_funcs->set_watermarks_table((smu), (tab), (clock_ranges)) : 0)
 #define smu_get_current_clk_freq_by_table(smu, clk_type, value) \
@@ -804,5 +798,7 @@ bool smu_clk_dpm_is_enabled(struct smu_context *smu, enum smu_clk_type clk_type)
 int smu_feature_update_enable_state(struct smu_context *smu, uint64_t feature_mask, bool enabled);
 const char *smu_get_message_name(struct smu_context *smu, enum smu_message_type type);
 const char *smu_get_feature_name(struct smu_context *smu, enum smu_feature_mask feature);
+size_t smu_sys_get_pp_feature_mask(struct smu_context *smu, char *buf);
+int smu_sys_set_pp_feature_mask(struct smu_context *smu, uint64_t new_mask);
 
 #endif
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -165

177 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -153

165 lines not on this page · raw message

--
2.22.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): MN2PR12MB33098222156F946AA7EABB26ECC10-rweVpJHSKTpWdvXm18W95QdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#26 lore raw

Re: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

Tom, does umr use it?

Alex
________________________________
From: Huang, Ray <[email protected]>
Sent: Thursday, July 25, 2019 4:49 AM
To: Wang, Kevin(Yang) <[email protected]>; Quan, Evan <[email protected]>; [email protected] <[email protected]>; Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>
Cc: Feng, Kenneth <[email protected]>
Subject: RE: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

Any other user mode tool use the “ppfeature” sysfs interface?

Thanks,

Ray

From: Wang, Kevin(Yang) <[email protected]>
Sent: Thursday, July 25, 2019 4:44 PM
To: Quan, Evan <[email protected]>; [email protected]; Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>
Cc: Huang, Ray <[email protected]>; Feng, Kenneth <[email protected]>
Subject: Re: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

in fact, i don't want to change this sysfs name from "ppfeatures" to "pp_features",

but it seems that don't have same name format with other pp sysfs node.

the other powerplay sysfs name have "pp_" prefix, i think we'd better to change it name to "pp_features"

eg:

pp_cur_state    pp_dpm_fclk  pp_dpm_pcie  pp_dpm_socclk  pp_force_state  pp_num_states          pp_sclk_od
pp_dpm_dcefclk  pp_dpm_mclk  pp_dpm_sclk  pp_features    pp_mclk_od      pp_power_profile_mode  pp_table

@Deucher, Alexander<mailto:[email protected]> @Zhang, Hawking<mailto:[email protected]>

Could you give us some idea about it,

Thanks.

Best Regards,
Kevin

________________________________

From: Quan, Evan <[email protected]<mailto:[email protected]>>
Sent: Thursday, July 25, 2019 4:30 PM
To: Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Deucher, Alexander <[email protected]<mailto:[email protected]>>; Huang, Ray <[email protected]<mailto:[email protected]>>; Feng, Kenneth <[email protected]<mailto:[email protected]>>
Subject: RE: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

To keep backward compatibility, we cannot change the sysfs file naming.

But it’s a good idea to summarize these as common APIs.

Regards,

Evan

From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:[email protected]>> On Behalf Of Wang, Kevin(Yang)
Sent: Thursday, July 25, 2019 4:10 PM
To: [email protected]<mailto:[email protected]>
Cc: Deucher, Alexander <[email protected]<mailto:[email protected]>>; Huang, Ray <[email protected]<mailto:[email protected]>>; Feng, Kenneth <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

add sample data from sysfs pp_features with this patch.

print format:

index. feature name (Hardware Message ID): state

sudo find /sys -name "pp_features" -exec cat {} \;

features high: 0x00000623 low: 0xb3cdaffb

00. DPM_PREFETCHER ( 0) : enabeld

01. DPM_GFXCLK ( 1) : enabeld

02. DPM_UCLK ( 3) : enabeld

03. DPM_SOCCLK ( 4) : enabeld

04. DPM_MP0CLK ( 5) : enabeld

05. DPM_LINK ( 6) : enabeld

06. DPM_DCEFCLK ( 7) : enabeld

07. DS_GFXCLK (10) : enabeld

08. DS_SOCCLK (11) : enabeld

09. DS_LCLK (12) : disabled

10. PPT (23) : enabeld

11. TDC (24) : enabeld

12. THERMAL (33) : enabeld

13. RM (35) : disabled

14. DS_DCEFCLK (13) : enabeld

15. ACDC (28) : enabeld

16. VR0HOT (29) : enabeld

17. VR1HOT (30) : disabled

18. FW_CTF (31) : enabeld

19. LED_DISPLAY (36) : disabled

20. FAN_CONTROL (32) : enabeld

21. GFX_EDC (25) : enabeld

22. GFXOFF (17) : disabled

23. DPM_GFX_PACE ( 2) : disabled

24. MEM_VDDCI_SCALING ( 8) : enabeld

25. MEM_MVDD_SCALING ( 9) : enabeld

26. DS_UCLK (14) : disabled

27. GFX_ULV (15) : enabeld

28. FW_DSTATE (16) : enabeld

29. BACO (18) : enabeld

30. VCN_PG (19) : enabeld

31. JPEG_PG (20) : disabled

32. USB_PG (21) : disabled

33. RSMU_SMN_CG (22) : enabeld

34. APCC_PLUS (26) : disabled

35. GTHR (27) : disabled

36. GFX_DCS (34) : disabled

37. GFX_SS (37) : enabeld

38. OUT_OF_BAND_MONITOR (38) : disabled

39. TEMP_DEPENDENT_VMIN (39) : disabled

40. MMHUB_PG (40) : disabled

41. ATHUB_PG (41) : enabeld

________________________________

From: Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Sent: Thursday, July 25, 2019 1:11 PM
To: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Feng, Kenneth <[email protected]<mailto:[email protected]>>; Huang, Ray <[email protected]<mailto:[email protected]>>; Deucher, Alexander <[email protected]<mailto:[email protected]>>; Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Subject: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

1. Unified feature enable status format in sysfs
2. Rename ppfeature to pp_features to adapt other pp sysfs node name
3. this function support all asic, not asic related function.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c        |  24 +--
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c    |  61 +++++++
 .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    |   8 +-
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c    | 165 ------------------
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c    | 153 ----------------
 5 files changed, 75 insertions(+), 336 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +12 -12
index 866097d5cf26..9e8e8a65d9bf 100644
@@ -788,10 +788,10 @@ static ssize_t amdgpu_get_pp_od_clk_voltage(struct device *dev,
 }
 
 /**
- * DOC: ppfeatures
+ * DOC: pp_features
  *
  * The amdgpu driver provides a sysfs API for adjusting what powerplay
- * features to be enabled. The file ppfeatures is used for this. And
+ * features to be enabled. The file pp_features is used for this. And
  * this is only available for Vega10 and later dGPUs.
  *
  * Reading back the file will show you the followings:
@@ -803,7 +803,7 @@ static ssize_t amdgpu_get_pp_od_clk_voltage(struct device *dev,
  * the corresponding bit from original ppfeature masks and input the
  * new ppfeature masks.
  */
-static ssize_t amdgpu_set_ppfeature_status(struct device *dev,
+static ssize_t amdgpu_set_pp_feature_status(struct device *dev,
                 struct device_attribute *attr,
                 const char *buf,
                 size_t count)
@@ -820,7 +820,7 @@ static ssize_t amdgpu_set_ppfeature_status(struct device *dev,
         pr_debug("featuremask = 0x%llx\n", featuremask);
 
         if (is_support_sw_smu(adev)) {
-               ret = smu_set_ppfeature_status(&adev->smu, featuremask);
+               ret = smu_sys_set_pp_feature_mask(&adev->smu, featuremask);
                 if (ret)
                         return -EINVAL;
         } else if (adev->powerplay.pp_funcs->set_ppfeature_status) {
@@ -832,7 +832,7 @@ static ssize_t amdgpu_set_ppfeature_status(struct device *dev,
         return count;
 }
 
-static ssize_t amdgpu_get_ppfeature_status(struct device *dev,
+static ssize_t amdgpu_get_pp_feature_status(struct device *dev,
                 struct device_attribute *attr,
                 char *buf)
 {
@@ -840,7 +840,7 @@ static ssize_t amdgpu_get_ppfeature_status(struct device *dev,
         struct amdgpu_device *adev = ddev->dev_private;
 
         if (is_support_sw_smu(adev)) {
-               return smu_get_ppfeature_status(&adev->smu, buf);
+               return smu_sys_get_pp_feature_mask(&adev->smu, buf);
         } else if (adev->powerplay.pp_funcs->get_ppfeature_status)
                 return amdgpu_dpm_get_ppfeature_status(adev, buf);
 
@@ -1500,9 +1500,9 @@ static DEVICE_ATTR(gpu_busy_percent, S_IRUGO,
 static DEVICE_ATTR(mem_busy_percent, S_IRUGO,
                 amdgpu_get_memory_busy_percent, NULL);
 static DEVICE_ATTR(pcie_bw, S_IRUGO, amdgpu_get_pcie_bw, NULL);
-static DEVICE_ATTR(ppfeatures, S_IRUGO | S_IWUSR,
-               amdgpu_get_ppfeature_status,
-               amdgpu_set_ppfeature_status);
+static DEVICE_ATTR(pp_features, S_IRUGO | S_IWUSR,
+               amdgpu_get_pp_feature_status,
+               amdgpu_set_pp_feature_status);
 static DEVICE_ATTR(unique_id, S_IRUGO, amdgpu_get_unique_id, NULL);
 
 static ssize_t amdgpu_hwmon_show_temp(struct device *dev,
@@ -2960,10 +2960,10 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)
         if ((adev->asic_type >= CHIP_VEGA10) &&
             !(adev->flags & AMD_IS_APU)) {
                 ret = device_create_file(adev->dev,
-                               &dev_attr_ppfeatures);
+                               &dev_attr_pp_features);
                 if (ret) {
                         DRM_ERROR("failed to create device file "
-                                       "ppfeatures\n");
+                                       "pp_features\n");
                         return ret;
                 }
         }
@@ -3017,7 +3017,7 @@ void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev)
                 device_remove_file(adev->dev, &dev_attr_unique_id);
         if ((adev->asic_type >= CHIP_VEGA10) &&
             !(adev->flags & AMD_IS_APU))
-               device_remove_file(adev->dev, &dev_attr_ppfeatures);
+               device_remove_file(adev->dev, &dev_attr_pp_features);
 }
 
 void amdgpu_pm_compute_clocks(struct amdgpu_device *adev)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +61 -0

67 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +2 -6
index abc2644b4c07..ac9e9d5d8a5c 100644
@@ -432,8 +432,6 @@ struct pptable_funcs {
                                       uint32_t *mclk_mask,
                                       uint32_t *soc_mask);
         int (*set_cpu_power_state)(struct smu_context *smu);
-       int (*set_ppfeature_status)(struct smu_context *smu, uint64_t ppfeatures);
-       int (*get_ppfeature_status)(struct smu_context *smu, char *buf);
         bool (*is_dpm_running)(struct smu_context *smu);
         int (*tables_init)(struct smu_context *smu, struct smu_table *tables);
         int (*set_thermal_fan_table)(struct smu_context *smu);
@@ -713,10 +711,6 @@ struct smu_funcs
         ((smu)->ppt_funcs->dpm_set_vce_enable ? (smu)->ppt_funcs->dpm_set_vce_enable((smu), (enable)) : 0)
 #define smu_set_xgmi_pstate(smu, pstate) \
                 ((smu)->funcs->set_xgmi_pstate ? (smu)->funcs->set_xgmi_pstate((smu), (pstate)) : 0)
-#define smu_set_ppfeature_status(smu, ppfeatures) \
-       ((smu)->ppt_funcs->set_ppfeature_status ? (smu)->ppt_funcs->set_ppfeature_status((smu), (ppfeatures)) : -EINVAL)
-#define smu_get_ppfeature_status(smu, buf) \
-       ((smu)->ppt_funcs->get_ppfeature_status ? (smu)->ppt_funcs->get_ppfeature_status((smu), (buf)) : -EINVAL)
 #define smu_set_watermarks_table(smu, tab, clock_ranges) \
         ((smu)->ppt_funcs->set_watermarks_table ? (smu)->ppt_funcs->set_watermarks_table((smu), (tab), (clock_ranges)) : 0)
 #define smu_get_current_clk_freq_by_table(smu, clk_type, value) \
@@ -804,5 +798,7 @@ bool smu_clk_dpm_is_enabled(struct smu_context *smu, enum smu_clk_type clk_type)
 int smu_feature_update_enable_state(struct smu_context *smu, uint64_t feature_mask, bool enabled);
 const char *smu_get_message_name(struct smu_context *smu, enum smu_message_type type);
 const char *smu_get_feature_name(struct smu_context *smu, enum smu_feature_mask feature);
+size_t smu_sys_get_pp_feature_mask(struct smu_context *smu, char *buf);
+int smu_sys_set_pp_feature_mask(struct smu_context *smu, uint64_t new_mask);
 
 #endif
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -165

177 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -153

165 lines not on this page · raw message

--
2.22.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): BN6PR12MB1809E62D6BFE3224637F25D9F7C10-/b2+HYfkarSEx6ez0IUAagdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#28 lore raw

Re: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

No it doesn't.  We get clocks for --top from the sensors interface.

Quoted 819 lines · Alexander

Tom, does umr use it?

Alex
------------------------------------------------------------------------
*From:* Huang, Ray <[email protected]>
*Sent:* Thursday, July 25, 2019 4:49 AM
*To:* Wang, Kevin(Yang) <[email protected]>; Quan, Evan <[email protected]>; [email protected] <[email protected]>; Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]> *Cc:* Feng, Kenneth <[email protected]>
*Subject:* RE: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

Any other user mode tool use the “ppfeature” sysfs interface?

Thanks,

Ray

*From:* Wang, Kevin(Yang) <[email protected]>
*Sent:* Thursday, July 25, 2019 4:44 PM
*To:* Quan, Evan <[email protected]>; [email protected]; Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>
*Cc:* Huang, Ray <[email protected]>; Feng, Kenneth <[email protected]> *Subject:* Re: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

in fact, i don't want to change this sysfs name from "ppfeatures" to "pp_features",

but it seems that don't have same name format with other pp sysfs node.

the other powerplay sysfs name have "pp_" prefix, i think we'd better to change it name to "pp_features"

eg:

pp_cur_state    pp_dpm_fclk  pp_dpm_pcie  pp_dpm_socclk pp_force_state  pp_num_states  pp_sclk_od pp_dpm_dcefclk  pp_dpm_mclk  pp_dpm_sclk  pp_features    pp_mclk_od pp_power_profile_mode  pp_table

@Deucher, Alexander <mailto:[email protected]> @Zhang, Hawking <mailto:[email protected]>

Could you give us some idea about it,

Thanks.

Best Regards,
Kevin

------------------------------------------------------------------------

*From:*Quan, Evan <[email protected] <mailto:[email protected]>> *Sent:* Thursday, July 25, 2019 4:30 PM
*To:* Wang, Kevin(Yang) <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>>
*Cc:* Deucher, Alexander <[email protected] <mailto:[email protected]>>; Huang, Ray <[email protected] <mailto:[email protected]>>; Feng, Kenneth <[email protected] <mailto:[email protected]>>
*Subject:* RE: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

To keep backward compatibility, we cannot change the sysfs file naming.

But it’s a good idea to summarize these as common APIs.

Regards,

Evan

*From:* amd-gfx <[email protected] <mailto:[email protected]>> *On Behalf Of *Wang, Kevin(Yang)
*Sent:* Thursday, July 25, 2019 4:10 PM
*To:* [email protected] <mailto:[email protected]> *Cc:* Deucher, Alexander <[email protected] <mailto:[email protected]>>; Huang, Ray <[email protected] <mailto:[email protected]>>; Feng, Kenneth <[email protected] <mailto:[email protected]>>
*Subject:* Re: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

add sample data from sysfs pp_features with this patch.

print format:

index. feature name (Hardware Message ID): state

/sudo find /sys -name "pp_features" -exec cat {} \;/

features high: 0x00000623 low: 0xb3cdaffb

00. DPM_PREFETCHER       ( 0) : enabeld

01. DPM_GFXCLK           ( 1) : enabeld

02. DPM_UCLK             ( 3) : enabeld

03. DPM_SOCCLK           ( 4) : enabeld

04. DPM_MP0CLK           ( 5) : enabeld

05. DPM_LINK             ( 6) : enabeld

06. DPM_DCEFCLK          ( 7) : enabeld

07. DS_GFXCLK            (10) : enabeld

08. DS_SOCCLK            (11) : enabeld

09. DS_LCLK              (12) : disabled

10. PPT                (23) : enabeld

11. TDC                (24) : enabeld

12. THERMAL              (33) : enabeld

13. RM                 (35) : disabled

14. DS_DCEFCLK           (13) : enabeld

15. ACDC                 (28) : enabeld

16. VR0HOT               (29) : enabeld

17. VR1HOT               (30) : disabled

18. FW_CTF               (31) : enabeld

19. LED_DISPLAY          (36) : disabled

20. FAN_CONTROL          (32) : enabeld

21. GFX_EDC              (25) : enabeld

22. GFXOFF               (17) : disabled

23. DPM_GFX_PACE         ( 2) : disabled

24. MEM_VDDCI_SCALING    ( 8) : enabeld

25. MEM_MVDD_SCALING     ( 9) : enabeld

26. DS_UCLK              (14) : disabled

27. GFX_ULV              (15) : enabeld

28. FW_DSTATE            (16) : enabeld

29. BACO                 (18) : enabeld

30. VCN_PG               (19) : enabeld

31. JPEG_PG              (20) : disabled

32. USB_PG               (21) : disabled

33. RSMU_SMN_CG          (22) : enabeld

34. APCC_PLUS            (26) : disabled

35. GTHR                 (27) : disabled

36. GFX_DCS              (34) : disabled

37. GFX_SS               (37) : enabeld

38. OUT_OF_BAND_MONITOR  (38) : disabled

39. TEMP_DEPENDENT_VMIN  (39) : disabled

40. MMHUB_PG             (40) : disabled

41. ATHUB_PG             (41) : enabeld

------------------------------------------------------------------------

*From:*Wang, Kevin(Yang) <[email protected] <mailto:[email protected]>>
*Sent:* Thursday, July 25, 2019 1:11 PM
*To:* [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>>
*Cc:* Feng, Kenneth <[email protected] <mailto:[email protected]>>; Huang, Ray <[email protected] <mailto:[email protected]>>; Deucher, Alexander <[email protected] <mailto:[email protected]>>; Wang, Kevin(Yang) <[email protected] <mailto:[email protected]>> *Subject:* [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

1. Unified feature enable status format in sysfs
2. Rename ppfeature to pp_features to adapt other pp sysfs node name
3. this function support all asic, not asic related function.

<mailto:[email protected]>>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c |  24 +-- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c |  61 +++++++ .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h |   8 +- drivers/gpu/drm/amd/powerplay/navi10_ppt.c    | 165 ------------------ drivers/gpu/drm/amd/powerplay/vega20_ppt.c    | 153 ----------------

 5 files changed, 75 insertions(+), 336 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +2 -2
index 866097d5cf26..9e8e8a65d9bf 100644
@@ -788,10 +788,10 @@ static ssize_t 
 amdgpu_get_pp_od_clk_voltage(struct device *dev,
  }
 
  /**
- * DOC: ppfeatures
+ * DOC: pp_features
   *
   * The amdgpu driver provides a sysfs API for adjusting what powerplay
- * features to be enabled. The file ppfeatures is used for this. And
+ * features to be enabled. The file pp_features is used for this. And
   * this is only available for Vega10 and later dGPUs.
   *

  * Reading back the file will show you the followings:

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
@@ -803,7 +803,7 @@ static ssize_t amdgpu_get_pp_od_clk_voltage(struct 
 device *dev,
   * the corresponding bit from original ppfeature masks and input the
   * new ppfeature masks.
   */
-static ssize_t amdgpu_set_ppfeature_status(struct device *dev,
+static ssize_t amdgpu_set_pp_feature_status(struct device *dev,
                  struct device_attribute *attr,
                  const char *buf,

                 size_t count)

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
@@ -820,7 +820,7 @@ static ssize_t amdgpu_set_ppfeature_status(struct 
 device *dev,
          pr_debug("featuremask = 0x%llx\n", featuremask);
 
          if (is_support_sw_smu(adev)) {
-               ret = smu_set_ppfeature_status(&adev->smu, featuremask);
+               ret = smu_sys_set_pp_feature_mask(&adev->smu, 
 featuremask);
                  if (ret)

                         return -EINVAL;
         } else if (adev->powerplay.pp_funcs->set_ppfeature_status) {

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
@@ -832,7 +832,7 @@ static ssize_t amdgpu_set_ppfeature_status(struct 
 device *dev,
          return count;
  }
 
-static ssize_t amdgpu_get_ppfeature_status(struct device *dev,
+static ssize_t amdgpu_get_pp_feature_status(struct device *dev,
                  struct device_attribute *attr,
                  char *buf)

 {

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +4 -4
@@ -840,7 +840,7 @@ static ssize_t amdgpu_get_ppfeature_status(struct 
 device *dev,
          struct amdgpu_device *adev = ddev->dev_private;
 
          if (is_support_sw_smu(adev)) {
-               return smu_get_ppfeature_status(&adev->smu, buf);
+               return smu_sys_get_pp_feature_mask(&adev->smu, buf);
          } else if (adev->powerplay.pp_funcs->get_ppfeature_status)
                  return amdgpu_dpm_get_ppfeature_status(adev, buf);
@@ -1500,9 +1500,9 @@ static DEVICE_ATTR(gpu_busy_percent, S_IRUGO,
  static DEVICE_ATTR(mem_busy_percent, S_IRUGO,
                  amdgpu_get_memory_busy_percent, NULL);
  static DEVICE_ATTR(pcie_bw, S_IRUGO, amdgpu_get_pcie_bw, NULL);
-static DEVICE_ATTR(ppfeatures, S_IRUGO | S_IWUSR,
-               amdgpu_get_ppfeature_status,
-               amdgpu_set_ppfeature_status);
+static DEVICE_ATTR(pp_features, S_IRUGO | S_IWUSR,
+               amdgpu_get_pp_feature_status,
+               amdgpu_set_pp_feature_status);
  static DEVICE_ATTR(unique_id, S_IRUGO, amdgpu_get_unique_id, NULL);
 
  static ssize_t amdgpu_hwmon_show_temp(struct device *dev,
@@ -2960,10 +2960,10 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device 
 *adev)

         if ((adev->asic_type >= CHIP_VEGA10) && !(adev->flags & AMD_IS_APU)) {
                 ret = device_create_file(adev->dev,
- &dev_attr_ppfeatures);
+ &dev_attr_pp_features);
                 if (ret) {
                         DRM_ERROR("failed to create device file "
- "ppfeatures\n");
+ "pp_features\n");
                         return ret;
                 }
         }

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
@@ -3017,7 +3017,7 @@ void amdgpu_pm_sysfs_fini(struct amdgpu_device 
 *adev)
 device_remove_file(adev->dev, &dev_attr_unique_id);

         if ((adev->asic_type >= CHIP_VEGA10) && !(adev->flags & AMD_IS_APU))
-               device_remove_file(adev->dev, &dev_attr_ppfeatures); +               device_remove_file(adev->dev, &dev_attr_pp_features); }

 void amdgpu_pm_compute_clocks(struct amdgpu_device *adev)

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +49 -0
index e881de955388..90833ff2fe00 100644
@@ -55,6 +55,67 @@ const char *smu_get_feature_name(struct smu_context 
 *smu, enum smu_feature_mask
          return __smu_feature_names[feature];
  }
 
+size_t smu_sys_get_pp_feature_mask(struct smu_context *smu, char *buf)
+{
+       size_t size = 0;
+       int ret = 0, i = 0;
+       uint32_t feature_mask[2] = { 0 };
+       int32_t feature_index = 0;
+       uint32_t count = 0;
+
+       ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
+       if (ret)
+               goto failed;
+
+       size =  sprintf(buf + size, "features high: 0x%08x low: 0x%08x\n",
+                       feature_mask[1], feature_mask[0]);
+
+       for (i = 0; i < SMU_FEATURE_COUNT; i++) {
+               feature_index = smu_feature_get_index(smu, i);
+               if (feature_index < 0)
+                       continue;
+               size += sprintf(buf + size, "%02d. %-20s (%2d) : %s\n",
+                              count++,
+ smu_get_feature_name(smu, i),
+                              feature_index,
+ !!smu_feature_is_enabled(smu, i) ? "enabeld" : "disabled");
+       }
+
+failed:
+       return size;
+}
+
+int smu_sys_set_pp_feature_mask(struct smu_context *smu, uint64_t 
 new_mask)
+{
+       int ret = 0;
+       uint32_t feature_mask[2] = { 0 };
+       uint64_t feature_2_enabled = 0;
+       uint64_t feature_2_disabled = 0;
+       uint64_t feature_enables = 0;
+
+       ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
+       if (ret)
+               return ret;
+
+       feature_enables = ((uint64_t)feature_mask[1] << 32 | 
 (uint64_t)feature_mask[0]);
+
+       feature_2_enabled  = ~feature_enables & new_mask;
+       feature_2_disabled = feature_enables & ~new_mask;
+
+       if (feature_2_enabled) {
+               ret = smu_feature_update_enable_state(smu, 

feature_2_enabled, true);
+               if (ret)
+                       ret;
+       }
+       if (feature_2_disabled) {
+               ret = smu_feature_update_enable_state(smu, feature_2_disabled, false);
+               if (ret)
+                       return ret;
+       }

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +4 -0
+
+       return ret;
+}
+

 int smu_get_smc_version(struct smu_context *smu, uint32_t *if_version, uint32_t *smu_version)
 {
         int ret = 0;

drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -2
index abc2644b4c07..ac9e9d5d8a5c 100644
@@ -432,8 +432,6 @@ struct pptable_funcs {
                                        uint32_t *mclk_mask,
                                        uint32_t *soc_mask);
          int (*set_cpu_power_state)(struct smu_context *smu);
-       int (*set_ppfeature_status)(struct smu_context *smu, uint64_t 
 ppfeatures);
-       int (*get_ppfeature_status)(struct smu_context *smu, char *buf);
          bool (*is_dpm_running)(struct smu_context *smu);

         int (*tables_init)(struct smu_context *smu, struct smu_table *tables);
         int (*set_thermal_fan_table)(struct smu_context *smu);

drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -0
@@ -713,10 +711,6 @@ struct smu_funcs

((smu)->ppt_funcs->dpm_set_vce_enable ? (smu)->ppt_funcs->dpm_set_vce_enable((smu), (enable)) : 0) #define smu_set_xgmi_pstate(smu, pstate) \
((smu)->funcs->set_xgmi_pstate ? (smu)->funcs->set_xgmi_pstate((smu), (pstate)) : 0)
-#define smu_set_ppfeature_status(smu, ppfeatures) \
- ((smu)->ppt_funcs->set_ppfeature_status ? (smu)->ppt_funcs->set_ppfeature_status((smu), (ppfeatures)) : -EINVAL) -#define smu_get_ppfeature_status(smu, buf) \
- ((smu)->ppt_funcs->get_ppfeature_status ? (smu)->ppt_funcs->get_ppfeature_status((smu), (buf)) : -EINVAL) #define smu_set_watermarks_table(smu, tab, clock_ranges) \
((smu)->ppt_funcs->set_watermarks_table ? (smu)->ppt_funcs->set_watermarks_table((smu), (tab), (clock_ranges)) : 0) #define smu_get_current_clk_freq_by_table(smu, clk_type, value) \

drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -0
@@ -804,5 +798,7 @@ bool smu_clk_dpm_is_enabled(struct smu_context 
 *smu, enum smu_clk_type clk_type)

 int smu_feature_update_enable_state(struct smu_context *smu, uint64_t feature_mask, bool enabled);
 const char *smu_get_message_name(struct smu_context *smu, enum smu_message_type type);
 const char *smu_get_feature_name(struct smu_context *smu, enum smu_feature_mask feature);

drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +2 -0
+size_t smu_sys_get_pp_feature_mask(struct smu_context *smu, char *buf);
+int smu_sys_set_pp_feature_mask(struct smu_context *smu, uint64_t 

new_mask);

 #endif

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -0
index c873228bf05f..cd0920093a5e 100644
@@ -1422,169 +1422,6 @@ static int navi10_get_uclk_dpm_states(struct 

smu_context *smu, uint32_t *clocks_
         return 0;
 }

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -59
-static int navi10_get_ppfeature_status(struct smu_context *smu,
-                                      char *buf)
-{
-       static const char *ppfeature_name[] = {
- "DPM_PREFETCHER",
-                               "DPM_GFXCLK",
-                               "DPM_GFX_PACE",
-                               "DPM_UCLK",
-                               "DPM_SOCCLK",
-                               "DPM_MP0CLK",
-                               "DPM_LINK",
-                               "DPM_DCEFCLK",
- "MEM_VDDCI_SCALING",
- "MEM_MVDD_SCALING",
-                               "DS_GFXCLK",
-                               "DS_SOCCLK",
-                               "DS_LCLK",
-                               "DS_DCEFCLK",
-                               "DS_UCLK",
-                               "GFX_ULV",
-                               "FW_DSTATE",
-                               "GFXOFF",
-                               "BACO",
-                               "VCN_PG",
-                               "JPEG_PG",
-                               "USB_PG",
-                               "RSMU_SMN_CG",
-                               "PPT",
-                               "TDC",
-                               "GFX_EDC",
-                               "APCC_PLUS",
-                               "GTHR",
-                               "ACDC",
-                               "VR0HOT",
-                               "VR1HOT",
-                               "FW_CTF",
-                               "FAN_CONTROL",
-                               "THERMAL",
-                               "GFX_DCS",
-                               "RM",
-                               "LED_DISPLAY",
-                               "GFX_SS",
- "OUT_OF_BAND_MONITOR",
- "TEMP_DEPENDENT_VMIN",
-                               "MMHUB_PG",
-                               "ATHUB_PG"};
-       static const char *output_title[] = {
-                               "FEATURES",
-                               "BITMASK",
-                               "ENABLEMENT"};
-       uint64_t features_enabled;
-       uint32_t feature_mask[2];
-       int i;
-       int ret = 0;
-       int size = 0;
-
-       ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
-       PP_ASSERT_WITH_CODE(!ret,
-                       "[GetPPfeatureStatus] Failed to get enabled 

smc features!",
-                       return ret);
-       features_enabled = (uint64_t)feature_mask[0] |
- (uint64_t)feature_mask[1] << 32;
-
-       size += sprintf(buf + size, "Current ppfeatures: 0x%016llx\n", features_enabled);
-       size += sprintf(buf + size, "%-19s %-22s %s\n",
-                               output_title[0],
-                               output_title[1],
- output_title[2]);
-       for (i = 0; i < (sizeof(ppfeature_name) / sizeof(ppfeature_name[0])); i++) {
-               size += sprintf(buf + size, "%-19s 0x%016llx %6s\n",
- ppfeature_name[i],
-                                       1ULL << i,
- (features_enabled & (1ULL << i)) ? "Y" : "N");
-       }

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -15
-
-       return size;
-}
-
-static int navi10_enable_smc_features(struct smu_context *smu,
-                                     bool enabled,
-                                     uint64_t feature_masks)
-{
-       struct smu_feature *feature = &smu->smu_feature;
-       uint32_t feature_low, feature_high;
-       uint32_t feature_mask[2];
-       int ret = 0;
-
-       feature_low = (uint32_t)(feature_masks & 0xFFFFFFFF);
-       feature_high = (uint32_t)((feature_masks & 

0xFFFFFFFF00000000ULL) >> 32);
-
-       if (enabled) {
-               ret = smu_send_smc_msg_with_param(smu, SMU_MSG_EnableSmuFeaturesLow,
-                                                 feature_low); -               if (ret)
-                       return ret;
-               ret = smu_send_smc_msg_with_param(smu, SMU_MSG_EnableSmuFeaturesHigh,
-                                                 feature_high); -               if (ret)
-                       return ret;
-       } else {
-               ret = smu_send_smc_msg_with_param(smu, SMU_MSG_DisableSmuFeaturesLow,
-                                                 feature_low); -               if (ret)
-                       return ret;
-               ret = smu_send_smc_msg_with_param(smu, SMU_MSG_DisableSmuFeaturesHigh,
-                                                 feature_high); -               if (ret)
-                       return ret;
-       }

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -25
-
-       ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
-       if (ret)
-               return ret;
-
-       mutex_lock(&feature->mutex);
-       bitmap_copy(feature->enabled, (unsigned long *)&feature_mask,
-                   feature->feature_num);
-       mutex_unlock(&feature->mutex);
-
-       return 0;
-}
-
-static int navi10_set_ppfeature_status(struct smu_context *smu,
-                                      uint64_t new_ppfeature_masks)
-{
-       uint64_t features_enabled;
-       uint32_t feature_mask[2];
-       uint64_t features_to_enable;
-       uint64_t features_to_disable;
-       int ret = 0;
-
-       ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
-       PP_ASSERT_WITH_CODE(!ret,
-                       "[SetPPfeatureStatus] Failed to get enabled 

smc features!",
-                       return ret);
-       features_enabled = (uint64_t)feature_mask[0] |
- (uint64_t)feature_mask[1] << 32;

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -11
-
-       features_to_disable =
-               features_enabled & ~new_ppfeature_masks;
-       features_to_enable =
-               ~features_enabled & new_ppfeature_masks;
-
-       pr_debug("features_to_disable 0x%llx\n", features_to_disable);
-       pr_debug("features_to_enable 0x%llx\n", features_to_enable);
-
-       if (features_to_disable) {
-               ret = navi10_enable_smc_features(smu, false, 

features_to_disable);
-               PP_ASSERT_WITH_CODE(!ret,
- "[SetPPfeatureStatus] Failed to disable smc features!", -                               return ret);
-       }
-
-       if (features_to_enable) {
-               ret = navi10_enable_smc_features(smu, true, features_to_enable);
-               PP_ASSERT_WITH_CODE(!ret,
- "[SetPPfeatureStatus] Failed to enable smc features!", -                               return ret);
-       }

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -4
-
-       return 0;
-}
-

 static int navi10_set_peak_clock_by_device(struct smu_context *smu) {
         struct amdgpu_device *adev = smu->adev;

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -2
@@ -1689,8 +1526,6 @@ static const struct pptable_funcs 
 navi10_ppt_funcs = {
          .set_watermarks_table = navi10_set_watermarks_table,
          .read_sensor = navi10_read_sensor,
          .get_uclk_dpm_states = navi10_get_uclk_dpm_states,
-       .get_ppfeature_status = navi10_get_ppfeature_status,
-       .set_ppfeature_status = navi10_set_ppfeature_status,
          .set_performance_level = navi10_set_performance_level,

         .get_thermal_temperature_range =
navi10_get_thermal_temperature_range,
 };

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -11
index c06a9472c3b2..52c8fc9f1ff4 100644
@@ -2858,157 +2858,6 @@ static int vega20_dpm_set_vce_enable(struct 
 smu_context *smu, bool enable)
          return smu_feature_set_enabled(smu, SMU_FEATURE_DPM_VCE_BIT, 
 enable);
  }
 
-static int vega20_get_enabled_smc_features(struct smu_context *smu,
-               uint64_t *features_enabled)
-{
-       uint32_t feature_mask[2] = {0, 0};
-       int ret = 0;
-
-       ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
-       if (ret)
-               return ret;
-
-       *features_enabled = ((((uint64_t)feature_mask[0] << 

SMU_FEATURES_LOW_SHIFT) & SMU_FEATURES_LOW_MASK) |
- (((uint64_t)feature_mask[1] << SMU_FEATURES_HIGH_SHIFT) & SMU_FEATURES_HIGH_MASK));

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -11
-
-       return ret;
-}
-
-static int vega20_enable_smc_features(struct smu_context *smu,
-               bool enable, uint64_t feature_mask)
-{
-       uint32_t smu_features_low, smu_features_high;
-       int ret = 0;
-
-       smu_features_low = (uint32_t)((feature_mask & 

SMU_FEATURES_LOW_MASK) >> SMU_FEATURES_LOW_SHIFT);
-       smu_features_high = (uint32_t)((feature_mask & SMU_FEATURES_HIGH_MASK) >> SMU_FEATURES_HIGH_SHIFT);
-
-       if (enable) {
-               ret = smu_send_smc_msg_with_param(smu, SMU_MSG_EnableSmuFeaturesLow,
-                                                 smu_features_low); -               if (ret)
-                       return ret;
-               ret = smu_send_smc_msg_with_param(smu, SMU_MSG_EnableSmuFeaturesHigh,
-                                                 smu_features_high); -               if (ret)
-                       return ret;
-       } else {
-               ret = smu_send_smc_msg_with_param(smu, SMU_MSG_DisableSmuFeaturesLow,
-                                                 smu_features_low); -               if (ret)
-                       return ret;
-               ret = smu_send_smc_msg_with_param(smu, SMU_MSG_DisableSmuFeaturesHigh,
-                                                 smu_features_high); -               if (ret)
-                       return ret;
-       }

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -6
-
-       return 0;
-
-}
-
-static int vega20_get_ppfeature_status(struct smu_context *smu, char 

*buf)

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -50
-{
-       static const char *ppfeature_name[] = {
- "DPM_PREFETCHER",
-                               "GFXCLK_DPM",
-                               "UCLK_DPM",
-                               "SOCCLK_DPM",
-                               "UVD_DPM",
-                               "VCE_DPM",
-                               "ULV",
-                               "MP0CLK_DPM",
-                               "LINK_DPM",
-                               "DCEFCLK_DPM",
-                               "GFXCLK_DS",
-                               "SOCCLK_DS",
-                               "LCLK_DS",
-                               "PPT",
-                               "TDC",
-                               "THERMAL",
-                               "GFX_PER_CU_CG",
-                               "RM",
-                               "DCEFCLK_DS",
-                               "ACDC",
-                               "VR0HOT",
-                               "VR1HOT",
-                               "FW_CTF",
-                               "LED_DISPLAY",
-                               "FAN_CONTROL",
-                               "GFX_EDC",
-                               "GFXOFF",
-                               "CG",
-                               "FCLK_DPM",
-                               "FCLK_DS",
-                               "MP1CLK_DS",
-                               "MP0CLK_DS",
-                               "XGMI",
-                               "ECC"};
-       static const char *output_title[] = {
-                               "FEATURES",
-                               "BITMASK",
-                               "ENABLEMENT"};
-       uint64_t features_enabled;
-       int i;
-       int ret = 0;
-       int size = 0;
-
-       ret = vega20_get_enabled_smc_features(smu, &features_enabled);
-       if (ret)
-               return ret;
-
-       size += sprintf(buf + size, "Current ppfeatures: 0x%016llx\n", 

features_enabled);
-       size += sprintf(buf + size, "%-19s %-22s %s\n",
-                               output_title[0],
-                               output_title[1],
- output_title[2]);
-       for (i = 0; i < GNLD_FEATURES_MAX; i++) {
-               size += sprintf(buf + size, "%-19s 0x%016llx %6s\n",
- ppfeature_name[i],
-                                       1ULL << i,
- (features_enabled & (1ULL << i)) ? "Y" : "N");
-       }

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -5
-
-       return size;
-}
-
-static int vega20_set_ppfeature_status(struct smu_context *smu, 

uint64_t new_ppfeature_masks)

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -23
-{
-       uint64_t features_enabled;
-       uint64_t features_to_enable;
-       uint64_t features_to_disable;
-       int ret = 0;
-
-       if (new_ppfeature_masks >= (1ULL << GNLD_FEATURES_MAX))
-               return -EINVAL;
-
-       ret = vega20_get_enabled_smc_features(smu, &features_enabled);
-       if (ret)
-               return ret;
-
-       features_to_disable =
-               features_enabled & ~new_ppfeature_masks;
-       features_to_enable =
-               ~features_enabled & new_ppfeature_masks;
-
-       pr_debug("features_to_disable 0x%llx\n", features_to_disable);
-       pr_debug("features_to_enable 0x%llx\n", features_to_enable);
-
-       if (features_to_disable) {
-               ret = vega20_enable_smc_features(smu, false, 

features_to_disable);
-               if (ret)
-                       return ret;
-       }
-
-       if (features_to_enable) {
-               ret = vega20_enable_smc_features(smu, true, features_to_enable);
-               if (ret)
-                       return ret;
-       }

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -4
-
-       return 0;
-}
-

 static bool vega20_is_dpm_running(struct smu_context *smu) {
         int ret = 0;

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -2
@@ -3311,8 +3160,6 @@ static const struct pptable_funcs 
 vega20_ppt_funcs = {
          .force_dpm_limit_value = vega20_force_dpm_limit_value,
          .unforce_dpm_levels = vega20_unforce_dpm_levels,
          .get_profiling_clk_mask = vega20_get_profiling_clk_mask,
-       .set_ppfeature_status = vega20_set_ppfeature_status,
-       .get_ppfeature_status = vega20_get_ppfeature_status,
          .is_dpm_running = vega20_is_dpm_running,
          .set_thermal_fan_table = vega20_set_thermal_fan_table,
Quoted 4 lines

         .get_fan_speed_percent = vega20_get_fan_speed_percent,

Signature · 1 line
2.22.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): f76aeb2d-01be-d629-72e9-a96f702a73e0-5C7GfCeVMHo@public.gmane.org

#30 lore raw

Re: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

@Deucher, Alexander<mailto:[email protected]>

Hi Alex,

it seems not application will use this sysfs, can we rename it from "ppfeatures" to "pp_features"? this patch sets is pending.

Best Regards,
Kevin
________________________________
From: StDenis, Tom <[email protected]>
Sent: Thursday, July 25, 2019 9:14 PM
To: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>; Wang, Kevin(Yang) <[email protected]>; Quan, Evan <[email protected]>; [email protected] <[email protected]>; Zhang, Hawking <[email protected]>
Cc: Feng, Kenneth <[email protected]>
Subject: Re: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

No it doesn't. We get clocks for --top from the sensors interface.

Quoted 819 lines · Alexander

Tom, does umr use it?

Alex
------------------------------------------------------------------------
*From:* Huang, Ray <[email protected]>
*Sent:* Thursday, July 25, 2019 4:49 AM
*To:* Wang, Kevin(Yang) <[email protected]>; Quan, Evan <[email protected]>; [email protected] <[email protected]>; Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]> *Cc:* Feng, Kenneth <[email protected]>
*Subject:* RE: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature
status function in smu

Any other user mode tool use the “ppfeature” sysfs interface?

Thanks,

Ray

*From:* Wang, Kevin(Yang) <[email protected]>
*Sent:* Thursday, July 25, 2019 4:44 PM
*To:* Quan, Evan <[email protected]>; [email protected]; Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>
*Cc:* Huang, Ray <[email protected]>; Feng, Kenneth <[email protected]> *Subject:* Re: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature
status function in smu

in fact, i don't want to change this sysfs name from "ppfeatures" to "pp_features",

but it seems that don't have same name format with other pp sysfs node.

the other powerplay sysfs name have "pp_" prefix, i think we'd better to change it name to "pp_features"

eg:

pp_cur_state pp_dpm_fclk pp_dpm_pcie pp_dpm_socclk
pp_force_state pp_num_states pp_sclk_od
pp_dpm_dcefclk pp_dpm_mclk pp_dpm_sclk pp_features pp_mclk_od
pp_power_profile_mode pp_table

@Deucher, Alexander <mailto:[email protected]> @Zhang, Hawking <mailto:[email protected]>

Could you give us some idea about it,

Thanks.

Best Regards,
Kevin

------------------------------------------------------------------------

*From:*Quan, Evan <[email protected] <mailto:[email protected]>> *Sent:* Thursday, July 25, 2019 4:30 PM
*To:* Wang, Kevin(Yang) <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>>
*Cc:* Deucher, Alexander <[email protected] <mailto:[email protected]>>; Huang, Ray <[email protected] <mailto:[email protected]>>; Feng, Kenneth <[email protected] <mailto:[email protected]>>
*Subject:* RE: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature
status function in smu

To keep backward compatibility, we cannot change the sysfs file naming.

But it’s a good idea to summarize these as common APIs.

Regards,

Evan

*From:* amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org <mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>> *On Behalf Of *Wang,
Kevin(Yang)
*Sent:* Thursday, July 25, 2019 4:10 PM
*To:* [email protected] <mailto:[email protected]> *Cc:* Deucher, Alexander <[email protected] <mailto:[email protected]>>; Huang, Ray <[email protected] <mailto:[email protected]>>; Feng, Kenneth <[email protected] <mailto:[email protected]>>
*Subject:* Re: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature
status function in smu

add sample data from sysfs pp_features with this patch.

print format:

index. feature name (Hardware Message ID): state

/sudo find /sys -name "pp_features" -exec cat {} \;/

features high: 0x00000623 low: 0xb3cdaffb

00. DPM_PREFETCHER ( 0) : enabeld

01. DPM_GFXCLK ( 1) : enabeld

02. DPM_UCLK ( 3) : enabeld

03. DPM_SOCCLK ( 4) : enabeld

04. DPM_MP0CLK ( 5) : enabeld

05. DPM_LINK ( 6) : enabeld

06. DPM_DCEFCLK ( 7) : enabeld

07. DS_GFXCLK (10) : enabeld

08. DS_SOCCLK (11) : enabeld

09. DS_LCLK (12) : disabled

10. PPT (23) : enabeld

11. TDC (24) : enabeld

12. THERMAL (33) : enabeld

13. RM (35) : disabled

14. DS_DCEFCLK (13) : enabeld

15. ACDC (28) : enabeld

16. VR0HOT (29) : enabeld

17. VR1HOT (30) : disabled

18. FW_CTF (31) : enabeld

19. LED_DISPLAY (36) : disabled

20. FAN_CONTROL (32) : enabeld

21. GFX_EDC (25) : enabeld

22. GFXOFF (17) : disabled

23. DPM_GFX_PACE ( 2) : disabled

24. MEM_VDDCI_SCALING ( 8) : enabeld

25. MEM_MVDD_SCALING ( 9) : enabeld

26. DS_UCLK (14) : disabled

27. GFX_ULV (15) : enabeld

28. FW_DSTATE (16) : enabeld

29. BACO (18) : enabeld

30. VCN_PG (19) : enabeld

31. JPEG_PG (20) : disabled

32. USB_PG (21) : disabled

33. RSMU_SMN_CG (22) : enabeld

34. APCC_PLUS (26) : disabled

35. GTHR (27) : disabled

36. GFX_DCS (34) : disabled

37. GFX_SS (37) : enabeld

38. OUT_OF_BAND_MONITOR (38) : disabled

39. TEMP_DEPENDENT_VMIN (39) : disabled

40. MMHUB_PG (40) : disabled

41. ATHUB_PG (41) : enabeld

------------------------------------------------------------------------

*From:*Wang, Kevin(Yang) <[email protected] <mailto:[email protected]>>
*Sent:* Thursday, July 25, 2019 1:11 PM
*To:* [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>>
*Cc:* Feng, Kenneth <[email protected] <mailto:[email protected]>>; Huang, Ray <[email protected] <mailto:[email protected]>>; Deucher, Alexander <[email protected] <mailto:[email protected]>>; Wang, Kevin(Yang) <[email protected] <mailto:[email protected]>> *Subject:* [PATCH 5/5] drm/amd/powerplay: implment sysfs feature
status function in smu

1. Unified feature enable status format in sysfs
2. Rename ppfeature to pp_features to adapt other pp sysfs node name
3. this function support all asic, not asic related function.

<mailto:[email protected]>>

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c |  24 +--
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c |  61 +++++++
 .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h |   8 +-
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c    | 165 ------------------
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c    | 153 ----------------
 5 files changed, 75 insertions(+), 336 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +2 -2
index 866097d5cf26..9e8e8a65d9bf 100644
@@ -788,10 +788,10 @@ static ssize_t
 amdgpu_get_pp_od_clk_voltage(struct device *dev,
 }
 
 /**
- * DOC: ppfeatures
+ * DOC: pp_features
  *
  * The amdgpu driver provides a sysfs API for adjusting what powerplay
- * features to be enabled. The file ppfeatures is used for this. And
+ * features to be enabled. The file pp_features is used for this. And
  * this is only available for Vega10 and later dGPUs.
  *

* Reading back the file will show you the followings:

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
@@ -803,7 +803,7 @@ static ssize_t amdgpu_get_pp_od_clk_voltage(struct
 device *dev,
  * the corresponding bit from original ppfeature masks and input the
  * new ppfeature masks.
  */
-static ssize_t amdgpu_set_ppfeature_status(struct device *dev,
+static ssize_t amdgpu_set_pp_feature_status(struct device *dev,
                 struct device_attribute *attr,
                 const char *buf,

size_t count)

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
@@ -820,7 +820,7 @@ static ssize_t amdgpu_set_ppfeature_status(struct
 device *dev,
         pr_debug("featuremask = 0x%llx\n", featuremask);
 
         if (is_support_sw_smu(adev)) {
-               ret = smu_set_ppfeature_status(&adev->smu, featuremask);
+               ret = smu_sys_set_pp_feature_mask(&adev->smu,
 featuremask);
                 if (ret)
                         return -EINVAL;
         } else if (adev->powerplay.pp_funcs->set_ppfeature_status) {
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
@@ -832,7 +832,7 @@ static ssize_t amdgpu_set_ppfeature_status(struct
 device *dev,
         return count;
 }
 
-static ssize_t amdgpu_get_ppfeature_status(struct device *dev,
+static ssize_t amdgpu_get_pp_feature_status(struct device *dev,
                 struct device_attribute *attr,
                 char *buf)

{

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +6 -6
@@ -840,7 +840,7 @@ static ssize_t amdgpu_get_ppfeature_status(struct
 device *dev,
         struct amdgpu_device *adev = ddev->dev_private;
 
         if (is_support_sw_smu(adev)) {
-               return smu_get_ppfeature_status(&adev->smu, buf);
+               return smu_sys_get_pp_feature_mask(&adev->smu, buf);
         } else if (adev->powerplay.pp_funcs->get_ppfeature_status)
                 return amdgpu_dpm_get_ppfeature_status(adev, buf);
@@ -1500,9 +1500,9 @@ static DEVICE_ATTR(gpu_busy_percent, S_IRUGO,
 static DEVICE_ATTR(mem_busy_percent, S_IRUGO,
                 amdgpu_get_memory_busy_percent, NULL);
 static DEVICE_ATTR(pcie_bw, S_IRUGO, amdgpu_get_pcie_bw, NULL);
-static DEVICE_ATTR(ppfeatures, S_IRUGO | S_IWUSR,
-               amdgpu_get_ppfeature_status,
-               amdgpu_set_ppfeature_status);
+static DEVICE_ATTR(pp_features, S_IRUGO | S_IWUSR,
+               amdgpu_get_pp_feature_status,
+               amdgpu_set_pp_feature_status);
 static DEVICE_ATTR(unique_id, S_IRUGO, amdgpu_get_unique_id, NULL);
 
 static ssize_t amdgpu_hwmon_show_temp(struct device *dev,
@@ -2960,10 +2960,10 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device
 *adev)
         if ((adev->asic_type >= CHIP_VEGA10) &&
             !(adev->flags & AMD_IS_APU)) {
                 ret = device_create_file(adev->dev,
- &dev_attr_ppfeatures);
+ &dev_attr_pp_features);
                 if (ret) {
                         DRM_ERROR("failed to create device file "
- "ppfeatures\n");
+ "pp_features\n");
                         return ret;
                 }
         }
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
@@ -3017,7 +3017,7 @@ void amdgpu_pm_sysfs_fini(struct amdgpu_device
 *adev)
 device_remove_file(adev->dev, &dev_attr_unique_id);
         if ((adev->asic_type >= CHIP_VEGA10) &&
             !(adev->flags & AMD_IS_APU))
-               device_remove_file(adev->dev, &dev_attr_ppfeatures);
+               device_remove_file(adev->dev, &dev_attr_pp_features);
 }
 

void amdgpu_pm_compute_clocks(struct amdgpu_device *adev)

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +49 -0
index e881de955388..90833ff2fe00 100644
@@ -55,6 +55,67 @@ const char *smu_get_feature_name(struct smu_context
 *smu, enum smu_feature_mask
         return __smu_feature_names[feature];
 }
 
+size_t smu_sys_get_pp_feature_mask(struct smu_context *smu, char *buf)
+{
+       size_t size = 0;
+       int ret = 0, i = 0;
+       uint32_t feature_mask[2] = { 0 };
+       int32_t feature_index = 0;
+       uint32_t count = 0;
+
+       ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
+       if (ret)
+               goto failed;
+
+       size =  sprintf(buf + size, "features high: 0x%08x low: 0x%08x\n",
+                       feature_mask[1], feature_mask[0]);
+
+       for (i = 0; i < SMU_FEATURE_COUNT; i++) {
+               feature_index = smu_feature_get_index(smu, i);
+               if (feature_index < 0)
+                       continue;
+               size += sprintf(buf + size, "%02d. %-20s (%2d) : %s\n",
+                              count++,
+ smu_get_feature_name(smu, i),
+                              feature_index,
+ !!smu_feature_is_enabled(smu, i) ? "enabeld" : "disabled");
+       }
+
+failed:
+       return size;
+}
+
+int smu_sys_set_pp_feature_mask(struct smu_context *smu, uint64_t
 new_mask)
+{
+       int ret = 0;
+       uint32_t feature_mask[2] = { 0 };
+       uint64_t feature_2_enabled = 0;
+       uint64_t feature_2_disabled = 0;
+       uint64_t feature_enables = 0;
+
+       ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
+       if (ret)
+               return ret;
+
+       feature_enables = ((uint64_t)feature_mask[1] << 32 |
 (uint64_t)feature_mask[0]);
+
+       feature_2_enabled  = ~feature_enables & new_mask;
+       feature_2_disabled = feature_enables & ~new_mask;
+
+       if (feature_2_enabled) {
+               ret = smu_feature_update_enable_state(smu,

feature_2_enabled, true);

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +5 -0
+               if (ret)
+                       ret;
+       }
+       if (feature_2_disabled) {
+               ret = smu_feature_update_enable_state(smu,

feature_2_disabled, false);

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +7 -0
+               if (ret)
+                       return ret;
+       }
+
+       return ret;
+}
+
 int smu_get_smc_version(struct smu_context *smu, uint32_t

*if_version, uint32_t *smu_version)

 {
         int ret = 0;
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -2
index abc2644b4c07..ac9e9d5d8a5c 100644
@@ -432,8 +432,6 @@ struct pptable_funcs {
                                       uint32_t *mclk_mask,
                                       uint32_t *soc_mask);
         int (*set_cpu_power_state)(struct smu_context *smu);
-       int (*set_ppfeature_status)(struct smu_context *smu, uint64_t
 ppfeatures);
-       int (*get_ppfeature_status)(struct smu_context *smu, char *buf);
         bool (*is_dpm_running)(struct smu_context *smu);
         int (*tables_init)(struct smu_context *smu, struct smu_table
*tables);
         int (*set_thermal_fan_table)(struct smu_context *smu);
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -0
@@ -713,10 +711,6 @@ struct smu_funcs

((smu)->ppt_funcs->dpm_set_vce_enable ? (smu)->ppt_funcs->dpm_set_vce_enable((smu), (enable)) : 0)
#define smu_set_xgmi_pstate(smu, pstate) \
((smu)->funcs->set_xgmi_pstate ? (smu)->funcs->set_xgmi_pstate((smu), (pstate)) : 0)
-#define smu_set_ppfeature_status(smu, ppfeatures) \
- ((smu)->ppt_funcs->set_ppfeature_status ? (smu)->ppt_funcs->set_ppfeature_status((smu), (ppfeatures)) : -EINVAL) -#define smu_get_ppfeature_status(smu, buf) \
- ((smu)->ppt_funcs->get_ppfeature_status ? (smu)->ppt_funcs->get_ppfeature_status((smu), (buf)) : -EINVAL) #define smu_set_watermarks_table(smu, tab, clock_ranges) \
((smu)->ppt_funcs->set_watermarks_table ? (smu)->ppt_funcs->set_watermarks_table((smu), (tab), (clock_ranges)) : 0)
#define smu_get_current_clk_freq_by_table(smu, clk_type, value) \

drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -0
@@ -804,5 +798,7 @@ bool smu_clk_dpm_is_enabled(struct smu_context
 *smu, enum smu_clk_type clk_type)
 int smu_feature_update_enable_state(struct smu_context *smu, uint64_t
 feature_mask, bool enabled);
 const char *smu_get_message_name(struct smu_context *smu, enum
 smu_message_type type);
 const char *smu_get_feature_name(struct smu_context *smu, enum

smu_feature_mask feature);

drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +2 -0
+size_t smu_sys_get_pp_feature_mask(struct smu_context *smu, char *buf);
+int smu_sys_set_pp_feature_mask(struct smu_context *smu, uint64_t

new_mask);

#endif

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -0
index c873228bf05f..cd0920093a5e 100644
@@ -1422,169 +1422,6 @@ static int navi10_get_uclk_dpm_states(struct

smu_context *smu, uint32_t *clocks_

         return 0;

}

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -59
-static int navi10_get_ppfeature_status(struct smu_context *smu,
-                                      char *buf)
-{
-       static const char *ppfeature_name[] = {
- "DPM_PREFETCHER",
-                               "DPM_GFXCLK",
-                               "DPM_GFX_PACE",
-                               "DPM_UCLK",
-                               "DPM_SOCCLK",
-                               "DPM_MP0CLK",
-                               "DPM_LINK",
-                               "DPM_DCEFCLK",
- "MEM_VDDCI_SCALING",
- "MEM_MVDD_SCALING",
-                               "DS_GFXCLK",
-                               "DS_SOCCLK",
-                               "DS_LCLK",
-                               "DS_DCEFCLK",
-                               "DS_UCLK",
-                               "GFX_ULV",
-                               "FW_DSTATE",
-                               "GFXOFF",
-                               "BACO",
-                               "VCN_PG",
-                               "JPEG_PG",
-                               "USB_PG",
-                               "RSMU_SMN_CG",
-                               "PPT",
-                               "TDC",
-                               "GFX_EDC",
-                               "APCC_PLUS",
-                               "GTHR",
-                               "ACDC",
-                               "VR0HOT",
-                               "VR1HOT",
-                               "FW_CTF",
-                               "FAN_CONTROL",
-                               "THERMAL",
-                               "GFX_DCS",
-                               "RM",
-                               "LED_DISPLAY",
-                               "GFX_SS",
- "OUT_OF_BAND_MONITOR",
- "TEMP_DEPENDENT_VMIN",
-                               "MMHUB_PG",
-                               "ATHUB_PG"};
-       static const char *output_title[] = {
-                               "FEATURES",
-                               "BITMASK",
-                               "ENABLEMENT"};
-       uint64_t features_enabled;
-       uint32_t feature_mask[2];
-       int i;
-       int ret = 0;
-       int size = 0;
-
-       ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
-       PP_ASSERT_WITH_CODE(!ret,
-                       "[GetPPfeatureStatus] Failed to get enabled

smc features!",

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -5
-                       return ret);
-       features_enabled = (uint64_t)feature_mask[0] |
- (uint64_t)feature_mask[1] << 32;
-
-       size += sprintf(buf + size, "Current ppfeatures: 0x%016llx\n",

features_enabled);

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -5
-       size += sprintf(buf + size, "%-19s %-22s %s\n",
-                               output_title[0],
-                               output_title[1],
- output_title[2]);
-       for (i = 0; i < (sizeof(ppfeature_name) /

sizeof(ppfeature_name[0])); i++) {

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -20
-               size += sprintf(buf + size, "%-19s 0x%016llx %6s\n",
- ppfeature_name[i],
-                                       1ULL << i,
- (features_enabled & (1ULL << i)) ? "Y" : "N");
-       }
-
-       return size;
-}
-
-static int navi10_enable_smc_features(struct smu_context *smu,
-                                     bool enabled,
-                                     uint64_t feature_masks)
-{
-       struct smu_feature *feature = &smu->smu_feature;
-       uint32_t feature_low, feature_high;
-       uint32_t feature_mask[2];
-       int ret = 0;
-
-       feature_low = (uint32_t)(feature_masks & 0xFFFFFFFF);
-       feature_high = (uint32_t)((feature_masks &

0xFFFFFFFF00000000ULL) >> 32);

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -3
-
-       if (enabled) {
-               ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_EnableSmuFeaturesLow,

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -4
-                                                 feature_low);
-               if (ret)
-                       return ret;
-               ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_EnableSmuFeaturesHigh,

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -5
-                                                 feature_high);
-               if (ret)
-                       return ret;
-       } else {
-               ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_DisableSmuFeaturesLow,

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -4
-                                                 feature_low);
-               if (ret)
-                       return ret;
-               ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_DisableSmuFeaturesHigh,

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -29
-                                                 feature_high);
-               if (ret)
-                       return ret;
-       }
-
-       ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
-       if (ret)
-               return ret;
-
-       mutex_lock(&feature->mutex);
-       bitmap_copy(feature->enabled, (unsigned long *)&feature_mask,
-                   feature->feature_num);
-       mutex_unlock(&feature->mutex);
-
-       return 0;
-}
-
-static int navi10_set_ppfeature_status(struct smu_context *smu,
-                                      uint64_t new_ppfeature_masks)
-{
-       uint64_t features_enabled;
-       uint32_t feature_mask[2];
-       uint64_t features_to_enable;
-       uint64_t features_to_disable;
-       int ret = 0;
-
-       ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
-       PP_ASSERT_WITH_CODE(!ret,
-                       "[SetPPfeatureStatus] Failed to get enabled

smc features!",

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -14
-                       return ret);
-       features_enabled = (uint64_t)feature_mask[0] |
- (uint64_t)feature_mask[1] << 32;
-
-       features_to_disable =
-               features_enabled & ~new_ppfeature_masks;
-       features_to_enable =
-               ~features_enabled & new_ppfeature_masks;
-
-       pr_debug("features_to_disable 0x%llx\n", features_to_disable);
-       pr_debug("features_to_enable 0x%llx\n", features_to_enable);
-
-       if (features_to_disable) {
-               ret = navi10_enable_smc_features(smu, false,

features_to_disable);

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -7
-               PP_ASSERT_WITH_CODE(!ret,
- "[SetPPfeatureStatus] Failed to disable smc features!",
-                               return ret);
-       }
-
-       if (features_to_enable) {
-               ret = navi10_enable_smc_features(smu, true,

features_to_enable);

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -10
-               PP_ASSERT_WITH_CODE(!ret,
- "[SetPPfeatureStatus] Failed to enable smc features!",
-                               return ret);
-       }
-
-       return 0;
-}
-
 static int navi10_set_peak_clock_by_device(struct smu_context *smu)
 {
         struct amdgpu_device *adev = smu->adev;
@@ -1689,8 +1526,6 @@ static const struct pptable_funcs
 navi10_ppt_funcs = {
         .set_watermarks_table = navi10_set_watermarks_table,
         .read_sensor = navi10_read_sensor,
         .get_uclk_dpm_states = navi10_get_uclk_dpm_states,
-       .get_ppfeature_status = navi10_get_ppfeature_status,
-       .set_ppfeature_status = navi10_set_ppfeature_status,
         .set_performance_level = navi10_set_performance_level,
         .get_thermal_temperature_range =

navi10_get_thermal_temperature_range,
};

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -11
index c06a9472c3b2..52c8fc9f1ff4 100644
@@ -2858,157 +2858,6 @@ static int vega20_dpm_set_vce_enable(struct
 smu_context *smu, bool enable)
         return smu_feature_set_enabled(smu, SMU_FEATURE_DPM_VCE_BIT,
 enable);
 }
 
-static int vega20_get_enabled_smc_features(struct smu_context *smu,
-               uint64_t *features_enabled)
-{
-       uint32_t feature_mask[2] = {0, 0};
-       int ret = 0;
-
-       ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
-       if (ret)
-               return ret;
-
-       *features_enabled = ((((uint64_t)feature_mask[0] <<

SMU_FEATURES_LOW_SHIFT) & SMU_FEATURES_LOW_MASK) |
- (((uint64_t)feature_mask[1] << SMU_FEATURES_HIGH_SHIFT) & SMU_FEATURES_HIGH_MASK));

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -11
-
-       return ret;
-}
-
-static int vega20_enable_smc_features(struct smu_context *smu,
-               bool enable, uint64_t feature_mask)
-{
-       uint32_t smu_features_low, smu_features_high;
-       int ret = 0;
-
-       smu_features_low = (uint32_t)((feature_mask &

SMU_FEATURES_LOW_MASK) >> SMU_FEATURES_LOW_SHIFT);
- smu_features_high = (uint32_t)((feature_mask &
SMU_FEATURES_HIGH_MASK) >> SMU_FEATURES_HIGH_SHIFT);

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -3
-
-       if (enable) {
-               ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_EnableSmuFeaturesLow,

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -4
-                                                 smu_features_low);
-               if (ret)
-                       return ret;
-               ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_EnableSmuFeaturesHigh,

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -5
-                                                 smu_features_high);
-               if (ret)
-                       return ret;
-       } else {
-               ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_DisableSmuFeaturesLow,

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -4
-                                                 smu_features_low);
-               if (ret)
-                       return ret;
-               ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_DisableSmuFeaturesHigh,

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -10
-                                                 smu_features_high);
-               if (ret)
-                       return ret;
-       }
-
-       return 0;
-
-}
-
-static int vega20_get_ppfeature_status(struct smu_context *smu, char

*buf)

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -50
-{
-       static const char *ppfeature_name[] = {
- "DPM_PREFETCHER",
-                               "GFXCLK_DPM",
-                               "UCLK_DPM",
-                               "SOCCLK_DPM",
-                               "UVD_DPM",
-                               "VCE_DPM",
-                               "ULV",
-                               "MP0CLK_DPM",
-                               "LINK_DPM",
-                               "DCEFCLK_DPM",
-                               "GFXCLK_DS",
-                               "SOCCLK_DS",
-                               "LCLK_DS",
-                               "PPT",
-                               "TDC",
-                               "THERMAL",
-                               "GFX_PER_CU_CG",
-                               "RM",
-                               "DCEFCLK_DS",
-                               "ACDC",
-                               "VR0HOT",
-                               "VR1HOT",
-                               "FW_CTF",
-                               "LED_DISPLAY",
-                               "FAN_CONTROL",
-                               "GFX_EDC",
-                               "GFXOFF",
-                               "CG",
-                               "FCLK_DPM",
-                               "FCLK_DS",
-                               "MP1CLK_DS",
-                               "MP0CLK_DS",
-                               "XGMI",
-                               "ECC"};
-       static const char *output_title[] = {
-                               "FEATURES",
-                               "BITMASK",
-                               "ENABLEMENT"};
-       uint64_t features_enabled;
-       int i;
-       int ret = 0;
-       int size = 0;
-
-       ret = vega20_get_enabled_smc_features(smu, &features_enabled);
-       if (ret)
-               return ret;
-
-       size += sprintf(buf + size, "Current ppfeatures: 0x%016llx\n",

features_enabled);

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -15
-       size += sprintf(buf + size, "%-19s %-22s %s\n",
-                               output_title[0],
-                               output_title[1],
- output_title[2]);
-       for (i = 0; i < GNLD_FEATURES_MAX; i++) {
-               size += sprintf(buf + size, "%-19s 0x%016llx %6s\n",
- ppfeature_name[i],
-                                       1ULL << i,
- (features_enabled & (1ULL << i)) ? "Y" : "N");
-       }
-
-       return size;
-}
-
-static int vega20_set_ppfeature_status(struct smu_context *smu,

uint64_t new_ppfeature_masks)

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -23
-{
-       uint64_t features_enabled;
-       uint64_t features_to_enable;
-       uint64_t features_to_disable;
-       int ret = 0;
-
-       if (new_ppfeature_masks >= (1ULL << GNLD_FEATURES_MAX))
-               return -EINVAL;
-
-       ret = vega20_get_enabled_smc_features(smu, &features_enabled);
-       if (ret)
-               return ret;
-
-       features_to_disable =
-               features_enabled & ~new_ppfeature_masks;
-       features_to_enable =
-               ~features_enabled & new_ppfeature_masks;
-
-       pr_debug("features_to_disable 0x%llx\n", features_to_disable);
-       pr_debug("features_to_enable 0x%llx\n", features_to_enable);
-
-       if (features_to_disable) {
-               ret = vega20_enable_smc_features(smu, false,

features_to_disable);

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -6
-               if (ret)
-                       return ret;
-       }
-
-       if (features_to_enable) {
-               ret = vega20_enable_smc_features(smu, true,

features_to_enable);

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -9
-               if (ret)
-                       return ret;
-       }
-
-       return 0;
-}
-
 static bool vega20_is_dpm_running(struct smu_context *smu)
 {
         int ret = 0;
@@ -3311,8 +3160,6 @@ static const struct pptable_funcs
 vega20_ppt_funcs = {
         .force_dpm_limit_value = vega20_force_dpm_limit_value,
         .unforce_dpm_levels = vega20_unforce_dpm_levels,
         .get_profiling_clk_mask = vega20_get_profiling_clk_mask,
-       .set_ppfeature_status = vega20_set_ppfeature_status,
-       .get_ppfeature_status = vega20_get_ppfeature_status,
         .is_dpm_running = vega20_is_dpm_running,
         .set_thermal_fan_table = vega20_set_thermal_fan_table,
Quoted 4 lines

.get_fan_speed_percent = vega20_get_fan_speed_percent,
--
2.22.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): BN8PR12MB3283A9239266F64A93F2E3DDA2C00-h6+T2+wrnx1KUVg95YpnwwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

Acked-by
#32 lore raw

RE: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

I am fine to align the interface name if no user mode use.

From: Wang, Kevin(Yang) <[email protected]>
Sent: Friday, July 26, 2019 5:05 PM
To: StDenis, Tom <[email protected]>; Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>; Quan, Evan <[email protected]>; [email protected]; Zhang, Hawking <[email protected]>
Cc: Feng, Kenneth <[email protected]>
Subject: Re: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

@Deucher, Alexander<mailto:[email protected]>

Hi Alex,

it seems not application will use this sysfs, can we rename it from "ppfeatures" to "pp_features"? this patch sets is pending.

Best Regards,
Kevin
________________________________
From: StDenis, Tom <[email protected]<mailto:[email protected]>>
Sent: Thursday, July 25, 2019 9:14 PM
To: Deucher, Alexander <[email protected]<mailto:[email protected]>>; Huang, Ray <[email protected]<mailto:[email protected]>>; Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>; Quan, Evan <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>; Zhang, Hawking <[email protected]<mailto:[email protected]>>
Cc: Feng, Kenneth <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

No it doesn't. We get clocks for --top from the sensors interface.

Quoted 51 lines · Alexander

Tom, does umr use it?

Alex
------------------------------------------------------------------------
*From:* Huang, Ray <[email protected]<mailto:[email protected]>>
*Sent:* Thursday, July 25, 2019 4:49 AM
*To:* Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>; Quan, Evan <[email protected]<mailto:[email protected]>>; amd-gfx-PD4FTy7X32lNgt0PjOBp9/[email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>; Zhang, Hawking <[email protected]<mailto:[email protected]>>; Deucher, Alexander <[email protected]<mailto:[email protected]>> *Cc:* Feng, Kenneth <[email protected]<mailto:[email protected]>>
*Subject:* RE: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature
status function in smu

Any other user mode tool use the "ppfeature" sysfs interface?

Thanks,

Ray

*From:* Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
*Sent:* Thursday, July 25, 2019 4:44 PM
*To:* Quan, Evan <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>; Zhang, Hawking <[email protected]<mailto:[email protected]>>; Deucher, Alexander <[email protected]<mailto:[email protected]>>
*Cc:* Huang, Ray <[email protected]<mailto:[email protected]>>; Feng, Kenneth <[email protected]<mailto:[email protected]>> *Subject:* Re: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature
status function in smu

in fact, i don't want to change this sysfs name from "ppfeatures" to "pp_features",

but it seems that don't have same name format with other pp sysfs node.

the other powerplay sysfs name have "pp_" prefix, i think we'd better to change it name to "pp_features"

eg:

pp_cur_state pp_dpm_fclk pp_dpm_pcie pp_dpm_socclk
pp_force_state pp_num_states pp_sclk_od
pp_dpm_dcefclk pp_dpm_mclk pp_dpm_sclk pp_features pp_mclk_od
pp_power_profile_mode pp_table

@Deucher, Alexander <mailto:[email protected]> @Zhang, Hawking <mailto:[email protected]>

Could you give us some idea about it,

Thanks.

Quoted 8 lines

Best Regards,
Kevin

------------------------------------------------------------------------

*From:*Quan, Evan <[email protected] <mailto:[email protected]>> *Sent:* Thursday, July 25, 2019 4:30 PM
*To:* Wang, Kevin(Yang) <[email protected]

<mailto:[email protected]%20%0b>> <mailto:[email protected]>>; [email protected]<mailto:[email protected]>

Quoted 1 line

<mailto:[email protected]> <[email protected]

<mailto:[email protected]%20%0b>> <mailto:[email protected]>>

Quoted 1 line

*Cc:* Deucher, Alexander <[email protected]

<mailto:[email protected]%20%0b>> <mailto:[email protected]>>; Huang, Ray <[email protected] <mailto:[email protected]%20%0b>> <mailto:[email protected]>>; Feng, Kenneth <[email protected] <mailto:[email protected]%20%0b>> <mailto:[email protected]>>

Quoted 5 lines

*Subject:* RE: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

To keep backward compatibility, we cannot change the sysfs file naming.

Quoted 7 lines

But it's a good idea to summarize these as common APIs.

Regards,

Evan

*From:* amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org

<mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org%20%0b>> <mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>> *On Behalf Of *Wang,

Quoted 4 lines

Kevin(Yang)
*Sent:* Thursday, July 25, 2019 4:10 PM
*To:* [email protected]<mailto:[email protected]> <mailto:[email protected]> *Cc:* Deucher, Alexander <[email protected]

<mailto:[email protected]%20%0b>> <mailto:[email protected]>>; Huang, Ray <[email protected] <mailto:[email protected]%20%0b>> <mailto:[email protected]>>; Feng, Kenneth <[email protected] <mailto:[email protected]%20%0b>> <mailto:[email protected]>>

Quoted 93 lines

*Subject:* Re: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

add sample data from sysfs pp_features with this patch.

print format:

index. feature name (Hardware Message ID): state

/sudo find /sys -name "pp_features" -exec cat {} \;/

features high: 0x00000623 low: 0xb3cdaffb

00. DPM_PREFETCHER ( 0) : enabeld

01. DPM_GFXCLK ( 1) : enabeld

02. DPM_UCLK ( 3) : enabeld

03. DPM_SOCCLK ( 4) : enabeld

04. DPM_MP0CLK ( 5) : enabeld

05. DPM_LINK ( 6) : enabeld

06. DPM_DCEFCLK ( 7) : enabeld

07. DS_GFXCLK (10) : enabeld

08. DS_SOCCLK (11) : enabeld

09. DS_LCLK (12) : disabled

10. PPT (23) : enabeld

11. TDC (24) : enabeld

12. THERMAL (33) : enabeld

13. RM (35) : disabled

14. DS_DCEFCLK (13) : enabeld

15. ACDC (28) : enabeld

16. VR0HOT (29) : enabeld

17. VR1HOT (30) : disabled

18. FW_CTF (31) : enabeld

19. LED_DISPLAY (36) : disabled

20. FAN_CONTROL (32) : enabeld

21. GFX_EDC (25) : enabeld

22. GFXOFF (17) : disabled

23. DPM_GFX_PACE ( 2) : disabled

24. MEM_VDDCI_SCALING ( 8) : enabeld

25. MEM_MVDD_SCALING ( 9) : enabeld

26. DS_UCLK (14) : disabled

27. GFX_ULV (15) : enabeld

28. FW_DSTATE (16) : enabeld

29. BACO (18) : enabeld

30. VCN_PG (19) : enabeld

31. JPEG_PG (20) : disabled

32. USB_PG (21) : disabled

33. RSMU_SMN_CG (22) : enabeld

34. APCC_PLUS (26) : disabled

35. GTHR (27) : disabled

36. GFX_DCS (34) : disabled

37. GFX_SS (37) : enabeld

38. OUT_OF_BAND_MONITOR (38) : disabled

39. TEMP_DEPENDENT_VMIN (39) : disabled

Quoted 7 lines

40. MMHUB_PG (40) : disabled

41. ATHUB_PG (41) : enabeld

------------------------------------------------------------------------

*From:*Wang, Kevin(Yang) <[email protected]

<mailto:[email protected]%20%0b>> <mailto:[email protected]>>

Quoted 3 lines

*Sent:* Thursday, July 25, 2019 1:11 PM
*To:* [email protected]<mailto:[email protected]> <mailto:[email protected]> <[email protected]

<mailto:[email protected]%20%0b>> <mailto:[email protected]>>

Quoted 1 line

*Cc:* Feng, Kenneth <[email protected]

<mailto:[email protected]%20%0b>> <mailto:[email protected]>>; Huang, Ray <[email protected] <mailto:[email protected]%20%0b>> <mailto:[email protected]>>; Deucher, Alexander

Quoted 10 lines

<[email protected] <mailto:[email protected]>>; Wang, Kevin(Yang) <[email protected] <mailto:[email protected]>> *Subject:* [PATCH 5/5] drm/amd/powerplay: implment sysfs feature
status function in smu

1. Unified feature enable status format in sysfs
2. Rename ppfeature to pp_features to adapt other pp sysfs node name
3. this function support all asic, not asic related function.

<mailto:[email protected]%20%0b>> <mailto:[email protected]>>

Quoted 614 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c |  24 +--
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c |  61 +++++++
 .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h |   8 +-
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c    | 165 ------------------
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c    | 153 ----------------
 5 files changed, 75 insertions(+), 336 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +2 -2
index 866097d5cf26..9e8e8a65d9bf 100644
@@ -788,10 +788,10 @@ static ssize_t
 amdgpu_get_pp_od_clk_voltage(struct device *dev,
 }
 
 /**
- * DOC: ppfeatures
+ * DOC: pp_features
  *
  * The amdgpu driver provides a sysfs API for adjusting what powerplay
- * features to be enabled. The file ppfeatures is used for this. And
+ * features to be enabled. The file pp_features is used for this. And
  * this is only available for Vega10 and later dGPUs.
  *

* Reading back the file will show you the followings:

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
@@ -803,7 +803,7 @@ static ssize_t amdgpu_get_pp_od_clk_voltage(struct
 device *dev,
  * the corresponding bit from original ppfeature masks and input the
  * new ppfeature masks.
  */
-static ssize_t amdgpu_set_ppfeature_status(struct device *dev,
+static ssize_t amdgpu_set_pp_feature_status(struct device *dev,
                 struct device_attribute *attr,
                 const char *buf,

size_t count)

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
@@ -820,7 +820,7 @@ static ssize_t amdgpu_set_ppfeature_status(struct
 device *dev,
         pr_debug("featuremask = 0x%llx\n", featuremask);
 
         if (is_support_sw_smu(adev)) {
-               ret = smu_set_ppfeature_status(&adev->smu, featuremask);
+               ret = smu_sys_set_pp_feature_mask(&adev->smu,
 featuremask);
                 if (ret)
                         return -EINVAL;
         } else if (adev->powerplay.pp_funcs->set_ppfeature_status) {
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
@@ -832,7 +832,7 @@ static ssize_t amdgpu_set_ppfeature_status(struct
 device *dev,
         return count;
 }
 
-static ssize_t amdgpu_get_ppfeature_status(struct device *dev,
+static ssize_t amdgpu_get_pp_feature_status(struct device *dev,
                 struct device_attribute *attr,
                 char *buf)

{

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +6 -6
@@ -840,7 +840,7 @@ static ssize_t amdgpu_get_ppfeature_status(struct
 device *dev,
         struct amdgpu_device *adev = ddev->dev_private;
 
         if (is_support_sw_smu(adev)) {
-               return smu_get_ppfeature_status(&adev->smu, buf);
+               return smu_sys_get_pp_feature_mask(&adev->smu, buf);
         } else if (adev->powerplay.pp_funcs->get_ppfeature_status)
                 return amdgpu_dpm_get_ppfeature_status(adev, buf);
@@ -1500,9 +1500,9 @@ static DEVICE_ATTR(gpu_busy_percent, S_IRUGO,
 static DEVICE_ATTR(mem_busy_percent, S_IRUGO,
                 amdgpu_get_memory_busy_percent, NULL);
 static DEVICE_ATTR(pcie_bw, S_IRUGO, amdgpu_get_pcie_bw, NULL);
-static DEVICE_ATTR(ppfeatures, S_IRUGO | S_IWUSR,
-               amdgpu_get_ppfeature_status,
-               amdgpu_set_ppfeature_status);
+static DEVICE_ATTR(pp_features, S_IRUGO | S_IWUSR,
+               amdgpu_get_pp_feature_status,
+               amdgpu_set_pp_feature_status);
 static DEVICE_ATTR(unique_id, S_IRUGO, amdgpu_get_unique_id, NULL);
 
 static ssize_t amdgpu_hwmon_show_temp(struct device *dev,
@@ -2960,10 +2960,10 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device
 *adev)
         if ((adev->asic_type >= CHIP_VEGA10) &&
             !(adev->flags & AMD_IS_APU)) {
                 ret = device_create_file(adev->dev,
- &dev_attr_ppfeatures);
+ &dev_attr_pp_features);
                 if (ret) {
                         DRM_ERROR("failed to create device file "
- "ppfeatures\n");
+ "pp_features\n");
                         return ret;
                 }
         }
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
@@ -3017,7 +3017,7 @@ void amdgpu_pm_sysfs_fini(struct amdgpu_device
 *adev)
 device_remove_file(adev->dev, &dev_attr_unique_id);
         if ((adev->asic_type >= CHIP_VEGA10) &&
             !(adev->flags & AMD_IS_APU))
-               device_remove_file(adev->dev, &dev_attr_ppfeatures);
+               device_remove_file(adev->dev, &dev_attr_pp_features);
 }
 

void amdgpu_pm_compute_clocks(struct amdgpu_device *adev)

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +49 -0
index e881de955388..90833ff2fe00 100644
@@ -55,6 +55,67 @@ const char *smu_get_feature_name(struct smu_context
 *smu, enum smu_feature_mask
         return __smu_feature_names[feature];
 }
 
+size_t smu_sys_get_pp_feature_mask(struct smu_context *smu, char *buf)
+{
+       size_t size = 0;
+       int ret = 0, i = 0;
+       uint32_t feature_mask[2] = { 0 };
+       int32_t feature_index = 0;
+       uint32_t count = 0;
+
+       ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
+       if (ret)
+               goto failed;
+
+       size =  sprintf(buf + size, "features high: 0x%08x low: 0x%08x\n",
+                       feature_mask[1], feature_mask[0]);
+
+       for (i = 0; i < SMU_FEATURE_COUNT; i++) {
+               feature_index = smu_feature_get_index(smu, i);
+               if (feature_index < 0)
+                       continue;
+               size += sprintf(buf + size, "%02d. %-20s (%2d) : %s\n",
+                              count++,
+ smu_get_feature_name(smu, i),
+                              feature_index,
+ !!smu_feature_is_enabled(smu, i) ? "enabeld" : "disabled");
+       }
+
+failed:
+       return size;
+}
+
+int smu_sys_set_pp_feature_mask(struct smu_context *smu, uint64_t
 new_mask)
+{
+       int ret = 0;
+       uint32_t feature_mask[2] = { 0 };
+       uint64_t feature_2_enabled = 0;
+       uint64_t feature_2_disabled = 0;
+       uint64_t feature_enables = 0;
+
+       ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
+       if (ret)
+               return ret;
+
+       feature_enables = ((uint64_t)feature_mask[1] << 32 |
 (uint64_t)feature_mask[0]);
+
+       feature_2_enabled  = ~feature_enables & new_mask;
+       feature_2_disabled = feature_enables & ~new_mask;
+
+       if (feature_2_enabled) {
+               ret = smu_feature_update_enable_state(smu,

feature_2_enabled, true);

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +5 -0
+               if (ret)
+                       ret;
+       }
+       if (feature_2_disabled) {
+               ret = smu_feature_update_enable_state(smu,

feature_2_disabled, false);

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +7 -0
+               if (ret)
+                       return ret;
+       }
+
+       return ret;
+}
+
 int smu_get_smc_version(struct smu_context *smu, uint32_t

*if_version, uint32_t *smu_version)

 {
         int ret = 0;
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -2
index abc2644b4c07..ac9e9d5d8a5c 100644
@@ -432,8 +432,6 @@ struct pptable_funcs {
                                       uint32_t *mclk_mask,
                                       uint32_t *soc_mask);
         int (*set_cpu_power_state)(struct smu_context *smu);
-       int (*set_ppfeature_status)(struct smu_context *smu, uint64_t
 ppfeatures);
-       int (*get_ppfeature_status)(struct smu_context *smu, char *buf);
         bool (*is_dpm_running)(struct smu_context *smu);
         int (*tables_init)(struct smu_context *smu, struct smu_table
*tables);
         int (*set_thermal_fan_table)(struct smu_context *smu);
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -0
@@ -713,10 +711,6 @@ struct smu_funcs

((smu)->ppt_funcs->dpm_set_vce_enable ? (smu)->ppt_funcs->dpm_set_vce_enable((smu), (enable)) : 0)
#define smu_set_xgmi_pstate(smu, pstate) \
((smu)->funcs->set_xgmi_pstate ? (smu)->funcs->set_xgmi_pstate((smu), (pstate)) : 0)
-#define smu_set_ppfeature_status(smu, ppfeatures) \
- ((smu)->ppt_funcs->set_ppfeature_status ? (smu)->ppt_funcs->set_ppfeature_status((smu), (ppfeatures)) : -EINVAL) -#define smu_get_ppfeature_status(smu, buf) \
- ((smu)->ppt_funcs->get_ppfeature_status ? (smu)->ppt_funcs->get_ppfeature_status((smu), (buf)) : -EINVAL) #define smu_set_watermarks_table(smu, tab, clock_ranges) \
((smu)->ppt_funcs->set_watermarks_table ? (smu)->ppt_funcs->set_watermarks_table((smu), (tab), (clock_ranges)) : 0)
#define smu_get_current_clk_freq_by_table(smu, clk_type, value) \

drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -0
@@ -804,5 +798,7 @@ bool smu_clk_dpm_is_enabled(struct smu_context
 *smu, enum smu_clk_type clk_type)
 int smu_feature_update_enable_state(struct smu_context *smu, uint64_t
 feature_mask, bool enabled);
 const char *smu_get_message_name(struct smu_context *smu, enum
 smu_message_type type);
 const char *smu_get_feature_name(struct smu_context *smu, enum

smu_feature_mask feature);

drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +2 -0
+size_t smu_sys_get_pp_feature_mask(struct smu_context *smu, char *buf);
+int smu_sys_set_pp_feature_mask(struct smu_context *smu, uint64_t

new_mask);

#endif

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -0
index c873228bf05f..cd0920093a5e 100644
@@ -1422,169 +1422,6 @@ static int navi10_get_uclk_dpm_states(struct

smu_context *smu, uint32_t *clocks_

         return 0;

}

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -59
-static int navi10_get_ppfeature_status(struct smu_context *smu,
-                                      char *buf)
-{
-       static const char *ppfeature_name[] = {
- "DPM_PREFETCHER",
-                               "DPM_GFXCLK",
-                               "DPM_GFX_PACE",
-                               "DPM_UCLK",
-                               "DPM_SOCCLK",
-                               "DPM_MP0CLK",
-                               "DPM_LINK",
-                               "DPM_DCEFCLK",
- "MEM_VDDCI_SCALING",
- "MEM_MVDD_SCALING",
-                               "DS_GFXCLK",
-                               "DS_SOCCLK",
-                               "DS_LCLK",
-                               "DS_DCEFCLK",
-                               "DS_UCLK",
-                               "GFX_ULV",
-                               "FW_DSTATE",
-                               "GFXOFF",
-                               "BACO",
-                               "VCN_PG",
-                               "JPEG_PG",
-                               "USB_PG",
-                               "RSMU_SMN_CG",
-                               "PPT",
-                               "TDC",
-                               "GFX_EDC",
-                               "APCC_PLUS",
-                               "GTHR",
-                               "ACDC",
-                               "VR0HOT",
-                               "VR1HOT",
-                               "FW_CTF",
-                               "FAN_CONTROL",
-                               "THERMAL",
-                               "GFX_DCS",
-                               "RM",
-                               "LED_DISPLAY",
-                               "GFX_SS",
- "OUT_OF_BAND_MONITOR",
- "TEMP_DEPENDENT_VMIN",
-                               "MMHUB_PG",
-                               "ATHUB_PG"};
-       static const char *output_title[] = {
-                               "FEATURES",
-                               "BITMASK",
-                               "ENABLEMENT"};
-       uint64_t features_enabled;
-       uint32_t feature_mask[2];
-       int i;
-       int ret = 0;
-       int size = 0;
-
-       ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
-       PP_ASSERT_WITH_CODE(!ret,
-                       "[GetPPfeatureStatus] Failed to get enabled

smc features!",

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -5
-                       return ret);
-       features_enabled = (uint64_t)feature_mask[0] |
- (uint64_t)feature_mask[1] << 32;
-
-       size += sprintf(buf + size, "Current ppfeatures: 0x%016llx\n",

features_enabled);

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -5
-       size += sprintf(buf + size, "%-19s %-22s %s\n",
-                               output_title[0],
-                               output_title[1],
- output_title[2]);
-       for (i = 0; i < (sizeof(ppfeature_name) /

sizeof(ppfeature_name[0])); i++) {

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -20
-               size += sprintf(buf + size, "%-19s 0x%016llx %6s\n",
- ppfeature_name[i],
-                                       1ULL << i,
- (features_enabled & (1ULL << i)) ? "Y" : "N");
-       }
-
-       return size;
-}
-
-static int navi10_enable_smc_features(struct smu_context *smu,
-                                     bool enabled,
-                                     uint64_t feature_masks)
-{
-       struct smu_feature *feature = &smu->smu_feature;
-       uint32_t feature_low, feature_high;
-       uint32_t feature_mask[2];
-       int ret = 0;
-
-       feature_low = (uint32_t)(feature_masks & 0xFFFFFFFF);
-       feature_high = (uint32_t)((feature_masks &

0xFFFFFFFF00000000ULL) >> 32);

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -3
-
-       if (enabled) {
-               ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_EnableSmuFeaturesLow,

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -4
-                                                 feature_low);
-               if (ret)
-                       return ret;
-               ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_EnableSmuFeaturesHigh,

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -5
-                                                 feature_high);
-               if (ret)
-                       return ret;
-       } else {
-               ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_DisableSmuFeaturesLow,

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -4
-                                                 feature_low);
-               if (ret)
-                       return ret;
-               ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_DisableSmuFeaturesHigh,

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -29
-                                                 feature_high);
-               if (ret)
-                       return ret;
-       }
-
-       ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
-       if (ret)
-               return ret;
-
-       mutex_lock(&feature->mutex);
-       bitmap_copy(feature->enabled, (unsigned long *)&feature_mask,
-                   feature->feature_num);
-       mutex_unlock(&feature->mutex);
-
-       return 0;
-}
-
-static int navi10_set_ppfeature_status(struct smu_context *smu,
-                                      uint64_t new_ppfeature_masks)
-{
-       uint64_t features_enabled;
-       uint32_t feature_mask[2];
-       uint64_t features_to_enable;
-       uint64_t features_to_disable;
-       int ret = 0;
-
-       ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
-       PP_ASSERT_WITH_CODE(!ret,
-                       "[SetPPfeatureStatus] Failed to get enabled

smc features!",

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -14
-                       return ret);
-       features_enabled = (uint64_t)feature_mask[0] |
- (uint64_t)feature_mask[1] << 32;
-
-       features_to_disable =
-               features_enabled & ~new_ppfeature_masks;
-       features_to_enable =
-               ~features_enabled & new_ppfeature_masks;
-
-       pr_debug("features_to_disable 0x%llx\n", features_to_disable);
-       pr_debug("features_to_enable 0x%llx\n", features_to_enable);
-
-       if (features_to_disable) {
-               ret = navi10_enable_smc_features(smu, false,

features_to_disable);

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -7
-               PP_ASSERT_WITH_CODE(!ret,
- "[SetPPfeatureStatus] Failed to disable smc features!",
-                               return ret);
-       }
-
-       if (features_to_enable) {
-               ret = navi10_enable_smc_features(smu, true,

features_to_enable);

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -10
-               PP_ASSERT_WITH_CODE(!ret,
- "[SetPPfeatureStatus] Failed to enable smc features!",
-                               return ret);
-       }
-
-       return 0;
-}
-
 static int navi10_set_peak_clock_by_device(struct smu_context *smu)
 {
         struct amdgpu_device *adev = smu->adev;
@@ -1689,8 +1526,6 @@ static const struct pptable_funcs
 navi10_ppt_funcs = {
         .set_watermarks_table = navi10_set_watermarks_table,
         .read_sensor = navi10_read_sensor,
         .get_uclk_dpm_states = navi10_get_uclk_dpm_states,
-       .get_ppfeature_status = navi10_get_ppfeature_status,
-       .set_ppfeature_status = navi10_set_ppfeature_status,
         .set_performance_level = navi10_set_performance_level,
         .get_thermal_temperature_range =

navi10_get_thermal_temperature_range,
};

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -11
index c06a9472c3b2..52c8fc9f1ff4 100644
@@ -2858,157 +2858,6 @@ static int vega20_dpm_set_vce_enable(struct
 smu_context *smu, bool enable)
         return smu_feature_set_enabled(smu, SMU_FEATURE_DPM_VCE_BIT,
 enable);
 }
 
-static int vega20_get_enabled_smc_features(struct smu_context *smu,
-               uint64_t *features_enabled)
-{
-       uint32_t feature_mask[2] = {0, 0};
-       int ret = 0;
-
-       ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
-       if (ret)
-               return ret;
-
-       *features_enabled = ((((uint64_t)feature_mask[0] <<

SMU_FEATURES_LOW_SHIFT) & SMU_FEATURES_LOW_MASK) |
- (((uint64_t)feature_mask[1] << SMU_FEATURES_HIGH_SHIFT) & SMU_FEATURES_HIGH_MASK));

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -11
-
-       return ret;
-}
-
-static int vega20_enable_smc_features(struct smu_context *smu,
-               bool enable, uint64_t feature_mask)
-{
-       uint32_t smu_features_low, smu_features_high;
-       int ret = 0;
-
-       smu_features_low = (uint32_t)((feature_mask &

SMU_FEATURES_LOW_MASK) >> SMU_FEATURES_LOW_SHIFT);
- smu_features_high = (uint32_t)((feature_mask &
SMU_FEATURES_HIGH_MASK) >> SMU_FEATURES_HIGH_SHIFT);

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -3
-
-       if (enable) {
-               ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_EnableSmuFeaturesLow,

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -4
-                                                 smu_features_low);
-               if (ret)
-                       return ret;
-               ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_EnableSmuFeaturesHigh,

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -5
-                                                 smu_features_high);
-               if (ret)
-                       return ret;
-       } else {
-               ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_DisableSmuFeaturesLow,

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -4
-                                                 smu_features_low);
-               if (ret)
-                       return ret;
-               ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_DisableSmuFeaturesHigh,

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -10
-                                                 smu_features_high);
-               if (ret)
-                       return ret;
-       }
-
-       return 0;
-
-}
-
-static int vega20_get_ppfeature_status(struct smu_context *smu, char

*buf)

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -50
-{
-       static const char *ppfeature_name[] = {
- "DPM_PREFETCHER",
-                               "GFXCLK_DPM",
-                               "UCLK_DPM",
-                               "SOCCLK_DPM",
-                               "UVD_DPM",
-                               "VCE_DPM",
-                               "ULV",
-                               "MP0CLK_DPM",
-                               "LINK_DPM",
-                               "DCEFCLK_DPM",
-                               "GFXCLK_DS",
-                               "SOCCLK_DS",
-                               "LCLK_DS",
-                               "PPT",
-                               "TDC",
-                               "THERMAL",
-                               "GFX_PER_CU_CG",
-                               "RM",
-                               "DCEFCLK_DS",
-                               "ACDC",
-                               "VR0HOT",
-                               "VR1HOT",
-                               "FW_CTF",
-                               "LED_DISPLAY",
-                               "FAN_CONTROL",
-                               "GFX_EDC",
-                               "GFXOFF",
-                               "CG",
-                               "FCLK_DPM",
-                               "FCLK_DS",
-                               "MP1CLK_DS",
-                               "MP0CLK_DS",
-                               "XGMI",
-                               "ECC"};
-       static const char *output_title[] = {
-                               "FEATURES",
-                               "BITMASK",
-                               "ENABLEMENT"};
-       uint64_t features_enabled;
-       int i;
-       int ret = 0;
-       int size = 0;
-
-       ret = vega20_get_enabled_smc_features(smu, &features_enabled);
-       if (ret)
-               return ret;
-
-       size += sprintf(buf + size, "Current ppfeatures: 0x%016llx\n",

features_enabled);

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -15
-       size += sprintf(buf + size, "%-19s %-22s %s\n",
-                               output_title[0],
-                               output_title[1],
- output_title[2]);
-       for (i = 0; i < GNLD_FEATURES_MAX; i++) {
-               size += sprintf(buf + size, "%-19s 0x%016llx %6s\n",
- ppfeature_name[i],
-                                       1ULL << i,
- (features_enabled & (1ULL << i)) ? "Y" : "N");
-       }
-
-       return size;
-}
-
-static int vega20_set_ppfeature_status(struct smu_context *smu,

uint64_t new_ppfeature_masks)

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -23
-{
-       uint64_t features_enabled;
-       uint64_t features_to_enable;
-       uint64_t features_to_disable;
-       int ret = 0;
-
-       if (new_ppfeature_masks >= (1ULL << GNLD_FEATURES_MAX))
-               return -EINVAL;
-
-       ret = vega20_get_enabled_smc_features(smu, &features_enabled);
-       if (ret)
-               return ret;
-
-       features_to_disable =
-               features_enabled & ~new_ppfeature_masks;
-       features_to_enable =
-               ~features_enabled & new_ppfeature_masks;
-
-       pr_debug("features_to_disable 0x%llx\n", features_to_disable);
-       pr_debug("features_to_enable 0x%llx\n", features_to_enable);
-
-       if (features_to_disable) {
-               ret = vega20_enable_smc_features(smu, false,

features_to_disable);

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -6
-               if (ret)
-                       return ret;
-       }
-
-       if (features_to_enable) {
-               ret = vega20_enable_smc_features(smu, true,

features_to_enable);

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -9
-               if (ret)
-                       return ret;
-       }
-
-       return 0;
-}
-
 static bool vega20_is_dpm_running(struct smu_context *smu)
 {
         int ret = 0;
@@ -3311,8 +3160,6 @@ static const struct pptable_funcs
 vega20_ppt_funcs = {
         .force_dpm_limit_value = vega20_force_dpm_limit_value,
         .unforce_dpm_levels = vega20_unforce_dpm_levels,
         .get_profiling_clk_mask = vega20_get_profiling_clk_mask,
-       .set_ppfeature_status = vega20_set_ppfeature_status,
-       .get_ppfeature_status = vega20_get_ppfeature_status,
         .is_dpm_running = vega20_is_dpm_running,
         .set_thermal_fan_table = vega20_set_thermal_fan_table,
Quoted 4 lines

.get_fan_speed_percent = vega20_get_fan_speed_percent,
--
2.22.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#33 lore raw

Re: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

In reply to a message not in the archive

Sure.

Alex
________________________________
From: Wang, Kevin(Yang) <[email protected]>
Sent: Friday, July 26, 2019 5:05 AM
To: StDenis, Tom <[email protected]>; Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>; Quan, Evan <[email protected]>; [email protected] <[email protected]>; Zhang, Hawking <[email protected]>
Cc: Feng, Kenneth <[email protected]>
Subject: Re: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

@Deucher, Alexander<mailto:[email protected]>

Hi Alex,

it seems not application will use this sysfs, can we rename it from "ppfeatures" to "pp_features"? this patch sets is pending.

Best Regards,
Kevin
________________________________
From: StDenis, Tom <[email protected]>
Sent: Thursday, July 25, 2019 9:14 PM
To: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>; Wang, Kevin(Yang) <[email protected]>; Quan, Evan <[email protected]>; [email protected] <[email protected]>; Zhang, Hawking <[email protected]>
Cc: Feng, Kenneth <[email protected]>
Subject: Re: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature status function in smu

No it doesn't. We get clocks for --top from the sensors interface.

Quoted 819 lines · Alexander

Tom, does umr use it?

Alex
------------------------------------------------------------------------
*From:* Huang, Ray <[email protected]>
*Sent:* Thursday, July 25, 2019 4:49 AM
*To:* Wang, Kevin(Yang) <[email protected]>; Quan, Evan <[email protected]>; [email protected] <[email protected]>; Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]> *Cc:* Feng, Kenneth <[email protected]>
*Subject:* RE: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature
status function in smu

Any other user mode tool use the “ppfeature” sysfs interface?

Thanks,

Ray

*From:* Wang, Kevin(Yang) <[email protected]>
*Sent:* Thursday, July 25, 2019 4:44 PM
*To:* Quan, Evan <[email protected]>; [email protected]; Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>
*Cc:* Huang, Ray <[email protected]>; Feng, Kenneth <[email protected]> *Subject:* Re: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature
status function in smu

in fact, i don't want to change this sysfs name from "ppfeatures" to "pp_features",

but it seems that don't have same name format with other pp sysfs node.

the other powerplay sysfs name have "pp_" prefix, i think we'd better to change it name to "pp_features"

eg:

pp_cur_state pp_dpm_fclk pp_dpm_pcie pp_dpm_socclk
pp_force_state pp_num_states pp_sclk_od
pp_dpm_dcefclk pp_dpm_mclk pp_dpm_sclk pp_features pp_mclk_od
pp_power_profile_mode pp_table

@Deucher, Alexander <mailto:[email protected]> @Zhang, Hawking <mailto:[email protected]>

Could you give us some idea about it,

Thanks.

Best Regards,
Kevin

------------------------------------------------------------------------

*From:*Quan, Evan <[email protected] <mailto:[email protected]>> *Sent:* Thursday, July 25, 2019 4:30 PM
*To:* Wang, Kevin(Yang) <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>>
*Cc:* Deucher, Alexander <[email protected] <mailto:[email protected]>>; Huang, Ray <[email protected] <mailto:[email protected]>>; Feng, Kenneth <[email protected] <mailto:[email protected]>>
*Subject:* RE: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature
status function in smu

To keep backward compatibility, we cannot change the sysfs file naming.

But it’s a good idea to summarize these as common APIs.

Regards,

Evan

*From:* amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org <mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>> *On Behalf Of *Wang,
Kevin(Yang)
*Sent:* Thursday, July 25, 2019 4:10 PM
*To:* [email protected] <mailto:[email protected]> *Cc:* Deucher, Alexander <[email protected] <mailto:[email protected]>>; Huang, Ray <[email protected] <mailto:[email protected]>>; Feng, Kenneth <[email protected] <mailto:[email protected]>>
*Subject:* Re: [PATCH 5/5] drm/amd/powerplay: implment sysfs feature
status function in smu

add sample data from sysfs pp_features with this patch.

print format:

index. feature name (Hardware Message ID): state

/sudo find /sys -name "pp_features" -exec cat {} \;/

features high: 0x00000623 low: 0xb3cdaffb

00. DPM_PREFETCHER ( 0) : enabeld

01. DPM_GFXCLK ( 1) : enabeld

02. DPM_UCLK ( 3) : enabeld

03. DPM_SOCCLK ( 4) : enabeld

04. DPM_MP0CLK ( 5) : enabeld

05. DPM_LINK ( 6) : enabeld

06. DPM_DCEFCLK ( 7) : enabeld

07. DS_GFXCLK (10) : enabeld

08. DS_SOCCLK (11) : enabeld

09. DS_LCLK (12) : disabled

10. PPT (23) : enabeld

11. TDC (24) : enabeld

12. THERMAL (33) : enabeld

13. RM (35) : disabled

14. DS_DCEFCLK (13) : enabeld

15. ACDC (28) : enabeld

16. VR0HOT (29) : enabeld

17. VR1HOT (30) : disabled

18. FW_CTF (31) : enabeld

19. LED_DISPLAY (36) : disabled

20. FAN_CONTROL (32) : enabeld

21. GFX_EDC (25) : enabeld

22. GFXOFF (17) : disabled

23. DPM_GFX_PACE ( 2) : disabled

24. MEM_VDDCI_SCALING ( 8) : enabeld

25. MEM_MVDD_SCALING ( 9) : enabeld

26. DS_UCLK (14) : disabled

27. GFX_ULV (15) : enabeld

28. FW_DSTATE (16) : enabeld

29. BACO (18) : enabeld

30. VCN_PG (19) : enabeld

31. JPEG_PG (20) : disabled

32. USB_PG (21) : disabled

33. RSMU_SMN_CG (22) : enabeld

34. APCC_PLUS (26) : disabled

35. GTHR (27) : disabled

36. GFX_DCS (34) : disabled

37. GFX_SS (37) : enabeld

38. OUT_OF_BAND_MONITOR (38) : disabled

39. TEMP_DEPENDENT_VMIN (39) : disabled

40. MMHUB_PG (40) : disabled

41. ATHUB_PG (41) : enabeld

------------------------------------------------------------------------

*From:*Wang, Kevin(Yang) <[email protected] <mailto:[email protected]>>
*Sent:* Thursday, July 25, 2019 1:11 PM
*To:* [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>>
*Cc:* Feng, Kenneth <[email protected] <mailto:[email protected]>>; Huang, Ray <[email protected] <mailto:[email protected]>>; Deucher, Alexander <[email protected] <mailto:[email protected]>>; Wang, Kevin(Yang) <[email protected] <mailto:[email protected]>> *Subject:* [PATCH 5/5] drm/amd/powerplay: implment sysfs feature
status function in smu

1. Unified feature enable status format in sysfs
2. Rename ppfeature to pp_features to adapt other pp sysfs node name
3. this function support all asic, not asic related function.

<mailto:[email protected]>>

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c |  24 +--
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c |  61 +++++++
 .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h |   8 +-
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c    | 165 ------------------
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c    | 153 ----------------
 5 files changed, 75 insertions(+), 336 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +2 -2
index 866097d5cf26..9e8e8a65d9bf 100644
@@ -788,10 +788,10 @@ static ssize_t
 amdgpu_get_pp_od_clk_voltage(struct device *dev,
 }
 
 /**
- * DOC: ppfeatures
+ * DOC: pp_features
  *
  * The amdgpu driver provides a sysfs API for adjusting what powerplay
- * features to be enabled. The file ppfeatures is used for this. And
+ * features to be enabled. The file pp_features is used for this. And
  * this is only available for Vega10 and later dGPUs.
  *

* Reading back the file will show you the followings:

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
@@ -803,7 +803,7 @@ static ssize_t amdgpu_get_pp_od_clk_voltage(struct
 device *dev,
  * the corresponding bit from original ppfeature masks and input the
  * new ppfeature masks.
  */
-static ssize_t amdgpu_set_ppfeature_status(struct device *dev,
+static ssize_t amdgpu_set_pp_feature_status(struct device *dev,
                 struct device_attribute *attr,
                 const char *buf,

size_t count)

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
@@ -820,7 +820,7 @@ static ssize_t amdgpu_set_ppfeature_status(struct
 device *dev,
         pr_debug("featuremask = 0x%llx\n", featuremask);
 
         if (is_support_sw_smu(adev)) {
-               ret = smu_set_ppfeature_status(&adev->smu, featuremask);
+               ret = smu_sys_set_pp_feature_mask(&adev->smu,
 featuremask);
                 if (ret)
                         return -EINVAL;
         } else if (adev->powerplay.pp_funcs->set_ppfeature_status) {
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
@@ -832,7 +832,7 @@ static ssize_t amdgpu_set_ppfeature_status(struct
 device *dev,
         return count;
 }
 
-static ssize_t amdgpu_get_ppfeature_status(struct device *dev,
+static ssize_t amdgpu_get_pp_feature_status(struct device *dev,
                 struct device_attribute *attr,
                 char *buf)

{

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +6 -6
@@ -840,7 +840,7 @@ static ssize_t amdgpu_get_ppfeature_status(struct
 device *dev,
         struct amdgpu_device *adev = ddev->dev_private;
 
         if (is_support_sw_smu(adev)) {
-               return smu_get_ppfeature_status(&adev->smu, buf);
+               return smu_sys_get_pp_feature_mask(&adev->smu, buf);
         } else if (adev->powerplay.pp_funcs->get_ppfeature_status)
                 return amdgpu_dpm_get_ppfeature_status(adev, buf);
@@ -1500,9 +1500,9 @@ static DEVICE_ATTR(gpu_busy_percent, S_IRUGO,
 static DEVICE_ATTR(mem_busy_percent, S_IRUGO,
                 amdgpu_get_memory_busy_percent, NULL);
 static DEVICE_ATTR(pcie_bw, S_IRUGO, amdgpu_get_pcie_bw, NULL);
-static DEVICE_ATTR(ppfeatures, S_IRUGO | S_IWUSR,
-               amdgpu_get_ppfeature_status,
-               amdgpu_set_ppfeature_status);
+static DEVICE_ATTR(pp_features, S_IRUGO | S_IWUSR,
+               amdgpu_get_pp_feature_status,
+               amdgpu_set_pp_feature_status);
 static DEVICE_ATTR(unique_id, S_IRUGO, amdgpu_get_unique_id, NULL);
 
 static ssize_t amdgpu_hwmon_show_temp(struct device *dev,
@@ -2960,10 +2960,10 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device
 *adev)
         if ((adev->asic_type >= CHIP_VEGA10) &&
             !(adev->flags & AMD_IS_APU)) {
                 ret = device_create_file(adev->dev,
- &dev_attr_ppfeatures);
+ &dev_attr_pp_features);
                 if (ret) {
                         DRM_ERROR("failed to create device file "
- "ppfeatures\n");
+ "pp_features\n");
                         return ret;
                 }
         }
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
@@ -3017,7 +3017,7 @@ void amdgpu_pm_sysfs_fini(struct amdgpu_device
 *adev)
 device_remove_file(adev->dev, &dev_attr_unique_id);
         if ((adev->asic_type >= CHIP_VEGA10) &&
             !(adev->flags & AMD_IS_APU))
-               device_remove_file(adev->dev, &dev_attr_ppfeatures);
+               device_remove_file(adev->dev, &dev_attr_pp_features);
 }
 

void amdgpu_pm_compute_clocks(struct amdgpu_device *adev)

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +49 -0
index e881de955388..90833ff2fe00 100644
@@ -55,6 +55,67 @@ const char *smu_get_feature_name(struct smu_context
 *smu, enum smu_feature_mask
         return __smu_feature_names[feature];
 }
 
+size_t smu_sys_get_pp_feature_mask(struct smu_context *smu, char *buf)
+{
+       size_t size = 0;
+       int ret = 0, i = 0;
+       uint32_t feature_mask[2] = { 0 };
+       int32_t feature_index = 0;
+       uint32_t count = 0;
+
+       ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
+       if (ret)
+               goto failed;
+
+       size =  sprintf(buf + size, "features high: 0x%08x low: 0x%08x\n",
+                       feature_mask[1], feature_mask[0]);
+
+       for (i = 0; i < SMU_FEATURE_COUNT; i++) {
+               feature_index = smu_feature_get_index(smu, i);
+               if (feature_index < 0)
+                       continue;
+               size += sprintf(buf + size, "%02d. %-20s (%2d) : %s\n",
+                              count++,
+ smu_get_feature_name(smu, i),
+                              feature_index,
+ !!smu_feature_is_enabled(smu, i) ? "enabeld" : "disabled");
+       }
+
+failed:
+       return size;
+}
+
+int smu_sys_set_pp_feature_mask(struct smu_context *smu, uint64_t
 new_mask)
+{
+       int ret = 0;
+       uint32_t feature_mask[2] = { 0 };
+       uint64_t feature_2_enabled = 0;
+       uint64_t feature_2_disabled = 0;
+       uint64_t feature_enables = 0;
+
+       ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
+       if (ret)
+               return ret;
+
+       feature_enables = ((uint64_t)feature_mask[1] << 32 |
 (uint64_t)feature_mask[0]);
+
+       feature_2_enabled  = ~feature_enables & new_mask;
+       feature_2_disabled = feature_enables & ~new_mask;
+
+       if (feature_2_enabled) {
+               ret = smu_feature_update_enable_state(smu,

feature_2_enabled, true);

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +5 -0
+               if (ret)
+                       ret;
+       }
+       if (feature_2_disabled) {
+               ret = smu_feature_update_enable_state(smu,

feature_2_disabled, false);

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +7 -0
+               if (ret)
+                       return ret;
+       }
+
+       return ret;
+}
+
 int smu_get_smc_version(struct smu_context *smu, uint32_t

*if_version, uint32_t *smu_version)

 {
         int ret = 0;
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -2
index abc2644b4c07..ac9e9d5d8a5c 100644
@@ -432,8 +432,6 @@ struct pptable_funcs {
                                       uint32_t *mclk_mask,
                                       uint32_t *soc_mask);
         int (*set_cpu_power_state)(struct smu_context *smu);
-       int (*set_ppfeature_status)(struct smu_context *smu, uint64_t
 ppfeatures);
-       int (*get_ppfeature_status)(struct smu_context *smu, char *buf);
         bool (*is_dpm_running)(struct smu_context *smu);
         int (*tables_init)(struct smu_context *smu, struct smu_table
*tables);
         int (*set_thermal_fan_table)(struct smu_context *smu);
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -0
@@ -713,10 +711,6 @@ struct smu_funcs

((smu)->ppt_funcs->dpm_set_vce_enable ? (smu)->ppt_funcs->dpm_set_vce_enable((smu), (enable)) : 0)
#define smu_set_xgmi_pstate(smu, pstate) \
((smu)->funcs->set_xgmi_pstate ? (smu)->funcs->set_xgmi_pstate((smu), (pstate)) : 0)
-#define smu_set_ppfeature_status(smu, ppfeatures) \
- ((smu)->ppt_funcs->set_ppfeature_status ? (smu)->ppt_funcs->set_ppfeature_status((smu), (ppfeatures)) : -EINVAL) -#define smu_get_ppfeature_status(smu, buf) \
- ((smu)->ppt_funcs->get_ppfeature_status ? (smu)->ppt_funcs->get_ppfeature_status((smu), (buf)) : -EINVAL) #define smu_set_watermarks_table(smu, tab, clock_ranges) \
((smu)->ppt_funcs->set_watermarks_table ? (smu)->ppt_funcs->set_watermarks_table((smu), (tab), (clock_ranges)) : 0)
#define smu_get_current_clk_freq_by_table(smu, clk_type, value) \

drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -0
@@ -804,5 +798,7 @@ bool smu_clk_dpm_is_enabled(struct smu_context
 *smu, enum smu_clk_type clk_type)
 int smu_feature_update_enable_state(struct smu_context *smu, uint64_t
 feature_mask, bool enabled);
 const char *smu_get_message_name(struct smu_context *smu, enum
 smu_message_type type);
 const char *smu_get_feature_name(struct smu_context *smu, enum

smu_feature_mask feature);

drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +2 -0
+size_t smu_sys_get_pp_feature_mask(struct smu_context *smu, char *buf);
+int smu_sys_set_pp_feature_mask(struct smu_context *smu, uint64_t

new_mask);

#endif

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -0
index c873228bf05f..cd0920093a5e 100644
@@ -1422,169 +1422,6 @@ static int navi10_get_uclk_dpm_states(struct

smu_context *smu, uint32_t *clocks_

         return 0;

}

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -59
-static int navi10_get_ppfeature_status(struct smu_context *smu,
-                                      char *buf)
-{
-       static const char *ppfeature_name[] = {
- "DPM_PREFETCHER",
-                               "DPM_GFXCLK",
-                               "DPM_GFX_PACE",
-                               "DPM_UCLK",
-                               "DPM_SOCCLK",
-                               "DPM_MP0CLK",
-                               "DPM_LINK",
-                               "DPM_DCEFCLK",
- "MEM_VDDCI_SCALING",
- "MEM_MVDD_SCALING",
-                               "DS_GFXCLK",
-                               "DS_SOCCLK",
-                               "DS_LCLK",
-                               "DS_DCEFCLK",
-                               "DS_UCLK",
-                               "GFX_ULV",
-                               "FW_DSTATE",
-                               "GFXOFF",
-                               "BACO",
-                               "VCN_PG",
-                               "JPEG_PG",
-                               "USB_PG",
-                               "RSMU_SMN_CG",
-                               "PPT",
-                               "TDC",
-                               "GFX_EDC",
-                               "APCC_PLUS",
-                               "GTHR",
-                               "ACDC",
-                               "VR0HOT",
-                               "VR1HOT",
-                               "FW_CTF",
-                               "FAN_CONTROL",
-                               "THERMAL",
-                               "GFX_DCS",
-                               "RM",
-                               "LED_DISPLAY",
-                               "GFX_SS",
- "OUT_OF_BAND_MONITOR",
- "TEMP_DEPENDENT_VMIN",
-                               "MMHUB_PG",
-                               "ATHUB_PG"};
-       static const char *output_title[] = {
-                               "FEATURES",
-                               "BITMASK",
-                               "ENABLEMENT"};
-       uint64_t features_enabled;
-       uint32_t feature_mask[2];
-       int i;
-       int ret = 0;
-       int size = 0;
-
-       ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
-       PP_ASSERT_WITH_CODE(!ret,
-                       "[GetPPfeatureStatus] Failed to get enabled

smc features!",

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -5
-                       return ret);
-       features_enabled = (uint64_t)feature_mask[0] |
- (uint64_t)feature_mask[1] << 32;
-
-       size += sprintf(buf + size, "Current ppfeatures: 0x%016llx\n",

features_enabled);

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -5
-       size += sprintf(buf + size, "%-19s %-22s %s\n",
-                               output_title[0],
-                               output_title[1],
- output_title[2]);
-       for (i = 0; i < (sizeof(ppfeature_name) /

sizeof(ppfeature_name[0])); i++) {

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -20
-               size += sprintf(buf + size, "%-19s 0x%016llx %6s\n",
- ppfeature_name[i],
-                                       1ULL << i,
- (features_enabled & (1ULL << i)) ? "Y" : "N");
-       }
-
-       return size;
-}
-
-static int navi10_enable_smc_features(struct smu_context *smu,
-                                     bool enabled,
-                                     uint64_t feature_masks)
-{
-       struct smu_feature *feature = &smu->smu_feature;
-       uint32_t feature_low, feature_high;
-       uint32_t feature_mask[2];
-       int ret = 0;
-
-       feature_low = (uint32_t)(feature_masks & 0xFFFFFFFF);
-       feature_high = (uint32_t)((feature_masks &

0xFFFFFFFF00000000ULL) >> 32);

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -3
-
-       if (enabled) {
-               ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_EnableSmuFeaturesLow,

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -4
-                                                 feature_low);
-               if (ret)
-                       return ret;
-               ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_EnableSmuFeaturesHigh,

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -5
-                                                 feature_high);
-               if (ret)
-                       return ret;
-       } else {
-               ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_DisableSmuFeaturesLow,

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -4
-                                                 feature_low);
-               if (ret)
-                       return ret;
-               ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_DisableSmuFeaturesHigh,

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -29
-                                                 feature_high);
-               if (ret)
-                       return ret;
-       }
-
-       ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
-       if (ret)
-               return ret;
-
-       mutex_lock(&feature->mutex);
-       bitmap_copy(feature->enabled, (unsigned long *)&feature_mask,
-                   feature->feature_num);
-       mutex_unlock(&feature->mutex);
-
-       return 0;
-}
-
-static int navi10_set_ppfeature_status(struct smu_context *smu,
-                                      uint64_t new_ppfeature_masks)
-{
-       uint64_t features_enabled;
-       uint32_t feature_mask[2];
-       uint64_t features_to_enable;
-       uint64_t features_to_disable;
-       int ret = 0;
-
-       ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
-       PP_ASSERT_WITH_CODE(!ret,
-                       "[SetPPfeatureStatus] Failed to get enabled

smc features!",

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -14
-                       return ret);
-       features_enabled = (uint64_t)feature_mask[0] |
- (uint64_t)feature_mask[1] << 32;
-
-       features_to_disable =
-               features_enabled & ~new_ppfeature_masks;
-       features_to_enable =
-               ~features_enabled & new_ppfeature_masks;
-
-       pr_debug("features_to_disable 0x%llx\n", features_to_disable);
-       pr_debug("features_to_enable 0x%llx\n", features_to_enable);
-
-       if (features_to_disable) {
-               ret = navi10_enable_smc_features(smu, false,

features_to_disable);

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -7
-               PP_ASSERT_WITH_CODE(!ret,
- "[SetPPfeatureStatus] Failed to disable smc features!",
-                               return ret);
-       }
-
-       if (features_to_enable) {
-               ret = navi10_enable_smc_features(smu, true,

features_to_enable);

drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -10
-               PP_ASSERT_WITH_CODE(!ret,
- "[SetPPfeatureStatus] Failed to enable smc features!",
-                               return ret);
-       }
-
-       return 0;
-}
-
 static int navi10_set_peak_clock_by_device(struct smu_context *smu)
 {
         struct amdgpu_device *adev = smu->adev;
@@ -1689,8 +1526,6 @@ static const struct pptable_funcs
 navi10_ppt_funcs = {
         .set_watermarks_table = navi10_set_watermarks_table,
         .read_sensor = navi10_read_sensor,
         .get_uclk_dpm_states = navi10_get_uclk_dpm_states,
-       .get_ppfeature_status = navi10_get_ppfeature_status,
-       .set_ppfeature_status = navi10_set_ppfeature_status,
         .set_performance_level = navi10_set_performance_level,
         .get_thermal_temperature_range =

navi10_get_thermal_temperature_range,
};

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -11
index c06a9472c3b2..52c8fc9f1ff4 100644
@@ -2858,157 +2858,6 @@ static int vega20_dpm_set_vce_enable(struct
 smu_context *smu, bool enable)
         return smu_feature_set_enabled(smu, SMU_FEATURE_DPM_VCE_BIT,
 enable);
 }
 
-static int vega20_get_enabled_smc_features(struct smu_context *smu,
-               uint64_t *features_enabled)
-{
-       uint32_t feature_mask[2] = {0, 0};
-       int ret = 0;
-
-       ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
-       if (ret)
-               return ret;
-
-       *features_enabled = ((((uint64_t)feature_mask[0] <<

SMU_FEATURES_LOW_SHIFT) & SMU_FEATURES_LOW_MASK) |
- (((uint64_t)feature_mask[1] << SMU_FEATURES_HIGH_SHIFT) & SMU_FEATURES_HIGH_MASK));

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -11
-
-       return ret;
-}
-
-static int vega20_enable_smc_features(struct smu_context *smu,
-               bool enable, uint64_t feature_mask)
-{
-       uint32_t smu_features_low, smu_features_high;
-       int ret = 0;
-
-       smu_features_low = (uint32_t)((feature_mask &

SMU_FEATURES_LOW_MASK) >> SMU_FEATURES_LOW_SHIFT);
- smu_features_high = (uint32_t)((feature_mask &
SMU_FEATURES_HIGH_MASK) >> SMU_FEATURES_HIGH_SHIFT);

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -3
-
-       if (enable) {
-               ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_EnableSmuFeaturesLow,

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -4
-                                                 smu_features_low);
-               if (ret)
-                       return ret;
-               ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_EnableSmuFeaturesHigh,

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -5
-                                                 smu_features_high);
-               if (ret)
-                       return ret;
-       } else {
-               ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_DisableSmuFeaturesLow,

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -4
-                                                 smu_features_low);
-               if (ret)
-                       return ret;
-               ret = smu_send_smc_msg_with_param(smu,

SMU_MSG_DisableSmuFeaturesHigh,

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -10
-                                                 smu_features_high);
-               if (ret)
-                       return ret;
-       }
-
-       return 0;
-
-}
-
-static int vega20_get_ppfeature_status(struct smu_context *smu, char

*buf)

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -50
-{
-       static const char *ppfeature_name[] = {
- "DPM_PREFETCHER",
-                               "GFXCLK_DPM",
-                               "UCLK_DPM",
-                               "SOCCLK_DPM",
-                               "UVD_DPM",
-                               "VCE_DPM",
-                               "ULV",
-                               "MP0CLK_DPM",
-                               "LINK_DPM",
-                               "DCEFCLK_DPM",
-                               "GFXCLK_DS",
-                               "SOCCLK_DS",
-                               "LCLK_DS",
-                               "PPT",
-                               "TDC",
-                               "THERMAL",
-                               "GFX_PER_CU_CG",
-                               "RM",
-                               "DCEFCLK_DS",
-                               "ACDC",
-                               "VR0HOT",
-                               "VR1HOT",
-                               "FW_CTF",
-                               "LED_DISPLAY",
-                               "FAN_CONTROL",
-                               "GFX_EDC",
-                               "GFXOFF",
-                               "CG",
-                               "FCLK_DPM",
-                               "FCLK_DS",
-                               "MP1CLK_DS",
-                               "MP0CLK_DS",
-                               "XGMI",
-                               "ECC"};
-       static const char *output_title[] = {
-                               "FEATURES",
-                               "BITMASK",
-                               "ENABLEMENT"};
-       uint64_t features_enabled;
-       int i;
-       int ret = 0;
-       int size = 0;
-
-       ret = vega20_get_enabled_smc_features(smu, &features_enabled);
-       if (ret)
-               return ret;
-
-       size += sprintf(buf + size, "Current ppfeatures: 0x%016llx\n",

features_enabled);

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -15
-       size += sprintf(buf + size, "%-19s %-22s %s\n",
-                               output_title[0],
-                               output_title[1],
- output_title[2]);
-       for (i = 0; i < GNLD_FEATURES_MAX; i++) {
-               size += sprintf(buf + size, "%-19s 0x%016llx %6s\n",
- ppfeature_name[i],
-                                       1ULL << i,
- (features_enabled & (1ULL << i)) ? "Y" : "N");
-       }
-
-       return size;
-}
-
-static int vega20_set_ppfeature_status(struct smu_context *smu,

uint64_t new_ppfeature_masks)

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -23
-{
-       uint64_t features_enabled;
-       uint64_t features_to_enable;
-       uint64_t features_to_disable;
-       int ret = 0;
-
-       if (new_ppfeature_masks >= (1ULL << GNLD_FEATURES_MAX))
-               return -EINVAL;
-
-       ret = vega20_get_enabled_smc_features(smu, &features_enabled);
-       if (ret)
-               return ret;
-
-       features_to_disable =
-               features_enabled & ~new_ppfeature_masks;
-       features_to_enable =
-               ~features_enabled & new_ppfeature_masks;
-
-       pr_debug("features_to_disable 0x%llx\n", features_to_disable);
-       pr_debug("features_to_enable 0x%llx\n", features_to_enable);
-
-       if (features_to_disable) {
-               ret = vega20_enable_smc_features(smu, false,

features_to_disable);

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -6
-               if (ret)
-                       return ret;
-       }
-
-       if (features_to_enable) {
-               ret = vega20_enable_smc_features(smu, true,

features_to_enable);

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -9
-               if (ret)
-                       return ret;
-       }
-
-       return 0;
-}
-
 static bool vega20_is_dpm_running(struct smu_context *smu)
 {
         int ret = 0;
@@ -3311,8 +3160,6 @@ static const struct pptable_funcs
 vega20_ppt_funcs = {
         .force_dpm_limit_value = vega20_force_dpm_limit_value,
         .unforce_dpm_levels = vega20_unforce_dpm_levels,
         .get_profiling_clk_mask = vega20_get_profiling_clk_mask,
-       .set_ppfeature_status = vega20_set_ppfeature_status,
-       .get_ppfeature_status = vega20_get_ppfeature_status,
         .is_dpm_running = vega20_is_dpm_running,
         .set_thermal_fan_table = vega20_set_thermal_fan_table,
Quoted 4 lines

.get_fan_speed_percent = vega20_get_fan_speed_percent,
--
2.22.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by Kenneth Feng
#34 lore raw
In reply to a message not in the archive

-----Original Message-----
From: Wang, Kevin(Yang)
Sent: Thursday, July 25, 2019 1:11 PM
To: [email protected]
Cc: Feng, Kenneth <[email protected]>; Huang, Ray <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Kevin(Yang) <[email protected]>
Subject: [PATCH 1/5] drm/amd/powerplay: move smu types to smu_types.h

move some enum type (message, feature, clock) to smu_types.h. these types is too long in amdgpu_smu.h, and not clearly.

---
 .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    | 186 +---------------
 drivers/gpu/drm/amd/powerplay/inc/smu_types.h | 210 ++++++++++++++++++
 2 files changed, 211 insertions(+), 185 deletions(-)  create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu_types.h
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +1 -185
index 33d2d75ba903..397040a4d1b4 100644
@@ -26,6 +26,7 @@
 #include "kgd_pp_interface.h"
 #include "dm_pp_interface.h"
 #include "dm_pp_smu.h"
+#include "smu_types.h"
 
 #define SMU_THERMAL_MINIMUM_ALERT_TEMP		0
 #define SMU_THERMAL_MAXIMUM_ALERT_TEMP		255
@@ -150,134 +151,6 @@ struct smu_power_state {
 	struct smu_hw_power_state                     hardware;
 };
 
-enum smu_message_type
-{
-	SMU_MSG_TestMessage = 0,
-	SMU_MSG_GetSmuVersion,
-	SMU_MSG_GetDriverIfVersion,
-	SMU_MSG_SetAllowedFeaturesMaskLow,
-	SMU_MSG_SetAllowedFeaturesMaskHigh,
-	SMU_MSG_EnableAllSmuFeatures,
-	SMU_MSG_DisableAllSmuFeatures,
-	SMU_MSG_EnableSmuFeaturesLow,
-	SMU_MSG_EnableSmuFeaturesHigh,
-	SMU_MSG_DisableSmuFeaturesLow,
-	SMU_MSG_DisableSmuFeaturesHigh,
-	SMU_MSG_GetEnabledSmuFeaturesLow,
-	SMU_MSG_GetEnabledSmuFeaturesHigh,
-	SMU_MSG_SetWorkloadMask,
-	SMU_MSG_SetPptLimit,
-	SMU_MSG_SetDriverDramAddrHigh,
-	SMU_MSG_SetDriverDramAddrLow,
-	SMU_MSG_SetToolsDramAddrHigh,
-	SMU_MSG_SetToolsDramAddrLow,
-	SMU_MSG_TransferTableSmu2Dram,
-	SMU_MSG_TransferTableDram2Smu,
-	SMU_MSG_UseDefaultPPTable,
-	SMU_MSG_UseBackupPPTable,
-	SMU_MSG_RunBtc,
-	SMU_MSG_RequestI2CBus,
-	SMU_MSG_ReleaseI2CBus,
-	SMU_MSG_SetFloorSocVoltage,
-	SMU_MSG_SoftReset,
-	SMU_MSG_StartBacoMonitor,
-	SMU_MSG_CancelBacoMonitor,
-	SMU_MSG_EnterBaco,
-	SMU_MSG_SetSoftMinByFreq,
-	SMU_MSG_SetSoftMaxByFreq,
-	SMU_MSG_SetHardMinByFreq,
-	SMU_MSG_SetHardMaxByFreq,
-	SMU_MSG_GetMinDpmFreq,
-	SMU_MSG_GetMaxDpmFreq,
-	SMU_MSG_GetDpmFreqByIndex,
-	SMU_MSG_GetDpmClockFreq,
-	SMU_MSG_GetSsVoltageByDpm,
-	SMU_MSG_SetMemoryChannelConfig,
-	SMU_MSG_SetGeminiMode,
-	SMU_MSG_SetGeminiApertureHigh,
-	SMU_MSG_SetGeminiApertureLow,
-	SMU_MSG_SetMinLinkDpmByIndex,
-	SMU_MSG_OverridePcieParameters,
-	SMU_MSG_OverDriveSetPercentage,
-	SMU_MSG_SetMinDeepSleepDcefclk,
-	SMU_MSG_ReenableAcDcInterrupt,
-	SMU_MSG_NotifyPowerSource,
-	SMU_MSG_SetUclkFastSwitch,
-	SMU_MSG_SetUclkDownHyst,
-	SMU_MSG_GfxDeviceDriverReset,
-	SMU_MSG_GetCurrentRpm,
-	SMU_MSG_SetVideoFps,
-	SMU_MSG_SetTjMax,
-	SMU_MSG_SetFanTemperatureTarget,
-	SMU_MSG_PrepareMp1ForUnload,
-	SMU_MSG_DramLogSetDramAddrHigh,
-	SMU_MSG_DramLogSetDramAddrLow,
-	SMU_MSG_DramLogSetDramSize,
-	SMU_MSG_SetFanMaxRpm,
-	SMU_MSG_SetFanMinPwm,
-	SMU_MSG_ConfigureGfxDidt,
-	SMU_MSG_NumOfDisplays,
-	SMU_MSG_RemoveMargins,
-	SMU_MSG_ReadSerialNumTop32,
-	SMU_MSG_ReadSerialNumBottom32,
-	SMU_MSG_SetSystemVirtualDramAddrHigh,
-	SMU_MSG_SetSystemVirtualDramAddrLow,
-	SMU_MSG_WaflTest,
-	SMU_MSG_SetFclkGfxClkRatio,
-	SMU_MSG_AllowGfxOff,
-	SMU_MSG_DisallowGfxOff,
-	SMU_MSG_GetPptLimit,
-	SMU_MSG_GetDcModeMaxDpmFreq,
-	SMU_MSG_GetDebugData,
-	SMU_MSG_SetXgmiMode,
-	SMU_MSG_RunAfllBtc,
-	SMU_MSG_ExitBaco,
-	SMU_MSG_PrepareMp1ForReset,
-	SMU_MSG_PrepareMp1ForShutdown,
-	SMU_MSG_SetMGpuFanBoostLimitRpm,
-	SMU_MSG_GetAVFSVoltageByDpm,
-	SMU_MSG_PowerUpVcn,
-	SMU_MSG_PowerDownVcn,
-	SMU_MSG_PowerUpJpeg,
-	SMU_MSG_PowerDownJpeg,
-	SMU_MSG_BacoAudioD3PME,
-	SMU_MSG_ArmD3,
-	SMU_MSG_RunGfxDcBtc,
-	SMU_MSG_RunSocDcBtc,
-	SMU_MSG_SetMemoryChannelEnable,
-	SMU_MSG_SetDfSwitchType,
-	SMU_MSG_GetVoltageByDpm,
-	SMU_MSG_GetVoltageByDpmOverdrive,
-	SMU_MSG_PowerUpVcn0,
-	SMU_MSG_PowerDownVcn01,
-	SMU_MSG_PowerUpVcn1,
-	SMU_MSG_PowerDownVcn1,
-	SMU_MSG_MAX_COUNT,
-};
-
-enum smu_clk_type
-{
-	SMU_GFXCLK,
-	SMU_VCLK,
-	SMU_DCLK,
-	SMU_ECLK,
-	SMU_SOCCLK,
-	SMU_UCLK,
-	SMU_DCEFCLK,
-	SMU_DISPCLK,
-	SMU_PIXCLK,
-	SMU_PHYCLK,
-	SMU_FCLK,
-	SMU_SCLK,
-	SMU_MCLK,
-	SMU_PCIE,
-	SMU_OD_SCLK,
-	SMU_OD_MCLK,
-	SMU_OD_VDDC_CURVE,
-	SMU_OD_RANGE,
-	SMU_CLK_COUNT,
-};
-
 enum smu_power_src_type
 {
 	SMU_POWER_SOURCE_AC,
@@ -285,63 +158,6 @@ enum smu_power_src_type
 	SMU_POWER_SOURCE_COUNT,
 };
 
-enum smu_feature_mask
-{
-	SMU_FEATURE_DPM_PREFETCHER_BIT,
-	SMU_FEATURE_DPM_GFXCLK_BIT,
-	SMU_FEATURE_DPM_UCLK_BIT,
-	SMU_FEATURE_DPM_SOCCLK_BIT,
-	SMU_FEATURE_DPM_UVD_BIT,
-	SMU_FEATURE_DPM_VCE_BIT,
-	SMU_FEATURE_ULV_BIT,
-	SMU_FEATURE_DPM_MP0CLK_BIT,
-	SMU_FEATURE_DPM_LINK_BIT,
-	SMU_FEATURE_DPM_DCEFCLK_BIT,
-	SMU_FEATURE_DS_GFXCLK_BIT,
-	SMU_FEATURE_DS_SOCCLK_BIT,
-	SMU_FEATURE_DS_LCLK_BIT,
-	SMU_FEATURE_PPT_BIT,
-	SMU_FEATURE_TDC_BIT,
-	SMU_FEATURE_THERMAL_BIT,
-	SMU_FEATURE_GFX_PER_CU_CG_BIT,
-	SMU_FEATURE_RM_BIT,
-	SMU_FEATURE_DS_DCEFCLK_BIT,
-	SMU_FEATURE_ACDC_BIT,
-	SMU_FEATURE_VR0HOT_BIT,
-	SMU_FEATURE_VR1HOT_BIT,
-	SMU_FEATURE_FW_CTF_BIT,
-	SMU_FEATURE_LED_DISPLAY_BIT,
-	SMU_FEATURE_FAN_CONTROL_BIT,
-	SMU_FEATURE_GFX_EDC_BIT,
-	SMU_FEATURE_GFXOFF_BIT,
-	SMU_FEATURE_CG_BIT,
-	SMU_FEATURE_DPM_FCLK_BIT,
-	SMU_FEATURE_DS_FCLK_BIT,
-	SMU_FEATURE_DS_MP1CLK_BIT,
-	SMU_FEATURE_DS_MP0CLK_BIT,
-	SMU_FEATURE_XGMI_BIT,
-	SMU_FEATURE_DPM_GFX_PACE_BIT,
-	SMU_FEATURE_MEM_VDDCI_SCALING_BIT,
-	SMU_FEATURE_MEM_MVDD_SCALING_BIT,
-	SMU_FEATURE_DS_UCLK_BIT,
-	SMU_FEATURE_GFX_ULV_BIT,
-	SMU_FEATURE_FW_DSTATE_BIT,
-	SMU_FEATURE_BACO_BIT,
-	SMU_FEATURE_VCN_PG_BIT,
-	SMU_FEATURE_JPEG_PG_BIT,
-	SMU_FEATURE_USB_PG_BIT,
-	SMU_FEATURE_RSMU_SMN_CG_BIT,
-	SMU_FEATURE_APCC_PLUS_BIT,
-	SMU_FEATURE_GTHR_BIT,
-	SMU_FEATURE_GFX_DCS_BIT,
-	SMU_FEATURE_GFX_SS_BIT,
-	SMU_FEATURE_OUT_OF_BAND_MONITOR_BIT,
-	SMU_FEATURE_TEMP_DEPENDENT_VMIN_BIT,
-	SMU_FEATURE_MMHUB_PG_BIT,
-	SMU_FEATURE_ATHUB_PG_BIT,
-	SMU_FEATURE_COUNT,
-};
-
 enum smu_memory_pool_size
 {
     SMU_MEMORY_POOL_SIZE_ZERO   = 0,
drivers/gpu/drm/amd/powerplay/inc/smu_types.h new file +210 -0

210 lines not on this page · raw message

+ SMU_FEATURE_GTHR_BIT,
+ SMU_FEATURE_GFX_DCS_BIT,
+ SMU_FEATURE_GFX_SS_BIT,
+ SMU_FEATURE_OUT_OF_BAND_MONITOR_BIT,
+ SMU_FEATURE_TEMP_DEPENDENT_VMIN_BIT,
+ SMU_FEATURE_MMHUB_PG_BIT,
+ SMU_FEATURE_ATHUB_PG_BIT,
+ SMU_FEATURE_COUNT,
+};
+
+#endif
+
--
2.22.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by Evan Quan
#35 lore raw
In reply to a message not in the archive
Quoted 467 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Wang, Kevin(Yang)
Sent: Thursday, July 25, 2019 1:11 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>; Feng, Kenneth <[email protected]>; Wang, Kevin(Yang) <[email protected]>
Subject: [PATCH 1/5] drm/amd/powerplay: move smu types to smu_types.h

move some enum type (message, feature, clock) to smu_types.h. these types is too long in amdgpu_smu.h, and not clearly.

---
 .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    | 186 +---------------
 drivers/gpu/drm/amd/powerplay/inc/smu_types.h | 210
++++++++++++++++++
 2 files changed, 211 insertions(+), 185 deletions(-)  create mode 100644

drivers/gpu/drm/amd/powerplay/inc/smu_types.h

drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +1 -185
index 33d2d75ba903..397040a4d1b4 100644
@@ -26,6 +26,7 @@
 #include "kgd_pp_interface.h"
 #include "dm_pp_interface.h"
 #include "dm_pp_smu.h"
+#include "smu_types.h"
 
 #define SMU_THERMAL_MINIMUM_ALERT_TEMP		0
 #define SMU_THERMAL_MAXIMUM_ALERT_TEMP		255
@@ -150,134 +151,6 @@ struct smu_power_state {
 	struct smu_hw_power_state                     hardware;
 };
 
-enum smu_message_type
-{
-	SMU_MSG_TestMessage = 0,
-	SMU_MSG_GetSmuVersion,
-	SMU_MSG_GetDriverIfVersion,
-	SMU_MSG_SetAllowedFeaturesMaskLow,
-	SMU_MSG_SetAllowedFeaturesMaskHigh,
-	SMU_MSG_EnableAllSmuFeatures,
-	SMU_MSG_DisableAllSmuFeatures,
-	SMU_MSG_EnableSmuFeaturesLow,
-	SMU_MSG_EnableSmuFeaturesHigh,
-	SMU_MSG_DisableSmuFeaturesLow,
-	SMU_MSG_DisableSmuFeaturesHigh,
-	SMU_MSG_GetEnabledSmuFeaturesLow,
-	SMU_MSG_GetEnabledSmuFeaturesHigh,
-	SMU_MSG_SetWorkloadMask,
-	SMU_MSG_SetPptLimit,
-	SMU_MSG_SetDriverDramAddrHigh,
-	SMU_MSG_SetDriverDramAddrLow,
-	SMU_MSG_SetToolsDramAddrHigh,
-	SMU_MSG_SetToolsDramAddrLow,
-	SMU_MSG_TransferTableSmu2Dram,
-	SMU_MSG_TransferTableDram2Smu,
-	SMU_MSG_UseDefaultPPTable,
-	SMU_MSG_UseBackupPPTable,
-	SMU_MSG_RunBtc,
-	SMU_MSG_RequestI2CBus,
-	SMU_MSG_ReleaseI2CBus,
-	SMU_MSG_SetFloorSocVoltage,
-	SMU_MSG_SoftReset,
-	SMU_MSG_StartBacoMonitor,
-	SMU_MSG_CancelBacoMonitor,
-	SMU_MSG_EnterBaco,
-	SMU_MSG_SetSoftMinByFreq,
-	SMU_MSG_SetSoftMaxByFreq,
-	SMU_MSG_SetHardMinByFreq,
-	SMU_MSG_SetHardMaxByFreq,
-	SMU_MSG_GetMinDpmFreq,
-	SMU_MSG_GetMaxDpmFreq,
-	SMU_MSG_GetDpmFreqByIndex,
-	SMU_MSG_GetDpmClockFreq,
-	SMU_MSG_GetSsVoltageByDpm,
-	SMU_MSG_SetMemoryChannelConfig,
-	SMU_MSG_SetGeminiMode,
-	SMU_MSG_SetGeminiApertureHigh,
-	SMU_MSG_SetGeminiApertureLow,
-	SMU_MSG_SetMinLinkDpmByIndex,
-	SMU_MSG_OverridePcieParameters,
-	SMU_MSG_OverDriveSetPercentage,
-	SMU_MSG_SetMinDeepSleepDcefclk,
-	SMU_MSG_ReenableAcDcInterrupt,
-	SMU_MSG_NotifyPowerSource,
-	SMU_MSG_SetUclkFastSwitch,
-	SMU_MSG_SetUclkDownHyst,
-	SMU_MSG_GfxDeviceDriverReset,
-	SMU_MSG_GetCurrentRpm,
-	SMU_MSG_SetVideoFps,
-	SMU_MSG_SetTjMax,
-	SMU_MSG_SetFanTemperatureTarget,
-	SMU_MSG_PrepareMp1ForUnload,
-	SMU_MSG_DramLogSetDramAddrHigh,
-	SMU_MSG_DramLogSetDramAddrLow,
-	SMU_MSG_DramLogSetDramSize,
-	SMU_MSG_SetFanMaxRpm,
-	SMU_MSG_SetFanMinPwm,
-	SMU_MSG_ConfigureGfxDidt,
-	SMU_MSG_NumOfDisplays,
-	SMU_MSG_RemoveMargins,
-	SMU_MSG_ReadSerialNumTop32,
-	SMU_MSG_ReadSerialNumBottom32,
-	SMU_MSG_SetSystemVirtualDramAddrHigh,
-	SMU_MSG_SetSystemVirtualDramAddrLow,
-	SMU_MSG_WaflTest,
-	SMU_MSG_SetFclkGfxClkRatio,
-	SMU_MSG_AllowGfxOff,
-	SMU_MSG_DisallowGfxOff,
-	SMU_MSG_GetPptLimit,
-	SMU_MSG_GetDcModeMaxDpmFreq,
-	SMU_MSG_GetDebugData,
-	SMU_MSG_SetXgmiMode,
-	SMU_MSG_RunAfllBtc,
-	SMU_MSG_ExitBaco,
-	SMU_MSG_PrepareMp1ForReset,
-	SMU_MSG_PrepareMp1ForShutdown,
-	SMU_MSG_SetMGpuFanBoostLimitRpm,
-	SMU_MSG_GetAVFSVoltageByDpm,
-	SMU_MSG_PowerUpVcn,
-	SMU_MSG_PowerDownVcn,
-	SMU_MSG_PowerUpJpeg,
-	SMU_MSG_PowerDownJpeg,
-	SMU_MSG_BacoAudioD3PME,
-	SMU_MSG_ArmD3,
-	SMU_MSG_RunGfxDcBtc,
-	SMU_MSG_RunSocDcBtc,
-	SMU_MSG_SetMemoryChannelEnable,
-	SMU_MSG_SetDfSwitchType,
-	SMU_MSG_GetVoltageByDpm,
-	SMU_MSG_GetVoltageByDpmOverdrive,
-	SMU_MSG_PowerUpVcn0,
-	SMU_MSG_PowerDownVcn01,
-	SMU_MSG_PowerUpVcn1,
-	SMU_MSG_PowerDownVcn1,
-	SMU_MSG_MAX_COUNT,
-};
-
-enum smu_clk_type
-{
-	SMU_GFXCLK,
-	SMU_VCLK,
-	SMU_DCLK,
-	SMU_ECLK,
-	SMU_SOCCLK,
-	SMU_UCLK,
-	SMU_DCEFCLK,
-	SMU_DISPCLK,
-	SMU_PIXCLK,
-	SMU_PHYCLK,
-	SMU_FCLK,
-	SMU_SCLK,
-	SMU_MCLK,
-	SMU_PCIE,
-	SMU_OD_SCLK,
-	SMU_OD_MCLK,
-	SMU_OD_VDDC_CURVE,
-	SMU_OD_RANGE,
-	SMU_CLK_COUNT,
-};
-
 enum smu_power_src_type
 {
 	SMU_POWER_SOURCE_AC,
@@ -285,63 +158,6 @@ enum smu_power_src_type
 	SMU_POWER_SOURCE_COUNT,
 };
 
-enum smu_feature_mask
-{
-	SMU_FEATURE_DPM_PREFETCHER_BIT,
-	SMU_FEATURE_DPM_GFXCLK_BIT,
-	SMU_FEATURE_DPM_UCLK_BIT,
-	SMU_FEATURE_DPM_SOCCLK_BIT,
-	SMU_FEATURE_DPM_UVD_BIT,
-	SMU_FEATURE_DPM_VCE_BIT,
-	SMU_FEATURE_ULV_BIT,
-	SMU_FEATURE_DPM_MP0CLK_BIT,
-	SMU_FEATURE_DPM_LINK_BIT,
-	SMU_FEATURE_DPM_DCEFCLK_BIT,
-	SMU_FEATURE_DS_GFXCLK_BIT,
-	SMU_FEATURE_DS_SOCCLK_BIT,
-	SMU_FEATURE_DS_LCLK_BIT,
-	SMU_FEATURE_PPT_BIT,
-	SMU_FEATURE_TDC_BIT,
-	SMU_FEATURE_THERMAL_BIT,
-	SMU_FEATURE_GFX_PER_CU_CG_BIT,
-	SMU_FEATURE_RM_BIT,
-	SMU_FEATURE_DS_DCEFCLK_BIT,
-	SMU_FEATURE_ACDC_BIT,
-	SMU_FEATURE_VR0HOT_BIT,
-	SMU_FEATURE_VR1HOT_BIT,
-	SMU_FEATURE_FW_CTF_BIT,
-	SMU_FEATURE_LED_DISPLAY_BIT,
-	SMU_FEATURE_FAN_CONTROL_BIT,
-	SMU_FEATURE_GFX_EDC_BIT,
-	SMU_FEATURE_GFXOFF_BIT,
-	SMU_FEATURE_CG_BIT,
-	SMU_FEATURE_DPM_FCLK_BIT,
-	SMU_FEATURE_DS_FCLK_BIT,
-	SMU_FEATURE_DS_MP1CLK_BIT,
-	SMU_FEATURE_DS_MP0CLK_BIT,
-	SMU_FEATURE_XGMI_BIT,
-	SMU_FEATURE_DPM_GFX_PACE_BIT,
-	SMU_FEATURE_MEM_VDDCI_SCALING_BIT,
-	SMU_FEATURE_MEM_MVDD_SCALING_BIT,
-	SMU_FEATURE_DS_UCLK_BIT,
-	SMU_FEATURE_GFX_ULV_BIT,
-	SMU_FEATURE_FW_DSTATE_BIT,
-	SMU_FEATURE_BACO_BIT,
-	SMU_FEATURE_VCN_PG_BIT,
-	SMU_FEATURE_JPEG_PG_BIT,
-	SMU_FEATURE_USB_PG_BIT,
-	SMU_FEATURE_RSMU_SMN_CG_BIT,
-	SMU_FEATURE_APCC_PLUS_BIT,
-	SMU_FEATURE_GTHR_BIT,
-	SMU_FEATURE_GFX_DCS_BIT,
-	SMU_FEATURE_GFX_SS_BIT,
-	SMU_FEATURE_OUT_OF_BAND_MONITOR_BIT,
-	SMU_FEATURE_TEMP_DEPENDENT_VMIN_BIT,
-	SMU_FEATURE_MMHUB_PG_BIT,
-	SMU_FEATURE_ATHUB_PG_BIT,
-	SMU_FEATURE_COUNT,
-};
-
 enum smu_memory_pool_size
 {
     SMU_MEMORY_POOL_SIZE_ZERO   = 0,
drivers/gpu/drm/amd/powerplay/inc/smu_types.h new file +24 -0
new file mode 100644
index 000000000000..29d14c162417
@@ -0,0 +1,210 @@
+/*
+ * Copyright 2019 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person
+obtaining a
+ * copy of this software and associated documentation files (the
+"Software"),
+ * to deal in the Software without restriction, including without
+limitation
+ * the rights to use, copy, modify, merge, publish, distribute,
+sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom
+the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO

EVENT

drivers/gpu/drm/amd/powerplay/inc/smu_types.h new file +6 -0
+SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM,
+DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR

THE USE

drivers/gpu/drm/amd/powerplay/inc/smu_types.h new file +192 -1
+OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __SMU_TYPES_H__
+#define __SMU_TYPES_H__
+
+
+enum smu_message_type {
+	SMU_MSG_TestMessage = 0,
+	SMU_MSG_GetSmuVersion,
+	SMU_MSG_GetDriverIfVersion,
+	SMU_MSG_SetAllowedFeaturesMaskLow,
+	SMU_MSG_SetAllowedFeaturesMaskHigh,
+	SMU_MSG_EnableAllSmuFeatures,
+	SMU_MSG_DisableAllSmuFeatures,
+	SMU_MSG_EnableSmuFeaturesLow,
+	SMU_MSG_EnableSmuFeaturesHigh,
+	SMU_MSG_DisableSmuFeaturesLow,
+	SMU_MSG_DisableSmuFeaturesHigh,
+	SMU_MSG_GetEnabledSmuFeaturesLow,
+	SMU_MSG_GetEnabledSmuFeaturesHigh,
+	SMU_MSG_SetWorkloadMask,
+	SMU_MSG_SetPptLimit,
+	SMU_MSG_SetDriverDramAddrHigh,
+	SMU_MSG_SetDriverDramAddrLow,
+	SMU_MSG_SetToolsDramAddrHigh,
+	SMU_MSG_SetToolsDramAddrLow,
+	SMU_MSG_TransferTableSmu2Dram,
+	SMU_MSG_TransferTableDram2Smu,
+	SMU_MSG_UseDefaultPPTable,
+	SMU_MSG_UseBackupPPTable,
+	SMU_MSG_RunBtc,
+	SMU_MSG_RequestI2CBus,
+	SMU_MSG_ReleaseI2CBus,
+	SMU_MSG_SetFloorSocVoltage,
+	SMU_MSG_SoftReset,
+	SMU_MSG_StartBacoMonitor,
+	SMU_MSG_CancelBacoMonitor,
+	SMU_MSG_EnterBaco,
+	SMU_MSG_SetSoftMinByFreq,
+	SMU_MSG_SetSoftMaxByFreq,
+	SMU_MSG_SetHardMinByFreq,
+	SMU_MSG_SetHardMaxByFreq,
+	SMU_MSG_GetMinDpmFreq,
+	SMU_MSG_GetMaxDpmFreq,
+	SMU_MSG_GetDpmFreqByIndex,
+	SMU_MSG_GetDpmClockFreq,
+	SMU_MSG_GetSsVoltageByDpm,
+	SMU_MSG_SetMemoryChannelConfig,
+	SMU_MSG_SetGeminiMode,
+	SMU_MSG_SetGeminiApertureHigh,
+	SMU_MSG_SetGeminiApertureLow,
+	SMU_MSG_SetMinLinkDpmByIndex,
+	SMU_MSG_OverridePcieParameters,
+	SMU_MSG_OverDriveSetPercentage,
+	SMU_MSG_SetMinDeepSleepDcefclk,
+	SMU_MSG_ReenableAcDcInterrupt,
+	SMU_MSG_NotifyPowerSource,
+	SMU_MSG_SetUclkFastSwitch,
+	SMU_MSG_SetUclkDownHyst,
+	SMU_MSG_GfxDeviceDriverReset,
+	SMU_MSG_GetCurrentRpm,
+	SMU_MSG_SetVideoFps,
+	SMU_MSG_SetTjMax,
+	SMU_MSG_SetFanTemperatureTarget,
+	SMU_MSG_PrepareMp1ForUnload,
+	SMU_MSG_DramLogSetDramAddrHigh,
+	SMU_MSG_DramLogSetDramAddrLow,
+	SMU_MSG_DramLogSetDramSize,
+	SMU_MSG_SetFanMaxRpm,
+	SMU_MSG_SetFanMinPwm,
+	SMU_MSG_ConfigureGfxDidt,
+	SMU_MSG_NumOfDisplays,
+	SMU_MSG_RemoveMargins,
+	SMU_MSG_ReadSerialNumTop32,
+	SMU_MSG_ReadSerialNumBottom32,
+	SMU_MSG_SetSystemVirtualDramAddrHigh,
+	SMU_MSG_SetSystemVirtualDramAddrLow,
+	SMU_MSG_WaflTest,
+	SMU_MSG_SetFclkGfxClkRatio,
+	SMU_MSG_AllowGfxOff,
+	SMU_MSG_DisallowGfxOff,
+	SMU_MSG_GetPptLimit,
+	SMU_MSG_GetDcModeMaxDpmFreq,
+	SMU_MSG_GetDebugData,
+	SMU_MSG_SetXgmiMode,
+	SMU_MSG_RunAfllBtc,
+	SMU_MSG_ExitBaco,
+	SMU_MSG_PrepareMp1ForReset,
+	SMU_MSG_PrepareMp1ForShutdown,
+	SMU_MSG_SetMGpuFanBoostLimitRpm,
+	SMU_MSG_GetAVFSVoltageByDpm,
+	SMU_MSG_PowerUpVcn,
+	SMU_MSG_PowerDownVcn,
+	SMU_MSG_PowerUpJpeg,
+	SMU_MSG_PowerDownJpeg,
+	SMU_MSG_BacoAudioD3PME,
+	SMU_MSG_ArmD3,
+	SMU_MSG_RunGfxDcBtc,
+	SMU_MSG_RunSocDcBtc,
+	SMU_MSG_SetMemoryChannelEnable,
+	SMU_MSG_SetDfSwitchType,
+	SMU_MSG_GetVoltageByDpm,
+	SMU_MSG_GetVoltageByDpmOverdrive,
+	SMU_MSG_PowerUpVcn0,
+	SMU_MSG_PowerDownVcn01,
+	SMU_MSG_PowerUpVcn1,
+	SMU_MSG_PowerDownVcn1,
+	SMU_MSG_MAX_COUNT,
+};
+
+enum smu_clk_type {
+	SMU_GFXCLK,
+	SMU_VCLK,
+	SMU_DCLK,
+	SMU_ECLK,
+	SMU_SOCCLK,
+	SMU_UCLK,
+	SMU_DCEFCLK,
+	SMU_DISPCLK,
+	SMU_PIXCLK,
+	SMU_PHYCLK,
+	SMU_FCLK,
+	SMU_SCLK,
+	SMU_MCLK,
+	SMU_PCIE,
+	SMU_OD_SCLK,
+	SMU_OD_MCLK,
+	SMU_OD_VDDC_CURVE,
+	SMU_OD_RANGE,
+	SMU_CLK_COUNT,
+};
+
+enum smu_feature_mask {
+	SMU_FEATURE_DPM_PREFETCHER_BIT,
+	SMU_FEATURE_DPM_GFXCLK_BIT,
+	SMU_FEATURE_DPM_UCLK_BIT,
+	SMU_FEATURE_DPM_SOCCLK_BIT,
+	SMU_FEATURE_DPM_UVD_BIT,
+	SMU_FEATURE_DPM_VCE_BIT,
+	SMU_FEATURE_ULV_BIT,
+	SMU_FEATURE_DPM_MP0CLK_BIT,
+	SMU_FEATURE_DPM_LINK_BIT,
+	SMU_FEATURE_DPM_DCEFCLK_BIT,
+	SMU_FEATURE_DS_GFXCLK_BIT,
+	SMU_FEATURE_DS_SOCCLK_BIT,
+	SMU_FEATURE_DS_LCLK_BIT,
+	SMU_FEATURE_PPT_BIT,
+	SMU_FEATURE_TDC_BIT,
+	SMU_FEATURE_THERMAL_BIT,
+	SMU_FEATURE_GFX_PER_CU_CG_BIT,
+	SMU_FEATURE_RM_BIT,
+	SMU_FEATURE_DS_DCEFCLK_BIT,
+	SMU_FEATURE_ACDC_BIT,
+	SMU_FEATURE_VR0HOT_BIT,
+	SMU_FEATURE_VR1HOT_BIT,
+	SMU_FEATURE_FW_CTF_BIT,
+	SMU_FEATURE_LED_DISPLAY_BIT,
+	SMU_FEATURE_FAN_CONTROL_BIT,
+	SMU_FEATURE_GFX_EDC_BIT,
+	SMU_FEATURE_GFXOFF_BIT,
+	SMU_FEATURE_CG_BIT,
+	SMU_FEATURE_DPM_FCLK_BIT,
+	SMU_FEATURE_DS_FCLK_BIT,
+	SMU_FEATURE_DS_MP1CLK_BIT,
+	SMU_FEATURE_DS_MP0CLK_BIT,
+	SMU_FEATURE_XGMI_BIT,
+	SMU_FEATURE_DPM_GFX_PACE_BIT,
+	SMU_FEATURE_MEM_VDDCI_SCALING_BIT,
+	SMU_FEATURE_MEM_MVDD_SCALING_BIT,
+	SMU_FEATURE_DS_UCLK_BIT,
+	SMU_FEATURE_GFX_ULV_BIT,
+	SMU_FEATURE_FW_DSTATE_BIT,
+	SMU_FEATURE_BACO_BIT,
+	SMU_FEATURE_VCN_PG_BIT,
+	SMU_FEATURE_JPEG_PG_BIT,
+	SMU_FEATURE_USB_PG_BIT,
+	SMU_FEATURE_RSMU_SMN_CG_BIT,
+	SMU_FEATURE_APCC_PLUS_BIT,
+	SMU_FEATURE_GTHR_BIT,
+	SMU_FEATURE_GFX_DCS_BIT,
+	SMU_FEATURE_GFX_SS_BIT,
+	SMU_FEATURE_OUT_OF_BAND_MONITOR_BIT,
+	SMU_FEATURE_TEMP_DEPENDENT_VMIN_BIT,
+	SMU_FEATURE_MMHUB_PG_BIT,
+	SMU_FEATURE_ATHUB_PG_BIT,
+	SMU_FEATURE_COUNT,
+};
+
+#endif
+
--

2.22.0

Quoted 4 lines

_______________________________________________
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