[Mesa-dev] [PATCH 09/15] radv: dump some status MMIO registers when a hang occured

Samuel Pitoiset samuel.pitoiset at gmail.com
Tue Sep 12 10:35:46 UTC 2017


Might report some useful information to help figuring out where
does the hang happened.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/amd/vulkan/radv_debug.c | 57 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

diff --git a/src/amd/vulkan/radv_debug.c b/src/amd/vulkan/radv_debug.c
index 4abdb6489e..6f7337b028 100644
--- a/src/amd/vulkan/radv_debug.c
+++ b/src/amd/vulkan/radv_debug.c
@@ -28,6 +28,8 @@
 #include <stdlib.h>
 #include <stdio.h>
 
+#include "sid.h"
+#include "gfx9d.h"
 #include "ac_debug.h"
 #include "radv_debug.h"
 #include "radv_shader.h"
@@ -76,6 +78,59 @@ radv_dump_trace(struct radv_device *device, struct radeon_winsys_cs *cs)
 	fclose(f);
 }
 
+static void
+radv_dump_mmapped_reg(struct radv_device *device, FILE *f, unsigned offset)
+{
+	struct radeon_winsys *ws = device->ws;
+	uint32_t value;
+
+	if (ws->read_registers(ws, offset, 1, &value))
+		ac_dump_reg(f, device->physical_device->rad_info.chip_class,
+			    offset, value, ~0);
+}
+
+static void
+radv_dump_debug_registers(struct radv_device *device, FILE *f)
+{
+	struct radeon_info *info = &device->physical_device->rad_info;
+
+	if (info->drm_major == 2 && info->drm_minor < 42)
+		return; /* no radeon support */
+
+	fprintf(f, "Memory-mapped registers:\n");
+	radv_dump_mmapped_reg(device, f, R_008010_GRBM_STATUS);
+
+	/* No other registers can be read on DRM < 3.1.0. */
+	if (info->drm_major < 3 || info->drm_minor < 1) {
+		fprintf(f, "\n");
+		return;
+	}
+
+	radv_dump_mmapped_reg(device, f, R_008008_GRBM_STATUS2);
+	radv_dump_mmapped_reg(device, f, R_008014_GRBM_STATUS_SE0);
+	radv_dump_mmapped_reg(device, f, R_008018_GRBM_STATUS_SE1);
+	radv_dump_mmapped_reg(device, f, R_008038_GRBM_STATUS_SE2);
+	radv_dump_mmapped_reg(device, f, R_00803C_GRBM_STATUS_SE3);
+	radv_dump_mmapped_reg(device, f, R_00D034_SDMA0_STATUS_REG);
+	radv_dump_mmapped_reg(device, f, R_00D834_SDMA1_STATUS_REG);
+	if (info->chip_class <= VI) {
+		radv_dump_mmapped_reg(device, f, R_000E50_SRBM_STATUS);
+		radv_dump_mmapped_reg(device, f, R_000E4C_SRBM_STATUS2);
+		radv_dump_mmapped_reg(device, f, R_000E54_SRBM_STATUS3);
+	}
+	radv_dump_mmapped_reg(device, f, R_008680_CP_STAT);
+	radv_dump_mmapped_reg(device, f, R_008674_CP_STALLED_STAT1);
+	radv_dump_mmapped_reg(device, f, R_008678_CP_STALLED_STAT2);
+	radv_dump_mmapped_reg(device, f, R_008670_CP_STALLED_STAT3);
+	radv_dump_mmapped_reg(device, f, R_008210_CP_CPC_STATUS);
+	radv_dump_mmapped_reg(device, f, R_008214_CP_CPC_BUSY_STAT);
+	radv_dump_mmapped_reg(device, f, R_008218_CP_CPC_STALLED_STAT1);
+	radv_dump_mmapped_reg(device, f, R_00821C_CP_CPF_STATUS);
+	radv_dump_mmapped_reg(device, f, R_008220_CP_CPF_BUSY_STAT);
+	radv_dump_mmapped_reg(device, f, R_008224_CP_CPF_STALLED_STAT1);
+	fprintf(f, "\n");
+}
+
 static void
 radv_dump_shader(struct radv_pipeline *pipeline, gl_shader_stage stage, FILE *f)
 {
@@ -167,6 +222,8 @@ radv_check_gpu_hangs(struct radv_queue *queue, struct radeon_winsys_cs *cs)
 		fprintf(stderr, "Failing VM page: 0x%08"PRIx64"\n\n", addr);
 	}
 
+	radv_dump_debug_registers(device, stderr);
+
 	switch (ring) {
 	case RING_GFX:
 		radv_dump_state(graphics_pipeline, stderr);
-- 
2.14.1



More information about the mesa-dev mailing list