History

Merge tag 'pm+acpi-3.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management and ACPI fixes from Rafael Wysocki: "These are an ACPI device power management initialization fix (-stable material), two commits renaming stuff in the ACPI processor driver to make it more suitable for ARM64 processors and a new ACPI backlight blacklist entry. Specifics: - Fix ACPI power management intialization for device objects corresponding to devices that are not present at the init time (the _STA control method returns 0 for them) and therefore should not be regarded as power manageable (Rafael J Wysocki). - Rename a structure field and two functions used by the ACPI processor driver to make them less tied to architectures that use APICs (both x86 and ia64) and more suitable for ARM64 processors (Hanjun Guo). - Add a disable_native_backlight quirk for Dell XPS15 L521X designed in an unusual way preventing native backlight from working on that machine (Hans de Goede)" * tag 'pm+acpi-3.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: ACPI / video: Add disable_native_backlight quirk for Dell XPS15 L521X ACPI / processor: Rename acpi_(un)map_lsapic() to acpi_(un)map_cpu() ACPI / processor: Convert apic_id to phys_id to make it arch agnostic ACPI / PM: Fix PM initialization for devices that are not present

Linus Torvalds committed 11 years ago

Commit 74e59ea2 parents 086b2a9 794c3a09 files · +75 −61Browse files

Unified · Split

9 files
  1. arch/ia64/kernel/acpi.c +4 −5
  2. arch/x86/kernel/acpi/boot.c +4 −5
  3. drivers/acpi/acpi_processor.c +14 −11
  4. drivers/acpi/device_pm.c +1 −1
  5. drivers/acpi/processor_core.c +28 −28
  6. drivers/acpi/scan.c +8 −5
  7. drivers/acpi/video.c +10 −0
  8. include/acpi/processor.h +4 −4
  9. include/linux/acpi.h +2 −2
