All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] drm/imagination: Hard reset fixes for META firmware cores
@ 2026-11-25 23:26 Ryan Brue
  2026-11-25 23:26 ` [PATCH 1/2] drm/imagination: Report firmware page faults Ryan Brue
  2026-11-25 23:26 ` [PATCH 2/2] drm/imagination: Don't wait for a running META to idle on a hard reset Ryan Brue
  0 siblings, 2 replies; 4+ messages in thread
From: Ryan Brue @ 2026-11-25 23:26 UTC (permalink / raw)
  To: Alessio Belle, Luigi Santivetti, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Donald Robson,
	Sarah Walker
  Cc: imagination, dri-devel, linux-kernel, Ryan Brue

Two fixes found while chasing GPU freezes on an MT8173 tablet (GX6250,
BVNC 4.40.2.51, META firmware processor).

The firmware reports page faults of its own with FWCCB command 112,
which the driver logs as unknown and drops; patch 1 logs the address.

Patch 2: every hard reset on this core ended with "GPU device lost".
pvr_fw_stop() waits for the Garten wrapper to go idle, and a META that
was not asked to idle first keeps it busy; all the other idle polls
pass. Skipping that one wait on a hard reset, as the driver already does
when a debugger has halted META, lets the soft reset that follows stop
the core. Other firmware processors, and the other polls, are
unchanged.

On the board, with lockdep and a local debug hook that forces a hard
reset from the watchdog under glmark2, every hard reset recovered
without losing the device: 13 forced and 8 that the watchdog started on
its own, on this series over drm-misc-next. New GPU work ran correctly
afterwards. Contexts that had jobs in flight at the reset are flagged
guilty as before, and the clients using them (here KWin, through zink)
stop rendering.

I do not have Imagination's documentation for the META stop sequence. If
halting the META threads through the slave port first is the right
shape, I am happy to test that instead.

This series was developed with the help of an LLM.

Signed-off-by: Ryan Brue <ryanbrue.dev@gmail.com>
---
Ryan Brue (2):
      drm/imagination: Report firmware page faults
      drm/imagination: Don't wait for a running META to idle on a hard reset

 drivers/gpu/drm/imagination/pvr_ccb.c          |  5 +++++
 drivers/gpu/drm/imagination/pvr_fw.c           |  2 +-
 drivers/gpu/drm/imagination/pvr_fw.h           |  3 ++-
 drivers/gpu/drm/imagination/pvr_fw_meta.c      |  6 ++++--
 drivers/gpu/drm/imagination/pvr_fw_startstop.c | 10 ++++++----
 drivers/gpu/drm/imagination/pvr_fw_startstop.h |  4 +++-
 drivers/gpu/drm/imagination/pvr_power.c        |  4 ++--
 7 files changed, 23 insertions(+), 11 deletions(-)
---
base-commit: 479e381e77dcde0dfcc9d51e89ff3273da199804
change-id: 20261118-rbrue-suez-pvr-reset-recovery-ba687c88bf85

Best regards,
-- 
Ryan Brue <ryanbrue.dev@gmail.com>


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

* [PATCH 1/2] drm/imagination: Report firmware page faults
  2026-11-25 23:26 [PATCH 0/2] drm/imagination: Hard reset fixes for META firmware cores Ryan Brue
@ 2026-11-25 23:26 ` Ryan Brue
  2026-11-25 23:26 ` [PATCH 2/2] drm/imagination: Don't wait for a running META to idle on a hard reset Ryan Brue
  1 sibling, 0 replies; 4+ messages in thread
From: Ryan Brue @ 2026-11-25 23:26 UTC (permalink / raw)
  To: Alessio Belle, Luigi Santivetti, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Donald Robson,
	Sarah Walker
  Cc: imagination, dri-devel, linux-kernel, Ryan Brue

The firmware tells the host about a page fault of its own with
ROGUE_FWIF_FWCCB_CMD_CONTEXT_FW_PF_NOTIFICATION. The driver has no case
for it, so it logs "Received unknown FWCCB command (type=112)" and
drops the faulting address.

Log the address as an error.

Signed-off-by: Ryan Brue <ryanbrue.dev@gmail.com>
---
 drivers/gpu/drm/imagination/pvr_ccb.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/imagination/pvr_ccb.c b/drivers/gpu/drm/imagination/pvr_ccb.c
index 7043b491fe54..0a4d338ca47e 100644
--- a/drivers/gpu/drm/imagination/pvr_ccb.c
+++ b/drivers/gpu/drm/imagination/pvr_ccb.c
@@ -167,6 +167,11 @@ process_fwccb_command(struct pvr_device *pvr_dev, struct rogue_fwif_fwccb_cmd *c
 						    &cmd->cmd_data.cmd_context_reset_notification);
 		break;
 
+	case ROGUE_FWIF_FWCCB_CMD_CONTEXT_FW_PF_NOTIFICATION:
+		drm_err_ratelimited(drm_dev, "Firmware page fault at address 0x%llx\n",
+				    cmd->cmd_data.cmd_fw_pagefault.fw_fault_addr);
+		break;
+
 	default:
 		drm_info(drm_dev, "Received unknown FWCCB command (type=%d)\n",
 			 cmd->cmd_type & ~ROGUE_CMD_MAGIC_DWORD_MASK);

-- 
2.56.1


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

* [PATCH 2/2] drm/imagination: Don't wait for a running META to idle on a hard reset
  2026-11-25 23:26 [PATCH 0/2] drm/imagination: Hard reset fixes for META firmware cores Ryan Brue
  2026-11-25 23:26 ` [PATCH 1/2] drm/imagination: Report firmware page faults Ryan Brue
@ 2026-11-25 23:26 ` Ryan Brue
  2026-11-25 23:35   ` sashiko-bot
  1 sibling, 1 reply; 4+ messages in thread
From: Ryan Brue @ 2026-11-25 23:26 UTC (permalink / raw)
  To: Alessio Belle, Luigi Santivetti, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Donald Robson,
	Sarah Walker
  Cc: imagination, dri-devel, linux-kernel, Ryan Brue

A hard reset skips the idle and power-off requests, because the firmware
is presumed hung, and then calls pvr_fw_stop(). On a META firmware
processor that is still running, the Garten wrapper never reports idle,
so pvr_fw_stop() times out and every hard reset ends with the device
lost, even with an idle GPU. On a GX6250 (MT8173) every other idle poll
in pvr_fw_stop() passes.

Skip the Garten idle wait on a hard reset, as is already done when a
debugger has halted META, and let the soft reset that follows stop it.
The decision is META's must_wait_fw_idle() hook, so pass it hard_reset.
The other idle polls, and other firmware processors, are unchanged.

Fixes: cc1aeedb98ad ("drm/imagination: Implement firmware infrastructure and META FW support")
Signed-off-by: Ryan Brue <ryanbrue.dev@gmail.com>
---
 drivers/gpu/drm/imagination/pvr_fw.c           |  2 +-
 drivers/gpu/drm/imagination/pvr_fw.h           |  3 ++-
 drivers/gpu/drm/imagination/pvr_fw_meta.c      |  6 ++++--
 drivers/gpu/drm/imagination/pvr_fw_startstop.c | 10 ++++++----
 drivers/gpu/drm/imagination/pvr_fw_startstop.h |  4 +++-
 drivers/gpu/drm/imagination/pvr_power.c        |  4 ++--
 6 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/imagination/pvr_fw.c b/drivers/gpu/drm/imagination/pvr_fw.c
index d620141b5df0..d75fa3e4c575 100644
--- a/drivers/gpu/drm/imagination/pvr_fw.c
+++ b/drivers/gpu/drm/imagination/pvr_fw.c
@@ -976,7 +976,7 @@ pvr_fw_init(struct pvr_device *pvr_dev)
 	return 0;
 
 err_fw_stop:
-	pvr_fw_stop(pvr_dev);
+	pvr_fw_stop(pvr_dev, false);
 
 err_destroy_structures:
 	pvr_fw_destroy_structures(pvr_dev);
diff --git a/drivers/gpu/drm/imagination/pvr_fw.h b/drivers/gpu/drm/imagination/pvr_fw.h
index e9a802be45b2..d985089ae191 100644
--- a/drivers/gpu/drm/imagination/pvr_fw.h
+++ b/drivers/gpu/drm/imagination/pvr_fw.h
@@ -189,6 +189,7 @@ struct pvr_fw_defs {
 	 *                     to report FW idle before proceeding.
 	 *
 	 * @pvr_dev: Target PowerVR device.
+	 * @hard_reset: The FW was not asked to idle before this stop.
 	 * @wait[out]: Whether the FW stop sequence should wait for FW idle.
 	 *
 	 * This function is optional. The assumption is that we must always wait
@@ -199,7 +200,7 @@ struct pvr_fw_defs {
 	 *  * 0 on success.
 	 *  * Any appropriate error on failure.
 	 */
-	int (*must_wait_fw_idle)(struct pvr_device *pvr_dev, bool *wait);
+	int (*must_wait_fw_idle)(struct pvr_device *pvr_dev, bool hard_reset, bool *wait);
 
 	/**
 	 * @has_fixed_data_addr: Specify whether the firmware fixed data must be loaded at the
diff --git a/drivers/gpu/drm/imagination/pvr_fw_meta.c b/drivers/gpu/drm/imagination/pvr_fw_meta.c
index 41f5e9ddc7f0..19baea23c434 100644
--- a/drivers/gpu/drm/imagination/pvr_fw_meta.c
+++ b/drivers/gpu/drm/imagination/pvr_fw_meta.c
@@ -562,7 +562,7 @@ pvr_meta_irq_clear(struct pvr_device *pvr_dev)
 }
 
 static int
-pvr_meta_must_wait_fw_idle(struct pvr_device *pvr_dev, bool *wait)
+pvr_meta_must_wait_fw_idle(struct pvr_device *pvr_dev, bool hard_reset, bool *wait)
 {
 	u32 reg_value;
 	int err;
@@ -574,8 +574,10 @@ pvr_meta_must_wait_fw_idle(struct pvr_device *pvr_dev, bool *wait)
 	/*
 	 * Wait for Sidekick/Jones to signal IDLE including the Garten
 	 * Wrapper if there is no debugger attached (TxVECINT_BHALT = 0x0).
+	 * A META that was not asked to idle (hard reset) keeps the Garten
+	 * Wrapper busy; the soft reset that follows stops it.
 	 */
-	*wait = !reg_value;
+	*wait = !reg_value && !hard_reset;
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/imagination/pvr_fw_startstop.c b/drivers/gpu/drm/imagination/pvr_fw_startstop.c
index 40af04a64b0c..f543ebd2f56d 100644
--- a/drivers/gpu/drm/imagination/pvr_fw_startstop.c
+++ b/drivers/gpu/drm/imagination/pvr_fw_startstop.c
@@ -188,13 +188,14 @@ static inline bool layout_is_mars(struct pvr_device *pvr_dev)
 	return layout_mars_value > 0;
 }
 
-static inline int must_wait_fw_idle_before_stop(struct pvr_device *pvr_dev)
+static inline int must_wait_fw_idle_before_stop(struct pvr_device *pvr_dev, bool hard_reset)
 {
 	bool wait_fw_idle = true;
 	int err;
 
 	if (pvr_dev->fw_dev.defs->must_wait_fw_idle) {
-		err = pvr_dev->fw_dev.defs->must_wait_fw_idle(pvr_dev, &wait_fw_idle);
+		err = pvr_dev->fw_dev.defs->must_wait_fw_idle(pvr_dev, hard_reset,
+							      &wait_fw_idle);
 		if (err)
 			return err;
 	}
@@ -205,13 +206,14 @@ static inline int must_wait_fw_idle_before_stop(struct pvr_device *pvr_dev)
 /**
  * pvr_fw_stop() - Stop FW processor
  * @pvr_dev: Target PowerVR device.
+ * @hard_reset: The FW processor was not asked to idle first.
  *
  * Returns:
  *  * 0 on success, or
  *  * Any error returned by pvr_cr_poll_reg32().
  */
 int
-pvr_fw_stop(struct pvr_device *pvr_dev)
+pvr_fw_stop(struct pvr_device *pvr_dev, bool hard_reset)
 {
 	const u32 sidekick_idle_mask = ROGUE_CR_SIDEKICK_IDLE_MASKFULL &
 				       ~(ROGUE_CR_SIDEKICK_IDLE_GARTEN_EN |
@@ -309,7 +311,7 @@ pvr_fw_stop(struct pvr_device *pvr_dev)
 		if (err)
 			return err;
 
-		wait_fw_idle = must_wait_fw_idle_before_stop(pvr_dev);
+		wait_fw_idle = must_wait_fw_idle_before_stop(pvr_dev, hard_reset);
 		if (wait_fw_idle < 0)
 			return wait_fw_idle;
 
diff --git a/drivers/gpu/drm/imagination/pvr_fw_startstop.h b/drivers/gpu/drm/imagination/pvr_fw_startstop.h
index a3cef061bd60..79a95bbbe4e1 100644
--- a/drivers/gpu/drm/imagination/pvr_fw_startstop.h
+++ b/drivers/gpu/drm/imagination/pvr_fw_startstop.h
@@ -4,10 +4,12 @@
 #ifndef PVR_FW_STARTSTOP_H
 #define PVR_FW_STARTSTOP_H
 
+#include <linux/types.h>
+
 /* Forward declaration from pvr_device.h. */
 struct pvr_device;
 
 int pvr_fw_start(struct pvr_device *pvr_dev);
-int pvr_fw_stop(struct pvr_device *pvr_dev);
+int pvr_fw_stop(struct pvr_device *pvr_dev, bool hard_reset);
 
 #endif /* PVR_FW_STARTSTOP_H */
diff --git a/drivers/gpu/drm/imagination/pvr_power.c b/drivers/gpu/drm/imagination/pvr_power.c
index eb4b6ecdf4f4..d88a522c4bfd 100644
--- a/drivers/gpu/drm/imagination/pvr_power.c
+++ b/drivers/gpu/drm/imagination/pvr_power.c
@@ -111,7 +111,7 @@ pvr_power_fw_disable(struct pvr_device *pvr_dev, bool hard_reset, bool rpm_suspe
 		disable_irq(pvr_dev->irq);
 	}
 
-	err = pvr_fw_stop(pvr_dev);
+	err = pvr_fw_stop(pvr_dev, hard_reset);
 	if (err && rpm_suspend)
 		enable_irq(pvr_dev->irq);
 
@@ -133,7 +133,7 @@ pvr_power_fw_enable(struct pvr_device *pvr_dev, bool rpm_resume)
 	err = pvr_wait_for_fw_boot(pvr_dev);
 	if (err) {
 		drm_err(from_pvr_device(pvr_dev), "Firmware failed to boot\n");
-		pvr_fw_stop(pvr_dev);
+		pvr_fw_stop(pvr_dev, false);
 		goto out;
 	}
 

-- 
2.56.1


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

* Re: [PATCH 2/2] drm/imagination: Don't wait for a running META to idle on a hard reset
  2026-11-25 23:26 ` [PATCH 2/2] drm/imagination: Don't wait for a running META to idle on a hard reset Ryan Brue
@ 2026-11-25 23:35   ` sashiko-bot
  0 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-11-25 23:35 UTC (permalink / raw)
  To: Ryan Brue; +Cc: dri-devel

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/imagination: pvr_fw_stop() called with hard_reset=false
  on boot failure
- [Medium] drm/imagination: unnecessary META slave port read on hard
  reset
--

commit 1ab35810cce4163d613799da01f5a15168d56036
Author: Ryan Brue <ryanbrue.dev@gmail.com>

drm/imagination: Don't wait for a running META to idle on a hard reset

This patch adds a hard_reset parameter to pvr_fw_stop() and the
must_wait_fw_idle() callback so META firmware stops skip waiting for the
Garten wrapper to report idle when the firmware was not asked to idle
first.

> diff --git a/drivers/gpu/drm/imagination/pvr_fw.c b/drivers/gpu/drm/imagination/pvr_fw.c
> index d620141b5df03..d75fa3e4c5759 100644
> --- a/drivers/gpu/drm/imagination/pvr_fw.c
> +++ b/drivers/gpu/drm/imagination/pvr_fw.c
> @@ -976,7 +976,7 @@ pvr_fw_init(struct pvr_device *pvr_dev)
>  	return 0;
>  
>  err_fw_stop:
> -	pvr_fw_stop(pvr_dev);
> +	pvr_fw_stop(pvr_dev, false);
>  
>  err_destroy_structures:
>  	pvr_fw_destroy_structures(pvr_dev);

[Severity: Medium]
Should pvr_fw_stop() be called with hard_reset set to true here and in
pvr_power_fw_enable() when pvr_wait_for_fw_boot() fails?

Neither error path requests the firmware to idle before calling
pvr_fw_stop().  If META is running or stuck during early boot, the Garten
wrapper stays busy, causing pvr_fw_stop() to time out on
ROGUE_CR_SIDEKICK_IDLE_GARTEN_EN and return before asserting
ROGUE_CR_SOFT_RESET.  pvr_fw_init() ignores that return value and tears
down the firmware memory mappings and kernel_vm_ctx while META is still out
of soft reset.

[ ... ]

> diff --git a/drivers/gpu/drm/imagination/pvr_fw_meta.c b/drivers/gpu/drm/imagination/pvr_fw_meta.c
> index 41f5e9ddc7f0e..19baea23c4340 100644
> --- a/drivers/gpu/drm/imagination/pvr_fw_meta.c
> +++ b/drivers/gpu/drm/imagination/pvr_fw_meta.c
> @@ -562,7 +562,7 @@ pvr_meta_irq_clear(struct pvr_device *pvr_dev)
>  }
>  
>  static int
> -pvr_meta_must_wait_fw_idle(struct pvr_device *pvr_dev, bool *wait)
> +pvr_meta_must_wait_fw_idle(struct pvr_device *pvr_dev, bool hard_reset, bool *wait)
>  {
>  	u32 reg_value;
>  	int err;
> @@ -574,8 +574,10 @@ pvr_meta_must_wait_fw_idle(struct pvr_device *pvr_dev, bool *wait)
>  	/*
>  	 * Wait for Sidekick/Jones to signal IDLE including the Garten
>  	 * Wrapper if there is no debugger attached (TxVECINT_BHALT = 0x0).
> +	 * A META that was not asked to idle (hard reset) keeps the Garten
> +	 * Wrapper busy; the soft reset that follows stops it.
>  	 */
> -	*wait = !reg_value;
> +	*wait = !reg_value && !hard_reset;
>  
>  	return 0;
>  }

[Severity: Medium]
Can pvr_meta_must_wait_fw_idle() skip the pvr_meta_cr_read32() call when
hard_reset is true?

When hard_reset is true, *wait is unconditionally false, so reg_value is
unused.  Performing the slave-port read anyway polls
ROGUE_CR_META_SP_MSLVCTRL1 for READY_EN and GBLPORT_IDLE_EN; if a hung META
processor leaves the slave or global port stalled, pvr_meta_cr_read32()
times out and aborts the hard reset before ROGUE_CR_SOFT_RESET is asserted,
marking the device lost.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261125-rbrue-suez-pvr-reset-recovery-v1-0-2cea8b163e7e@gmail.com?part=2

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

end of thread, other threads:[~2026-11-25 23:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25 23:26 [PATCH 0/2] drm/imagination: Hard reset fixes for META firmware cores Ryan Brue
2026-11-25 23:26 ` [PATCH 1/2] drm/imagination: Report firmware page faults Ryan Brue
2026-11-25 23:26 ` [PATCH 2/2] drm/imagination: Don't wait for a running META to idle on a hard reset Ryan Brue
2026-11-25 23:35   ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.