x86/intel_pstate: the main boby of the intel_pstate driver
PATCH 6/9 x86/intel_pstate: the main boby of the intel_pstate driver
The intel_pstate driver is ported following its kernel code logic (commit: 93f0822d).
In the kernel, a user can adjust the limits via sysfs (limits.min_sysfs_pct/max_sysfs_pct). In Xen, the policy->min_perf_pct/max_perf_pct acts as the transit station. A user interacts with it via xenpm.
--- xen/arch/x86/acpi/cpufreq/Makefile | 1 + xen/arch/x86/acpi/cpufreq/intel_pstate.c | 843 ++++++++++++++++++++++++++++++ xen/include/acpi/cpufreq/cpufreq.h | 6 + xen/include/acpi/cpufreq/processor_perf.h | 1 + xen/include/asm-x86/cpufeature.h | 1 + xen/include/asm-x86/msr-index.h | 3 + 6 files changed, 855 insertions(+) create mode 100644 xen/arch/x86/acpi/cpufreq/intel_pstate.c
xen/arch/x86/acpi/cpufreq/Makefile +1 -0
@@ -1,2 +1,3 @@ obj-y += cpufreq.o +obj-y += intel_pstate.o obj-y += powernow.o
xen/arch/x86/acpi/cpufreq/intel_pstate.c new file +843 -0
843 lines not on this page · raw message
xen/include/acpi/cpufreq/cpufreq.h +6 -0
@@ -34,6 +34,12 @@ struct acpi_cpufreq_data {extern struct acpi_cpufreq_data *cpufreq_drv_data[NR_CPUS ]; +/* +* Maximum transition latency is in nanoseconds - if it's unknown, +* CPUFREQ_ETERNAL shall be used. +*/ +#define CPUFREQ_ETERNAL (-1) +struct cpufreq_cpuinfo {unsigned int max_freq;unsigned int second_max_freq;/* P1 if Turbo Mode is on */
xen/include/acpi/cpufreq/processor_perf.h +1 -0
@@ -7,6 +7,7 @@#define XEN_PX_INIT 0x80000000 +int intel_pstate_init (void );int powernow_cpufreq_init (void );unsigned int powernow_register_driver (void );unsigned int get_measured_perf (unsigned int cpu,unsigned int flag);
xen/include/asm-x86/cpufeature.h +1 -0
@@ -69,6 +69,7 @@#define X86_FEATURE_XTOPOLOGY (3*32+13)/* cpu topology enum extensions */ #define X86_FEATURE_CPUID_FAULTING (3*32+14)/* cpuid faulting */ #define X86_FEATURE_CLFLUSH_MONITOR (3*32+15)/* clflush reqd with monitor */ +#define X86_FEATURE_APERFMPERF (3*32+28)/* APERFMPERF */ /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ #define X86_FEATURE_XMM3 (4*32+ 0)/* Streaming SIMD Extensions-3 */
xen/include/asm-x86/msr-index.h +3 -0
@@ -52,6 +52,8 @@#define MSR_IA32_MCG_STATUS 0x0000017a#define MSR_IA32_MCG_CTL 0x0000017b +#define MSR_NHM_TURBO_RATIO_LIMIT 0x000001ad +#define MSR_IA32_PEBS_ENABLE 0x000003f1#define MSR_IA32_DS_AREA 0x00000600#define MSR_IA32_PERF_CAPABILITIES 0x00000345
@@ -319,6 +321,7 @@#define MSR_IA32_MISC_ENABLE_MONITOR_ENABLE (1<<18)#define MSR_IA32_MISC_ENABLE_LIMIT_CPUID (1<<22)#define MSR_IA32_MISC_ENABLE_XTPR_DISABLE (1<<23) +#define MSR_IA32_MISC_ENABLE_TURBO_DISABLE (1ULL<<38)#define MSR_IA32_TSC_DEADLINE 0x000006E0#define MSR_IA32_ENERGY_PERF_BIAS 0x000001b0
Signature · 1 line
1.9.1
Hi Wei,
xen/include/acpi/cpufreq/processor_perf.h line 10
Quoted 9 lines · Wei Wang
xen/include/acpi/cpufreq/processor_perf.h +1
-0@@ -7,6 +7,7 @@#define XEN_PX_INIT 0x80000000 +int intel_pstate_init (void );
The intel pstate driver is x86 specific. Although xen/include/acpi contains common headers for common code.
Can you move the declaration in an x86 specific header (i.e in xen/include/asm-x86)?
If I'm not mistaken, you have other patch with similar things in this series.
Regards,
Signature · 1 line
Julien Grall
Hi Julien,
On 24/04/2015 20:57, Julien Grall wrote
Quoted 8 lines · Wei Wang
Quoted 7 lines
xen/include/acpi/cpufreq/processor_perf.h +0
-0@@ -7,6 +7,7 @@
Quoted 6 lines
xen/include/acpi/cpufreq/processor_perf.h line 10
Quoted 3 lines
xen/include/acpi/cpufreq/processor_perf.h +1
-0#define XEN_PX_INIT 0x80000000 +int intel_pstate_init (void );The intel pstate driver is x86 specific. Although xen/include/acpi contains common headers for common code.
Thanks for your comments. But I saw "int powernow_cpufreq_init(void);" is put there.
Best,
Wei
Quoted 5 lines
Can you move the declaration in an x86 specific header (i.e in xen/include/asm-x86)?
If I'm not mistaken, you have other patch with similar things in this series.
Quoted 1 line · Wei W
Hi Julien,
Hi Wei,
Quoted 9 lines
On 24/04/2015 20:57, Julien Grall wrote
Quoted 8 lines · Wei Wang
Quoted 7 lines
xen/include/acpi/cpufreq/processor_perf.h +0
-0@@ -7,6 +7,7 @@
Quoted 8 lines
Quoted 6 lines
xen/include/acpi/cpufreq/processor_perf.h line 10
Quoted 3 lines
xen/include/acpi/cpufreq/processor_perf.h +1
-0#define XEN_PX_INIT 0x80000000 +int intel_pstate_init (void );The intel pstate driver is x86 specific. Although xen/include/acpi contains common headers for common code.
Thanks for your comments. But I saw "int
powernow_cpufreq_init(void);" is put there.
FWIW, this prototype doesn't have any implementation even on x86.
While currently some drivers (such as the x86 powernow) may define prototype in the common header. This is wrong, the common code should not be able to call those functions.
There is an ongoing support on ACPI for ARM (an RFC has been sent a couple of months ago). Adding new x86 prototype in this directory complicate the splitting. Please help us to at least avoid adding new x86 specific prototype/code in the common code when it's possible.
We will take care of moving the current x86 prototype/code in the arch-specific directories.
Although, I'm not a maintainer. They may have a different opinion on this point.
Regards,
Signature · 1 line
Julien Grall
On 26/04/2015 01:33, Julien Grall wrote
Hi Julien,
Quoted 31 lines · Wei W
Quoted 9 lines
On 24/04/2015 20:57, Julien Grall wrote
Quoted 8 lines · Wei Wang
Quoted 7 lines
xen/include/acpi/cpufreq/processor_perf.h +0
-0@@ -7,6 +7,7 @@Quoted 8 lines
Quoted 6 lines
xen/include/acpi/cpufreq/processor_perf.h line 10
Quoted 3 lines
xen/include/acpi/cpufreq/processor_perf.h +1
-0#define XEN_PX_INIT 0x80000000 +int intel_pstate_init (void );The intel pstate driver is x86 specific. Although xen/include/acpi contains common headers for common code.
Thanks for your comments. But I saw "int
powernow_cpufreq_init(void);"is put there.
FWIW, this prototype doesn't have any implementation even on x86.
While currently some drivers (such as the x86 powernow) may define prototype in the common header. This is wrong, the common code should not be able to call those functions.
There is an ongoing support on ACPI for ARM (an RFC has been sent a couple of months ago). Adding new x86 prototype in this directory complicate the splitting. Please help us to at least avoid adding new
x86 specific prototype/code in the common code when it's possible.
Quoted 5 lines
We will take care of moving the current x86 prototype/code in the arch- specific directories.
Although, I'm not a maintainer. They may have a different opinion on this point.
Sure. I will do it if maintainers don't have a different opinion.
Best,
Wei
Quoted 15 lines
Quoted 1 line
Quoted 1 line
Julien Grall <[email protected]> 04/26/15 7:33 PM >>>
Quoted 1 line · Wei W
Thanks for your comments. But I saw "int
powernow_cpufreq_init(void);" is put there.FWIW, this prototype doesn't have any implementation even on x86.
While currently some drivers (such as the x86 powernow) may define prototype in the common header. This is wrong, the common code should not be able to call those functions.
There is an ongoing support on ACPI for ARM (an RFC has been sent a couple of months ago). Adding new x86 prototype in this directory complicate the splitting. Please help us to at least avoid adding new x86 specific prototype/code in the common code when it's possible.
Quoted 5 lines
We will take care of moving the current x86 prototype/code in the arch-specific directories.
Although, I'm not a maintainer. They may have a different opinion on this point.
I fully agree - bad examples shouldn't lead to more bad stuff getting added.
Jan