linux-hardened/drivers/pnp
Rafael J. Wysocki 0294112ee3 ACPI / PNP: Reserve ACPI resources at the fs_initcall_sync stage
This effectively reverts the following three commits:

 7bc10388cc ACPI / resources: free memory on error in add_region_before()
 0f1b414d19 ACPI / PNP: Avoid conflicting resource reservations
 b9a5e5e18f ACPI / init: Fix the ordering of acpi_reserve_resources()

(commit b9a5e5e18f introduced regressions some of which, but not
all, were addressed by commit 0f1b414d19 and commit 7bc10388cc
was a fixup on top of the latter) and causes ACPI fixed hardware
resources to be reserved at the fs_initcall_sync stage of system
initialization.

The story is as follows.  First, a boot regression was reported due
to an apparent resource reservation ordering change after a commit
that shouldn't lead to such changes.  Investigation led to the
conclusion that the problem happened because acpi_reserve_resources()
was executed at the device_initcall() stage of system initialization
which wasn't strictly ordered with respect to driver initialization
(and with respect to the initialization of the pcieport driver in
particular), so a random change causing the device initcalls to be
run in a different order might break things.

The response to that was to attempt to run acpi_reserve_resources()
as soon as we knew that ACPI would be in use (commit b9a5e5e18f).
However, that turned out to be too early, because it caused resource
reservations made by the PNP system driver to fail on at least one
system and that failure was addressed by commit 0f1b414d19.

That fix still turned out to be insufficient, though, because
calling acpi_reserve_resources() before the fs_initcall stage of
system initialization caused a boot regression to happen on the
eCAFE EC-800-H20G/S netbook.  That meant that we only could call
acpi_reserve_resources() at the fs_initcall initialization stage
or later, but then we might just as well call it after the PNP
initalization in which case commit 0f1b414d19 wouldn't be
necessary any more.

For this reason, the changes made by commit 0f1b414d19 are reverted
(along with a memory leak fixup on top of that commit), the changes
made by commit b9a5e5e18f that went too far are reverted too and
acpi_reserve_resources() is changed into fs_initcall_sync, which
will cause it to be executed after the PNP subsystem initialization
(which is an fs_initcall) and before device initcalls (including
the pcieport driver initialization) which should avoid the initial
issue.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=100581
Link: http://marc.info/?t=143092384600002&r=1&w=2
Link: https://bugzilla.kernel.org/show_bug.cgi?id=99831
Link: http://marc.info/?t=143389402600001&r=1&w=2
Fixes: b9a5e5e18f "ACPI / init: Fix the ordering of acpi_reserve_resources()"
Reported-by: Roland Dreier <roland@purestorage.com>
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-07-06 23:52:21 +02:00
..
isapnp isapnp: switch to fixed_size_llseek() 2013-06-29 12:57:48 +04:00
pnpacpi PNP / ACPI: use unsigned int in pnpacpi_encode_resources() 2015-05-05 22:31:22 +02:00
pnpbios pnpbios: bail out on strange errors 2015-01-25 09:17:59 -08:00
base.h PNP: Convert pnp_lock into a mutex 2015-03-18 22:39:55 +01:00
card.c PNP: Convert pnp_lock into a mutex 2015-03-18 22:39:55 +01:00
core.c PNP: Avoid leaving unregistered device objects in lists 2015-03-18 22:40:04 +01:00
driver.c PNP: Convert pnp_lock into a mutex 2015-03-18 22:39:55 +01:00
interface.c PNP: replace strnicmp with strncasecmp 2014-10-14 02:18:25 +02:00
Kconfig PNP: remove old CONFIG_PNP_DEBUG option 2008-10-10 23:35:33 -04:00
Makefile PNP: Compile all pnp built-in stuff in one module namespace 2010-10-27 02:23:44 -04:00
manager.c pnp: restore automatic resolution of DMA conflicts 2013-05-22 00:21:02 +02:00
quirks.c PNP: Don't check for overlaps with unassigned PCI BARs 2015-03-12 12:30:00 -05:00
resource.c PNP: Switch from __check_region() to __request_region() 2015-01-22 01:14:50 +01:00
support.c PNPACPI: add bus number support 2010-03-14 20:08:38 -04:00
system.c ACPI / PNP: Reserve ACPI resources at the fs_initcall_sync stage 2015-07-06 23:52:21 +02:00