mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
intel_idle: Add __initdata annotations to init time variables
Annotate static variables cpuidle_state_table and mwait_substates with __initdata, because they are only used during the initialization of the driver. Also notice that static variable icpu could be annotated analogously and the structure pointed to by it could be __initconst, but two of its fields are accessed via icpu in intel_idle_cpu_init() and auto_demotion_disable(), so introduce two new static variables, auto_demotion_disable_flags and disable_promotion_to_c1e, to hold the values of these fields, set them during the initialization and use them in those functions instead of accessing the source data structure via icpu. That allows icpu to be annotated with __initdata, so do that, and it will also allow some __initconst annotations to be added subsequently. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
30a996fbb3
commit
7f843dd712
@ -65,7 +65,11 @@ static struct cpuidle_driver intel_idle_driver = {
|
|||||||
static int max_cstate = CPUIDLE_STATE_MAX - 1;
|
static int max_cstate = CPUIDLE_STATE_MAX - 1;
|
||||||
static unsigned int disabled_states_mask;
|
static unsigned int disabled_states_mask;
|
||||||
|
|
||||||
static unsigned int mwait_substates;
|
static unsigned int mwait_substates __initdata;
|
||||||
|
|
||||||
|
static unsigned long auto_demotion_disable_flags;
|
||||||
|
static bool disable_promotion_to_c1e;
|
||||||
|
|
||||||
static bool lapic_timer_always_reliable;
|
static bool lapic_timer_always_reliable;
|
||||||
|
|
||||||
struct idle_cpu {
|
struct idle_cpu {
|
||||||
@ -81,9 +85,9 @@ struct idle_cpu {
|
|||||||
bool use_acpi;
|
bool use_acpi;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct idle_cpu *icpu;
|
static const struct idle_cpu *icpu __initdata;
|
||||||
static struct cpuidle_device __percpu *intel_idle_cpuidle_devices;
|
static struct cpuidle_device __percpu *intel_idle_cpuidle_devices;
|
||||||
static struct cpuidle_state *cpuidle_state_table;
|
static struct cpuidle_state *cpuidle_state_table __initdata;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enable this state by default even if the ACPI _CST does not list it.
|
* Enable this state by default even if the ACPI _CST does not list it.
|
||||||
@ -1519,7 +1523,7 @@ static void auto_demotion_disable(void)
|
|||||||
unsigned long long msr_bits;
|
unsigned long long msr_bits;
|
||||||
|
|
||||||
rdmsrl(MSR_PKG_CST_CONFIG_CONTROL, msr_bits);
|
rdmsrl(MSR_PKG_CST_CONFIG_CONTROL, msr_bits);
|
||||||
msr_bits &= ~(icpu->auto_demotion_disable_flags);
|
msr_bits &= ~auto_demotion_disable_flags;
|
||||||
wrmsrl(MSR_PKG_CST_CONFIG_CONTROL, msr_bits);
|
wrmsrl(MSR_PKG_CST_CONFIG_CONTROL, msr_bits);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1549,13 +1553,10 @@ static int intel_idle_cpu_init(unsigned int cpu)
|
|||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!icpu)
|
if (auto_demotion_disable_flags)
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (icpu->auto_demotion_disable_flags)
|
|
||||||
auto_demotion_disable();
|
auto_demotion_disable();
|
||||||
|
|
||||||
if (icpu->disable_promotion_to_c1e)
|
if (disable_promotion_to_c1e)
|
||||||
c1e_promotion_disable();
|
c1e_promotion_disable();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -1633,6 +1634,8 @@ static int __init intel_idle_init(void)
|
|||||||
icpu = (const struct idle_cpu *)id->driver_data;
|
icpu = (const struct idle_cpu *)id->driver_data;
|
||||||
if (icpu) {
|
if (icpu) {
|
||||||
cpuidle_state_table = icpu->state_table;
|
cpuidle_state_table = icpu->state_table;
|
||||||
|
auto_demotion_disable_flags = icpu->auto_demotion_disable_flags;
|
||||||
|
disable_promotion_to_c1e = icpu->disable_promotion_to_c1e;
|
||||||
if (icpu->use_acpi || force_use_acpi)
|
if (icpu->use_acpi || force_use_acpi)
|
||||||
intel_idle_acpi_cst_extract();
|
intel_idle_acpi_cst_extract();
|
||||||
} else if (!intel_idle_acpi_cst_extract()) {
|
} else if (!intel_idle_acpi_cst_extract()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user