linux/include/acpi
Lv Zheng 0d0988af81 ACPICA: Events: Introduce ACPI_GPE_DISPATCH_RAW_HANDLER to fix 2 issues for the current GPE APIs
ACPICA commit 199cad16530a45aea2bec98e528866e20c5927e1

Since whether the GPE should be disabled/enabled/cleared should only be
determined by the GPE driver's state machine:
1. GPE should be disabled if the driver wants to switch to the GPE polling
   mode when a GPE storm condition is indicated and should be enabled if
   the driver wants to switch back to the GPE interrupt mode when all of
   the storm conditions are cleared. The conditions should be protected by
   the driver's specific lock.
2. GPE should be enabled if the driver has accepted more than one request
   and should be disabled if the driver has completed all of the requests.
   The request count should be protected by the driver's specific lock.
3. GPE should be cleared either when the driver is about to handle an edge
   triggered GPE or when the driver has completed to handle a level
   triggered GPE. The handling code should be protected by the driver's
   specific lock.
Thus the GPE enabling/disabling/clearing operations are likely to be
performed with the driver's specific lock held while we currently cannot do
this. This is because:
1. We have the acpi_gbl_gpe_lock held before invoking the GPE driver's
   handler. Driver's specific lock is likely to be held inside of the
   handler, thus we can see some dead lock issues due to the reversed
   locking order or recursive locking. In order to solve such dead lock
   issues, we need to unlock the acpi_gbl_gpe_lock before invoking the
   handler. BZ 1100.
2. Since GPE disabling/enabling/clearing should be determined by the GPE
   driver's state machine, we shouldn't perform such operations inside of
   ACPICA for a GPE handler to mess up the driver's state machine. BZ 1101.

Originally this patch includes a logic to flush GPE handlers, it is dropped
due to the following reasons:
1. This is a different issue;
2. Linux OSL has fixed this by flushing SCI in acpi_os_wait_events_complete().
We will pick up this topic when the Linux OSL fix turns out to be not
sufficient.

Note that currently the internal operations and the acpi_gbl_gpe_lock are
also used by ACPI_GPE_DISPATCH_METHOD and ACPI_GPE_DISPATCH_NOTIFY. In
order not to introduce regressions, we add one
ACPI_GPE_DISPATCH_RAW_HANDLER type to be distiguished from
ACPI_GPE_DISPATCH_HANDLER. For which the acpi_gbl_gpe_lock is unlocked before
invoking the GPE handler and the internal enabling/disabling operations are
bypassed to allow drivers to perform them at a proper position using the
GPE APIs and ACPI_GPE_DISPATCH_RAW_HANDLER users should invoke acpi_set_gpe()
instead of acpi_enable_gpe()/acpi_disable_gpe() to bypass the internal GPE
clearing code in acpi_enable_gpe(). Lv Zheng.

Known issues:
1. Edge-triggered GPE lost for frequent enablings
   On some buggy silicon platforms, GPE enable line may not be directly
   wired to the GPE trigger line. In that case, when GPE enabling is
   frequently performed for edge-triggered GPEs, GPE status may stay set
   without being triggered.
   This patch may maginify this problem as it allows GPE enabling to be
   parallel performed during the process the GPEs are handled.
   This is an existing issue, because:
   1. For task context:
      Current ACPI_GPE_DISPATCH_METHOD practices have proven that this
      isn't a real issue - we can re-enable edge-triggered GPE in a work
      queue where the GPE status bit might already be set.
   2. For IRQ context:
      This can even happen when the GPE enabling occurs before returning
      from the GPE handler and after unlocking the GPE lock.
   Thus currently no code is included to protect this.

Link: https://github.com/acpica/acpica/commit/199cad16
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-02-05 15:34:51 +01:00
..
platform ACPICA: Update Copyright headers to 2015 2015-02-05 15:31:43 +01:00
acbuffer.h ACPICA: Update Copyright headers to 2015 2015-02-05 15:31:43 +01:00
acconfig.h ACPICA: Update Copyright headers to 2015 2015-02-05 15:31:43 +01:00
acexcep.h ACPICA: Update Copyright headers to 2015 2015-02-05 15:31:43 +01:00
acnames.h ACPICA: Update Copyright headers to 2015 2015-02-05 15:31:43 +01:00
acoutput.h ACPICA: Update Copyright headers to 2015 2015-02-05 15:31:43 +01:00
acpi.h ACPICA: Update Copyright headers to 2015 2015-02-05 15:31:43 +01:00
acpi_bus.h Merge branches 'acpi-scan', 'acpi-utils' and 'acpi-pm' 2014-12-18 18:42:56 +01:00
acpi_drivers.h ACPI / PCI: Stub out pci_acpi_crs_quirks() and make it x86 specific 2014-05-07 01:09:47 +02:00
acpi_io.h ACPI: Clean up acpi_os_map/unmap_memory() to eliminate __iomem. 2014-05-27 18:13:08 +02:00
acpi_numa.h ACPI / numa: Make __acpi_map_pxm_to_node(), acpi_get_pxm() static 2014-02-03 10:39:38 -07:00
acpiosxf.h ACPICA: Update Copyright headers to 2015 2015-02-05 15:31:43 +01:00
acpixf.h ACPICA: Events: Introduce ACPI_GPE_DISPATCH_RAW_HANDLER to fix 2 issues for the current GPE APIs 2015-02-05 15:34:51 +01:00
acrestyp.h ACPICA: Update Copyright headers to 2015 2015-02-05 15:31:43 +01:00
actbl.h ACPICA: Update Copyright headers to 2015 2015-02-05 15:31:43 +01:00
actbl1.h ACPICA: Update Copyright headers to 2015 2015-02-05 15:31:43 +01:00
actbl2.h ACPICA: Update Copyright headers to 2015 2015-02-05 15:31:43 +01:00
actbl3.h ACPICA: Update Copyright headers to 2015 2015-02-05 15:31:43 +01:00
actypes.h ACPICA: Events: Introduce ACPI_GPE_DISPATCH_RAW_HANDLER to fix 2 issues for the current GPE APIs 2015-02-05 15:34:51 +01:00
apei.h acpi, apei, ghes: Factor out ioremap virtual memory for IRQ and NMI context. 2014-07-22 15:05:06 -07:00
button.h ACPI: make ACPI button funcs no-ops if not built in 2009-09-17 14:48:23 -07:00
ghes.h ACPICA: Restore error table definitions to reduce code differences between Linux and ACPICA upstream. 2014-06-16 22:33:50 +02:00
hed.h ACPI Hardware Error Device (PNP0C33) support 2010-05-19 22:40:24 -04:00
pdc_intel.h ACPI: Enable bit 11 in _PDC to advertise hw coord 2009-02-07 00:41:14 -05:00
processor.h ACPI / processor: Convert apic_id to phys_id to make it arch agnostic 2015-01-05 23:32:42 +01:00
reboot.h Add the ability to reset the machine using the RESET_REG in ACPI's FADT table. 2008-07-16 23:27:08 +02:00
video.h ACPI / i915: ignore firmware requests for backlight change 2014-07-07 23:38:05 +02:00