Skip to content

Commit 17f9c32

Browse files
mairacanalpelwell
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 85f9ed0 commit 17f9c32

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
@@ -46,6 +46,10 @@ module_param_named(super_pages, super_pages, bool, 0400);
4646
MODULE_PARM_DESC(super_pages, "Enable/Disable Super Pages support.");
4747
#endif
4848

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

drivers/gpu/drm/v3d/v3d_drv.h

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

602602
/* v3d_irq.c */
603+
extern bool debug_mmu;
603604
int v3d_irq_init(struct v3d_dev *v3d);
604605
void v3d_irq_enable(struct v3d_dev *v3d);
605606
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
@@ -197,7 +197,7 @@ v3d_hub_irq(int irq, void *arg)
197197
{0x7F, 0x80, "GMP"},
198198
};
199199
const char *client = "?";
200-
static int logged_error;
200+
static bool logged_error;
201201

202202
V3D_WRITE(V3D_MMU_CTL, V3D_READ(V3D_MMU_CTL));
203203

@@ -225,16 +225,18 @@ v3d_hub_irq(int irq, void *arg)
225225
}
226226
}
227227

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

0 commit comments

Comments
 (0)