diff mbox series

gpiolib: Don't implicitly disable irq when masking

Message ID 20230510001151.3946931-1-chris.packham@alliedtelesis.co.nz
State New
Headers show
Series gpiolib: Don't implicitly disable irq when masking | expand

Commit Message

Chris Packham May 10, 2023, 12:11 a.m. UTC
When preparing to kexec into a new kernel the kexec code will mask all
interrupts for all interrupt domains before disabling them. In the case
of a gpio chip which has a mix of gpio and irq pins a warning would be
triggered as follows

  [root@localhost ~]# echo c >/proc/sysrq-trigger
  [  175.677728] sysrq: Trigger a crash
  <snip expected dump from SysRq>
  [  175.803409] WARNING: CPU: 1 PID: 2345 at drivers/gpio/gpiolib.c:3284 gpiochip_disable_irq+0x68/0xac
  [  175.918321] CPU: 1 PID: 2345 Comm: sh Kdump: loaded Tainted: G           O      5.15.109+ #5
  [  175.926742] Hardware name: Allied Telesis x240-26GHXm (DT)
  [  175.932216] pstate: 804000c9 (Nzcv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
  [  175.939165] pc : gpiochip_disable_irq+0x68/0xac
  [  175.943686] lr : gpiochip_disable_irq+0x58/0xac
  [  175.948208] sp : ffff80000c03ba00
  [  175.951513] x29: ffff80000c03ba00 x28: ffff00002843c4c0 x27: 0000000000000000
  [  175.958638] x26: 0000000000000000 x25: ffff800008df0790 x24: 0000000000000000
  [  175.965763] x23: ffff8000095397f0 x22: ffff800009485178 x21: ffff000016ea38f0
  [  175.972888] x20: ffff000016ea3a20 x19: ffff000016073cc0 x18: ffffffffffffffff
  [  175.980012] x17: 20204f2020202020 x16: 2020202020204720 x15: ffff80008c03b667
  [  175.987136] x14: 0000000000000000 x13: ffff800009415148 x12: 0000000000000555
  [  175.994260] x11: 00000000000001c7 x10: ffff800009415148 x9 : ffff800009415148
  [  176.001385] x8 : 00000000ffffefff x7 : ffff80000946d148 x6 : ffff80000946d148
  [  176.008510] x5 : ffff00003fdc59a0 x4 : 0000000000000000 x3 : 0000000000000000
  [  176.015634] x2 : 0000000000000000 x1 : 0000000000000000 x0 : 0000000000000007
  [  176.022757] Call trace:
  [  176.025197]  gpiochip_disable_irq+0x68/0xac
  [  176.029373]  gpiochip_irq_mask+0x30/0x40
  [  176.033289]  machine_crash_shutdown+0xb4/0x11c
  [  176.037727]  __crash_kexec+0x88/0x16c
  [  176.041384]  panic+0x194/0x348
  [  176.044433]  sysrq_reset_seq_param_set+0x0/0x90
  [  176.048954]  __handle_sysrq+0x8c/0x1a0
  [  176.052695]  write_sysrq_trigger+0x88/0xc0
  [  176.056783]  proc_reg_write+0xa8/0x100
  [  176.060527]  vfs_write+0xf0/0x290
  [  176.063835]  ksys_write+0x68/0xf4
  [  176.067144]  __arm64_sys_write+0x1c/0x2c
  [  176.071058]  invoke_syscall+0x48/0x114
  [  176.074800]  el0_svc_common.constprop.0+0x44/0xfc
  [  176.079495]  do_el0_svc+0x28/0xa0
  [  176.082803]  el0_svc+0x28/0x80
  [  176.085851]  el0t_64_sync_handler+0xa4/0x130
  [  176.090112]  el0t_64_sync+0x1a0/0x1a4
  [  176.093768] ---[ end trace 486d53a4eb15ab42 ]---
  <more warnings for each gpio pin that is not used as an interrupt>

This is because gpiochip_irq_mask was being used to mask all possible
irqs in the domain but gpiochip_disable_irq will WARN if any of those
gpios haven't been requested as interrupts yet. Remove the call to
gpiochip_disable_irq to stop the warning.

Fixes: a8173820f441 ("gpio: gpiolib: Allow GPIO IRQs to lazy disable")
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
 drivers/gpio/gpiolib.c | 1 -
 1 file changed, 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 8c041a8dd9d8..903f5185ae55 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1451,7 +1451,6 @@  static void gpiochip_irq_mask(struct irq_data *d)
 
 	if (gc->irq.irq_mask)
 		gc->irq.irq_mask(d);
-	gpiochip_disable_irq(gc, d->hwirq);
 }
 
 static void gpiochip_irq_unmask(struct irq_data *d)