1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
From 04d7e52b095073cd29775e65cdaea1bfc74d0eb5 Mon Sep 17 00:00:00 2001
From: Tom St Denis <tom.stdenis@amd.com>
Date: Tue, 5 Sep 2017 07:55:48 -0400
Subject: [PATCH 0912/4131] drm/amd/powerplay: Fix
psm_set_user_performance_state()
We now pass a pointer to a pointer which seems to be
what they meant in the first place. The previous version
was modifying a pointer passed by value.
Fixes bug that was introduced by
commit 332798d40c2e91:drm/amd/powerplay: delete eventmgr layer in poweprlay
Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-By: Rex Zhu <Rex.Zhu@amd.com>
---
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 4 ++--
drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c | 8 ++++----
drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.h | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
index c6157bc..4f1b932 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
@@ -294,7 +294,7 @@ int hwmgr_handle_task(struct pp_instance *handle, enum amd_pp_task task_id,
{
enum amd_pm_state_type ps;
enum PP_StateUILabel requested_ui_label;
- struct pp_power_state *requested_ps;
+ struct pp_power_state *requested_ps = NULL;
if (input == NULL) {
ret = -EINVAL;
@@ -303,7 +303,7 @@ int hwmgr_handle_task(struct pp_instance *handle, enum amd_pp_task task_id,
ps = *(unsigned long *)input;
requested_ui_label = power_state_convert(ps);
- ret = psm_set_user_performance_state(hwmgr, requested_ui_label, requested_ps);
+ ret = psm_set_user_performance_state(hwmgr, requested_ui_label, &requested_ps);
if (ret)
return ret;
ret = psm_adjust_power_state_dynamic(hwmgr, false, requested_ps);
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c
index 7656324..167cdc3 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c
@@ -188,19 +188,19 @@ int psm_set_performance_states(struct pp_hwmgr *hwmgr)
int psm_set_user_performance_state(struct pp_hwmgr *hwmgr,
enum PP_StateUILabel label_id,
- struct pp_power_state *state)
+ struct pp_power_state **state)
{
int table_entries;
int i;
table_entries = hwmgr->num_ps;
- state = hwmgr->ps;
+ *state = hwmgr->ps;
restart_search:
for (i = 0; i < table_entries; i++) {
- if (state->classification.ui_label & label_id)
+ if ((*state)->classification.ui_label & label_id)
return 0;
- state = (struct pp_power_state *)((unsigned long)state + hwmgr->ps_size);
+ *state = (struct pp_power_state *)((uintptr_t)*state + hwmgr->ps_size);
}
switch (label_id) {
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.h b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.h
index aa44e60..fa1b682 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.h
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.h
@@ -32,7 +32,7 @@ int psm_set_boot_states(struct pp_hwmgr *hwmgr);
int psm_set_performance_states(struct pp_hwmgr *hwmgr);
int psm_set_user_performance_state(struct pp_hwmgr *hwmgr,
enum PP_StateUILabel label_id,
- struct pp_power_state *state);
+ struct pp_power_state **state);
int psm_adjust_power_state_dynamic(struct pp_hwmgr *hwmgr,
bool skip,
struct pp_power_state *new_ps);
--
2.7.4
|