[PATCH UMR] Fix off-by-one error for decoding sdma linear write packet

StDenis, Tom Tom.StDenis at amd.com
Tue Jul 14 14:11:02 UTC 2020


[AMD Official Use Only - Internal Distribution Only]

Thanks, can you attach the patch to your email instead though so it applies cleanly?

Cheers,
Tom

________________________________________
From: Yuan, Xiaojie <Xiaojie.Yuan at amd.com>
Sent: Tuesday, July 14, 2020 00:18
To: amd-gfx at lists.freedesktop.org; StDenis, Tom
Cc: Yuan, Xiaojie
Subject: [PATCH UMR] Fix off-by-one error for decoding sdma linear write packet

COUNT in linear write packet represents dword number - 1

Before fix:
navi10.sdma0.ring[   0] == 0x00000002    .w. OPCODE: [WRITE], SUB-OPCODE: [0], LINEAR_WRITE
navi10.sdma0.ring[   1] == 0x00400a60    ... |---+ WORD [1]: DST_ADDR_LO: 0x00400a60
navi10.sdma0.ring[   2] == 0x00000000    ... |---+ WORD [2]: DST_ADDR_HI: 0x00000000
navi10.sdma0.ring[   3] == 0x00000000    ... |---+ WORD [3]: COUNT: 0x00000000
navi10.sdma0.ring[   4] == 0xdeadbeef    ...

After fix:
navi10.sdma0.ring[   0] == 0x00000002    .w. OPCODE: [WRITE], SUB-OPCODE: [0], LINEAR_WRITE
navi10.sdma0.ring[   1] == 0x00400a60    ... |---+ WORD [1]: DST_ADDR_LOa: 0x00400a60
navi10.sdma0.ring[   2] == 0x00000000    ... |---+ WORD [2]: DST_ADDR_HIb: 0x00000000
navi10.sdma0.ring[   3] == 0x00000000    ... |---+ WORD [3]: COUNTc: 0x00000000
navi10.sdma0.ring[   4] == 0xdeadbeef    ... \---+ WORD [4]: DATA: 0xdeadbeef

Signed-off-by: Xiaojie Yuan <xiaojie.yuan at amd.com>
---
 src/lib/ring_decode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lib/ring_decode.c b/src/lib/ring_decode.c
index c3b5d18..a74229d 100644
--- a/src/lib/ring_decode.c
+++ b/src/lib/ring_decode.c
@@ -1819,7 +1819,7 @@ static void parse_next_sdma_pkt(struct umr_asic *asic, struct umr_ring_decoder *
                                                case 2: printf("DST_ADDR_HI: %s0x%08lx%s", YELLOW, (unsigned long)ib, RST);
                                                        break;
                                                case 3: printf("COUNT: %s0x%08lx%s", BLUE, (unsigned long)ib, RST);
-                                                       decoder->sdma.n_words += ib - 1;
+                                                       decoder->sdma.n_words += ib;
                                                        break;
                                                default: printf("DATA: %s0x%08lx%s", BLUE, (unsigned long)ib, RST);
                                                        break;
--
2.20.1



More information about the amd-gfx mailing list