Skip to content

Commit 808defe

Browse files
mairacanalpopcornmix
authored andcommitted
drm/v3d: Add module parameter to enable MMU error logging
MMU error messages are useful to help developers quickly identify issues in userspace graphics drivers, but always printing them can swamp the kernel log. Add a module parameter, ``debug_mmu``, to gate MMU error logging. Logging is disabled by default and can be enabled when needed with ``v3d.debug_mmu=1``. Signed-off-by: Maíra Canal <[email protected]>
1 parent 12a8f6f commit 808defe

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

drivers/gpu/drm/v3d/v3d_drv.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ module_param_named(super_pages, super_pages, bool, 0400);
4444
MODULE_PARM_DESC(super_pages, "Enable/Disable Super Pages support.");
4545
#endif
4646

47+
bool debug_mmu;
48+
module_param(debug_mmu, bool, 0644);
49+
MODULE_PARM_DESC(debug_mmu, "Enable/Disable MMU error logging");
50+
4751
static int v3d_get_param_ioctl(struct drm_device *dev, void *data,
4852
struct drm_file *file_priv)
4953
{

drivers/gpu/drm/v3d/v3d_drv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,7 @@ int v3d_submit_cpu_ioctl(struct drm_device *dev, void *data,
594594
struct drm_file *file_priv);
595595

596596
/* v3d_irq.c */
597+
extern bool debug_mmu;
597598
int v3d_irq_init(struct v3d_dev *v3d);
598599
void v3d_irq_enable(struct v3d_dev *v3d);
599600
void v3d_irq_disable(struct v3d_dev *v3d);

drivers/gpu/drm/v3d/v3d_irq.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ v3d_hub_irq(int irq, void *arg)
199199
{0x7F, 0x80, "GMP"},
200200
};
201201
const char *client = "?";
202-
static int logged_error;
202+
static bool logged_error;
203203

204204
V3D_WRITE(V3D_MMU_CTL, V3D_READ(V3D_MMU_CTL));
205205

@@ -227,16 +227,18 @@ v3d_hub_irq(int irq, void *arg)
227227
}
228228
}
229229

230-
if (!logged_error)
231-
dev_err(v3d->drm.dev, "MMU error from client %s (0x%x) at 0x%llx%s%s%s\n",
232-
client, axi_id, (long long)vio_addr,
233-
((intsts & V3D_HUB_INT_MMU_WRV) ?
234-
", write violation" : ""),
235-
((intsts & V3D_HUB_INT_MMU_PTI) ?
236-
", pte invalid" : ""),
237-
((intsts & V3D_HUB_INT_MMU_CAP) ?
238-
", cap exceeded" : ""));
239-
logged_error = 1;
230+
if (!logged_error || debug_mmu) {
231+
dev_err(v3d->drm.dev, "MMU error from client %s (%d) at 0x%llx%s%s%s\n",
232+
client, axi_id, (long long)vio_addr,
233+
((intsts & V3D_HUB_INT_MMU_WRV) ?
234+
", write violation" : ""),
235+
((intsts & V3D_HUB_INT_MMU_PTI) ?
236+
", pte invalid" : ""),
237+
((intsts & V3D_HUB_INT_MMU_CAP) ?
238+
", cap exceeded" : ""));
239+
}
240+
logged_error = true;
241+
240242
status = IRQ_HANDLED;
241243
}
242244

0 commit comments

Comments
 (0)