* improve similar pkg suggestions and share code in core-functions for all scripts...
[t2sde.git] / package / kernel / linux / hotfix-intel-epb-default.patch
blobd6e98787bad33cef38fdfbce436187f0b8cd2082
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: package/*/linux/hotfix-intel-epb-default.patch
3 # Copyright (C) 2024 The T2 SDE Project
4 #
5 # This Copyright note is generated by scripts/Create-CopyPatch,
6 # more information can be found in the files COPYING and README.
7 #
8 # This patch file is dual-licensed. It is available under the license the
9 # patched project is licensed under, as long as it is an OpenSource license
10 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
11 # of the GNU General Public License version 2 as used by the T2 SDE.
12 # --- T2-COPYRIGHT-NOTE-END ---
14 --- linux-6.9/arch/x86/kernel/cpu/intel_epb.c.vanilla 2024-06-26 12:40:56.472879229 +0200
15 +++ linux-6.9/arch/x86/kernel/cpu/intel_epb.c 2024-06-26 12:46:46.386853531 +0200
16 @@ -67,7 +67,7 @@
17 EPB_INDEX_POWERSAVE,
20 -static u8 energ_perf_values[] = {
21 +static u8 energy_perf_values[] = {
22 [EPB_INDEX_PERFORMANCE] = ENERGY_PERF_BIAS_PERFORMANCE,
23 [EPB_INDEX_BALANCE_PERFORMANCE] = ENERGY_PERF_BIAS_BALANCE_PERFORMANCE,
24 [EPB_INDEX_NORMAL] = ENERGY_PERF_BIAS_NORMAL,
25 @@ -89,6 +89,15 @@
26 return 0;
29 +static const char * const energy_perf_strings[] = {
30 + [EPB_INDEX_PERFORMANCE] = "performance",
31 + [EPB_INDEX_BALANCE_PERFORMANCE] = "balance-performance",
32 + [EPB_INDEX_NORMAL] = "normal",
33 + [EPB_INDEX_BALANCE_POWERSAVE] = "balance-power",
34 + [EPB_INDEX_POWERSAVE] = "power",
35 +};
38 static void intel_epb_restore(void)
40 u64 val = this_cpu_read(saved_epb);
41 @@ -107,8 +116,9 @@
43 val = epb & EPB_MASK;
44 if (val == ENERGY_PERF_BIAS_PERFORMANCE) {
45 - val = energ_perf_values[EPB_INDEX_NORMAL];
46 - pr_warn_once("ENERGY_PERF_BIAS: Set to 'normal', was 'performance'\n");
47 + val = energy_perf_values[EPB_INDEX_BALANCE_PERFORMANCE];
48 + pr_warn_once("ENERGY_PERF_BIAS: Set to '%s', was 'performance'\n",
49 + energy_perf_strings[EPB_INDEX_BALANCE_PERFORMANCE]);
52 wrmsrl(MSR_IA32_ENERGY_PERF_BIAS, (epb & ~EPB_MASK) | val);
53 @@ -119,14 +129,6 @@
54 .resume = intel_epb_restore,
57 -static const char * const energy_perf_strings[] = {
58 - [EPB_INDEX_PERFORMANCE] = "performance",
59 - [EPB_INDEX_BALANCE_PERFORMANCE] = "balance-performance",
60 - [EPB_INDEX_NORMAL] = "normal",
61 - [EPB_INDEX_BALANCE_POWERSAVE] = "balance-power",
62 - [EPB_INDEX_POWERSAVE] = "power",
63 -};
65 static ssize_t energy_perf_bias_show(struct device *dev,
66 struct device_attribute *attr,
67 char *buf)
68 @@ -153,7 +155,7 @@
69 ret = __sysfs_match_string(energy_perf_strings,
70 ARRAY_SIZE(energy_perf_strings), buf);
71 if (ret >= 0)
72 - val = energ_perf_values[ret];
73 + val = energy_perf_values[ret];
74 else if (kstrtou64(buf, 0, &val) || val > MAX_EPB)
75 return -EINVAL;
77 @@ -222,7 +224,7 @@
78 return -ENODEV;
80 if (id)
81 - energ_perf_values[EPB_INDEX_NORMAL] = id->driver_data;
82 + energy_perf_values[EPB_INDEX_NORMAL] = id->driver_data;
84 ret = cpuhp_setup_state(CPUHP_AP_X86_INTEL_EPB_ONLINE,
85 "x86/intel/epb:online", intel_epb_online,