Skip to content

Commit 6234fc0

Browse files
committed
drm/vc4: Make sure that the v3d ident debugfs has vc4's power on.
Otherwise, you sometimes decode the ident fields based on 0xdeadbeef register reads. Signed-off-by: Eric Anholt <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Reviewed-by: Paul Kocialkowski <[email protected]>
1 parent cb74f6e commit 6234fc0

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

drivers/gpu/drm/vc4/vc4_v3d.c

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -121,18 +121,23 @@ int vc4_v3d_debugfs_ident(struct seq_file *m, void *unused)
121121
struct drm_info_node *node = (struct drm_info_node *)m->private;
122122
struct drm_device *dev = node->minor->dev;
123123
struct vc4_dev *vc4 = to_vc4_dev(dev);
124-
uint32_t ident1 = V3D_READ(V3D_IDENT1);
125-
uint32_t nslc = VC4_GET_FIELD(ident1, V3D_IDENT1_NSLC);
126-
uint32_t tups = VC4_GET_FIELD(ident1, V3D_IDENT1_TUPS);
127-
uint32_t qups = VC4_GET_FIELD(ident1, V3D_IDENT1_QUPS);
128-
129-
seq_printf(m, "Revision: %d\n",
130-
VC4_GET_FIELD(ident1, V3D_IDENT1_REV));
131-
seq_printf(m, "Slices: %d\n", nslc);
132-
seq_printf(m, "TMUs: %d\n", nslc * tups);
133-
seq_printf(m, "QPUs: %d\n", nslc * qups);
134-
seq_printf(m, "Semaphores: %d\n",
135-
VC4_GET_FIELD(ident1, V3D_IDENT1_NSEM));
124+
int ret = vc4_v3d_pm_get(vc4);
125+
126+
if (ret == 0) {
127+
uint32_t ident1 = V3D_READ(V3D_IDENT1);
128+
uint32_t nslc = VC4_GET_FIELD(ident1, V3D_IDENT1_NSLC);
129+
uint32_t tups = VC4_GET_FIELD(ident1, V3D_IDENT1_TUPS);
130+
uint32_t qups = VC4_GET_FIELD(ident1, V3D_IDENT1_QUPS);
131+
132+
seq_printf(m, "Revision: %d\n",
133+
VC4_GET_FIELD(ident1, V3D_IDENT1_REV));
134+
seq_printf(m, "Slices: %d\n", nslc);
135+
seq_printf(m, "TMUs: %d\n", nslc * tups);
136+
seq_printf(m, "QPUs: %d\n", nslc * qups);
137+
seq_printf(m, "Semaphores: %d\n",
138+
VC4_GET_FIELD(ident1, V3D_IDENT1_NSEM));
139+
vc4_v3d_pm_put(vc4);
140+
}
136141

137142
return 0;
138143
}

0 commit comments

Comments
 (0)