Skip to content

Commit 35f27c3

Browse files
committed
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 <mairacanal@riseup.net>
1 parent 2015757 commit 35f27c3

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

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

drivers/gpu/drm/v3d/v3d_drv.h

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

591591
/* v3d_irq.c */
592+
extern bool debug_mmu;
592593
int v3d_irq_init(struct v3d_dev *v3d);
593594
void v3d_irq_enable(struct v3d_dev *v3d);
594595
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
@@ -183,7 +183,7 @@ v3d_hub_irq(int irq, void *arg)
183183
"GMP",
184184
};
185185
const char *client = "?";
186-
static int logged_error;
186+
static bool logged_error;
187187

188188
V3D_WRITE(V3D_MMU_CTL, V3D_READ(V3D_MMU_CTL));
189189

@@ -193,16 +193,18 @@ v3d_hub_irq(int irq, void *arg)
193193
client = v3d41_axi_ids[axi_id];
194194
}
195195

196-
if (!logged_error)
197-
dev_err(v3d->drm.dev, "MMU error from client %s (%d) at 0x%llx%s%s%s\n",
198-
client, axi_id, (long long)vio_addr,
199-
((intsts & V3D_HUB_INT_MMU_WRV) ?
200-
", write violation" : ""),
201-
((intsts & V3D_HUB_INT_MMU_PTI) ?
202-
", pte invalid" : ""),
203-
((intsts & V3D_HUB_INT_MMU_CAP) ?
204-
", cap exceeded" : ""));
205-
logged_error = 1;
196+
if (!logged_error || debug_mmu) {
197+
dev_err(v3d->drm.dev, "MMU error from client %s (%d) at 0x%llx%s%s%s\n",
198+
client, axi_id, (long long)vio_addr,
199+
((intsts & V3D_HUB_INT_MMU_WRV) ?
200+
", write violation" : ""),
201+
((intsts & V3D_HUB_INT_MMU_PTI) ?
202+
", pte invalid" : ""),
203+
((intsts & V3D_HUB_INT_MMU_CAP) ?
204+
", cap exceeded" : ""));
205+
}
206+
logged_error = true;
207+
206208
status = IRQ_HANDLED;
207209
}
208210

0 commit comments

Comments
 (0)