Skip to content

Commit 8ef8fa8

Browse files
committed
tools/power x86_energy_perf_policy: Prepare for MSR/sysfs refactoring
Rename routines to make "_msr" and "_sysfs" access methods clear No functional change Signed-off-by: Len Brown <len.brown@intel.com>
1 parent c97c057 commit 8ef8fa8

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ void print_hwp_request_pkg(int pkg, struct msr_hwp_request *h, char *str)
809809
h->hwp_min, h->hwp_max, h->hwp_desired, h->hwp_epp,
810810
h->hwp_window, h->hwp_window & 0x7F, (h->hwp_window >> 7) & 0x7);
811811
}
812-
void read_hwp_request(int cpu, struct msr_hwp_request *hwp_req, unsigned int msr_offset)
812+
void read_hwp_request_msr(int cpu, struct msr_hwp_request *hwp_req, unsigned int msr_offset)
813813
{
814814
unsigned long long msr;
815815

@@ -823,7 +823,7 @@ void read_hwp_request(int cpu, struct msr_hwp_request *hwp_req, unsigned int msr
823823
hwp_req->hwp_use_pkg = (((msr) >> 42) & 0x1);
824824
}
825825

826-
void write_hwp_request(int cpu, struct msr_hwp_request *hwp_req, unsigned int msr_offset)
826+
void write_hwp_request_msr(int cpu, struct msr_hwp_request *hwp_req, unsigned int msr_offset)
827827
{
828828
unsigned long long msr = 0;
829829

@@ -843,7 +843,7 @@ void write_hwp_request(int cpu, struct msr_hwp_request *hwp_req, unsigned int ms
843843
put_msr(cpu, msr_offset, msr);
844844
}
845845

846-
static int get_epb(int cpu)
846+
static int get_epb_sysfs(int cpu)
847847
{
848848
char path[SYSFS_PATH_MAX];
849849
char linebuf[3];
@@ -865,7 +865,7 @@ static int get_epb(int cpu)
865865
return (int)val;
866866
}
867867

868-
static int set_epb(int cpu, int val)
868+
static int set_epb_sysfs(int cpu, int val)
869869
{
870870
char path[SYSFS_PATH_MAX];
871871
char linebuf[3];
@@ -895,14 +895,14 @@ int print_cpu_msrs(int cpu)
895895
struct msr_hwp_cap cap;
896896
int epb;
897897

898-
epb = get_epb(cpu);
898+
epb = get_epb_sysfs(cpu);
899899
if (epb >= 0)
900900
printf("cpu%d: EPB %u\n", cpu, (unsigned int) epb);
901901

902902
if (!has_hwp)
903903
return 0;
904904

905-
read_hwp_request(cpu, &req, MSR_HWP_REQUEST);
905+
read_hwp_request_msr(cpu, &req, MSR_HWP_REQUEST);
906906
print_hwp_request(cpu, &req, "");
907907

908908
read_hwp_cap(cpu, &cap, MSR_HWP_CAPABILITIES);
@@ -919,7 +919,7 @@ int print_pkg_msrs(int pkg)
919919
if (!has_hwp)
920920
return 0;
921921

922-
read_hwp_request(first_cpu_in_pkg[pkg], &req, MSR_HWP_REQUEST_PKG);
922+
read_hwp_request_msr(first_cpu_in_pkg[pkg], &req, MSR_HWP_REQUEST_PKG);
923923
print_hwp_request_pkg(pkg, &req, "");
924924

925925
if (has_hwp_notify) {
@@ -1074,14 +1074,14 @@ int check_hwp_request_v_hwp_capabilities(int cpu, struct msr_hwp_request *req, s
10741074
return 0;
10751075
}
10761076

1077-
int update_hwp_request(int cpu)
1077+
int update_hwp_request_msr(int cpu)
10781078
{
10791079
struct msr_hwp_request req;
10801080
struct msr_hwp_cap cap;
10811081

10821082
int msr_offset = MSR_HWP_REQUEST;
10831083

1084-
read_hwp_request(cpu, &req, msr_offset);
1084+
read_hwp_request_msr(cpu, &req, msr_offset);
10851085
if (debug)
10861086
print_hwp_request(cpu, &req, "old: ");
10871087

@@ -1111,23 +1111,23 @@ int update_hwp_request(int cpu)
11111111

11121112
verify_hwp_req_self_consistency(cpu, &req);
11131113

1114-
write_hwp_request(cpu, &req, msr_offset);
1114+
write_hwp_request_msr(cpu, &req, msr_offset);
11151115

11161116
if (debug) {
1117-
read_hwp_request(cpu, &req, msr_offset);
1117+
read_hwp_request_msr(cpu, &req, msr_offset);
11181118
print_hwp_request(cpu, &req, "new: ");
11191119
}
11201120
return 0;
11211121
}
1122-
int update_hwp_request_pkg(int pkg)
1122+
int update_hwp_request_pkg_msr(int pkg)
11231123
{
11241124
struct msr_hwp_request req;
11251125
struct msr_hwp_cap cap;
11261126
int cpu = first_cpu_in_pkg[pkg];
11271127

11281128
int msr_offset = MSR_HWP_REQUEST_PKG;
11291129

1130-
read_hwp_request(cpu, &req, msr_offset);
1130+
read_hwp_request_msr(cpu, &req, msr_offset);
11311131
if (debug)
11321132
print_hwp_request_pkg(pkg, &req, "old: ");
11331133

@@ -1155,10 +1155,10 @@ int update_hwp_request_pkg(int pkg)
11551155

11561156
verify_hwp_req_self_consistency(cpu, &req);
11571157

1158-
write_hwp_request(cpu, &req, msr_offset);
1158+
write_hwp_request_msr(cpu, &req, msr_offset);
11591159

11601160
if (debug) {
1161-
read_hwp_request(cpu, &req, msr_offset);
1161+
read_hwp_request_msr(cpu, &req, msr_offset);
11621162
print_hwp_request_pkg(pkg, &req, "new: ");
11631163
}
11641164
return 0;
@@ -1188,8 +1188,8 @@ int update_cpu_msrs(int cpu)
11881188
int epb;
11891189

11901190
if (update_epb) {
1191-
epb = get_epb(cpu);
1192-
set_epb(cpu, new_epb);
1191+
epb = get_epb_sysfs(cpu);
1192+
set_epb_sysfs(cpu, new_epb);
11931193

11941194
if (verbose)
11951195
printf("cpu%d: ENERGY_PERF_BIAS old: %d new: %d\n",
@@ -1229,7 +1229,7 @@ int update_cpu_msrs(int cpu)
12291229
if (!hwp_update_enabled())
12301230
return 0;
12311231

1232-
update_hwp_request(cpu);
1232+
update_hwp_request_msr(cpu);
12331233
return 0;
12341234
}
12351235

@@ -1587,7 +1587,7 @@ int main(int argc, char **argv)
15871587
for_all_cpus_in_set(cpu_setsize, cpu_selected_set, update_sysfs);
15881588
for_all_cpus_in_set(cpu_setsize, cpu_selected_set, update_cpu_msrs);
15891589
} else if (pkg_selected_set)
1590-
for_packages(pkg_selected_set, update_hwp_request_pkg);
1590+
for_packages(pkg_selected_set, update_hwp_request_pkg_msr);
15911591

15921592
return 0;
15931593
}

0 commit comments

Comments
 (0)