Linux GPIO subsystem development
 help / color / mirror / Atom feed
* [PATCH v5] gpio: mvebu: fix Armada XP per-CPU mask register save/restore
@ 2026-11-26  0:13 Rosen Penev
  2026-11-26 14:46 ` Bartosz Golaszewski
  0 siblings, 1 reply; 2+ messages in thread
From: Rosen Penev @ 2026-11-26  0:13 UTC (permalink / raw)
  To: linux-gpio
  Cc: Linus Walleij, Bartosz Golaszewski, Thomas Petazzoni,
	Alexandre Courbot, stable

The Armada XP variant keeps the per-CPU edge/level mask registers in a
second I/O window (percpu_regs) rather than in the main GPIO window.
The suspend and resume paths however read and wrote them through
mvchip->regs with the per-CPU offsets, which hits unrelated registers
in the main window (including the global GPIO_EDGE_MASK /
GPIO_LEVEL_MASK registers) instead. The per-CPU mask state was
therefore never saved or restored, so interrupts the kernel had
unmasked could stay masked after resume, while the main window was
written with per-CPU mask values.

Use mvchip->percpu_regs for the Armada XP per-CPU mask registers in
both the suspend save and the resume restore paths, matching the
mask/unmask handlers and the probe-time masking.

Fixes: b5b7b487431b ("gpio: mvebu: add suspend/resume support")
Cc: stable@vger.kernel.org
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 v5: rebase onto gpio/for-next (on top of 02af7eac17bc "gpio: mvebu: keep
     resume masks within the irqchip cache"); reword the impact paragraph
     since that commit already confines the resume masks to the irqchip cache
 v4: rebase again
 v3: rebase again
 v2: rebase
 drivers/gpio/gpio-mvebu.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index 46604093a01e..a9e6e7a63495 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -1031,10 +1031,10 @@ static int mvebu_gpio_suspend(struct platform_device *pdev, pm_message_t state)
 		break;
 	case MVEBU_GPIO_SOC_VARIANT_ARMADAXP:
 		for (i = 0; i < 4; i++) {
-			regmap_read(mvchip->regs,
+			regmap_read(mvchip->percpu_regs,
 				    GPIO_EDGE_MASK_ARMADAXP_OFF(i),
 				    &mvchip->edge_mask_regs[i]);
-			regmap_read(mvchip->regs,
+			regmap_read(mvchip->percpu_regs,
 				    GPIO_LEVEL_MASK_ARMADAXP_OFF(i),
 				    &mvchip->level_mask_regs[i]);
 		}
@@ -1104,10 +1104,10 @@ static int mvebu_gpio_resume(struct platform_device *pdev)
 		break;
 	case MVEBU_GPIO_SOC_VARIANT_ARMADAXP:
 		for (i = 0; i < 4; i++) {
-			regmap_write(mvchip->regs,
+			regmap_write(mvchip->percpu_regs,
 				     GPIO_EDGE_MASK_ARMADAXP_OFF(i),
 				     mvchip->edge_mask_regs[i] & edge_cache);
-			regmap_write(mvchip->regs,
+			regmap_write(mvchip->percpu_regs,
 				     GPIO_LEVEL_MASK_ARMADAXP_OFF(i),
 				     mvchip->level_mask_regs[i] & level_cache);
 		}
-- 
2.56.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v5] gpio: mvebu: fix Armada XP per-CPU mask register save/restore
  2026-11-26  0:13 [PATCH v5] gpio: mvebu: fix Armada XP per-CPU mask register save/restore Rosen Penev
@ 2026-11-26 14:46 ` Bartosz Golaszewski
  0 siblings, 0 replies; 2+ messages in thread
From: Bartosz Golaszewski @ 2026-11-26 14:46 UTC (permalink / raw)
  To: linux-gpio, Rosen Penev
  Cc: Bartosz Golaszewski, Linus Walleij, Bartosz Golaszewski,
	Thomas Petazzoni, Alexandre Courbot, stable


On Wed, 25 Nov 2026 16:13:23 -0800, Rosen Penev wrote:
> The Armada XP variant keeps the per-CPU edge/level mask registers in a
> second I/O window (percpu_regs) rather than in the main GPIO window.
> The suspend and resume paths however read and wrote them through
> mvchip->regs with the per-CPU offsets, which hits unrelated registers
> in the main window (including the global GPIO_EDGE_MASK /
> GPIO_LEVEL_MASK registers) instead. The per-CPU mask state was
> therefore never saved or restored, so interrupts the kernel had
> unmasked could stay masked after resume, while the main window was
> written with per-CPU mask values.
> 
> [...]

Applied, thanks!

[1/1] gpio: mvebu: fix Armada XP per-CPU mask register save/restore
      https://git.kernel.org/brgl/c/d8e27d04274746093f8d5a4e909efd9885262166

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-26 14:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26  0:13 [PATCH v5] gpio: mvebu: fix Armada XP per-CPU mask register save/restore Rosen Penev
2026-11-26 14:46 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox