Skip to contentSkip to conversation

drm/amdgpu/sdma4: set align mask to 255

PATCH In review Alex Deucher 5 participants 5 messages Jun 7, 2023 – Jun 13, 2023

Subsystems (2)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/1 drm/amdgpu/sdma4: set align mask to 255

The wptr needs to be incremented at at least 64 dword intervals, use 256 to align with windows. This should fix potential hangs with unaligned updates.

---
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c   | 4 ++--
 drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +2 -2
index 1f83eebfc8a7..cd37f45e01a1 100644
@@ -2312,7 +2312,7 @@ const struct amd_ip_funcs sdma_v4_0_ip_funcs = {
 
 static const struct amdgpu_ring_funcs sdma_v4_0_ring_funcs = {
 	.type = AMDGPU_RING_TYPE_SDMA,
-	.align_mask = 0xf,
+	.align_mask = 0xff,
 	.nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
 	.support_64bit_ptrs = true,
 	.secure_submission_supported = true,
@@ -2344,7 +2344,7 @@ static const struct amdgpu_ring_funcs sdma_v4_0_ring_funcs = {
 
 static const struct amdgpu_ring_funcs sdma_v4_0_page_ring_funcs = {
 	.type = AMDGPU_RING_TYPE_SDMA,
-	.align_mask = 0xf,
+	.align_mask = 0xff,
 	.nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
 	.support_64bit_ptrs = true,
 	.secure_submission_supported = true,
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +2 -2
index 8eebf9c2bbcd..05bb0691ee0e 100644
@@ -1823,7 +1823,7 @@ const struct amd_ip_funcs sdma_v4_4_2_ip_funcs = {
 
 static const struct amdgpu_ring_funcs sdma_v4_4_2_ring_funcs = {
 	.type = AMDGPU_RING_TYPE_SDMA,
-	.align_mask = 0xf,
+	.align_mask = 0xff,
 	.nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
 	.support_64bit_ptrs = true,
 	.get_rptr = sdma_v4_4_2_ring_get_rptr,
@@ -1854,7 +1854,7 @@ static const struct amdgpu_ring_funcs sdma_v4_4_2_ring_funcs = {
 
 static const struct amdgpu_ring_funcs sdma_v4_4_2_page_ring_funcs = {
 	.type = AMDGPU_RING_TYPE_SDMA,
-	.align_mask = 0xf,
+	.align_mask = 0xff,
 	.nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
 	.support_64bit_ptrs = true,
 	.get_rptr = sdma_v4_4_2_ring_get_rptr,
Signature · 1 line
2.40.1
#1 lore raw

ping?

Quoted 58 lines · Alex Deucher

The wptr needs to be incremented at at least 64 dword intervals, use 256 to align with windows. This should fix potential hangs with unaligned updates.

---
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c   | 4 ++--
 drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +2 -2
index 1f83eebfc8a7..cd37f45e01a1 100644
@@ -2312,7 +2312,7 @@ const struct amd_ip_funcs sdma_v4_0_ip_funcs = {
 
 static const struct amdgpu_ring_funcs sdma_v4_0_ring_funcs = {
        .type = AMDGPU_RING_TYPE_SDMA,
-       .align_mask = 0xf,
+       .align_mask = 0xff,
        .nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
        .support_64bit_ptrs = true,
        .secure_submission_supported = true,
@@ -2344,7 +2344,7 @@ static const struct amdgpu_ring_funcs sdma_v4_0_ring_funcs = {
 
 static const struct amdgpu_ring_funcs sdma_v4_0_page_ring_funcs = {
        .type = AMDGPU_RING_TYPE_SDMA,
-       .align_mask = 0xf,
+       .align_mask = 0xff,
        .nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
        .support_64bit_ptrs = true,
        .secure_submission_supported = true,
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +2 -3
index 8eebf9c2bbcd..05bb0691ee0e 100644
@@ -1823,7 +1823,7 @@ const struct amd_ip_funcs sdma_v4_4_2_ip_funcs = {
 
 static const struct amdgpu_ring_funcs sdma_v4_4_2_ring_funcs = {
        .type = AMDGPU_RING_TYPE_SDMA,
-       .align_mask = 0xf,
+       .align_mask = 0xff,
        .nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
        .support_64bit_ptrs = true,
        .get_rptr = sdma_v4_4_2_ring_get_rptr,
@@ -1854,7 +1854,7 @@ static const struct amdgpu_ring_funcs sdma_v4_4_2_ring_funcs = {
 
 static const struct amdgpu_ring_funcs sdma_v4_4_2_page_ring_funcs = {
        .type = AMDGPU_RING_TYPE_SDMA,
-       .align_mask = 0xf,
+       .align_mask = 0xff,
        .nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
        .support_64bit_ptrs = true,
        .get_rptr = sdma_v4_4_2_ring_get_rptr,
--

2.40.1

Reviewed-by
#2 lore raw

[AMD Official Use Only - General]

Quoted 73 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Tuesday, June 13, 2023 5:48 AM
To: Deucher, Alexander <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] drm/amdgpu/sdma4: set align mask to 255

ping?

Quoted 61 lines · Alex Deucher

The wptr needs to be incremented at at least 64 dword intervals, use 256 to align with windows. This should fix potential hangs with unaligned updates.

---
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c   | 4 ++--
 drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +1 -1
index 1f83eebfc8a7..cd37f45e01a1 100644
@@ -2312,7 +2312,7 @@ const struct amd_ip_funcs sdma_v4_0_ip_funcs = {
 
 static const struct amdgpu_ring_funcs sdma_v4_0_ring_funcs = {
        .type = AMDGPU_RING_TYPE_SDMA,
-       .align_mask = 0xf,
+       .align_mask = 0xff,
        .nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
        .support_64bit_ptrs = true,
        .secure_submission_supported = true, @@ -2344,7 +2344,7 @@

static const struct amdgpu_ring_funcs sdma_v4_0_ring_funcs = {

static const struct amdgpu_ring_funcs sdma_v4_0_page_ring_funcs = {
.type = AMDGPU_RING_TYPE_SDMA,

drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +1 -1
-       .align_mask = 0xf,
+       .align_mask = 0xff,
        .nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
        .support_64bit_ptrs = true,
        .secure_submission_supported = true, diff --git

a/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c
b/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c
index 8eebf9c2bbcd..05bb0691ee0e 100644

drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +1 -1
@@ -1823,7 +1823,7 @@ const struct amd_ip_funcs sdma_v4_4_2_ip_funcs =
 {
 
 static const struct amdgpu_ring_funcs sdma_v4_4_2_ring_funcs = {
        .type = AMDGPU_RING_TYPE_SDMA,
-       .align_mask = 0xf,
+       .align_mask = 0xff,
        .nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
        .support_64bit_ptrs = true,
        .get_rptr = sdma_v4_4_2_ring_get_rptr, @@ -1854,7 +1854,7 @@

static const struct amdgpu_ring_funcs sdma_v4_4_2_ring_funcs = {

static const struct amdgpu_ring_funcs sdma_v4_4_2_page_ring_funcs = {
.type = AMDGPU_RING_TYPE_SDMA,

drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +1 -2
-       .align_mask = 0xf,
+       .align_mask = 0xff,
        .nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
        .support_64bit_ptrs = true,
        .get_rptr = sdma_v4_4_2_ring_get_rptr,
--

2.40.1

Reviewed-by
#3 lore raw

Am 13.06.23 um 03:14 schrieb Liu, Aaron:

Quoted 76 lines

[AMD Official Use Only - General]

Quoted 72 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Tuesday, June 13, 2023 5:48 AM
To: Deucher, Alexander <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] drm/amdgpu/sdma4: set align mask to 255

ping?

Quoted 60 lines · Alex Deucher

The wptr needs to be incremented at at least 64 dword intervals, use 256 to align with windows. This should fix potential hangs with unaligned updates.

---
  drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c   | 4 ++--
  drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c | 4 ++--
  2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +1 -1
index 1f83eebfc8a7..cd37f45e01a1 100644
@@ -2312,7 +2312,7 @@ const struct amd_ip_funcs sdma_v4_0_ip_funcs = {
 
  static const struct amdgpu_ring_funcs sdma_v4_0_ring_funcs = {
         .type = AMDGPU_RING_TYPE_SDMA,
-       .align_mask = 0xf,
+       .align_mask = 0xff,
         .nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
         .support_64bit_ptrs = true,
         .secure_submission_supported = true, @@ -2344,7 +2344,7 @@

static const struct amdgpu_ring_funcs sdma_v4_0_ring_funcs = {

  static const struct amdgpu_ring_funcs sdma_v4_0_page_ring_funcs = {
         .type = AMDGPU_RING_TYPE_SDMA,
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +1 -1
-       .align_mask = 0xf,
+       .align_mask = 0xff,
         .nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
         .support_64bit_ptrs = true,
         .secure_submission_supported = true, diff --git

a/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c
b/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c
index 8eebf9c2bbcd..05bb0691ee0e 100644

drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +1 -1
@@ -1823,7 +1823,7 @@ const struct amd_ip_funcs sdma_v4_4_2_ip_funcs =
 {
 
  static const struct amdgpu_ring_funcs sdma_v4_4_2_ring_funcs = {
         .type = AMDGPU_RING_TYPE_SDMA,
-       .align_mask = 0xf,
+       .align_mask = 0xff,
         .nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
         .support_64bit_ptrs = true,
         .get_rptr = sdma_v4_4_2_ring_get_rptr, @@ -1854,7 +1854,7 @@

static const struct amdgpu_ring_funcs sdma_v4_4_2_ring_funcs = {

  static const struct amdgpu_ring_funcs sdma_v4_4_2_page_ring_funcs = {
         .type = AMDGPU_RING_TYPE_SDMA,
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +1 -2
-       .align_mask = 0xf,
+       .align_mask = 0xff,
         .nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
         .support_64bit_ptrs = true,
         .get_rptr = sdma_v4_4_2_ring_get_rptr,
--

2.40.1

Reviewed-by on v1 1/1
#4 lore raw
In reply to Alex Deucher

Am 2023-06-07 um 12:31 schrieb Alex Deucher:

Quoted 5 lines

The wptr needs to be incremented at at least 64 dword intervals, use 256 to align with windows. This should fix potential hangs with unaligned updates.

Quoted 49 lines
---
  drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c   | 4 ++--
  drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c | 4 ++--
  2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +2 -2
index 1f83eebfc8a7..cd37f45e01a1 100644
@@ -2312,7 +2312,7 @@ const struct amd_ip_funcs sdma_v4_0_ip_funcs = {
 
  static const struct amdgpu_ring_funcs sdma_v4_0_ring_funcs = {
  	.type = AMDGPU_RING_TYPE_SDMA,
-	.align_mask = 0xf,
+	.align_mask = 0xff,
  	.nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
  	.support_64bit_ptrs = true,
  	.secure_submission_supported = true,
@@ -2344,7 +2344,7 @@ static const struct amdgpu_ring_funcs sdma_v4_0_ring_funcs = {
 
  static const struct amdgpu_ring_funcs sdma_v4_0_page_ring_funcs = {
  	.type = AMDGPU_RING_TYPE_SDMA,
-	.align_mask = 0xf,
+	.align_mask = 0xff,
  	.nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
  	.support_64bit_ptrs = true,
  	.secure_submission_supported = true,
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +2 -2
index 8eebf9c2bbcd..05bb0691ee0e 100644
@@ -1823,7 +1823,7 @@ const struct amd_ip_funcs sdma_v4_4_2_ip_funcs = {
 
  static const struct amdgpu_ring_funcs sdma_v4_4_2_ring_funcs = {
  	.type = AMDGPU_RING_TYPE_SDMA,
-	.align_mask = 0xf,
+	.align_mask = 0xff,
  	.nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
  	.support_64bit_ptrs = true,
  	.get_rptr = sdma_v4_4_2_ring_get_rptr,
@@ -1854,7 +1854,7 @@ static const struct amdgpu_ring_funcs sdma_v4_4_2_ring_funcs = {
 
  static const struct amdgpu_ring_funcs sdma_v4_4_2_page_ring_funcs = {
  	.type = AMDGPU_RING_TYPE_SDMA,
-	.align_mask = 0xf,
+	.align_mask = 0xff,
  	.nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
  	.support_64bit_ptrs = true,
  	.get_rptr = sdma_v4_4_2_ring_get_rptr,