OpenCloudOS-Kernel/drivers
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
..
accessibility
acpi 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
amba
android
ata
atm
auxdisplay
base
bcma
block
bluetooth
bus drivers: bus: check cci device tree node status 2015-01-16 19:10:41 -08:00
cdrom
char ACPICA: Resources: Provide common part for struct acpi_resource_address structures. 2015-01-26 16:09:56 +01:00
clk clk: fix possible null pointer dereference 2015-01-17 11:33:57 -08:00
clocksource
connector
coresight
cpufreq
cpuidle
crypto
dca
devfreq
dio
dma dmaengine: dw: balance PM runtime calls 2015-01-13 23:07:58 +05:30
dma-buf
edac
eisa
extcon
firewire
firmware
fmc
gpio
gpu
hid
hsi
hv ACPICA: Resources: Provide common part for struct acpi_resource_address structures. 2015-01-26 16:09:56 +01:00
hwmon
hwspinlock
i2c
ide
idle
iio
infiniband
input
iommu
ipack
irqchip
isdn
leds leds: netxbig: fix oops at probe time 2015-01-13 13:49:01 -08:00
lguest
macintosh
mailbox
mcb
md
media
memory
memstick
message
mfd
misc Char/Misc driver fixes for 3.19-rc5 2015-01-17 08:18:08 +13:00
mmc mmc: sdhci: Set SDHCI_POWER_ON with external vmmc 2015-01-14 09:47:19 +01:00
mtd
net tg3: Release tp->lock before invoking synchronize_irq() 2015-01-14 17:05:51 -05:00
nfc
ntb
nubus
of
oprofile
parisc
parport
pci ACPI: Introduce acpi_unload_parent_table() usages in Linux kernel 2015-01-26 16:08:49 +01:00
pcmcia
phy
pinctrl
platform
pnp ACPICA: Resources: Provide common part for struct acpi_resource_address structures. 2015-01-26 16:09:56 +01:00
power
powercap
pps
ps3
ptp
pwm
rapidio
ras
regulator
remoteproc
reset reset: sunxi: fix spinlock initialization 2015-01-16 19:11:31 -08:00
rpmsg
rtc
s390
sbus
scsi
sfi
sh
sn
soc
spi
spmi
ssb
staging staging: vt6655: fix sparse warning: argument type 2015-01-12 19:49:47 -08:00
target
tc
thermal Merge branch 'thermal-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux 2015-01-15 19:20:26 +13:00
thunderbolt
tty
uio
usb usb: fixes for v3.19-rc6 2015-01-14 16:27:23 -08:00
uwb
vfio
vhost Merge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending 2015-01-13 15:23:26 +13:00
video fbdev/broadsheetfb: fix memory leak 2015-01-13 15:13:45 +02:00
virt
virtio
vlynq
vme
w1
watchdog
xen ACPICA: Resources: Provide common part for struct acpi_resource_address structures. 2015-01-26 16:09:56 +01:00
zorro
Kconfig
Makefile