arch/ia64/kernel/acpi.c+4−5
@@ -893,13 +893,13 @@ static int _acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu) · 892 unmodified lines
893893 }
894894
895895 /* wrapper to silence section mismatch warning */
896−int __ref acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu)
896+int __ref acpi_map_cpu(acpi_handle handle, int physid, int *pcpu)
897897 {
898898 return _acpi_map_lsapic(handle, physid, pcpu);
899899 }
900−EXPORT_SYMBOL(acpi_map_lsapic);
900+EXPORT_SYMBOL(acpi_map_cpu);
901901
902−int acpi_unmap_lsapic(int cpu)
902+int acpi_unmap_cpu(int cpu)
903903 {
904904 ia64_cpu_to_sapicid[cpu] = -1;
905905 set_cpu_present(cpu, false);
@@ -910,8 +910,7 @@ int acpi_unmap_lsapic(int cpu) · 4 unmodified lines
910910
911911 return (0);
912912 }
913−
914−EXPORT_SYMBOL(acpi_unmap_lsapic);
913+EXPORT_SYMBOL(acpi_unmap_cpu);
915914 #endif /* CONFIG_ACPI_HOTPLUG_CPU */
916915
917916 #ifdef CONFIG_ACPI_NUMA
arch/x86/kernel/acpi/boot.c+4−5
@@ -750,13 +750,13 @@ static int _acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu) · 749 unmodified lines
750750 }
751751
752752 /* wrapper to silence section mismatch warning */
753−int __ref acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu)
753+int __ref acpi_map_cpu(acpi_handle handle, int physid, int *pcpu)
754754 {
755755 return _acpi_map_lsapic(handle, physid, pcpu);
756756 }
757−EXPORT_SYMBOL(acpi_map_lsapic);
757+EXPORT_SYMBOL(acpi_map_cpu);
758758
759−int acpi_unmap_lsapic(int cpu)
759+int acpi_unmap_cpu(int cpu)
760760 {
761761 #ifdef CONFIG_ACPI_NUMA
762762 set_apicid_to_node(per_cpu(x86_cpu_to_apicid, cpu), NUMA_NO_NODE);
@@ -768,8 +768,7 @@ int acpi_unmap_lsapic(int cpu) · 5 unmodified lines
768768
769769 return (0);
770770 }
771−
772−EXPORT_SYMBOL(acpi_unmap_lsapic);
771+EXPORT_SYMBOL(acpi_unmap_cpu);
773772 #endif /* CONFIG_ACPI_HOTPLUG_CPU */
774773
775774 int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
drivers/acpi/acpi_processor.c+14−11
@@ -170,7 +170,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr) · 169 unmodified lines
170170 acpi_status status;
171171 int ret;
172172
173− if (pr->apic_id == -1)
173+ if (pr->phys_id == -1)
174174 return -ENODEV;
175175
176176 status = acpi_evaluate_integer(pr->handle, "_STA", NULL, &sta);
@@ -180,13 +180,13 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr) · 3 unmodified lines
180180 cpu_maps_update_begin();
181181 cpu_hotplug_begin();
182182
183− ret = acpi_map_lsapic(pr->handle, pr->apic_id, &pr->id);
183+ ret = acpi_map_cpu(pr->handle, pr->phys_id, &pr->id);
184184 if (ret)
185185 goto out;
186186
187187 ret = arch_register_cpu(pr->id);
188188 if (ret) {
189− acpi_unmap_lsapic(pr->id);
189+ acpi_unmap_cpu(pr->id);
190190 goto out;
191191 }
192192
@@ -215,7 +215,7 @@ static int acpi_processor_get_info(struct acpi_device *device) · 22 unmodified lines
215215 union acpi_object object = { 0 };
216216 struct acpi_buffer buffer = { sizeof(union acpi_object), &object };
217217 struct acpi_processor *pr = acpi_driver_data(device);
218− int apic_id, cpu_index, device_declaration = 0;
218+ int phys_id, cpu_index, device_declaration = 0;
219219 acpi_status status = AE_OK;
220220 static int cpu0_initialized;
221221 unsigned long long value;
@@ -262,15 +262,18 @@ static int acpi_processor_get_info(struct acpi_device *device) · 40 unmodified lines
262262 pr->acpi_id = value;
263263 }
264264
265− apic_id = acpi_get_apicid(pr->handle, device_declaration, pr->acpi_id);
266− if (apic_id < 0)
267− acpi_handle_debug(pr->handle, "failed to get CPU APIC ID.\n");
268− pr->apic_id = apic_id;
265+ phys_id = acpi_get_phys_id(pr->handle, device_declaration, pr->acpi_id);
266+ if (phys_id < 0)
267+ acpi_handle_debug(pr->handle, "failed to get CPU physical ID.\n");
268+ pr->phys_id = phys_id;
269269
270− cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id);
270+ cpu_index = acpi_map_cpuid(pr->phys_id, pr->acpi_id);
271271 if (!cpu0_initialized && !acpi_has_cpu_in_madt()) {
272272 cpu0_initialized = 1;
273− /* Handle UP system running SMP kernel, with no LAPIC in MADT */
273+ /*
274+ * Handle UP system running SMP kernel, with no CPU
275+ * entry in MADT
276+ */
274277 if ((cpu_index == -1) && (num_online_cpus() == 1))
275278 cpu_index = 0;
276279 }
@@ -458,7 +461,7 @@ static void acpi_processor_remove(struct acpi_device *device) · 181 unmodified lines
458461
459462 /* Remove the CPU. */
460463 arch_unregister_cpu(pr->id);
461− acpi_unmap_lsapic(pr->id);
464+ acpi_unmap_cpu(pr->id);
462465
463466 cpu_hotplug_done();
464467 cpu_maps_update_done();
drivers/acpi/device_pm.c+1−1
@@ -257,7 +257,7 @@ int acpi_bus_init_power(struct acpi_device *device) · 256 unmodified lines
257257
258258 device->power.state = ACPI_STATE_UNKNOWN;
259259 if (!acpi_device_is_present(device))
260− return 0;
260+ return -ENXIO;
261261
262262 result = acpi_device_get_power(device, &state);
263263 if (result)
drivers/acpi/processor_core.c+28−28
@@ -69,7 +69,7 @@ static int map_madt_entry(int type, u32 acpi_id) · 68 unmodified lines
6969 unsigned long madt_end, entry;
7070 static struct acpi_table_madt *madt;
7171 static int read_madt;
72− int apic_id = -1;
72+ int phys_id = -1; /* CPU hardware ID */
7373
7474 if (!read_madt) {
7575 if (ACPI_FAILURE(acpi_get_table(ACPI_SIG_MADT, 0,
@@ -79,7 +79,7 @@ static int map_madt_entry(int type, u32 acpi_id) · 3 unmodified lines
7979 }
8080
8181 if (!madt)
82− return apic_id;
82+ return phys_id;
8383
8484 entry = (unsigned long)madt;
8585 madt_end = entry + madt->header.length;
@@ -91,18 +91,18 @@ static int map_madt_entry(int type, u32 acpi_id) · 5 unmodified lines
9191 struct acpi_subtable_header *header =
9292 (struct acpi_subtable_header *)entry;
9393 if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) {
94− if (!map_lapic_id(header, acpi_id, &apic_id))
94+ if (!map_lapic_id(header, acpi_id, &phys_id))
9595 break;
9696 } else if (header->type == ACPI_MADT_TYPE_LOCAL_X2APIC) {
97− if (!map_x2apic_id(header, type, acpi_id, &apic_id))
97+ if (!map_x2apic_id(header, type, acpi_id, &phys_id))
9898 break;
9999 } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) {
100− if (!map_lsapic_id(header, type, acpi_id, &apic_id))
100+ if (!map_lsapic_id(header, type, acpi_id, &phys_id))
101101 break;
102102 }
103103 entry += header->length;
104104 }
105− return apic_id;
105+ return phys_id;
106106 }
107107
108108 static int map_mat_entry(acpi_handle handle, int type, u32 acpi_id)
@@ -110,7 +110,7 @@ static int map_mat_entry(acpi_handle handle, int type, u32 acpi_id) · 1 unmodified line
110110 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
111111 union acpi_object *obj;
112112 struct acpi_subtable_header *header;
113− int apic_id = -1;
113+ int phys_id = -1;
114114
115115 if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
116116 goto exit;
@@ -126,38 +126,38 @@ static int map_mat_entry(acpi_handle handle, int type, u32 acpi_id) · 9 unmodified lines
126126
127127 header = (struct acpi_subtable_header *)obj->buffer.pointer;
128128 if (header->type == ACPI_MADT_TYPE_LOCAL_APIC)
129− map_lapic_id(header, acpi_id, &apic_id);
129+ map_lapic_id(header, acpi_id, &phys_id);
130130 else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC)
131− map_lsapic_id(header, type, acpi_id, &apic_id);
131+ map_lsapic_id(header, type, acpi_id, &phys_id);
132132 else if (header->type == ACPI_MADT_TYPE_LOCAL_X2APIC)
133− map_x2apic_id(header, type, acpi_id, &apic_id);
133+ map_x2apic_id(header, type, acpi_id, &phys_id);
134134
135135 exit:
136136 kfree(buffer.pointer);
137− return apic_id;
137+ return phys_id;
138138 }
139139
140−int acpi_get_apicid(acpi_handle handle, int type, u32 acpi_id)
140+int acpi_get_phys_id(acpi_handle handle, int type, u32 acpi_id)
141141 {
142− int apic_id;
142+ int phys_id;
143143
144− apic_id = map_mat_entry(handle, type, acpi_id);
145− if (apic_id == -1)
146− apic_id = map_madt_entry(type, acpi_id);
144+ phys_id = map_mat_entry(handle, type, acpi_id);
145+ if (phys_id == -1)
146+ phys_id = map_madt_entry(type, acpi_id);
147147
148− return apic_id;
148+ return phys_id;
149149 }
150150
151−int acpi_map_cpuid(int apic_id, u32 acpi_id)
151+int acpi_map_cpuid(int phys_id, u32 acpi_id)
152152 {
153153 #ifdef CONFIG_SMP
154154 int i;
155155 #endif
156156
157− if (apic_id == -1) {
157+ if (phys_id == -1) {
158158 /*
159159 * On UP processor, there is no _MAT or MADT table.
160− * So above apic_id is always set to -1.
160+ * So above phys_id is always set to -1.
161161 *
162162 * BIOS may define multiple CPU handles even for UP processor.
163163 * For example,
@@ -170,7 +170,7 @@ int acpi_map_cpuid(int apic_id, u32 acpi_id) · 6 unmodified lines
170170 * Processor (CPU3, 0x03, 0x00000410, 0x06) {}
171171 * }
172172 *
173− * Ignores apic_id and always returns 0 for the processor
173+ * Ignores phys_id and always returns 0 for the processor
174174 * handle with acpi id 0 if nr_cpu_ids is 1.
175175 * This should be the case if SMP tables are not found.
176176 * Return -1 for other CPU's handle.
@@ -178,28 +178,28 @@ int acpi_map_cpuid(int apic_id, u32 acpi_id) · 1 unmodified line
178178 if (nr_cpu_ids <= 1 && acpi_id == 0)
179179 return acpi_id;
180180 else
181− return apic_id;
181+ return phys_id;
182182 }
183183
184184 #ifdef CONFIG_SMP
185185 for_each_possible_cpu(i) {
186− if (cpu_physical_id(i) == apic_id)
186+ if (cpu_physical_id(i) == phys_id)
187187 return i;
188188 }
189189 #else
190190 /* In UP kernel, only processor 0 is valid */
191− if (apic_id == 0)
192− return apic_id;
191+ if (phys_id == 0)
192+ return phys_id;
193193 #endif
194194 return -1;
195195 }
196196
197197 int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id)
198198 {
199− int apic_id;
199+ int phys_id;
200200
201− apic_id = acpi_get_apicid(handle, type, acpi_id);
201+ phys_id = acpi_get_phys_id(handle, type, acpi_id);
202202
203− return acpi_map_cpuid(apic_id, acpi_id);
203+ return acpi_map_cpuid(phys_id, acpi_id);
204204 }
205205 EXPORT_SYMBOL_GPL(acpi_get_cpuid);
drivers/acpi/scan.c+8−5
@@ -1001,7 +1001,7 @@ static void acpi_free_power_resources_lists(struct acpi_device *device) · 1000 unmodified lines
10011001 if (device->wakeup.flags.valid)
10021002 acpi_power_resources_list_free(&device->wakeup.resources);
10031003
1004− if (!device->flags.power_manageable)
1004+ if (!device->power.flags.power_resources)
10051005 return;
10061006
10071007 for (i = ACPI_STATE_D0; i <= ACPI_STATE_D3_HOT; i++) {
@@ -1744,10 +1744,8 @@ static void acpi_bus_get_power_flags(struct acpi_device *device) · 736 unmodified lines
17441744 device->power.flags.power_resources)
17451745 device->power.states[ACPI_STATE_D3_COLD].flags.os_accessible = 1;
17461746
1747− if (acpi_bus_init_power(device)) {
1748− acpi_free_power_resources_lists(device);
1747+ if (acpi_bus_init_power(device))
17491748 device->flags.power_manageable = 0;
1750− }
17511749 }
17521750
17531751 static void acpi_bus_get_flags(struct acpi_device *device)
@@ -2371,13 +2369,18 @@ static void acpi_bus_attach(struct acpi_device *device) · 617 unmodified lines
23712369 /* Skip devices that are not present. */
23722370 if (!acpi_device_is_present(device)) {
23732371 device->flags.visited = false;
2372+ device->flags.power_manageable = 0;
23742373 return;
23752374 }
23762375 if (device->handler)
23772376 goto ok;
23782377
23792378 if (!device->flags.initialized) {
2380− acpi_bus_update_power(device, NULL);
2379+ device->flags.power_manageable =
2380+ device->power.states[ACPI_STATE_D0].flags.valid;
2381+ if (acpi_bus_init_power(device))
2382+ device->flags.power_manageable = 0;
2383+
23812384 device->flags.initialized = true;
23822385 }
23832386 device->flags.visited = false;
drivers/acpi/video.c+10−0
@@ -522,6 +522,16 @@ static struct dmi_system_id video_dmi_table[] __initdata = { · 521 unmodified lines
522522 DMI_MATCH(DMI_PRODUCT_NAME, "370R4E/370R4V/370R5E/3570RE/370R5V"),
523523 },
524524 },
525+
526+ {
527+ /* https://bugzilla.redhat.com/show_bug.cgi?id=1163574 */
528+ .callback = video_disable_native_backlight,
529+ .ident = "Dell XPS15 L521X",
530+ .matches = {
531+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
532+ DMI_MATCH(DMI_PRODUCT_NAME, "XPS L521X"),
533+ },
534+ },
525535 {}
526536 };
527537
include/acpi/processor.h+4−4
@@ -196,8 +196,8 @@ struct acpi_processor_flags { · 195 unmodified lines
196196 struct acpi_processor {
197197 acpi_handle handle;
198198 u32 acpi_id;
199− u32 apic_id;
200− u32 id;
199+ u32 phys_id; /* CPU hardware ID such as APIC ID for x86 */
200+ u32 id; /* CPU logical ID allocated by OS */
201201 u32 pblk;
202202 int performance_platform_limit;
203203 int throttling_platform_limit;
@@ -310,8 +310,8 @@ static inline int acpi_processor_get_bios_limit(int cpu, unsigned int *limit) · 106 unmodified lines
310310 #endif /* CONFIG_CPU_FREQ */
311311
312312 /* in processor_core.c */
313−int acpi_get_apicid(acpi_handle, int type, u32 acpi_id);
314−int acpi_map_cpuid(int apic_id, u32 acpi_id);
313+int acpi_get_phys_id(acpi_handle, int type, u32 acpi_id);
314+int acpi_map_cpuid(int phys_id, u32 acpi_id);
315315 int acpi_get_cpuid(acpi_handle, int type, u32 acpi_id);
316316
317317 /* in processor_pdc.c */
include/linux/acpi.h+2−2
@@ -147,8 +147,8 @@ void acpi_numa_arch_fixup(void); · 146 unmodified lines
147147
148148 #ifdef CONFIG_ACPI_HOTPLUG_CPU
149149 /* Arch dependent functions for cpu hotplug support */
150−int acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu);
151−int acpi_unmap_lsapic(int cpu);
150+int acpi_map_cpu(acpi_handle handle, int physid, int *pcpu);
151+int acpi_unmap_cpu(int cpu);
152152 #endif /* CONFIG_ACPI_HOTPLUG_CPU */
153153
154154 int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base);