Commit e1b4e722 authored by Alex Deucher's avatar Alex Deucher

drm/radeon: dump full IB if we hit a packet error

Dump the whole IB if we run into an invalid packet.
This makes things much easier to debug.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=89148Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 951caa6a
...@@ -715,6 +715,7 @@ int radeon_cs_packet_parse(struct radeon_cs_parser *p, ...@@ -715,6 +715,7 @@ int radeon_cs_packet_parse(struct radeon_cs_parser *p,
struct radeon_cs_chunk *ib_chunk = p->chunk_ib; struct radeon_cs_chunk *ib_chunk = p->chunk_ib;
struct radeon_device *rdev = p->rdev; struct radeon_device *rdev = p->rdev;
uint32_t header; uint32_t header;
int ret = 0, i;
if (idx >= ib_chunk->length_dw) { if (idx >= ib_chunk->length_dw) {
DRM_ERROR("Can not parse packet at %d after CS end %d !\n", DRM_ERROR("Can not parse packet at %d after CS end %d !\n",
...@@ -743,14 +744,25 @@ int radeon_cs_packet_parse(struct radeon_cs_parser *p, ...@@ -743,14 +744,25 @@ int radeon_cs_packet_parse(struct radeon_cs_parser *p,
break; break;
default: default:
DRM_ERROR("Unknown packet type %d at %d !\n", pkt->type, idx); DRM_ERROR("Unknown packet type %d at %d !\n", pkt->type, idx);
return -EINVAL; ret = -EINVAL;
goto dump_ib;
} }
if ((pkt->count + 1 + pkt->idx) >= ib_chunk->length_dw) { if ((pkt->count + 1 + pkt->idx) >= ib_chunk->length_dw) {
DRM_ERROR("Packet (%d:%d:%d) end after CS buffer (%d) !\n", DRM_ERROR("Packet (%d:%d:%d) end after CS buffer (%d) !\n",
pkt->idx, pkt->type, pkt->count, ib_chunk->length_dw); pkt->idx, pkt->type, pkt->count, ib_chunk->length_dw);
return -EINVAL; ret = -EINVAL;
goto dump_ib;
} }
return 0; return 0;
dump_ib:
for (i = 0; i < ib_chunk->length_dw; i++) {
if (i == idx)
printk("\t0x%08x <---\n", radeon_get_ib_value(p, i));
else
printk("\t0x%08x\n", radeon_get_ib_value(p, i));
}
return ret;
} }
/** /**
......
...@@ -4699,12 +4699,6 @@ int si_ib_parse(struct radeon_device *rdev, struct radeon_ib *ib) ...@@ -4699,12 +4699,6 @@ int si_ib_parse(struct radeon_device *rdev, struct radeon_ib *ib)
switch (pkt.type) { switch (pkt.type) {
case RADEON_PACKET_TYPE0: case RADEON_PACKET_TYPE0:
dev_err(rdev->dev, "Packet0 not allowed!\n"); dev_err(rdev->dev, "Packet0 not allowed!\n");
for (i = 0; i < ib->length_dw; i++) {
if (i == idx)
printk("\t0x%08x <---\n", ib->ptr[i]);
else
printk("\t0x%08x\n", ib->ptr[i]);
}
ret = -EINVAL; ret = -EINVAL;
break; break;
case RADEON_PACKET_TYPE2: case RADEON_PACKET_TYPE2:
...@@ -4736,8 +4730,15 @@ int si_ib_parse(struct radeon_device *rdev, struct radeon_ib *ib) ...@@ -4736,8 +4730,15 @@ int si_ib_parse(struct radeon_device *rdev, struct radeon_ib *ib)
ret = -EINVAL; ret = -EINVAL;
break; break;
} }
if (ret) if (ret) {
for (i = 0; i < ib->length_dw; i++) {
if (i == idx)
printk("\t0x%08x <---\n", ib->ptr[i]);
else
printk("\t0x%08x\n", ib->ptr[i]);
}
break; break;
}
} while (idx < ib->length_dw); } while (idx < ib->length_dw);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment