mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
Merge branches 'einj', 'intel_idle', 'misc', 'srat' and 'turbostat-ivb' into release
This commit is contained in:
commit
79ba0db69c
12 changed files with 345 additions and 111 deletions
|
|
@ -197,7 +197,7 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = {
|
|||
.enter = &intel_idle },
|
||||
};
|
||||
|
||||
static int get_driver_data(int cstate)
|
||||
static long get_driver_data(int cstate)
|
||||
{
|
||||
int driver_data;
|
||||
switch (cstate) {
|
||||
|
|
@ -232,6 +232,7 @@ static int get_driver_data(int cstate)
|
|||
* @drv: cpuidle driver
|
||||
* @index: index of cpuidle state
|
||||
*
|
||||
* Must be called under local_irq_disable().
|
||||
*/
|
||||
static int intel_idle(struct cpuidle_device *dev,
|
||||
struct cpuidle_driver *drv, int index)
|
||||
|
|
@ -247,8 +248,6 @@ static int intel_idle(struct cpuidle_device *dev,
|
|||
|
||||
cstate = (((eax) >> MWAIT_SUBSTATE_SIZE) & MWAIT_CSTATE_MASK) + 1;
|
||||
|
||||
local_irq_disable();
|
||||
|
||||
/*
|
||||
* leave_mm() to avoid costly and often unnecessary wakeups
|
||||
* for flushing the user TLB's associated with the active mm.
|
||||
|
|
@ -348,7 +347,8 @@ static int intel_idle_probe(void)
|
|||
cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &mwait_substates);
|
||||
|
||||
if (!(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) ||
|
||||
!(ecx & CPUID5_ECX_INTERRUPT_BREAK))
|
||||
!(ecx & CPUID5_ECX_INTERRUPT_BREAK) ||
|
||||
!mwait_substates)
|
||||
return -ENODEV;
|
||||
|
||||
pr_debug(PREFIX "MWAIT substates: 0x%x\n", mwait_substates);
|
||||
|
|
@ -394,7 +394,7 @@ static int intel_idle_probe(void)
|
|||
if (boot_cpu_has(X86_FEATURE_ARAT)) /* Always Reliable APIC Timer */
|
||||
lapic_timer_reliable_states = LAPIC_TIMER_ALWAYS_RELIABLE;
|
||||
else {
|
||||
smp_call_function(__setup_broadcast_timer, (void *)true, 1);
|
||||
on_each_cpu(__setup_broadcast_timer, (void *)true, 1);
|
||||
register_cpu_notifier(&setup_broadcast_notifier);
|
||||
}
|
||||
|
||||
|
|
@ -471,71 +471,67 @@ static int intel_idle_cpuidle_driver_init(void)
|
|||
}
|
||||
|
||||
if (auto_demotion_disable_flags)
|
||||
smp_call_function(auto_demotion_disable, NULL, 1);
|
||||
on_each_cpu(auto_demotion_disable, NULL, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* intel_idle_cpuidle_devices_init()
|
||||
* intel_idle_cpu_init()
|
||||
* allocate, initialize, register cpuidle_devices
|
||||
* @cpu: cpu/core to initialize
|
||||
*/
|
||||
static int intel_idle_cpuidle_devices_init(void)
|
||||
int intel_idle_cpu_init(int cpu)
|
||||
{
|
||||
int i, cstate;
|
||||
int cstate;
|
||||
struct cpuidle_device *dev;
|
||||
|
||||
intel_idle_cpuidle_devices = alloc_percpu(struct cpuidle_device);
|
||||
if (intel_idle_cpuidle_devices == NULL)
|
||||
return -ENOMEM;
|
||||
dev = per_cpu_ptr(intel_idle_cpuidle_devices, cpu);
|
||||
|
||||
for_each_online_cpu(i) {
|
||||
dev = per_cpu_ptr(intel_idle_cpuidle_devices, i);
|
||||
dev->state_count = 1;
|
||||
|
||||
dev->state_count = 1;
|
||||
for (cstate = 1; cstate < MWAIT_MAX_NUM_CSTATES; ++cstate) {
|
||||
int num_substates;
|
||||
|
||||
for (cstate = 1; cstate < MWAIT_MAX_NUM_CSTATES; ++cstate) {
|
||||
int num_substates;
|
||||
if (cstate > max_cstate) {
|
||||
printk(PREFIX "max_cstate %d reached\n",
|
||||
max_cstate);
|
||||
break;
|
||||
}
|
||||
|
||||
if (cstate > max_cstate) {
|
||||
printk(PREFIX "max_cstate %d reached\n",
|
||||
max_cstate);
|
||||
break;
|
||||
}
|
||||
/* does the state exist in CPUID.MWAIT? */
|
||||
num_substates = (mwait_substates >> ((cstate) * 4))
|
||||
& MWAIT_SUBSTATE_MASK;
|
||||
if (num_substates == 0)
|
||||
continue;
|
||||
/* is the state not enabled? */
|
||||
if (cpuidle_state_table[cstate].enter == NULL)
|
||||
continue;
|
||||
|
||||
/* does the state exist in CPUID.MWAIT? */
|
||||
num_substates = (mwait_substates >> ((cstate) * 4))
|
||||
& MWAIT_SUBSTATE_MASK;
|
||||
if (num_substates == 0)
|
||||
continue;
|
||||
/* is the state not enabled? */
|
||||
if (cpuidle_state_table[cstate].enter == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
dev->states_usage[dev->state_count].driver_data =
|
||||
(void *)get_driver_data(cstate);
|
||||
dev->states_usage[dev->state_count].driver_data =
|
||||
(void *)get_driver_data(cstate);
|
||||
|
||||
dev->state_count += 1;
|
||||
}
|
||||
dev->cpu = cpu;
|
||||
|
||||
dev->cpu = i;
|
||||
if (cpuidle_register_device(dev)) {
|
||||
pr_debug(PREFIX "cpuidle_register_device %d failed!\n",
|
||||
i);
|
||||
intel_idle_cpuidle_devices_uninit();
|
||||
return -EIO;
|
||||
}
|
||||
if (cpuidle_register_device(dev)) {
|
||||
pr_debug(PREFIX "cpuidle_register_device %d failed!\n", cpu);
|
||||
intel_idle_cpuidle_devices_uninit();
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
if (auto_demotion_disable_flags)
|
||||
smp_call_function_single(cpu, auto_demotion_disable, NULL, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int __init intel_idle_init(void)
|
||||
{
|
||||
int retval;
|
||||
int retval, i;
|
||||
|
||||
/* Do not load intel_idle at all for now if idle= is passed */
|
||||
if (boot_option_idle_override != IDLE_NO_OVERRIDE)
|
||||
|
|
@ -553,10 +549,16 @@ static int __init intel_idle_init(void)
|
|||
return retval;
|
||||
}
|
||||
|
||||
retval = intel_idle_cpuidle_devices_init();
|
||||
if (retval) {
|
||||
cpuidle_unregister_driver(&intel_idle_driver);
|
||||
return retval;
|
||||
intel_idle_cpuidle_devices = alloc_percpu(struct cpuidle_device);
|
||||
if (intel_idle_cpuidle_devices == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
for_each_online_cpu(i) {
|
||||
retval = intel_idle_cpu_init(i);
|
||||
if (retval) {
|
||||
cpuidle_unregister_driver(&intel_idle_driver);
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -568,7 +570,7 @@ static void __exit intel_idle_exit(void)
|
|||
cpuidle_unregister_driver(&intel_idle_driver);
|
||||
|
||||
if (lapic_timer_reliable_states != LAPIC_TIMER_ALWAYS_RELIABLE) {
|
||||
smp_call_function(__setup_broadcast_timer, (void *)false, 1);
|
||||
on_each_cpu(__setup_broadcast_timer, (void *)false, 1);
|
||||
unregister_cpu_notifier(&setup_broadcast_notifier);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue