Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 286502
b: refs/heads/master
c: 8df0eb7
h: refs/heads/master
v: v3
  • Loading branch information
Kurt Garloff authored and Len Brown committed Jan 17, 2012
1 parent c9da3f7 commit 10b73ee
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 83 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 65b7f839ceecc0a36c7969c0c9151d5748cd4242
refs/heads/master: 8df0eb7c9d96f9e82f233ee8b74e0f0c8471f868
6 changes: 6 additions & 0 deletions trunk/drivers/acpi/numa.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ static int pxm_to_node_map[MAX_PXM_DOMAINS]
static int node_to_pxm_map[MAX_NUMNODES]
= { [0 ... MAX_NUMNODES - 1] = PXM_INVAL };

unsigned char acpi_srat_revision __initdata;

int pxm_to_node(int pxm)
{
if (pxm < 0)
Expand Down Expand Up @@ -255,9 +257,13 @@ acpi_parse_memory_affinity(struct acpi_subtable_header * header,

static int __init acpi_parse_srat(struct acpi_table_header *table)
{
struct acpi_table_srat *srat;
if (!table)
return -EINVAL;

srat = (struct acpi_table_srat *)table;
acpi_srat_revision = srat->header.revision;

/* Real work done in acpi_table_parse_srat below. */

return 0;
Expand Down
26 changes: 2 additions & 24 deletions trunk/drivers/acpi/processor_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,30 +173,8 @@ int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id)
apic_id = map_mat_entry(handle, type, acpi_id);
if (apic_id == -1)
apic_id = map_madt_entry(type, acpi_id);
if (apic_id == -1) {
/*
* On UP processor, there is no _MAT or MADT table.
* So above apic_id is always set to -1.
*
* BIOS may define multiple CPU handles even for UP processor.
* For example,
*
* Scope (_PR)
* {
* Processor (CPU0, 0x00, 0x00000410, 0x06) {}
* Processor (CPU1, 0x01, 0x00000410, 0x06) {}
* Processor (CPU2, 0x02, 0x00000410, 0x06) {}
* Processor (CPU3, 0x03, 0x00000410, 0x06) {}
* }
*
* Ignores apic_id and always return 0 for CPU0's handle.
* Return -1 for other CPU's handle.
*/
if (acpi_id == 0)
return acpi_id;
else
return apic_id;
}
if (apic_id == -1)
return apic_id;

#ifdef CONFIG_SMP
for_each_possible_cpu(i) {
Expand Down
20 changes: 11 additions & 9 deletions trunk/drivers/acpi/processor_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ MODULE_LICENSE("GPL");
static int acpi_processor_add(struct acpi_device *device);
static int acpi_processor_remove(struct acpi_device *device, int type);
static void acpi_processor_notify(struct acpi_device *device, u32 event);
static acpi_status acpi_processor_hotadd_init(struct acpi_processor *pr);
static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu);
static int acpi_processor_handle_eject(struct acpi_processor *pr);


Expand Down Expand Up @@ -324,8 +324,10 @@ static int acpi_processor_get_info(struct acpi_device *device)
* they are physically not present.
*/
if (pr->id == -1) {
if (ACPI_FAILURE(acpi_processor_hotadd_init(pr)))
if (ACPI_FAILURE
(acpi_processor_hotadd_init(pr->handle, &pr->id))) {
return -ENODEV;
}
}
/*
* On some boxes several processors use the same processor bus id.
Expand Down Expand Up @@ -537,7 +539,6 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device)
thermal_cooling_device_unregister(pr->cdev);
err_power_exit:
acpi_processor_power_exit(pr, device);
sysfs_remove_link(&device->dev.kobj, "sysdev");
err_free_cpumask:
free_cpumask_var(pr->throttling.shared_cpu_map);

Expand Down Expand Up @@ -719,19 +720,18 @@ processor_walk_namespace_cb(acpi_handle handle,
return (AE_OK);
}

static acpi_status acpi_processor_hotadd_init(struct acpi_processor *pr)
static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu)
{
acpi_handle handle = pr->handle;

if (!is_processor_present(handle)) {
return AE_ERROR;
}

if (acpi_map_lsapic(handle, &pr->id))
if (acpi_map_lsapic(handle, p_cpu))
return AE_ERROR;

if (arch_register_cpu(pr->id)) {
acpi_unmap_lsapic(pr->id);
if (arch_register_cpu(*p_cpu)) {
acpi_unmap_lsapic(*p_cpu);
return AE_ERROR;
}

Expand All @@ -748,7 +748,7 @@ static int acpi_processor_handle_eject(struct acpi_processor *pr)
return (0);
}
#else
static acpi_status acpi_processor_hotadd_init(struct acpi_processor *pr)
static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu)
{
return AE_ERROR;
}
Expand Down Expand Up @@ -827,6 +827,8 @@ static void __exit acpi_processor_exit(void)

acpi_bus_unregister_driver(&acpi_processor_driver);

cpuidle_unregister_driver(&acpi_idle_driver);

return;
}

Expand Down
82 changes: 40 additions & 42 deletions trunk/drivers/idle/intel_idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -478,60 +478,64 @@ static int intel_idle_cpuidle_driver_init(void)


/*
* intel_idle_cpu_init()
* intel_idle_cpuidle_devices_init()
* allocate, initialize, register cpuidle_devices
* @cpu: cpu/core to initialize
*/
int intel_idle_cpu_init(int cpu)
static int intel_idle_cpuidle_devices_init(void)
{
int cstate;
int i, cstate;
struct cpuidle_device *dev;

dev = per_cpu_ptr(intel_idle_cpuidle_devices, cpu);
intel_idle_cpuidle_devices = alloc_percpu(struct cpuidle_device);
if (intel_idle_cpuidle_devices == NULL)
return -ENOMEM;

dev->state_count = 1;
for_each_online_cpu(i) {
dev = per_cpu_ptr(intel_idle_cpuidle_devices, i);

for (cstate = 1; cstate < MWAIT_MAX_NUM_CSTATES; ++cstate) {
int num_substates;
dev->state_count = 1;

if (cstate > max_cstate) {
printk(PREFIX "max_cstate %d reached\n",
max_cstate);
break;
}
for (cstate = 1; cstate < MWAIT_MAX_NUM_CSTATES; ++cstate) {
int num_substates;

/* 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;
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;
}

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;

if (cpuidle_register_device(dev)) {
pr_debug(PREFIX "cpuidle_register_device %d failed!\n", cpu);
intel_idle_cpuidle_devices_uninit();
return -EIO;
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 (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, i;
int retval;

/* Do not load intel_idle at all for now if idle= is passed */
if (boot_option_idle_override != IDLE_NO_OVERRIDE)
Expand All @@ -549,16 +553,10 @@ static int __init intel_idle_init(void)
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;
}
retval = intel_idle_cpuidle_devices_init();
if (retval) {
cpuidle_unregister_driver(&intel_idle_driver);
return retval;
}

return 0;
Expand Down
1 change: 1 addition & 0 deletions trunk/include/acpi/acpi_numa.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ extern int pxm_to_node(int);
extern int node_to_pxm(int);
extern void __acpi_map_pxm_to_node(int, int);
extern int acpi_map_pxm_to_node(int);
extern unsigned char acpi_srat_revision;

#endif /* CONFIG_ACPI_NUMA */
#endif /* __ACP_NUMA_H */
7 changes: 0 additions & 7 deletions trunk/include/linux/cpuidle.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,7 @@ struct cpuidle_governor {
extern int cpuidle_register_governor(struct cpuidle_governor *gov);
extern void cpuidle_unregister_governor(struct cpuidle_governor *gov);

#ifdef CONFIG_INTEL_IDLE
extern int intel_idle_cpu_init(int cpu);
#else
static inline int intel_idle_cpu_init(int cpu) { return -1; }
#endif

#else
static inline int intel_idle_cpu_init(int cpu) { return -1; }

static inline int cpuidle_register_governor(struct cpuidle_governor *gov)
{return 0;}
Expand Down

0 comments on commit 10b73ee

Please sign in to comment.