aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiang Liu <jiang.liu@linux.intel.com>2014-01-09 03:15:19 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-01-10 19:31:38 -0500
commitb981513f806d26b2cc971eb65ced14bede67558b (patch)
tree27120eeb63d0ce9c01574f5aefeb7bd804fc43a3
parentd6e0a2dd12f4067a5bcefb8bbd8ddbeff800afbc (diff)
ACPI / scan: bail out early if failed to parse APIC ID for CPU
Enhance ACPI CPU hotplug driver to print clear error message and bail out early if BIOS returns wrong value in ACPI MADT table or _MAT method. Otherwise it will add the CPU device even if failed to get APIC ID and fails any operations against sysfs interface: /sys/devices/system/cpu/cpux/online Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/acpi/acpi_processor.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
index 3c1d6b0c09a4..6ce71b07c197 100644
--- a/drivers/acpi/acpi_processor.c
+++ b/drivers/acpi/acpi_processor.c
@@ -212,7 +212,7 @@ static int acpi_processor_get_info(struct acpi_device *device)
212 union acpi_object object = { 0 }; 212 union acpi_object object = { 0 };
213 struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; 213 struct acpi_buffer buffer = { sizeof(union acpi_object), &object };
214 struct acpi_processor *pr = acpi_driver_data(device); 214 struct acpi_processor *pr = acpi_driver_data(device);
215 int cpu_index, device_declaration = 0; 215 int apic_id, cpu_index, device_declaration = 0;
216 acpi_status status = AE_OK; 216 acpi_status status = AE_OK;
217 static int cpu0_initialized; 217 static int cpu0_initialized;
218 unsigned long long value; 218 unsigned long long value;
@@ -258,18 +258,21 @@ static int acpi_processor_get_info(struct acpi_device *device)
258 device_declaration = 1; 258 device_declaration = 1;
259 pr->acpi_id = value; 259 pr->acpi_id = value;
260 } 260 }
261 pr->apic_id = acpi_get_apicid(pr->handle, device_declaration,
262 pr->acpi_id);
263 cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id);
264 261
265 /* Handle UP system running SMP kernel, with no LAPIC in MADT */ 262 apic_id = acpi_get_apicid(pr->handle, device_declaration, pr->acpi_id);
266 if (!cpu0_initialized && (cpu_index == -1) && 263 if (apic_id < 0) {
267 (num_online_cpus() == 1)) { 264 acpi_handle_err(pr->handle, "failed to get CPU APIC ID.\n");
268 cpu_index = 0; 265 return -ENODEV;
269 } 266 }
267 pr->apic_id = apic_id;
270 268
271 cpu0_initialized = 1; 269 cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id);
272 270 if (!cpu0_initialized) {
271 cpu0_initialized = 1;
272 /* Handle UP system running SMP kernel, with no LAPIC in MADT */
273 if ((cpu_index == -1) && (num_online_cpus() == 1))
274 cpu_index = 0;
275 }
273 pr->id = cpu_index; 276 pr->id = cpu_index;
274 277
275 /* 278 /*
@@ -282,6 +285,7 @@ static int acpi_processor_get_info(struct acpi_device *device)
282 if (ret) 285 if (ret)
283 return ret; 286 return ret;
284 } 287 }
288
285 /* 289 /*
286 * On some boxes several processors use the same processor bus id. 290 * On some boxes several processors use the same processor bus id.
287 * But they are located in different scope. For example: 291 * But they are located in different scope. For example: