* [PATCH v3 1/3] drm/imagination: Add missing rogue context reset reasons
2026-03-23 18:31 [PATCH v3 0/3] drm/imagination: Firmware handling of context reset notification Alexandru Dadu
@ 2026-03-23 18:31 ` Alexandru Dadu
2026-03-24 21:34 ` Claude review: " Claude Code Review Bot
2026-03-23 18:31 ` [PATCH v3 2/3] drm/imagination: Switch reset_reason fields from enum to u32 Alexandru Dadu
` (3 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Alexandru Dadu @ 2026-03-23 18:31 UTC (permalink / raw)
To: Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: linux-kernel, dri-devel, Alessio Belle, Brajesh Gupta,
Alexandru Dadu, Sarah Walker
Update the context reset reason enum with the missing reset reasons in
the 6-11 value gap:
- CDM Mission/safety checksum mismatch;
- TRP checksum mismatch;
- GPU ECC error (corrected, OK);
- GPU ECC error (uncorrected, HWR);
- FW ECC error (corrected, OK);
- FW ECC error (uncorrected, ERR);
Co-developed-by: Sarah Walker <sarah.walker@imgtec.com>
Signed-off-by: Sarah Walker <sarah.walker@imgtec.com>
Signed-off-by: Alexandru Dadu <alexandru.dadu@imgtec.com>
Reviewed-by: Matt Coster <matt.coster@imgtec.com>
---
drivers/gpu/drm/imagination/pvr_rogue_fwif_shared.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/gpu/drm/imagination/pvr_rogue_fwif_shared.h b/drivers/gpu/drm/imagination/pvr_rogue_fwif_shared.h
index 6c09c15bf9bd..f622553cdc11 100644
--- a/drivers/gpu/drm/imagination/pvr_rogue_fwif_shared.h
+++ b/drivers/gpu/drm/imagination/pvr_rogue_fwif_shared.h
@@ -236,6 +236,18 @@ enum rogue_context_reset_reason {
ROGUE_CONTEXT_RESET_REASON_INNOCENT_OVERRUNING = 4,
/* Forced reset to ensure scheduling requirements */
ROGUE_CONTEXT_RESET_REASON_HARD_CONTEXT_SWITCH = 5,
+ /* CDM Mission/safety checksum mismatch */
+ ROGUE_CONTEXT_RESET_REASON_WGP_CHECKSUM = 6,
+ /* TRP checksum mismatch */
+ ROGUE_CONTEXT_RESET_REASON_TRP_CHECKSUM = 7,
+ /* GPU ECC error (corrected, OK) */
+ ROGUE_CONTEXT_RESET_REASON_GPU_ECC_OK = 8,
+ /* GPU ECC error (uncorrected, HWR) */
+ ROGUE_CONTEXT_RESET_REASON_GPU_ECC_HWR = 9,
+ /* FW ECC error (corrected, OK) */
+ ROGUE_CONTEXT_RESET_REASON_FW_ECC_OK = 10,
+ /* FW ECC error (uncorrected, ERR) */
+ ROGUE_CONTEXT_RESET_REASON_FW_ECC_ERR = 11,
/* FW Safety watchdog triggered */
ROGUE_CONTEXT_RESET_REASON_FW_WATCHDOG = 12,
/* FW page fault (no HWR) */
--
2.43.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH v3 2/3] drm/imagination: Switch reset_reason fields from enum to u32
2026-03-23 18:31 [PATCH v3 0/3] drm/imagination: Firmware handling of context reset notification Alexandru Dadu
2026-03-23 18:31 ` [PATCH v3 1/3] drm/imagination: Add missing rogue context reset reasons Alexandru Dadu
@ 2026-03-23 18:31 ` Alexandru Dadu
2026-03-24 21:34 ` Claude review: " Claude Code Review Bot
2026-03-23 18:31 ` [PATCH v3 3/3] drm/imagination: Implement handling of context reset notification Alexandru Dadu
` (2 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Alexandru Dadu @ 2026-03-23 18:31 UTC (permalink / raw)
To: Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: linux-kernel, dri-devel, Alessio Belle, Brajesh Gupta,
Alexandru Dadu
Update the reset_reason fwif structure fields from enum to u32 to remove
any ambiguity from the interface (enum is not a fixed size thus is unfit
for the purpose of the data type).
Fixes: a26f067feac1f ("drm/imagination: Add FWIF headers")
Signed-off-by: Alexandru Dadu <alexandru.dadu@imgtec.com>
Reviewed-by: Matt Coster <matt.coster@imgtec.com>
---
drivers/gpu/drm/imagination/pvr_rogue_fwif.h | 8 ++++++--
drivers/gpu/drm/imagination/pvr_rogue_fwif_shared.h | 6 +++++-
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/imagination/pvr_rogue_fwif.h b/drivers/gpu/drm/imagination/pvr_rogue_fwif.h
index 172886be4c82..5d590c4c2566 100644
--- a/drivers/gpu/drm/imagination/pvr_rogue_fwif.h
+++ b/drivers/gpu/drm/imagination/pvr_rogue_fwif.h
@@ -1347,8 +1347,12 @@ struct rogue_fwif_fwccb_cmd_freelists_reconstruction_data {
struct rogue_fwif_fwccb_cmd_context_reset_data {
/* Context affected by the reset */
u32 server_common_context_id;
- /* Reason for reset */
- enum rogue_context_reset_reason reset_reason;
+ /*
+ * Reason for reset
+ * The valid values for reset_reason are the ones from
+ * enum rogue_context_reset_reason
+ */
+ u32 reset_reason;
/* Data Master affected by the reset */
u32 dm;
/* Job ref running at the time of reset */
diff --git a/drivers/gpu/drm/imagination/pvr_rogue_fwif_shared.h b/drivers/gpu/drm/imagination/pvr_rogue_fwif_shared.h
index f622553cdc11..869d904e3649 100644
--- a/drivers/gpu/drm/imagination/pvr_rogue_fwif_shared.h
+++ b/drivers/gpu/drm/imagination/pvr_rogue_fwif_shared.h
@@ -261,7 +261,11 @@ enum rogue_context_reset_reason {
};
struct rogue_context_reset_reason_data {
- enum rogue_context_reset_reason reset_reason;
+ /*
+ * The valid values for reset_reason are the ones from
+ * enum rogue_context_reset_reason
+ */
+ u32 reset_reason;
u32 reset_ext_job_ref;
};
--
2.43.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* Claude review: drm/imagination: Switch reset_reason fields from enum to u32
2026-03-23 18:31 ` [PATCH v3 2/3] drm/imagination: Switch reset_reason fields from enum to u32 Alexandru Dadu
@ 2026-03-24 21:34 ` Claude Code Review Bot
0 siblings, 0 replies; 10+ messages in thread
From: Claude Code Review Bot @ 2026-03-24 21:34 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
**Verdict: Good with a minor note.**
The rationale is correct — `enum` is not a fixed-size type in C and using it in firmware interface structures that must match a specific binary layout is fragile. The existing `pvr_rogue_fwif_check.h` offset checks (offset 4, next field at offset 8) confirm the field is expected to be 4 bytes, which `u32` guarantees.
The `Fixes:` tag referencing the original FWIF headers commit is appropriate.
One minor observation: `struct rogue_context_reset_reason_data` in `pvr_rogue_fwif_shared.h` is also changed, but I don't see a corresponding offset/size check for that struct in the check headers. This is not a problem with the patch itself, just a pre-existing gap.
---
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v3 3/3] drm/imagination: Implement handling of context reset notification
2026-03-23 18:31 [PATCH v3 0/3] drm/imagination: Firmware handling of context reset notification Alexandru Dadu
2026-03-23 18:31 ` [PATCH v3 1/3] drm/imagination: Add missing rogue context reset reasons Alexandru Dadu
2026-03-23 18:31 ` [PATCH v3 2/3] drm/imagination: Switch reset_reason fields from enum to u32 Alexandru Dadu
@ 2026-03-23 18:31 ` Alexandru Dadu
2026-03-24 21:34 ` Claude review: " Claude Code Review Bot
2026-03-24 8:26 ` [PATCH v3 0/3] drm/imagination: Firmware " Matt Coster
2026-03-24 21:34 ` Claude review: " Claude Code Review Bot
4 siblings, 1 reply; 10+ messages in thread
From: Alexandru Dadu @ 2026-03-23 18:31 UTC (permalink / raw)
To: Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: linux-kernel, dri-devel, Alessio Belle, Brajesh Gupta,
Alexandru Dadu, Sarah Walker
The firmware will send the context reset notification message as
part of handling hardware recovery (HWR) events deecoding the message
and printing via drm_info(). This eliminates the "Unknown FWCCB command"
message that was previously printed.
Co-developed-by: Sarah Walker <sarah.walker@imgtec.com>
Signed-off-by: Sarah Walker <sarah.walker@imgtec.com>
Signed-off-by: Alexandru Dadu <alexandru.dadu@imgtec.com>
Reviewed-by: Matt Coster <matt.coster@imgtec.com>
---
drivers/gpu/drm/imagination/Makefile | 1 +
drivers/gpu/drm/imagination/pvr_ccb.c | 5 ++
drivers/gpu/drm/imagination/pvr_dump.c | 113 +++++++++++++++++++++++++++++++++
drivers/gpu/drm/imagination/pvr_dump.h | 17 +++++
4 files changed, 136 insertions(+)
diff --git a/drivers/gpu/drm/imagination/Makefile b/drivers/gpu/drm/imagination/Makefile
index f5072f06b4c4..1222a14262e4 100644
--- a/drivers/gpu/drm/imagination/Makefile
+++ b/drivers/gpu/drm/imagination/Makefile
@@ -8,6 +8,7 @@ powervr-y := \
pvr_device.o \
pvr_device_info.o \
pvr_drv.o \
+ pvr_dump.o \
pvr_free_list.o \
pvr_fw.o \
pvr_fw_meta.o \
diff --git a/drivers/gpu/drm/imagination/pvr_ccb.c b/drivers/gpu/drm/imagination/pvr_ccb.c
index f89db5e3baa2..a04520e7efc0 100644
--- a/drivers/gpu/drm/imagination/pvr_ccb.c
+++ b/drivers/gpu/drm/imagination/pvr_ccb.c
@@ -4,6 +4,7 @@
#include "pvr_ccb.h"
#include "pvr_device.h"
#include "pvr_drv.h"
+#include "pvr_dump.h"
#include "pvr_free_list.h"
#include "pvr_fw.h"
#include "pvr_gem.h"
@@ -165,6 +166,10 @@ process_fwccb_command(struct pvr_device *pvr_dev, struct rogue_fwif_fwccb_cmd *c
* suppress the "unknown" warning when receiving this command.
*/
break;
+ case ROGUE_FWIF_FWCCB_CMD_CONTEXT_RESET_NOTIFICATION:
+ pvr_dump_context_reset_notification(pvr_dev,
+ &cmd->cmd_data.cmd_context_reset_notification);
+ break;
default:
drm_info(drm_dev, "Received unknown FWCCB command (type=%d)\n",
diff --git a/drivers/gpu/drm/imagination/pvr_dump.c b/drivers/gpu/drm/imagination/pvr_dump.c
new file mode 100644
index 000000000000..bb52eea8b63a
--- /dev/null
+++ b/drivers/gpu/drm/imagination/pvr_dump.c
@@ -0,0 +1,113 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+/* Copyright (c) 2026 Imagination Technologies Ltd. */
+
+#include "pvr_device.h"
+#include "pvr_dump.h"
+#include "pvr_rogue_fwif.h"
+
+#include <drm/drm_print.h>
+#include <linux/types.h>
+
+static const char *
+get_reset_reason_desc(enum rogue_context_reset_reason reason)
+{
+ switch (reason) {
+ case ROGUE_CONTEXT_RESET_REASON_NONE:
+ return "None";
+ case ROGUE_CONTEXT_RESET_REASON_GUILTY_LOCKUP:
+ return "Guilty lockup";
+ case ROGUE_CONTEXT_RESET_REASON_INNOCENT_LOCKUP:
+ return "Innocent lockup";
+ case ROGUE_CONTEXT_RESET_REASON_GUILTY_OVERRUNING:
+ return "Guilty overrunning";
+ case ROGUE_CONTEXT_RESET_REASON_INNOCENT_OVERRUNING:
+ return "Innocent overrunning";
+ case ROGUE_CONTEXT_RESET_REASON_HARD_CONTEXT_SWITCH:
+ return "Hard context switch";
+ case ROGUE_CONTEXT_RESET_REASON_WGP_CHECKSUM:
+ return "CDM Mission/safety checksum mismatch";
+ case ROGUE_CONTEXT_RESET_REASON_TRP_CHECKSUM:
+ return "TRP checksum mismatch";
+ case ROGUE_CONTEXT_RESET_REASON_GPU_ECC_OK:
+ return "GPU ECC error (corrected, OK)";
+ case ROGUE_CONTEXT_RESET_REASON_GPU_ECC_HWR:
+ return "GPU ECC error (uncorrected, HWR)";
+ case ROGUE_CONTEXT_RESET_REASON_FW_ECC_OK:
+ return "Firmware ECC error (corrected, OK)";
+ case ROGUE_CONTEXT_RESET_REASON_FW_ECC_ERR:
+ return "Firmware ECC error (uncorrected, ERR)";
+ case ROGUE_CONTEXT_RESET_REASON_FW_WATCHDOG:
+ return "Firmware watchdog";
+ case ROGUE_CONTEXT_RESET_REASON_FW_PAGEFAULT:
+ return "Firmware pagefault";
+ case ROGUE_CONTEXT_RESET_REASON_FW_EXEC_ERR:
+ return "Firmware execution error";
+ case ROGUE_CONTEXT_RESET_REASON_HOST_WDG_FW_ERR:
+ return "Host watchdog";
+ case ROGUE_CONTEXT_GEOM_OOM_DISABLED:
+ return "Geometry OOM disabled";
+
+ default:
+ return "Unknown";
+ }
+}
+
+static const char *
+get_dm_name(u32 dm)
+{
+ switch (dm) {
+ case PVR_FWIF_DM_GP:
+ return "General purpose";
+ /* PVR_FWIF_DM_TDM has the same index, but is discriminated by a device feature */
+ case PVR_FWIF_DM_2D:
+ return "2D or TDM";
+ case PVR_FWIF_DM_GEOM:
+ return "Geometry";
+ case PVR_FWIF_DM_FRAG:
+ return "Fragment";
+ case PVR_FWIF_DM_CDM:
+ return "Compute";
+ case PVR_FWIF_DM_RAY:
+ return "Raytracing";
+ case PVR_FWIF_DM_GEOM2:
+ return "Geometry 2";
+ case PVR_FWIF_DM_GEOM3:
+ return "Geometry 3";
+ case PVR_FWIF_DM_GEOM4:
+ return "Geometry 4";
+
+ default:
+ return "Unknown";
+ }
+}
+
+/**
+ * pvr_dump_context_reset_notification() - Handle context reset notification from FW
+ * @pvr_dev: Device pointer.
+ * @data: Data provided by FW.
+ *
+ * This will decode the data structure provided by FW and print the results via drm_info().
+ */
+void
+pvr_dump_context_reset_notification(struct pvr_device *pvr_dev,
+ struct rogue_fwif_fwccb_cmd_context_reset_data *data)
+{
+ struct drm_device *drm_dev = from_pvr_device(pvr_dev);
+
+ if (data->flags & ROGUE_FWIF_FWCCB_CMD_CONTEXT_RESET_FLAG_ALL_CTXS) {
+ drm_info(drm_dev, "Received context reset notification for all contexts\n");
+ } else {
+ drm_info(drm_dev, "Received context reset notification on context %u\n",
+ data->server_common_context_id);
+ }
+
+ drm_info(drm_dev, " Reset reason=%u (%s)\n", data->reset_reason,
+ get_reset_reason_desc((enum rogue_context_reset_reason)data->reset_reason));
+ drm_info(drm_dev, " Data Master=%u (%s)\n", data->dm, get_dm_name(data->dm));
+ drm_info(drm_dev, " Job ref=%u\n", data->reset_job_ref);
+
+ if (data->flags & ROGUE_FWIF_FWCCB_CMD_CONTEXT_RESET_FLAG_PF) {
+ drm_info(drm_dev, " Page fault occurred, fault address=%llx\n",
+ data->fault_address);
+ }
+}
diff --git a/drivers/gpu/drm/imagination/pvr_dump.h b/drivers/gpu/drm/imagination/pvr_dump.h
new file mode 100644
index 000000000000..1e3e68694f5f
--- /dev/null
+++ b/drivers/gpu/drm/imagination/pvr_dump.h
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
+/* Copyright (c) 2026 Imagination Technologies Ltd. */
+
+#ifndef PVR_DUMP_H
+#define PVR_DUMP_H
+
+/* Forward declaration from pvr_device.h. */
+struct pvr_device;
+
+/* Forward declaration from pvr_rogue_fwif.h. */
+struct rogue_fwif_fwccb_cmd_context_reset_data;
+
+void
+pvr_dump_context_reset_notification(struct pvr_device *pvr_dev,
+ struct rogue_fwif_fwccb_cmd_context_reset_data *data);
+
+#endif /* PVR_DUMP_H */
--
2.43.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* Claude review: drm/imagination: Implement handling of context reset notification
2026-03-23 18:31 ` [PATCH v3 3/3] drm/imagination: Implement handling of context reset notification Alexandru Dadu
@ 2026-03-24 21:34 ` Claude Code Review Bot
0 siblings, 0 replies; 10+ messages in thread
From: Claude Code Review Bot @ 2026-03-24 21:34 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
**Verdict: Acceptable with minor nits.**
The implementation is clean and does what the commit message describes. A few observations:
1. **Commit message typo**: "deecoding" should be "decoding":
```
part of handling hardware recovery (HWR) events deecoding the message
```
2. **`get_reset_reason_desc` parameter type**: The function signature takes `enum rogue_context_reset_reason reason`, but the caller casts a `u32` to this enum:
```c
get_reset_reason_desc((enum rogue_context_reset_reason)data->reset_reason)
```
This is fine functionally and the `default` case handles unknown values, but since patch 2 explicitly moved away from using the enum type in structures (because "enum is not a fixed size"), it would be more consistent to have `get_reset_reason_desc` take a `u32` parameter instead. This is a style nit — the generated code will be the same.
3. **`get_dm_name` comment about TDM**: The comment and return value are slightly confusing:
```c
/* PVR_FWIF_DM_TDM has the same index, but is discriminated by a device feature */
case PVR_FWIF_DM_2D:
return "2D or TDM";
```
Since `PVR_FWIF_DM_TDM` and `PVR_FWIF_DM_2D` are both defined as `(1)` in `pvr_rogue_fwif_common.h`, you can't have separate `case` labels. Returning `"2D or TDM"` is a reasonable compromise, but it could be improved by checking the device feature flag at runtime to return the correct name (since `pvr_dev` is available to the caller). This is optional — the current approach is acceptable for a diagnostic message.
4. **`pvr_dump_context_reset_notification` data parameter should be `const`**: The function only reads from `data`, so the signature should be:
```c
void pvr_dump_context_reset_notification(struct pvr_device *pvr_dev,
const struct rogue_fwif_fwccb_cmd_context_reset_data *data);
```
(Both in the `.c` and `.h` files.)
5. **New file naming**: Creating `pvr_dump.c`/`.h` for a single function is fine if more dump/diagnostic functions are expected to be added later (which seems likely given the generic naming). If this will remain the only function, it could arguably live in `pvr_ccb.c` directly. Not a blocking issue.
6. **Alignment in `pvr_ccb.c`**: The indentation of the continuation line uses spaces that don't align perfectly with the opening parenthesis — minor formatting nit:
```c
pvr_dump_context_reset_notification(pvr_dev,
&cmd->cmd_data.cmd_context_reset_notification);
```
The `&cmd` should align under `pvr_dev`. This is cosmetic.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 0/3] drm/imagination: Firmware handling of context reset notification
2026-03-23 18:31 [PATCH v3 0/3] drm/imagination: Firmware handling of context reset notification Alexandru Dadu
` (2 preceding siblings ...)
2026-03-23 18:31 ` [PATCH v3 3/3] drm/imagination: Implement handling of context reset notification Alexandru Dadu
@ 2026-03-24 8:26 ` Matt Coster
2026-03-24 21:34 ` Claude review: " Claude Code Review Bot
4 siblings, 0 replies; 10+ messages in thread
From: Matt Coster @ 2026-03-24 8:26 UTC (permalink / raw)
To: Frank Binns, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Alexandru Dadu
Cc: linux-kernel, dri-devel, Alessio Belle, Brajesh Gupta,
Sarah Walker
On Mon, 23 Mar 2026 20:31:27 +0200, Alexandru Dadu wrote:
> - patch 1: Adds missing context reset reasons.
> - patch 2: Fixes the reset_reason from enum to u32 in the fwif.
> - patch 3: Adds the implementation of the context reset notification.
Applied, thanks!
[1/3] drm/imagination: Add missing rogue context reset reasons
commit: da173557a2b090d7d8c155283ba489a287983ced
[2/3] drm/imagination: Switch reset_reason fields from enum to u32
commit: d2f83a6cd598bf413f1acf34153bd1d71023fbab
[3/3] drm/imagination: Implement handling of context reset notification
commit: d994acc526c70d40ec9029cfe03d08ee411083c5
Best regards,
--
Matt Coster <matt.coster@imgtec.com>
^ permalink raw reply [flat|nested] 10+ messages in thread* Claude review: drm/imagination: Firmware handling of context reset notification
2026-03-23 18:31 [PATCH v3 0/3] drm/imagination: Firmware handling of context reset notification Alexandru Dadu
` (3 preceding siblings ...)
2026-03-24 8:26 ` [PATCH v3 0/3] drm/imagination: Firmware " Matt Coster
@ 2026-03-24 21:34 ` Claude Code Review Bot
4 siblings, 0 replies; 10+ messages in thread
From: Claude Code Review Bot @ 2026-03-24 21:34 UTC (permalink / raw)
To: dri-devel-reviews
Overall Series Review
Subject: drm/imagination: Firmware handling of context reset notification
Author: Alexandru Dadu <alexandru.dadu@imgtec.com>
Patches: 5
Reviewed: 2026-03-25T07:34:16.104123
---
This is a clean, well-structured 3-patch series that adds firmware context reset notification handling to the PowerVR (Imagination) DRM driver. The series is logically ordered: (1) add missing enum values, (2) fix the enum→u32 type issue in the firmware interface, (3) implement the actual notification handler. The code is straightforward and the approach is sensible. There are a few minor issues worth noting.
**Overall: Looks good with minor nits.**
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 10+ messages in thread