This patch detects the sequence of PKT0 writes to registers
which configure the VMID/ADDR/SIZE of the IBs in the ring and
then chains them once all 4 pieces of information are found.

Signed-off-by: Tom St Denis <tom.stde...@amd.com>
---
 src/lib/ring_decode.c | 26 +++++++++++++++++++++++++-
 src/umr.h             |  1 +
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/src/lib/ring_decode.c b/src/lib/ring_decode.c
index 48d840643bf9..d87d489b1e4a 100644
--- a/src/lib/ring_decode.c
+++ b/src/lib/ring_decode.c
@@ -562,6 +562,7 @@ static void print_decode_pm4_pkt3(struct umr_asic *asic, 
struct umr_ring_decoder
 
 static void print_decode_pm4(struct umr_asic *asic, struct umr_ring_decoder 
*decoder, uint32_t ib)
 {
+       char *name;
        switch (decoder->pm4.cur_opcode) {
                case 0xFFFFFFFF: // initial decode
                        decoder->pm4.pkt_type = ib >> 30;
@@ -582,7 +583,30 @@ static void print_decode_pm4(struct umr_asic *asic, struct 
umr_ring_decoder *dec
                                decoder->pm4.cur_opcode = 0xFFFFFFFF;
                        return;
                case 0x80000000:
-                       printf("PKT0 %s(0x%lx) == %lx", umr_reg_name(asic, 
decoder->pm4.next_write_mem.addr_lo), (unsigned 
long)decoder->pm4.next_write_mem.addr_lo, (unsigned long)ib);
+                       name = umr_reg_name(asic, 
decoder->pm4.next_write_mem.addr_lo);
+                       printf("PKT0 %s(0x%lx) == %lx", name, (unsigned 
long)decoder->pm4.next_write_mem.addr_lo, (unsigned long)ib);
+
+                       // detect VCN/UVD IBs and chain them once all
+                       // 4 pieces of information are found
+                       if (!strcmp(name, "mmUVD_LMI_RBC_IB_VMID")) {
+                               decoder->pm4.next_ib_state.ib_vmid = ib;
+                               ++decoder->pm4.next_ib_state.tally;
+                       } else if (!strcmp(name, 
"mmUVD_LMI_RBC_IB_64BIT_BAR_LOW")) {
+                               decoder->pm4.next_ib_state.ib_addr_lo = ib;
+                               ++decoder->pm4.next_ib_state.tally;
+                       } else if (!strcmp(name, 
"mmUVD_LMI_RBC_IB_64BIT_BAR_HIGH")) {
+                               decoder->pm4.next_ib_state.ib_addr_hi = ib;
+                               ++decoder->pm4.next_ib_state.tally;
+                       } else if (!strcmp(name, "mmUVD_RBC_IB_SIZE")) {
+                               decoder->pm4.next_ib_state.ib_size = ib;
+                               ++decoder->pm4.next_ib_state.tally;
+                       }
+
+                       if (decoder->pm4.next_ib_state.tally == 4) {
+                               decoder->pm4.next_ib_state.tally = 0;
+                               add_ib(decoder);
+                       }
+
                        decoder->pm4.next_write_mem.addr_lo++;
                        break;
                default:
diff --git a/src/umr.h b/src/umr.h
index 592dcc083bab..51690400f583 100644
--- a/src/umr.h
+++ b/src/umr.h
@@ -342,6 +342,7 @@ struct umr_ring_decoder {
                                 ib_addr_hi,
                                 ib_size,
                                 ib_vmid;
+                       int tally;
                } next_ib_state;
 
                struct {
-- 
2.12.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to