Skip to contentSkip to conversation

Add ability to follow IBs from VCN/UVD rings

PATCH New Tom St Denis 1 participant 1 message Jul 13, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add ability to follow IBs from VCN/UVD rings

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.

---
 src/lib/ring_decode.c | 26 +++++++++++++++++++++++++-
 src/umr.h             |  1 +
 2 files changed, 26 insertions(+), 1 deletion(-)
src/lib/ring_decode.c +25 -1
index 48d840643bf9..d87d489b1e4a 100644
@@ -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:
src/umr.h +1 -0
index 592dcc083bab..51690400f583 100644
@@ -342,6 +342,7 @@ struct umr_ring_decoder {
 				 ib_addr_hi,
 				 ib_size,
 				 ib_vmid;
+			int tally;
 		} next_ib_state;
 
 		struct {
Signature · 6 lines
2.12.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx