WSL2-Linux-Kernel/drivers/gpio
Linus Walleij 2ba3154d9c gpio: pl061: move irqdomain initialization
The PL061 driver had the irqdomain initialization in an unfortunate
place: when used with device tree (and thus passing the base IRQ
0) the driver would work, as this registers an irqdomain and waits
for mappings to be done dynamically as the devices request their
IRQs, whereas when booting using platform data the irqdomain core
would attempt to allocate IRQ descriptors dynamically (which works
fine) but also to associate the irq_domain_associate_many() on all
IRQs, which in turn will call the mapping function which at this
point will try to set the type of the IRQ and then tries to acquire
a non-initialized spinlock yielding a backtrace like this:

CPU: 0 PID: 1 Comm: swapper Not tainted 3.13.0-rc1+ #652
Backtrace:
[<c0016f0c>] (dump_backtrace) from [<c00172ac>] (show_stack+0x18/0x1c)
 r6:c798ace0 r5:00000000 r4:c78257e0 r3:00200140
[<c0017294>] (show_stack) from [<c0329ea0>] (dump_stack+0x20/0x28)
[<c0329e80>] (dump_stack) from [<c004fa80>] (__lock_acquire+0x1c0/0x1b80)
[<c004f8c0>] (__lock_acquire) from [<c0051970>] (lock_acquire+0x6c/0x80)
 r10:00000000 r9:c0455234 r8:00000060 r7:c047d798 r6:600000d3 r5:00000000
 r4:c782c000
[<c0051904>] (lock_acquire) from [<c032e484>] (_raw_spin_lock_irqsave+0x60/0x74)
 r6:c01a1100 r5:800000d3 r4:c798acd0
[<c032e424>] (_raw_spin_lock_irqsave) from [<c01a1100>] (pl061_irq_type+0x28/0x)
 r6:00000000 r5:00000000 r4:c798acd0
[<c01a10d8>] (pl061_irq_type) from [<c0059ef4>] (__irq_set_trigger+0x70/0x104)
 r6:00000000 r5:c01a10d8 r4:c046da1c r3:c01a10d8
[<c0059e84>] (__irq_set_trigger) from [<c005b348>] (irq_set_irq_type+0x40/0x60)
 r10:c043240c r8:00000060 r7:00000000 r6:c046da1c r5:00000060 r4:00000000
[<c005b308>] (irq_set_irq_type) from [<c01a1208>] (pl061_irq_map+0x40/0x54)
 r6:c79693c0 r5:c798acd0 r4:00000060
[<c01a11c8>] (pl061_irq_map) from [<c005d27c>] (irq_domain_associate+0xc0/0x190)
 r5:00000060 r4:c046da1c
[<c005d1bc>] (irq_domain_associate) from [<c005d604>] (irq_domain_associate_man)
 r8:00000008 r7:00000000 r6:c79693c0 r5:00000060 r4:00000000
[<c005d5d0>] (irq_domain_associate_many) from [<c005d864>] (irq_domain_add_simp)
 r8:c046578c r7:c035b72c r6:c79693c0 r5:00000060 r4:00000008 r3:00000008
[<c005d814>] (irq_domain_add_simple) from [<c01a1380>] (pl061_probe+0xc4/0x22c)
 r6:00000060 r5:c0464380 r4:c798acd0
[<c01a12bc>] (pl061_probe) from [<c01c0450>] (amba_probe+0x74/0xe0)
 r10:c043240c r9:c0455234 r8:00000000 r7:c047d7f8 r6:c047d744 r5:00000000
 r4:c0464380

This moves the irqdomain initialization to a point where the spinlock
and GPIO chip are both fully propulated, so the callbacks can be used
without crashes.

I had some problem reproducing the crash, as the devm_kzalloc():ed
zeroed memory would seemingly mask the spinlock as something OK,
but by poisoning the lock like this:

u32 *dum;
dum = (u32 *) &chip->lock;
*dum = 0xaaaaaaaaU;

I could reproduce, fix and test the patch.

Reported-by: Russell King <linux@arm.linux.org.uk>
Cc: Rob Herring <robherring2@gmail.com>
Cc: Haojian Zhuang <haojian.zhuang@linaro.org>
Cc: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-11-27 14:13:50 +01:00
..
Kconfig GPIO bulk changes for the v3.13 development cycle 2013-11-12 15:50:46 +09:00
Makefile GPIO bulk changes for the v3.13 development cycle 2013-11-12 15:50:46 +09:00
devres.c gpiolib: devres: add missing headers 2013-10-29 18:26:14 -07:00
gpio-74x164.c gpio: gpio-74x164: Remove redundant of_match_ptr 2013-09-23 12:52:21 +02:00
gpio-adnp.c gpio: adnp: rename "virq" to "child_irq" 2013-10-16 09:59:10 +02:00
gpio-adp5520.c gpio: use dev_get_platdata() 2013-08-16 15:24:35 +02:00
gpio-adp5588.c gpio: use dev_get_platdata() 2013-08-16 15:24:35 +02:00
gpio-amd8111.c
gpio-arizona.c gpio: arizona: Use the of_node from the Arizona device 2013-10-02 12:50:35 +02:00
gpio-bcm-kona.c gpio: bcm-kona: add missing .owner to struct gpio_chip 2013-10-30 11:23:00 -07:00
gpio-bt8xx.c gpio: bt8xx: remove unnecessary pci_set_drvdata() 2013-09-20 20:43:09 +02:00
gpio-clps711x.c gpio: clps711x: Remove redundant of_match_ptr 2013-10-02 12:43:25 +02:00
gpio-cs5535.c gpio: remove use of __devexit 2012-11-28 11:39:59 -08:00
gpio-da9052.c gpio: use dev_get_platdata() 2013-08-16 15:24:35 +02:00
gpio-da9055.c gpio: use dev_get_platdata() 2013-08-16 15:24:35 +02:00
gpio-davinci.c gpio: davinci: move to platform device 2013-09-24 10:31:51 +05:30
gpio-em.c gpio: em: drop references to "virtual" IRQ 2013-10-16 09:59:41 +02:00
gpio-ep93xx.c gpio: ep93xx: get rid of bogus __raw* accessors 2013-10-16 09:59:54 +02:00
gpio-f7188x.c gpio: add GPIO support for F71882FG and F71889F 2013-08-30 09:25:52 +02:00
gpio-ge.c
gpio-generic.c GPIO: gpio-generic: remove kfree() from bgpio_remove call 2013-04-11 19:33:54 +02:00
gpio-grgpio.c gpio: grgpio: Staticize local symbols 2013-06-19 21:40:38 +02:00
gpio-ich.c gpio: use dev_get_platdata() 2013-08-16 15:24:35 +02:00
gpio-intel-mid.c gpio: intel-mid: drop references to "virtual" IRQ 2013-10-16 09:59:51 +02:00
gpio-iop.c ARM: plat-iop: pass physical base for GPIO 2013-09-20 23:05:19 +02:00
gpio-it8761e.c
gpio-janz-ttl.c gpio: use dev_get_platdata() 2013-08-16 15:24:35 +02:00
gpio-kempld.c gpio: Fix bit masking in Kontron PLD GPIO driver 2013-08-16 17:56:53 +02:00
gpio-ks8695.c
gpio-lpc32xx.c gpio: lpc32xx: Include linux/of.h header 2013-10-16 13:09:10 +02:00
gpio-lynxpoint.c Linux 3.12-rc6 2013-10-19 23:24:03 +02:00
gpio-max730x.c gpio: use dev_get_platdata() 2013-08-16 15:24:35 +02:00
gpio-max732x.c gpio: use dev_get_platdata() 2013-08-16 15:24:35 +02:00
gpio-max7300.c gpio: max7300: use devm_kzalloc() 2013-03-27 16:05:11 +01:00
gpio-max7301.c gpio: max7301: Reverting "Do not force SPI speed when using OF Platform" 2013-08-23 19:44:28 +02:00
gpio-mc9s08dz60.c
gpio-mc33880.c gpio: gpio-mc33880: Remove redundant spi_set_drvdata 2013-09-23 12:53:13 +02:00
gpio-mcp23s08.c gpio: mcp23s08: rename the device tree property 2013-08-30 09:25:52 +02:00
gpio-ml-ioh.c gpio-ml-ioh: fix error return code in ioh_gpio_probe() 2013-05-30 19:39:20 +02:00
gpio-mm-lantiq.c
gpio-mpc8xxx.c DeviceTree updates for 3.13. This is a bit larger pull request than 2013-11-12 16:52:17 +09:00
gpio-mpc5200.c
gpio-msic.c gpio: use dev_get_platdata() 2013-08-16 15:24:35 +02:00
gpio-msm-v1.c gpio_msm: Fix build error due to missing err.h 2013-07-31 00:34:31 +02:00
gpio-msm-v2.c gpio: msm: make msm_gpio.summary_irq signed for error handling 2013-11-25 09:03:12 +01:00
gpio-mvebu.c gpio: mvebu: make mvchip->irqbase signed for error handling 2013-11-25 09:03:12 +01:00
gpio-mxc.c gpio/mxc: add chained_irq_enter/exit() to mx2_gpio_irq_handler 2013-08-16 15:19:11 +02:00
gpio-mxs.c gpio: gpio-mxs: Remove unneeded dt checks 2013-11-06 10:51:24 +01:00
gpio-octeon.c gpio MIPS/OCTEON: Add a driver for OCTEON's on-chip GPIO pins. 2013-08-26 15:33:40 +02:00
gpio-omap.c gpio/omap: use gpiolib API to mark a GPIO used as an IRQ 2013-10-16 10:06:00 +02:00
gpio-palmas.c gpio: palmas: add support for TPS80036 2013-09-19 15:31:48 +02:00
gpio-pca953x.c gpio: pca953x: Don't flip bits on PCA957x GPIO expanders when probing them. 2013-09-23 12:57:11 +02:00
gpio-pcf857x.c gpio: pcf857x: Add OF support 2013-09-23 20:00:01 +02:00
gpio-pch.c gpio: Don't override the error code in probe error handling 2013-05-20 20:27:30 +02:00
gpio-pl061.c gpio: pl061: move irqdomain initialization 2013-11-27 14:13:50 +01:00
gpio-pxa.c gpio: pxa: remove dead code 2013-07-21 18:14:20 +02:00
gpio-rc5t583.c gpio: remove use of __devexit 2012-11-28 11:39:59 -08:00
gpio-rcar.c gpio: rcar: NULL dereference on error in probe() 2013-11-25 09:03:12 +01:00
gpio-rdc321x.c gpio: use dev_get_platdata() 2013-08-16 15:24:35 +02:00
gpio-sa1100.c ARM: 7841/1: sa1100: remove complex GPIO interface 2013-10-29 11:01:02 +00:00
gpio-samsung.c ARM: SoC DT updates for 3.13 2013-11-11 17:34:56 +09:00
gpio-sch.c gpio: Don't override the error code in probe error handling 2013-05-20 20:27:30 +02:00
gpio-sodaville.c
gpio-spear-spics.c drivers/gpio: simplify use of devm_ioremap_resource 2013-08-16 17:16:31 +02:00
gpio-sta2x11.c gpio: use dev_get_platdata() 2013-08-16 15:24:35 +02:00
gpio-stmpe.c gpio: stmpe: drop references to "virtual" IRQ, fix bug 2013-10-16 09:59:53 +02:00
gpio-stp-xway.c gpio: gpio-stp-xway.c: fix checkpatch error 2013-03-27 16:05:16 +01:00
gpio-sx150x.c gpio: use dev_get_platdata() 2013-08-16 15:24:35 +02:00
gpio-tb10x.c gpio: tb10x: Set output value before setting direction to output 2013-11-25 09:02:29 +01:00
gpio-tc3589x.c gpio: tc3589x: drop references to "virtual" IRQ 2013-10-11 19:06:12 +02:00
gpio-tegra.c gpio: tegra: use new gpio_lock_as_irq() API 2013-10-17 10:51:53 +02:00
gpio-timberdale.c gpio: use dev_get_platdata() 2013-08-16 15:24:35 +02:00
gpio-tnetv107x.c ARM: davinci: gpio: use gpiolib API instead of inline functions 2013-09-25 04:16:37 +05:30
gpio-tps6586x.c This is the MFD patch set for the 3.8 merge window. 2012-12-16 18:55:20 -08:00
gpio-tps65910.c gpio: gpio-tps65910.c: fix checkpatch error 2013-03-27 16:05:18 +01:00
gpio-tps65912.c gpio: use dev_get_platdata() 2013-08-16 15:24:35 +02:00
gpio-ts5500.c gpio: use dev_get_platdata() 2013-08-16 15:24:35 +02:00
gpio-twl4030.c gpio: twl4030: Remove redundant of_match_ptr 2013-10-02 12:44:34 +02:00
gpio-twl6040.c GPIO: gpio-twl6040: Remove support for legacy (pdata) mode 2013-07-20 21:38:18 +02:00
gpio-tz1090-pdc.c gpio-tz1090-pdc: add TZ1090 PDC gpio driver 2013-07-20 19:03:48 +02:00
gpio-tz1090.c gpio-tz1090: convert to use generic irqchip 2013-07-20 19:05:15 +02:00
gpio-ucb1400.c gpio: ucb1400: Add MODULE_ALIAS 2013-11-25 09:03:13 +01:00
gpio-viperboard.c gpio: Don't override the error code in probe error handling 2013-05-20 20:27:30 +02:00
gpio-vr41xx.c gpio: remove use of __devexit 2012-11-28 11:39:59 -08:00
gpio-vx855.c gpio: vx855: remove unnecessary platform_set_drvdata() 2013-05-30 19:20:21 +02:00
gpio-wm831x.c gpio: use dev_get_platdata() 2013-08-16 15:24:35 +02:00
gpio-wm8350.c gpio: use dev_get_platdata() 2013-08-16 15:24:35 +02:00
gpio-wm8994.c gpio: use dev_get_platdata() 2013-08-16 15:24:35 +02:00
gpio-xilinx.c GPIO: xilinx: Use BIT macro 2013-06-17 07:47:33 +02:00
gpiolib-acpi.c gpiolib / ACPI: allow passing GPIOF_ACTIVE_LOW for GpioInt resources 2013-10-19 23:32:14 +02:00
gpiolib-of.c GPIO bulk changes for the v3.13 development cycle 2013-11-12 15:50:46 +09:00
gpiolib.c gpiolib: fix of_find_gpio() when OF not defined 2013-11-25 09:03:13 +01:00