Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 286738
b: refs/heads/master
c: 93f7708
h: refs/heads/master
v: v3
  • Loading branch information
Lan Tianyu authored and Len Brown committed Jan 21, 2012
1 parent 61db246 commit c7aace8
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 117 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: 99b725084450bbc6f8e1ab20a0df4cc291c342b5
refs/heads/master: 93f770846e8dedc5d9117bd4ad9d7efd18420627
154 changes: 40 additions & 114 deletions trunk/drivers/acpi/processor_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ 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 int acpi_processor_handle_eject(struct acpi_processor *pr);
static int acpi_processor_start(struct acpi_processor *pr);


static const struct acpi_device_id processor_device_ids[] = {
{ACPI_PROCESSOR_OBJECT_HID, 0},
Expand Down Expand Up @@ -423,29 +423,10 @@ static int acpi_cpu_soft_notify(struct notifier_block *nfb,
struct acpi_processor *pr = per_cpu(processors, cpu);

if (action == CPU_ONLINE && pr) {
/* CPU got physically hotplugged and onlined the first time:
* Initialize missing things
*/
if (pr->flags.need_hotplug_init) {
struct cpuidle_driver *idle_driver =
cpuidle_get_driver();

printk(KERN_INFO "Will online and init hotplugged "
"CPU: %d\n", pr->id);
WARN(acpi_processor_start(pr), "Failed to start CPU:"
" %d\n", pr->id);
pr->flags.need_hotplug_init = 0;
if (idle_driver && !strcmp(idle_driver->name,
"intel_idle")) {
intel_idle_cpu_init(pr->id);
}
/* Normal CPU soft online event */
} else {
acpi_processor_ppc_has_changed(pr, 0);
acpi_processor_cst_has_changed(pr);
acpi_processor_reevaluate_tstate(pr, action);
acpi_processor_tstate_has_changed(pr);
}
acpi_processor_ppc_has_changed(pr, 0);
acpi_processor_hotplug(pr);
acpi_processor_reevaluate_tstate(pr, action);
acpi_processor_tstate_has_changed(pr);
}
if (action == CPU_DEAD && pr) {
/* invalidate the flag.throttling after one CPU is offline */
Expand All @@ -459,71 +440,6 @@ static struct notifier_block acpi_cpu_notifier =
.notifier_call = acpi_cpu_soft_notify,
};

/*
* acpi_processor_start() is called by the cpu_hotplug_notifier func:
* acpi_cpu_soft_notify(). Getting it __cpuinit{data} is difficult, the
* root cause seem to be that acpi_processor_uninstall_hotplug_notify()
* is in the module_exit (__exit) func. Allowing acpi_processor_start()
* to not be in __cpuinit section, but being called from __cpuinit funcs
* via __ref looks like the right thing to do here.
*/
static __ref int acpi_processor_start(struct acpi_processor *pr)
{
struct acpi_device *device = per_cpu(processor_device_array, pr->id);
int result = 0;

#ifdef CONFIG_CPU_FREQ
acpi_processor_ppc_has_changed(pr, 0);
#endif
acpi_processor_get_throttling_info(pr);
acpi_processor_get_limit_info(pr);

if (!cpuidle_get_driver() || cpuidle_get_driver() == &acpi_idle_driver)
acpi_processor_power_init(pr, device);

pr->cdev = thermal_cooling_device_register("Processor", device,
&processor_cooling_ops);
if (IS_ERR(pr->cdev)) {
result = PTR_ERR(pr->cdev);
goto err_power_exit;
}

dev_dbg(&device->dev, "registered as cooling_device%d\n",
pr->cdev->id);

result = sysfs_create_link(&device->dev.kobj,
&pr->cdev->device.kobj,
"thermal_cooling");
if (result) {
printk(KERN_ERR PREFIX "Create sysfs link\n");
goto err_thermal_unregister;
}
result = sysfs_create_link(&pr->cdev->device.kobj,
&device->dev.kobj,
"device");
if (result) {
printk(KERN_ERR PREFIX "Create sysfs link\n");
goto err_remove_sysfs_thermal;
}

return 0;

err_remove_sysfs_thermal:
sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
err_thermal_unregister:
thermal_cooling_device_unregister(pr->cdev);
err_power_exit:
acpi_processor_power_exit(pr, device);

return result;
}

/*
* Do not put anything in here which needs the core to be online.
* For example MSR access or setting up things which check for cpuinfo_x86
* (cpu_data(cpu)) values, like CPU feature flags, family, model, etc.
* Such things have to be put in and set up above in acpi_processor_start()
*/
static int __cpuinit acpi_processor_add(struct acpi_device *device)
{
struct acpi_processor *pr = NULL;
Expand Down Expand Up @@ -579,27 +495,48 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device)
goto err_free_cpumask;
}

/*
* Do not start hotplugged CPUs now, but when they
* are onlined the first time
*/
if (pr->flags.need_hotplug_init)
return 0;
#ifdef CONFIG_CPU_FREQ
acpi_processor_ppc_has_changed(pr, 0);
#endif
acpi_processor_get_throttling_info(pr);
acpi_processor_get_limit_info(pr);

/*
* Do not start hotplugged CPUs now, but when they
* are onlined the first time
*/
if (pr->flags.need_hotplug_init)
return 0;
if (!cpuidle_get_driver() || cpuidle_get_driver() == &acpi_idle_driver)
acpi_processor_power_init(pr, device);

result = acpi_processor_start(pr);
if (result)
pr->cdev = thermal_cooling_device_register("Processor", device,
&processor_cooling_ops);
if (IS_ERR(pr->cdev)) {
result = PTR_ERR(pr->cdev);
goto err_power_exit;
}

dev_dbg(&device->dev, "registered as cooling_device%d\n",
pr->cdev->id);

result = sysfs_create_link(&device->dev.kobj,
&pr->cdev->device.kobj,
"thermal_cooling");
if (result) {
printk(KERN_ERR PREFIX "Create sysfs link\n");
goto err_thermal_unregister;
}
result = sysfs_create_link(&pr->cdev->device.kobj,
&device->dev.kobj,
"device");
if (result) {
printk(KERN_ERR PREFIX "Create sysfs link\n");
goto err_remove_sysfs;
}

return 0;

err_remove_sysfs:
sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
err_thermal_unregister:
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 @@ -798,17 +735,6 @@ static acpi_status acpi_processor_hotadd_init(struct acpi_processor *pr)
return AE_ERROR;
}

