From c5feca8251eebda28a328906fe51ea963aa0b754 Mon Sep 17 00:00:00 2001 From: Matthew Poremba Date: Sun, 30 Oct 2022 12:23:48 -0700 Subject: [PATCH] dev-amdgpu: Rework PM4 NOP packet The PM4 NOP header is used to insert spaces in the PM4 ring and can therefore be any size. This includes zero. A size of zero is denoted by a value of 0x3fff in the NOP packet header. Currently we assume this means the remainder of the PM4 queue up to the wptr is empty/NOPs. This is not always true. This changeset reworks the PM4 NOP packet to handle the value of 0x3fff as a special value and advances the rptr by 0 bytes. This fixes issues where there were additional packets in the queue which were being skipped over by fast forwarding. Since those packets could be anything, that leads to undefined behavior afterwards. Change-Id: I3f5c3f4b7dd50f93ba503fea97454a9d41771e30 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65094 Maintainer: Matt Sinclair Tested-by: kokoro Reviewed-by: Matt Sinclair --- src/dev/amdgpu/pm4_packet_processor.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/dev/amdgpu/pm4_packet_processor.cc b/src/dev/amdgpu/pm4_packet_processor.cc index 67c150a3a2..48496f6585 100644 --- a/src/dev/amdgpu/pm4_packet_processor.cc +++ b/src/dev/amdgpu/pm4_packet_processor.cc @@ -202,9 +202,7 @@ PM4PacketProcessor::decodeHeader(PM4Queue *q, PM4Header header) case IT_NOP: { DPRINTF(PM4PacketProcessor, "PM4 nop, count %p\n", header.count); DPRINTF(PM4PacketProcessor, "rptr %p wptr %p\n", q->rptr(), q->wptr()); - if (header.count == 0x3fff) { - q->fastforwardRptr(); - } else { + if (header.count != 0x3fff) { q->incRptr((header.count + 1) * sizeof(uint32_t)); } decodeNext(q);