@@ -280,10 +280,10 @@ static struct cpudata **all_cpu_data;
280
280
* structure is used to store those callbacks.
281
281
*/
282
282
struct pstate_funcs {
283
- int (* get_max )(void );
284
- int (* get_max_physical )(void );
285
- int (* get_min )(void );
286
- int (* get_turbo )(void );
283
+ int (* get_max )(int cpu );
284
+ int (* get_max_physical )(int cpu );
285
+ int (* get_min )(int cpu );
286
+ int (* get_turbo )(int cpu );
287
287
int (* get_scaling )(void );
288
288
int (* get_cpu_scaling )(int cpu );
289
289
int (* get_aperf_mperf_shift )(void );
@@ -531,12 +531,12 @@ static void intel_pstate_hybrid_hwp_adjust(struct cpudata *cpu)
531
531
{
532
532
int perf_ctl_max_phys = cpu -> pstate .max_pstate_physical ;
533
533
int perf_ctl_scaling = cpu -> pstate .perf_ctl_scaling ;
534
- int perf_ctl_turbo = pstate_funcs .get_turbo ();
534
+ int perf_ctl_turbo = pstate_funcs .get_turbo (cpu -> cpu );
535
535
int turbo_freq = perf_ctl_turbo * perf_ctl_scaling ;
536
536
int scaling = cpu -> pstate .scaling ;
537
537
538
538
pr_debug ("CPU%d: perf_ctl_max_phys = %d\n" , cpu -> cpu , perf_ctl_max_phys );
539
- pr_debug ("CPU%d: perf_ctl_max = %d\n" , cpu -> cpu , pstate_funcs .get_max ());
539
+ pr_debug ("CPU%d: perf_ctl_max = %d\n" , cpu -> cpu , pstate_funcs .get_max (cpu -> cpu ));
540
540
pr_debug ("CPU%d: perf_ctl_turbo = %d\n" , cpu -> cpu , perf_ctl_turbo );
541
541
pr_debug ("CPU%d: perf_ctl_scaling = %d\n" , cpu -> cpu , perf_ctl_scaling );
542
542
pr_debug ("CPU%d: HWP_CAP guaranteed = %d\n" , cpu -> cpu , cpu -> pstate .max_pstate );
@@ -1740,23 +1740,23 @@ static void intel_pstate_hwp_enable(struct cpudata *cpudata)
1740
1740
intel_pstate_update_epp_defaults (cpudata );
1741
1741
}
1742
1742
1743
- static int atom_get_min_pstate (void )
1743
+ static int atom_get_min_pstate (int not_used )
1744
1744
{
1745
1745
u64 value ;
1746
1746
1747
1747
rdmsrl (MSR_ATOM_CORE_RATIOS , value );
1748
1748
return (value >> 8 ) & 0x7F ;
1749
1749
}
1750
1750
1751
- static int atom_get_max_pstate (void )
1751
+ static int atom_get_max_pstate (int not_used )
1752
1752
{
1753
1753
u64 value ;
1754
1754
1755
1755
rdmsrl (MSR_ATOM_CORE_RATIOS , value );
1756
1756
return (value >> 16 ) & 0x7F ;
1757
1757
}
1758
1758
1759
- static int atom_get_turbo_pstate (void )
1759
+ static int atom_get_turbo_pstate (int not_used )
1760
1760
{
1761
1761
u64 value ;
1762
1762
@@ -1834,23 +1834,23 @@ static void atom_get_vid(struct cpudata *cpudata)
1834
1834
cpudata -> vid .turbo = value & 0x7f ;
1835
1835
}
1836
1836
1837
- static int core_get_min_pstate (void )
1837
+ static int core_get_min_pstate (int cpu )
1838
1838
{
1839
1839
u64 value ;
1840
1840
1841
- rdmsrl ( MSR_PLATFORM_INFO , value );
1841
+ rdmsrl_on_cpu ( cpu , MSR_PLATFORM_INFO , & value );
1842
1842
return (value >> 40 ) & 0xFF ;
1843
1843
}
1844
1844
1845
- static int core_get_max_pstate_physical (void )
1845
+ static int core_get_max_pstate_physical (int cpu )
1846
1846
{
1847
1847
u64 value ;
1848
1848
1849
- rdmsrl ( MSR_PLATFORM_INFO , value );
1849
+ rdmsrl_on_cpu ( cpu , MSR_PLATFORM_INFO , & value );
1850
1850
return (value >> 8 ) & 0xFF ;
1851
1851
}
1852
1852
1853
- static int core_get_tdp_ratio (u64 plat_info )
1853
+ static int core_get_tdp_ratio (int cpu , u64 plat_info )
1854
1854
{
1855
1855
/* Check how many TDP levels present */
1856
1856
if (plat_info & 0x600000000 ) {
@@ -1860,13 +1860,13 @@ static int core_get_tdp_ratio(u64 plat_info)
1860
1860
int err ;
1861
1861
1862
1862
/* Get the TDP level (0, 1, 2) to get ratios */
1863
- err = rdmsrl_safe ( MSR_CONFIG_TDP_CONTROL , & tdp_ctrl );
1863
+ err = rdmsrl_safe_on_cpu ( cpu , MSR_CONFIG_TDP_CONTROL , & tdp_ctrl );
1864
1864
if (err )
1865
1865
return err ;
1866
1866
1867
1867
/* TDP MSR are continuous starting at 0x648 */
1868
1868
tdp_msr = MSR_CONFIG_TDP_NOMINAL + (tdp_ctrl & 0x03 );
1869
- err = rdmsrl_safe ( tdp_msr , & tdp_ratio );
1869
+ err = rdmsrl_safe_on_cpu ( cpu , tdp_msr , & tdp_ratio );
1870
1870
if (err )
1871
1871
return err ;
1872
1872
@@ -1883,18 +1883,18 @@ static int core_get_tdp_ratio(u64 plat_info)
1883
1883
return - ENXIO ;
1884
1884
}
1885
1885
1886
- static int core_get_max_pstate (void )
1886
+ static int core_get_max_pstate (int cpu )
1887
1887
{
1888
1888
u64 tar ;
1889
1889
u64 plat_info ;
1890
1890
int max_pstate ;
1891
1891
int tdp_ratio ;
1892
1892
int err ;
1893
1893
1894
- rdmsrl ( MSR_PLATFORM_INFO , plat_info );
1894
+ rdmsrl_on_cpu ( cpu , MSR_PLATFORM_INFO , & plat_info );
1895
1895
max_pstate = (plat_info >> 8 ) & 0xFF ;
1896
1896
1897
- tdp_ratio = core_get_tdp_ratio (plat_info );
1897
+ tdp_ratio = core_get_tdp_ratio (cpu , plat_info );
1898
1898
if (tdp_ratio <= 0 )
1899
1899
return max_pstate ;
1900
1900
@@ -1903,7 +1903,7 @@ static int core_get_max_pstate(void)
1903
1903
return tdp_ratio ;
1904
1904
}
1905
1905
1906
- err = rdmsrl_safe ( MSR_TURBO_ACTIVATION_RATIO , & tar );
1906
+ err = rdmsrl_safe_on_cpu ( cpu , MSR_TURBO_ACTIVATION_RATIO , & tar );
1907
1907
if (!err ) {
1908
1908
int tar_levels ;
1909
1909
@@ -1918,13 +1918,13 @@ static int core_get_max_pstate(void)
1918
1918
return max_pstate ;
1919
1919
}
1920
1920
1921
- static int core_get_turbo_pstate (void )
1921
+ static int core_get_turbo_pstate (int cpu )
1922
1922
{
1923
1923
u64 value ;
1924
1924
int nont , ret ;
1925
1925
1926
- rdmsrl ( MSR_TURBO_RATIO_LIMIT , value );
1927
- nont = core_get_max_pstate ();
1926
+ rdmsrl_on_cpu ( cpu , MSR_TURBO_RATIO_LIMIT , & value );
1927
+ nont = core_get_max_pstate (cpu );
1928
1928
ret = (value ) & 255 ;
1929
1929
if (ret <= nont )
1930
1930
ret = nont ;
@@ -1952,13 +1952,13 @@ static int knl_get_aperf_mperf_shift(void)
1952
1952
return 10 ;
1953
1953
}
1954
1954
1955
- static int knl_get_turbo_pstate (void )
1955
+ static int knl_get_turbo_pstate (int cpu )
1956
1956
{
1957
1957
u64 value ;
1958
1958
int nont , ret ;
1959
1959
1960
- rdmsrl ( MSR_TURBO_RATIO_LIMIT , value );
1961
- nont = core_get_max_pstate ();
1960
+ rdmsrl_on_cpu ( cpu , MSR_TURBO_RATIO_LIMIT , & value );
1961
+ nont = core_get_max_pstate (cpu );
1962
1962
ret = (((value ) >> 8 ) & 0xFF );
1963
1963
if (ret <= nont )
1964
1964
ret = nont ;
@@ -2025,10 +2025,10 @@ static void intel_pstate_max_within_limits(struct cpudata *cpu)
2025
2025
2026
2026
static void intel_pstate_get_cpu_pstates (struct cpudata * cpu )
2027
2027
{
2028
- int perf_ctl_max_phys = pstate_funcs .get_max_physical ();
2028
+ int perf_ctl_max_phys = pstate_funcs .get_max_physical (cpu -> cpu );
2029
2029
int perf_ctl_scaling = pstate_funcs .get_scaling ();
2030
2030
2031
- cpu -> pstate .min_pstate = pstate_funcs .get_min ();
2031
+ cpu -> pstate .min_pstate = pstate_funcs .get_min (cpu -> cpu );
2032
2032
cpu -> pstate .max_pstate_physical = perf_ctl_max_phys ;
2033
2033
cpu -> pstate .perf_ctl_scaling = perf_ctl_scaling ;
2034
2034
@@ -2044,8 +2044,8 @@ static void intel_pstate_get_cpu_pstates(struct cpudata *cpu)
2044
2044
}
2045
2045
} else {
2046
2046
cpu -> pstate .scaling = perf_ctl_scaling ;
2047
- cpu -> pstate .max_pstate = pstate_funcs .get_max ();
2048
- cpu -> pstate .turbo_pstate = pstate_funcs .get_turbo ();
2047
+ cpu -> pstate .max_pstate = pstate_funcs .get_max (cpu -> cpu );
2048
+ cpu -> pstate .turbo_pstate = pstate_funcs .get_turbo (cpu -> cpu );
2049
2049
}
2050
2050
2051
2051
if (cpu -> pstate .scaling == perf_ctl_scaling ) {
@@ -3221,9 +3221,9 @@ static unsigned int force_load __initdata;
3221
3221
3222
3222
static int __init intel_pstate_msrs_not_valid (void )
3223
3223
{
3224
- if (!pstate_funcs .get_max () ||
3225
- !pstate_funcs .get_min () ||
3226
- !pstate_funcs .get_turbo ())
3224
+ if (!pstate_funcs .get_max (0 ) ||
3225
+ !pstate_funcs .get_min (0 ) ||
3226
+ !pstate_funcs .get_turbo (0 ))
3227
3227
return - ENODEV ;
3228
3228
3229
3229
return 0 ;
0 commit comments