/* CPU got hot-plugged, but cpu_data is not initialized yet
* Set flag to delay cpu_idle/throttling initialization
* in:
* acpi_processor_add()
* acpi_processor_get_info()
* and do it when the CPU gets online the first time
* TBD: Cleanup above functions and try to do this more elegant.
*/
printk(KERN_INFO "CPU %d got hotplugged\n", pr->id);
pr->flags.need_hotplug_init = 1;

return AE_OK;
}

Expand Down
8 changes: 8 additions & 0 deletions trunk/drivers/acpi/sleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,14 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
},
{
.callback = init_nvs_nosave,
.ident = "Sony Vaio VPCCW29FX",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
DMI_MATCH(DMI_PRODUCT_NAME, "VPCCW29FX"),
},
},
{
.callback = init_nvs_nosave,
.ident = "Averatec AV1020-ED2",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "AVERATEC"),
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/idle/intel_idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ int intel_idle_cpu_init(int cpu)

return 0;
}
EXPORT_SYMBOL_GPL(intel_idle_cpu_init);


static int __init intel_idle_init(void)
{
Expand Down
1 change: 0 additions & 1 deletion trunk/include/acpi/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ struct acpi_processor_flags {
u8 has_cst:1;
u8 power_setup_done:1;
u8 bm_rld_set:1;
u8 need_hotplug_init:1;
};

struct acpi_processor {
Expand Down

0 comments on commit c7aace8

Please sign in to comment.