mirror of https://gitee.com/openkylin/linux.git
Power management and ACPI material for 3.19-rc4
- 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). / -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABCAAGBQJUrcCTAAoJEILEb/54YlRxeMUQAKOHS8rlq0XtOxieufCks0Rq e96ZExiTdLI/KYZCgqwkSJxR7w2981hbFVIcFccPpo1k9Z1YowSOvWcHvmn1RwHQ lXDfCEqWssIXMn0zctH3Ob/uBggvWFx9g5y8slOZ6W2LaUzzNdA+ZqxIbNsgwNSN vji2E1m2ZhcwgThPYeXNsvvWJzYyC3LI4nZ8UIKE8kUMM5oxYoIlrW/qjoHc8KNV AlUv+e0Z43XHy5jHaS8sQrKGrAPrdUroDRcByw1MG/V8r4vSXepvNjOXXwEZ9SF9 xPp/bzLLRPK8FW4MQ2VEhTcO0FcjblDTQDhenDHKyjEonWOse5A9VbAyZ2dORfZ+ juDsO3xalYk+OoHjRDdzxkQLIyQOATTcxkyGxyJf+HjcD6nfsdibWzisM6nl7E9h hpwGRhb5sgbWV9QRwmkkvFBP/uCsF3rHA/qCZQCFsxs0n3Ty5wiAg2JEHEL/kPF9 6vPsX4ttukw5MbNzTyHfXOm41Ula3u4EfJvTdQjWNdx9uifBjsosetw3ho6q4XmP e6mCBFIU0Fxxfnmgij5x6ufGCBCrkpbLuZsC63HyaRDiRDN4DuftDLesVEySfJix +FiqilOyiOmSXHHC17cF8YNYsxMdFo1mGJDpV1PS1gnh/xwmEgfzwdWrjso7Y76L 9MilW/AXspuXxegu6JDu =NEY0 -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
74e59ea05c
|
@ -893,13 +893,13 @@ static int _acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu)
|
|||
}
|
||||
|
||||
/* wrapper to silence section mismatch warning */
|
||||
int __ref acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu)
|
||||
int __ref acpi_map_cpu(acpi_handle handle, int physid, int *pcpu)
|
||||
{
|
||||
return _acpi_map_lsapic(handle, physid, pcpu);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_map_lsapic);
|
||||
EXPORT_SYMBOL(acpi_map_cpu);
|
||||
|
||||
int acpi_unmap_lsapic(int cpu)
|
||||
int acpi_unmap_cpu(int cpu)
|
||||
{
|
||||
ia64_cpu_to_sapicid[cpu] = -1;
|
||||
set_cpu_present(cpu, false);
|
||||
|
@ -910,8 +910,7 @@ int acpi_unmap_lsapic(int cpu)
|
|||
|
||||
return (0);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(acpi_unmap_lsapic);
|
||||
EXPORT_SYMBOL(acpi_unmap_cpu);
|
||||
#endif /* CONFIG_ACPI_HOTPLUG_CPU */
|
||||
|
||||
#ifdef CONFIG_ACPI_NUMA
|
||||
|
|
|
@ -750,13 +750,13 @@ static int _acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu)
|
|||
}
|
||||
|
||||
/* wrapper to silence section mismatch warning */
|
||||
int __ref acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu)
|
||||
int __ref acpi_map_cpu(acpi_handle handle, int physid, int *pcpu)
|
||||
{
|
||||
return _acpi_map_lsapic(handle, physid, pcpu);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_map_lsapic);
|
||||
EXPORT_SYMBOL(acpi_map_cpu);
|
||||
|
||||
int acpi_unmap_lsapic(int cpu)
|
||||
int acpi_unmap_cpu(int cpu)
|
||||
{
|
||||
#ifdef CONFIG_ACPI_NUMA
|
||||
set_apicid_to_node(per_cpu(x86_cpu_to_apicid, cpu), NUMA_NO_NODE);
|
||||
|
@ -768,8 +768,7 @@ int acpi_unmap_lsapic(int cpu)
|
|||
|
||||
return (0);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(acpi_unmap_lsapic);
|
||||
EXPORT_SYMBOL(acpi_unmap_cpu);
|
||||
#endif /* CONFIG_ACPI_HOTPLUG_CPU */
|
||||
|
||||
int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
|
||||
|
|
|
@ -170,7 +170,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
|
|||
acpi_status status;
|
||||
int ret;
|
||||
|
||||
if (pr->apic_id == -1)
|
||||
if (pr->phys_id == -1)
|
||||
return -ENODEV;
|
||||
|
||||
status = acpi_evaluate_integer(pr->handle, "_STA", NULL, &sta);
|
||||
|
@ -180,13 +180,13 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
|
|||
cpu_maps_update_begin();
|
||||
cpu_hotplug_begin();
|
||||
|
||||
ret = acpi_map_lsapic(pr->handle, pr->apic_id, &pr->id);
|
||||
ret = acpi_map_cpu(pr->handle, pr->phys_id, &pr->id);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
ret = arch_register_cpu(pr->id);
|
||||
if (ret) {
|
||||
acpi_unmap_lsapic(pr->id);
|
||||
acpi_unmap_cpu(pr->id);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,7 @@ static int acpi_processor_get_info(struct acpi_device *device)
|
|||
union acpi_object object = { 0 };
|
||||
struct acpi_buffer buffer = { sizeof(union acpi_object), &object };
|
||||
struct acpi_processor *pr = acpi_driver_data(device);
|
||||
int apic_id, cpu_index, device_declaration = 0;
|
||||
int phys_id, cpu_index, device_declaration = 0;
|
||||
acpi_status status = AE_OK;
|
||||
static int cpu0_initialized;
|
||||
unsigned long long value;
|
||||
|
@ -262,15 +262,18 @@ static int acpi_processor_get_info(struct acpi_device *device)
|
|||
pr->acpi_id = value;
|
||||
}
|
||||
|
||||
apic_id = acpi_get_apicid(pr->handle, device_declaration, pr->acpi_id);
|
||||
if (apic_id < 0)
|
||||
acpi_handle_debug(pr->handle, "failed to get CPU APIC ID.\n");
|
||||
pr->apic_id = apic_id;
|
||||
phys_id = acpi_get_phys_id(pr->handle, device_declaration, pr->acpi_id);
|
||||
if (phys_id < 0)
|
||||
acpi_handle_debug(pr->handle, "failed to get CPU physical ID.\n");
|
||||
pr->phys_id = phys_id;
|
||||
|
||||
cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id);
|
||||
cpu_index = acpi_map_cpuid(pr->phys_id, pr->acpi_id);
|
||||
if (!cpu0_initialized && !acpi_has_cpu_in_madt()) {
|
||||
cpu0_initialized = 1;
|
||||
/* Handle UP system running SMP kernel, with no LAPIC in MADT */
|
||||
/*
|
||||
* Handle UP system running SMP kernel, with no CPU
|
||||
* entry in MADT
|
||||
*/
|
||||
if ((cpu_index == -1) && (num_online_cpus() == 1))
|
||||
cpu_index = 0;
|
||||
}
|
||||
|
@ -458,7 +461,7 @@ static void acpi_processor_remove(struct acpi_device *device)
|
|||
|
||||
/* Remove the CPU. */
|
||||
arch_unregister_cpu(pr->id);
|
||||
acpi_unmap_lsapic(pr->id);
|
||||
acpi_unmap_cpu(pr->id);
|
||||
|
||||
cpu_hotplug_done();
|
||||
cpu_maps_update_done();
|
||||
|
|
|
@ -257,7 +257,7 @@ int acpi_bus_init_power(struct acpi_device *device)
|
|||
|
||||
device->power.state = ACPI_STATE_UNKNOWN;
|
||||
if (!acpi_device_is_present(device))
|
||||
return 0;
|
||||
return -ENXIO;
|
||||
|
||||
result = acpi_device_get_power(device, &state);
|
||||
if (result)
|
||||
|
|
|
@ -69,7 +69,7 @@ static int map_madt_entry(int type, u32 acpi_id)
|
|||
unsigned long madt_end, entry;
|
||||
static struct acpi_table_madt *madt;
|
||||
static int read_madt;
|
||||
int apic_id = -1;
|
||||
int phys_id = -1; /* CPU hardware ID */
|
||||
|
||||
if (!read_madt) {
|
||||
if (ACPI_FAILURE(acpi_get_table(ACPI_SIG_MADT, 0,
|
||||
|
@ -79,7 +79,7 @@ static int map_madt_entry(int type, u32 acpi_id)
|
|||
}
|
||||
|
||||
if (!madt)
|
||||
return apic_id;
|
||||
return phys_id;
|
||||
|
||||
entry = (unsigned long)madt;
|
||||
madt_end = entry + madt->header.length;
|
||||
|
@ -91,18 +91,18 @@ static int map_madt_entry(int type, u32 acpi_id)
|
|||
struct acpi_subtable_header *header =
|
||||
(struct acpi_subtable_header *)entry;
|
||||
if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) {
|
||||
if (!map_lapic_id(header, acpi_id, &apic_id))
|
||||
if (!map_lapic_id(header, acpi_id, &phys_id))
|
||||
break;
|
||||
} else if (header->type == ACPI_MADT_TYPE_LOCAL_X2APIC) {
|
||||
if (!map_x2apic_id(header, type, acpi_id, &apic_id))
|
||||
if (!map_x2apic_id(header, type, acpi_id, &phys_id))
|
||||
break;
|
||||
} else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) {
|
||||
if (!map_lsapic_id(header, type, acpi_id, &apic_id))
|
||||
if (!map_lsapic_id(header, type, acpi_id, &phys_id))
|
||||
break;
|
||||
}
|
||||
entry += header->length;
|
||||
}
|
||||
return apic_id;
|
||||
return phys_id;
|
||||
}
|
||||
|
||||
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)
|
|||
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
|
||||
union acpi_object *obj;
|
||||
struct acpi_subtable_header *header;
|
||||
int apic_id = -1;
|
||||
int phys_id = -1;
|
||||
|
||||
if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
|
||||
goto exit;
|
||||
|
@ -126,38 +126,38 @@ static int map_mat_entry(acpi_handle handle, int type, u32 acpi_id)
|
|||
|
||||
header = (struct acpi_subtable_header *)obj->buffer.pointer;
|
||||
if (header->type == ACPI_MADT_TYPE_LOCAL_APIC)
|
||||
map_lapic_id(header, acpi_id, &apic_id);
|
||||
map_lapic_id(header, acpi_id, &phys_id);
|
||||
else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC)
|
||||
map_lsapic_id(header, type, acpi_id, &apic_id);
|
||||
map_lsapic_id(header, type, acpi_id, &phys_id);
|
||||
else if (header->type == ACPI_MADT_TYPE_LOCAL_X2APIC)
|
||||
map_x2apic_id(header, type, acpi_id, &apic_id);
|
||||
map_x2apic_id(header, type, acpi_id, &phys_id);
|
||||
|
||||
exit:
|
||||
kfree(buffer.pointer);
|
||||
return apic_id;
|
||||
return phys_id;
|
||||
}
|
||||
|
||||
int acpi_get_apicid(acpi_handle handle, int type, u32 acpi_id)
|
||||
int acpi_get_phys_id(acpi_handle handle, int type, u32 acpi_id)
|
||||
{
|
||||
int apic_id;
|
||||
int phys_id;
|
||||
|
||||
apic_id = map_mat_entry(handle, type, acpi_id);
|
||||
if (apic_id == -1)
|
||||
apic_id = map_madt_entry(type, acpi_id);
|
||||
phys_id = map_mat_entry(handle, type, acpi_id);
|
||||
if (phys_id == -1)
|
||||
phys_id = map_madt_entry(type, acpi_id);
|
||||
|
||||
return apic_id;
|
||||
return phys_id;
|
||||
}
|
||||
|
||||
int acpi_map_cpuid(int apic_id, u32 acpi_id)
|
||||
int acpi_map_cpuid(int phys_id, u32 acpi_id)
|
||||
{
|
||||
#ifdef CONFIG_SMP
|
||||
int i;
|
||||
#endif
|
||||
|
||||
if (apic_id == -1) {
|
||||
if (phys_id == -1) {
|
||||
/*
|
||||
* On UP processor, there is no _MAT or MADT table.
|
||||
* So above apic_id is always set to -1.
|
||||
* So above phys_id is always set to -1.
|
||||
*
|
||||
* BIOS may define multiple CPU handles even for UP processor.
|
||||
* For example,
|
||||
|
@ -170,7 +170,7 @@ int acpi_map_cpuid(int apic_id, u32 acpi_id)
|
|||
* Processor (CPU3, 0x03, 0x00000410, 0x06) {}
|
||||
* }
|
||||
*
|
||||
* Ignores apic_id and always returns 0 for the processor
|
||||
* Ignores phys_id and always returns 0 for the processor
|
||||
* handle with acpi id 0 if nr_cpu_ids is 1.
|
||||
* This should be the case if SMP tables are not found.
|
||||
* Return -1 for other CPU's handle.
|
||||
|
@ -178,28 +178,28 @@ int acpi_map_cpuid(int apic_id, u32 acpi_id)
|
|||
if (nr_cpu_ids <= 1 && acpi_id == 0)
|
||||
return acpi_id;
|
||||
else
|
||||
return apic_id;
|
||||
return phys_id;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
for_each_possible_cpu(i) {
|
||||
if (cpu_physical_id(i) == apic_id)
|
||||
if (cpu_physical_id(i) == phys_id)
|
||||
return i;
|
||||
}
|
||||
#else
|
||||
/* In UP kernel, only processor 0 is valid */
|
||||
if (apic_id == 0)
|
||||
return apic_id;
|
||||
if (phys_id == 0)
|
||||
return phys_id;
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id)
|
||||
{
|
||||
int apic_id;
|
||||
int phys_id;
|
||||
|
||||
apic_id = acpi_get_apicid(handle, type, acpi_id);
|
||||
phys_id = acpi_get_phys_id(handle, type, acpi_id);
|
||||
|
||||
return acpi_map_cpuid(apic_id, acpi_id);
|
||||
return acpi_map_cpuid(phys_id, acpi_id);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(acpi_get_cpuid);
|
||||
|
|
|
@ -1001,7 +1001,7 @@ static void acpi_free_power_resources_lists(struct acpi_device *device)
|
|||
if (device->wakeup.flags.valid)
|
||||
acpi_power_resources_list_free(&device->wakeup.resources);
|
||||
|
||||
if (!device->flags.power_manageable)
|
||||
if (!device->power.flags.power_resources)
|
||||
return;
|
||||
|
||||
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)
|
|||
device->power.flags.power_resources)
|
||||
device->power.states[ACPI_STATE_D3_COLD].flags.os_accessible = 1;
|
||||
|
||||
if (acpi_bus_init_power(device)) {
|
||||
acpi_free_power_resources_lists(device);
|
||||
if (acpi_bus_init_power(device))
|
||||
device->flags.power_manageable = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void acpi_bus_get_flags(struct acpi_device *device)
|
||||
|
@ -2371,13 +2369,18 @@ static void acpi_bus_attach(struct acpi_device *device)
|
|||
/* Skip devices that are not present. */
|
||||
if (!acpi_device_is_present(device)) {
|
||||
device->flags.visited = false;
|
||||
device->flags.power_manageable = 0;
|
||||
return;
|
||||
}
|
||||
if (device->handler)
|
||||
goto ok;
|
||||
|
||||
if (!device->flags.initialized) {
|
||||
acpi_bus_update_power(device, NULL);
|
||||
device->flags.power_manageable =
|
||||
device->power.states[ACPI_STATE_D0].flags.valid;
|
||||
if (acpi_bus_init_power(device))
|
||||
device->flags.power_manageable = 0;
|
||||
|
||||
device->flags.initialized = true;
|
||||
}
|
||||
device->flags.visited = false;
|
||||
|
|
|
@ -522,6 +522,16 @@ static struct dmi_system_id video_dmi_table[] __initdata = {
|
|||
DMI_MATCH(DMI_PRODUCT_NAME, "370R4E/370R4V/370R5E/3570RE/370R5V"),
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
/* https://bugzilla.redhat.com/show_bug.cgi?id=1163574 */
|
||||
.callback = video_disable_native_backlight,
|
||||
.ident = "Dell XPS15 L521X",
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "XPS L521X"),
|
||||
},
|
||||
},
|
||||
{}
|
||||
};
|
||||
|
||||
|
|
|
@ -196,8 +196,8 @@ struct acpi_processor_flags {
|
|||
struct acpi_processor {
|
||||
acpi_handle handle;
|
||||
u32 acpi_id;
|
||||
u32 apic_id;
|
||||
u32 id;
|
||||
u32 phys_id; /* CPU hardware ID such as APIC ID for x86 */
|
||||
u32 id; /* CPU logical ID allocated by OS */
|
||||
u32 pblk;
|
||||
int performance_platform_limit;
|
||||
int throttling_platform_limit;
|
||||
|
@ -310,8 +310,8 @@ static inline int acpi_processor_get_bios_limit(int cpu, unsigned int *limit)
|
|||
#endif /* CONFIG_CPU_FREQ */
|
||||
|
||||
/* in processor_core.c */
|
||||
int acpi_get_apicid(acpi_handle, int type, u32 acpi_id);
|
||||
int acpi_map_cpuid(int apic_id, u32 acpi_id);
|
||||
int acpi_get_phys_id(acpi_handle, int type, u32 acpi_id);
|
||||
int acpi_map_cpuid(int phys_id, u32 acpi_id);
|
||||
int acpi_get_cpuid(acpi_handle, int type, u32 acpi_id);
|
||||
|
||||
/* in processor_pdc.c */
|
||||
|
|
|
@ -147,8 +147,8 @@ void acpi_numa_arch_fixup(void);
|
|||
|
||||
#ifdef CONFIG_ACPI_HOTPLUG_CPU
|
||||
/* Arch dependent functions for cpu hotplug support */
|
||||
int acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu);
|
||||
int acpi_unmap_lsapic(int cpu);
|
||||
int acpi_map_cpu(acpi_handle handle, int physid, int *pcpu);
|
||||
int acpi_unmap_cpu(int cpu);
|
||||
#endif /* CONFIG_ACPI_HOTPLUG_CPU */
|
||||
|
||||
int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base);
|
||||
|
|
Loading…
Reference in New Issue