Skip to contentSkip to conversation

drm/amdgpu: fix PTE copy corruption for sdma 7

PATCH In review Min, Frank 2 participants 2 messages Sep 26, 2024 – Sep 27, 2024 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): SN7PR12MB6932EB1636FC06F28B4E133BE9692@SN7PR12MB6932.namprd12.prod.outlook.com

Min, Frank

author
#2 lore raw

PATCH 1/1 drm/amdgpu: fix PTE copy corruption for sdma 7

[AMD Official Use Only - AMD Internal Distribution Only]

From: Frank Min <[email protected]>

Without setting dcc bit, there is ramdon PTE copy corruption on sdma 7.

so add this bit and update the packet format accordingly.

---
 drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c +5 -3
index cfd8e183ad50..a8763496aed3 100644
@@ -1080,13 +1080,16 @@ static void sdma_v7_0_vm_copy_pte(struct amdgpu_ib *ib,
        unsigned bytes = count * 8;
 
        ib->ptr[ib->length_dw++] = SDMA_PKT_COPY_LINEAR_HEADER_OP(SDMA_OP_COPY) |
-               SDMA_PKT_COPY_LINEAR_HEADER_SUB_OP(SDMA_SUBOP_COPY_LINEAR);
+               SDMA_PKT_COPY_LINEAR_HEADER_SUB_OP(SDMA_SUBOP_COPY_LINEAR) |
+               SDMA_PKT_COPY_LINEAR_HEADER_CPV(1);
+
        ib->ptr[ib->length_dw++] = bytes - 1;
        ib->ptr[ib->length_dw++] = 0; /* src/dst endian swap */
        ib->ptr[ib->length_dw++] = lower_32_bits(src);
        ib->ptr[ib->length_dw++] = upper_32_bits(src);
        ib->ptr[ib->length_dw++] = lower_32_bits(pe);
        ib->ptr[ib->length_dw++] = upper_32_bits(pe);
+       ib->ptr[ib->length_dw++] = 0;
 
 }
 
@@ -1744,7 +1747,7 @@ static void sdma_v7_0_set_buffer_funcs(struct amdgpu_device *adev)  }
 
 static const struct amdgpu_vm_pte_funcs sdma_v7_0_vm_pte_funcs = {
-       .copy_pte_num_dw = 7,
+       .copy_pte_num_dw = 8,
        .copy_pte = sdma_v7_0_vm_copy_pte,
        .write_pte = sdma_v7_0_vm_write_pte,
        .set_pte_pde = sdma_v7_0_vm_set_pte_pde,
--

2.43.0

Acked-by on v1 1/1
#3 lore raw
Quoted 10 lines · Frank

[AMD Official Use Only - AMD Internal Distribution Only]

From: Frank Min <[email protected]>

Without setting dcc bit, there is ramdon PTE copy corruption on sdma 7.

so add this bit and update the packet format accordingly.

Quoted 38 lines
---
 drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c +5 -3
index cfd8e183ad50..a8763496aed3 100644
@@ -1080,13 +1080,16 @@ static void sdma_v7_0_vm_copy_pte(struct amdgpu_ib *ib,
        unsigned bytes = count * 8;
 
        ib->ptr[ib->length_dw++] = SDMA_PKT_COPY_LINEAR_HEADER_OP(SDMA_OP_COPY) |
-               SDMA_PKT_COPY_LINEAR_HEADER_SUB_OP(SDMA_SUBOP_COPY_LINEAR);
+               SDMA_PKT_COPY_LINEAR_HEADER_SUB_OP(SDMA_SUBOP_COPY_LINEAR) |
+               SDMA_PKT_COPY_LINEAR_HEADER_CPV(1);
+
        ib->ptr[ib->length_dw++] = bytes - 1;
        ib->ptr[ib->length_dw++] = 0; /* src/dst endian swap */
        ib->ptr[ib->length_dw++] = lower_32_bits(src);
        ib->ptr[ib->length_dw++] = upper_32_bits(src);
        ib->ptr[ib->length_dw++] = lower_32_bits(pe);
        ib->ptr[ib->length_dw++] = upper_32_bits(pe);
+       ib->ptr[ib->length_dw++] = 0;
 
 }
 
@@ -1744,7 +1747,7 @@ static void sdma_v7_0_set_buffer_funcs(struct amdgpu_device *adev)  }
 
 static const struct amdgpu_vm_pte_funcs sdma_v7_0_vm_pte_funcs = {
-       .copy_pte_num_dw = 7,
+       .copy_pte_num_dw = 8,
        .copy_pte = sdma_v7_0_vm_copy_pte,
        .write_pte = sdma_v7_0_vm_write_pte,
        .set_pte_pde = sdma_v7_0_vm_set_pte_pde,
--

2.43.0