Skip to content

Commit 338154d

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 <mcanal@igalia.com>
1 parent acdaa4e commit 338154d

File tree

2 files changed

+18
-11
lines changed

2 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 = false;
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_irq.c

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ v3d_hub_irq(int irq, void *arg)
183183
"GMP",
184184
};
185185
const char *client = "?";
186-
static int logged_error;
186+
static bool logged_error = false;
187+
extern bool debug_mmu;
187188

188189
V3D_WRITE(V3D_MMU_CTL, V3D_READ(V3D_MMU_CTL));
189190

@@ -193,16 +194,18 @@ v3d_hub_irq(int irq, void *arg)
193194
client = v3d41_axi_ids[axi_id];
194195
}
195196

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

0 commit comments

Comments
 (0)