Skip to content

Commit 108bc59

Browse files
frank98753alexdeucher
authored andcommitted
drm/amdgpu: fix random data corruption for sdma 7
There is random data corruption caused by const fill, this is caused by write compression mode not correctly configured. So correct compression mode for const fill. Signed-off-by: Frank Min <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]> (cherry picked from commit 75400f8) Cc: [email protected] # 6.11.x
1 parent 63feb35 commit 108bc59

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ MODULE_FIRMWARE("amdgpu/sdma_7_0_1.bin");
5151
#define SDMA0_HYP_DEC_REG_END 0x589a
5252
#define SDMA1_HYP_DEC_REG_OFFSET 0x20
5353

54+
/*define for compression field for sdma7*/
55+
#define SDMA_PKT_CONSTANT_FILL_HEADER_compress_offset 0
56+
#define SDMA_PKT_CONSTANT_FILL_HEADER_compress_mask 0x00000001
57+
#define SDMA_PKT_CONSTANT_FILL_HEADER_compress_shift 16
58+
#define SDMA_PKT_CONSTANT_FILL_HEADER_COMPRESS(x) (((x) & SDMA_PKT_CONSTANT_FILL_HEADER_compress_mask) << SDMA_PKT_CONSTANT_FILL_HEADER_compress_shift)
59+
5460
static const struct amdgpu_hwip_reg_entry sdma_reg_list_7_0[] = {
5561
SOC15_REG_ENTRY_STR(GC, 0, regSDMA0_STATUS_REG),
5662
SOC15_REG_ENTRY_STR(GC, 0, regSDMA0_STATUS1_REG),
@@ -1724,7 +1730,8 @@ static void sdma_v7_0_emit_fill_buffer(struct amdgpu_ib *ib,
17241730
uint64_t dst_offset,
17251731
uint32_t byte_count)
17261732
{
1727-
ib->ptr[ib->length_dw++] = SDMA_PKT_COPY_LINEAR_HEADER_OP(SDMA_OP_CONST_FILL);
1733+
ib->ptr[ib->length_dw++] = SDMA_PKT_CONSTANT_FILL_HEADER_OP(SDMA_OP_CONST_FILL) |
1734+
SDMA_PKT_CONSTANT_FILL_HEADER_COMPRESS(1);
17281735
ib->ptr[ib->length_dw++] = lower_32_bits(dst_offset);
17291736
ib->ptr[ib->length_dw++] = upper_32_bits(dst_offset);
17301737
ib->ptr[ib->length_dw++] = src_data;

0 commit comments

Comments
 (0)