From bb35716d25999260c2cc491ed832a9a39f204dcb Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 31 Dec 2015 21:34:27 +0000 Subject: intel_error_decode: Update address parsing for 64bit offsets Signed-off-by: Chris Wilson --- tools/intel_error_decode.c | 49 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 13 deletions(-) (limited to 'tools/intel_error_decode.c') diff --git a/tools/intel_error_decode.c b/tools/intel_error_decode.c index 0f2f7063..371aa423 100644 --- a/tools/intel_error_decode.c +++ b/tools/intel_error_decode.c @@ -438,7 +438,7 @@ print_fault_data(unsigned devid, uint32_t data1, uint32_t data0) static void decode(struct drm_intel_decode *ctx, const char *buffer_name, const char *ring_name, - uint32_t gtt_offset, + uint64_t gtt_offset, uint32_t head_offset, uint32_t *data, int *count) @@ -446,9 +446,13 @@ static void decode(struct drm_intel_decode *ctx, if (!*count) return; - printf("%s (%s) at 0x%08x", buffer_name, ring_name, gtt_offset); + printf("%s (%s) at 0x%08x_%08x", buffer_name, ring_name, + (unsigned)(gtt_offset >> 32), + (unsigned)(gtt_offset & 0xffffffff)); if (head_offset != -1) - printf("; HEAD points to: 0x%08x", head_offset+ gtt_offset); + printf("; HEAD points to: 0x%08x_%08x", + (unsigned)((head_offset + gtt_offset) >> 32), + (unsigned)((head_offset + gtt_offset) & 0xffffffff)); printf("\n"); drm_intel_decode_set_batch_pointer(ctx, data, gtt_offset, *count); @@ -551,7 +555,7 @@ read_data_file(FILE *file) char *line = NULL; size_t line_size; uint32_t offset, value, ring_length = 0; - uint32_t gtt_offset = 0, new_gtt_offset; + uint64_t gtt_offset = 0, new_gtt_offset; uint32_t head_offset = -1; const char *buffer_name = "batch buffer"; char *ring_name = NULL; @@ -562,13 +566,20 @@ read_data_file(FILE *file) dashes = strstr(line, "---"); if (dashes) { + uint32_t lo, hi; char *new_ring_name = malloc(dashes - line); strncpy(new_ring_name, line, dashes - line); new_ring_name[dashes - line - 1] = '\0'; - matched = sscanf(dashes, "--- gtt_offset = 0x%08x\n", - &new_gtt_offset); - if (matched == 1) { + matched = sscanf(dashes, "--- gtt_offset = 0x%08x %08x\n", + &hi, &lo); + if (matched > 0) { + new_gtt_offset = hi; + if (matched == 2) { + new_gtt_offset <<= 32; + new_gtt_offset |= lo; + } + decode(decode_ctx, buffer_name, ring_name, gtt_offset, head_offset, @@ -581,9 +592,15 @@ read_data_file(FILE *file) continue; } - matched = sscanf(dashes, "--- ringbuffer = 0x%08x\n", - &new_gtt_offset); - if (matched == 1) { + matched = sscanf(dashes, "--- ringbuffer = 0x%08x %08x\n", + &hi, &lo); + if (matched > 0) { + new_gtt_offset = hi; + if (matched == 2) { + new_gtt_offset <<= 32; + new_gtt_offset |= lo; + } + decode(decode_ctx, buffer_name, ring_name, gtt_offset, head_offset, @@ -599,9 +616,15 @@ read_data_file(FILE *file) continue; } - matched = sscanf(dashes, "--- HW Context = 0x%08x\n", - &new_gtt_offset); - if (matched == 1) { + matched = sscanf(dashes, "--- HW Context = 0x%08x %08x\n", + &hi, &lo); + if (matched > 0) { + new_gtt_offset = hi; + if (matched == 2) { + new_gtt_offset <<= 32; + new_gtt_offset |= lo; + } + decode(decode_ctx, buffer_name, ring_name, gtt_offset, head_offset, -- cgit v1.2.3