Skip to contentSkip to conversation

drm/amd/powerplay: delete eventmgr layer in poweprlay

PATCH In review Rex Zhu 1 participant 1 message Sep 1, 2017

Subsystems (2)
lore
Share & tools
lore

Rex Zhu

author
#0 lore raw

PATCH 1/4 drm/amd/powerplay: delete eventmgr layer in poweprlay

Change-Id Ia34e09dd288d73bc7a64bf47646cd6898d01db7a
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h            |   4 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c             |  10 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c      |   2 +-
 drivers/gpu/drm/amd/powerplay/Makefile             |   5 +-
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c      | 112 +---------
 drivers/gpu/drm/amd/powerplay/hwmgr/Makefile       |   3 +-
 .../gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c  |  18 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c        | 214 +++++++++++-------
 drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c       | 243 +++++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.h       |  42 ++++
 drivers/gpu/drm/amd/powerplay/inc/amd_powerplay.h  |  96 +-------
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h          |   5 +
 drivers/gpu/drm/amd/powerplay/inc/pp_instance.h    |   2 -
 13 files changed, 474 insertions(+), 282 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.h
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h +2 -2
index f187680..bf41c67 100644
@@ -383,8 +383,8 @@ struct amdgpu_dpm_funcs {
 #define amdgpu_dpm_set_mclk_od(adev, value) \
 	((adev)->powerplay.pp_funcs->set_mclk_od((adev)->powerplay.pp_handle, value))
 
-#define amdgpu_dpm_dispatch_task(adev, event_id, input, output)		\
-	(adev)->powerplay.pp_funcs->dispatch_tasks((adev)->powerplay.pp_handle, (event_id), (input), (output))
+#define amdgpu_dpm_dispatch_task(adev, task_id, input, output)		\
+	((adev)->powerplay.pp_funcs->dispatch_tasks)((adev)->powerplay.pp_handle, (task_id), (input), (output))
 
 #define amgdpu_dpm_check_state_equal(adev, cps, rps, equal) (adev)->pm.funcs->check_state_equal((adev), (cps),(rps),(equal))
 
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +5 -5
index f435275..e78395a 100644
@@ -119,7 +119,7 @@ static ssize_t amdgpu_set_dpm_state(struct device *dev,
 	}
 
 	if (adev->pp_enabled) {
-		amdgpu_dpm_dispatch_task(adev, AMD_PP_EVENT_ENABLE_USER_STATE, &state, NULL);
+		amdgpu_dpm_dispatch_task(adev, AMD_PP_TASK_ENABLE_USER_STATE, &state, NULL);
 	} else {
 		mutex_lock(&adev->pm.mutex);
 		adev->pm.dpm.user_state = state;
@@ -330,7 +330,7 @@ static ssize_t amdgpu_set_pp_force_state(struct device *dev,
 		if (state != POWER_STATE_TYPE_INTERNAL_BOOT &&
 		    state != POWER_STATE_TYPE_DEFAULT) {
 			amdgpu_dpm_dispatch_task(adev,
-					AMD_PP_EVENT_ENABLE_USER_STATE, &state, NULL);
+					AMD_PP_TASK_ENABLE_USER_STATE, &state, NULL);
 			adev->pp_force_state_enabled = true;
 		}
 	}
@@ -559,7 +559,7 @@ static ssize_t amdgpu_set_pp_sclk_od(struct device *dev,
 
 	if (adev->pp_enabled) {
 		amdgpu_dpm_set_sclk_od(adev, (uint32_t)value);
-		amdgpu_dpm_dispatch_task(adev, AMD_PP_EVENT_READJUST_POWER_STATE, NULL, NULL);
+		amdgpu_dpm_dispatch_task(adev, AMD_PP_TASK_READJUST_POWER_STATE, NULL, NULL);
 	} else if (adev->pm.funcs->set_sclk_od) {
 		adev->pm.funcs->set_sclk_od(adev, (uint32_t)value);
 		adev->pm.dpm.current_ps = adev->pm.dpm.boot_ps;
@@ -605,7 +605,7 @@ static ssize_t amdgpu_set_pp_mclk_od(struct device *dev,
 
 	if (adev->pp_enabled) {
 		amdgpu_dpm_set_mclk_od(adev, (uint32_t)value);
-		amdgpu_dpm_dispatch_task(adev, AMD_PP_EVENT_READJUST_POWER_STATE, NULL, NULL);
+		amdgpu_dpm_dispatch_task(adev, AMD_PP_TASK_READJUST_POWER_STATE, NULL, NULL);
 	} else if (adev->pm.funcs->set_mclk_od) {
 		adev->pm.funcs->set_mclk_od(adev, (uint32_t)value);
 		adev->pm.dpm.current_ps = adev->pm.dpm.boot_ps;
@@ -1495,7 +1495,7 @@ void amdgpu_pm_compute_clocks(struct amdgpu_device *adev)
 	}
 
 	if (adev->pp_enabled) {
-		amdgpu_dpm_dispatch_task(adev, AMD_PP_EVENT_DISPLAY_CONFIG_CHANGE, NULL, NULL);
+		amdgpu_dpm_dispatch_task(adev, AMD_PP_TASK_DISPLAY_CONFIG_CHANGE, NULL, NULL);
 	} else {
 		mutex_lock(&adev->pm.mutex);
 		adev->pm.dpm.new_active_crtcs = 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c +1 -1
index b7e1c02..b0c4db8 100644
@@ -128,7 +128,7 @@ static int amdgpu_pp_late_init(void *handle)
 
 	if (adev->pp_enabled && adev->pm.dpm_enabled) {
 		amdgpu_pm_sysfs_init(adev);
-		amdgpu_dpm_dispatch_task(adev, AMD_PP_EVENT_COMPLETE_INIT, NULL, NULL);
+		amdgpu_dpm_dispatch_task(adev, AMD_PP_TASK_COMPLETE_INIT, NULL, NULL);
 	}
 
 	return ret;
drivers/gpu/drm/amd/powerplay/Makefile +2 -3
index 043e6eb..6762b5d 100644
@@ -4,12 +4,11 @@ subdir-ccflags-y += -Iinclude/drm  \
 		-I$(FULL_AMD_PATH)/include/asic_reg  \
 		-I$(FULL_AMD_PATH)/include  \
 		-I$(FULL_AMD_PATH)/powerplay/smumgr\
-		-I$(FULL_AMD_PATH)/powerplay/hwmgr \
-		-I$(FULL_AMD_PATH)/powerplay/eventmgr
+		-I$(FULL_AMD_PATH)/powerplay/hwmgr
 
 AMD_PP_PATH = ../powerplay
 
-PP_LIBS = smumgr hwmgr eventmgr
+PP_LIBS = smumgr hwmgr
 
 AMD_POWERPLAY = $(addsuffix /Makefile,$(addprefix $(FULL_AMD_PATH)/powerplay/,$(PP_LIBS)))
 
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +12 -100

228 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/Makefile +2 -1
index f0277c1..79119d6 100644
@@ -9,7 +9,8 @@ HARDWARE_MGR = hwmgr.o processpptables.o functiontables.o \
 		smu7_hwmgr.o smu7_powertune.o smu7_thermal.o \
 		smu7_clockpowergating.o \
 		vega10_processpptables.o vega10_hwmgr.o vega10_powertune.o \
-		vega10_thermal.o pp_overdriver.o rv_hwmgr.o
+		vega10_thermal.o rv_hwmgr.o pp_psm.o\
+		pp_overdriver.o
 
 AMD_PP_HWMGR = $(addprefix $(AMD_PP_PATH)/hwmgr/,$(HARDWARE_MGR))
 
drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c +17 -1
index 967f50f..ce378bd 100644
@@ -26,6 +26,10 @@
 #include "hardwaremanager.h"
 #include "power_state.h"
 
+
+#define TEMP_RANGE_MIN (90 * 1000)
+#define TEMP_RANGE_MAX (120 * 1000)
+
 #define PHM_FUNC_CHECK(hw) \
 	do {							\
 		if ((hw) == NULL || (hw)->hwmgr_func == NULL)	\
@@ -292,7 +296,19 @@ int phm_register_thermal_interrupt(struct pp_hwmgr *hwmgr, const void *info)
 */
 int phm_start_thermal_controller(struct pp_hwmgr *hwmgr, struct PP_TemperatureRange *temperature_range)
 {
-	return phm_dispatch_table(hwmgr, &(hwmgr->start_thermal_controller), temperature_range, NULL);
+	struct PP_TemperatureRange range;
+
+	if (temperature_range == NULL) {
+		range.max = TEMP_RANGE_MAX;
+		range.min = TEMP_RANGE_MIN;
+	} else {
+		range.max = temperature_range->max;
+		range.min = temperature_range->min;
+	}
+	if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
+			PHM_PlatformCaps_ThermalController))
+		return phm_dispatch_table(hwmgr, &(hwmgr->start_thermal_controller), &range, NULL);
+	return 0;
 }
 
 
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +136 -78

253 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c new file +243 -0

243 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.h new file +42 -0

42 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/amd_powerplay.h +7 -89

108 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +5 -0
index b1a6372..c649354 100644
@@ -797,6 +797,11 @@ struct pp_hwmgr {
 extern int hwmgr_early_init(struct pp_instance *handle);
 extern int hwmgr_hw_init(struct pp_instance *handle);
 extern int hwmgr_hw_fini(struct pp_instance *handle);
+extern int hwmgr_hw_suspend(struct pp_instance *handle);
+extern int hwmgr_hw_resume(struct pp_instance *handle);
+extern int hwmgr_handle_task(struct pp_instance *handle,
+				enum amd_pp_task task_id,
+				void *input, void *output);
 extern int phm_wait_on_register(struct pp_hwmgr *hwmgr, uint32_t index,
 				uint32_t value, uint32_t mask);
 
drivers/gpu/drm/amd/powerplay/inc/pp_instance.h +0 -2
index 4c3b537..5bf2ee4 100644
@@ -25,7 +25,6 @@
 
 #include "smumgr.h"
 #include "hwmgr.h"
-#include "eventmgr.h"
 
 #define PP_VALID  0x1F1F1F1F
 
@@ -38,7 +37,6 @@ struct pp_instance {
 	void *device;
 	struct pp_smumgr *smu_mgr;
 	struct pp_hwmgr *hwmgr;
-	struct pp_eventmgr *eventmgr;
 	struct mutex pp_lock;
 };
 
Signature · 6 lines
1.9.1

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