]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.14.44/acpi-init-fix-the-ordering-of-acpi_reserve_resources.patch
drop queue-4.14/mips-make-sure-dt-memory-regions-are-valid.patch
[thirdparty/kernel/stable-queue.git] / releases / 3.14.44 / acpi-init-fix-the-ordering-of-acpi_reserve_resources.patch
1 From b9a5e5e18fbf223502c0b2264c15024e393da928 Mon Sep 17 00:00:00 2001
2 From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
3 Date: Thu, 7 May 2015 21:19:39 +0200
4 Subject: ACPI / init: Fix the ordering of acpi_reserve_resources()
5
6 From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
7
8 commit b9a5e5e18fbf223502c0b2264c15024e393da928 upstream.
9
10 Since acpi_reserve_resources() is defined as a device_initcall(),
11 there's no guarantee that it will be executed in the right order
12 with respect to the rest of the ACPI initialization code. On some
13 systems this leads to breakage if, for example, the address range
14 that should be reserved for the ACPI fixed registers is given to
15 the PCI host bridge instead if the race is won by the wrong code
16 path.
17
18 Fix this by turning acpi_reserve_resources() into a void function
19 and calling it directly from within the ACPI initialization sequence.
20
21 Reported-and-tested-by: George McCollister <george.mccollister@gmail.com>
22 Link: http://marc.info/?t=143092384600002&r=1&w=2
23 Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25
26 ---
27 drivers/acpi/osl.c | 6 ++----
28 1 file changed, 2 insertions(+), 4 deletions(-)
29
30 --- a/drivers/acpi/osl.c
31 +++ b/drivers/acpi/osl.c
32 @@ -172,7 +172,7 @@ static void __init acpi_request_region (
33 request_mem_region(addr, length, desc);
34 }
35
36 -static int __init acpi_reserve_resources(void)
37 +static void __init acpi_reserve_resources(void)
38 {
39 acpi_request_region(&acpi_gbl_FADT.xpm1a_event_block, acpi_gbl_FADT.pm1_event_length,
40 "ACPI PM1a_EVT_BLK");
41 @@ -201,10 +201,7 @@ static int __init acpi_reserve_resources
42 if (!(acpi_gbl_FADT.gpe1_block_length & 0x1))
43 acpi_request_region(&acpi_gbl_FADT.xgpe1_block,
44 acpi_gbl_FADT.gpe1_block_length, "ACPI GPE1_BLK");
45 -
46 - return 0;
47 }
48 -device_initcall(acpi_reserve_resources);
49
50 void acpi_os_printf(const char *fmt, ...)
51 {
52 @@ -1792,6 +1789,7 @@ acpi_status __init acpi_os_initialize(vo
53
54 acpi_status __init acpi_os_initialize1(void)
55 {
56 + acpi_reserve_resources();
57 kacpid_wq = alloc_workqueue("kacpid", 0, 1);
58 kacpi_notify_wq = alloc_workqueue("kacpi_notify", 0, 1);
59 kacpi_hotplug_wq = alloc_ordered_workqueue("kacpi_hotplug", 0);