Skip to contentSkip to conversation

drm/amdgpu: detach ring priority from gfx priority

PATCH Superseded Nirmoy Das 3 participants 5 messages Aug 25, 2021 – Aug 26, 2021

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Nirmoy Das

author
#0 lore raw

PATCH 1/1 drm/amdgpu: detach ring priority from gfx priority

Currently AMDGPU_RING_PRIO_MAX is redefinition of a max gfx hwip priority, this won't work well when we will have a hwip with different set of priorities than gfx. Also, HW ring priorities are different from ring priorities.

Create a global enum for ring priority levels which each HWIP can use to define its own priority levels.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h  |  6 +++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 10 ++++++++--
 2 files changed, 11 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +3 -3
index d43fe2ed8116..937320293029 100644
@@ -43,9 +43,9 @@
 #define AMDGPU_MAX_COMPUTE_QUEUES KGD_MAX_QUEUES
 
 enum gfx_pipe_priority {
-	AMDGPU_GFX_PIPE_PRIO_NORMAL = 1,
-	AMDGPU_GFX_PIPE_PRIO_HIGH,
-	AMDGPU_GFX_PIPE_PRIO_MAX
+	AMDGPU_GFX_PIPE_PRIO_NORMAL = AMDGPU_RING_PRIO_1,
+	AMDGPU_GFX_PIPE_PRIO_HIGH = AMDGPU_RING_PRIO_2,
+	AMDGPU_GFX_PIPE_PRIO_MAX = AMDGPU_RING_PRIO_3
 };
 
 /* Argument for PPSMC_MSG_GpuChangeState */
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +8 -2
index e713d31619fe..85541005c1ad 100644
@@ -36,8 +36,14 @@
 #define AMDGPU_MAX_VCE_RINGS		3
 #define AMDGPU_MAX_UVD_ENC_RINGS	2
 
-#define AMDGPU_RING_PRIO_DEFAULT	1
-#define AMDGPU_RING_PRIO_MAX		AMDGPU_GFX_PIPE_PRIO_MAX
+enum amdgpu_ring_priority_level {
+	AMDGPU_RING_PRIO_0,
+	AMDGPU_RING_PRIO_1,
+	AMDGPU_RING_PRIO_DEFAULT = 1,
+	AMDGPU_RING_PRIO_2,
+	AMDGPU_RING_PRIO_3,
+	AMDGPU_RING_PRIO_MAX
+};
 
 /* some special values for the owner field */
 #define AMDGPU_FENCE_OWNER_UNDEFINED	((void *)0ul)
Signature · 1 line
2.32.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 19 lines · Nirmoy Das

Currently AMDGPU_RING_PRIO_MAX is redefinition of a max gfx hwip priority, this won't work well when we will have a hwip with different set of priorities than gfx. Also, HW ring priorities are different from ring priorities.

Create a global enum for ring priority levels which each HWIP can use to define its own priority levels.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h  |  6 +++---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 10 ++++++++--
  2 files changed, 11 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +0 -0
index d43fe2ed8116..937320293029 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h line 48

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +3 -3
@@ -43,9 +43,9 @@
  #define AMDGPU_MAX_COMPUTE_QUEUES KGD_MAX_QUEUES
 
  enum gfx_pipe_priority {
-	AMDGPU_GFX_PIPE_PRIO_NORMAL = 1,
-	AMDGPU_GFX_PIPE_PRIO_HIGH,
-	AMDGPU_GFX_PIPE_PRIO_MAX
+	AMDGPU_GFX_PIPE_PRIO_NORMAL = AMDGPU_RING_PRIO_1,
+	AMDGPU_GFX_PIPE_PRIO_HIGH = AMDGPU_RING_PRIO_2,
+	AMDGPU_GFX_PIPE_PRIO_MAX = AMDGPU_RING_PRIO_3

Is this a valid priority level? If not, better avoid it.

Quoted 25 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +0 -0
  };
 
  /* Argument for PPSMC_MSG_GpuChangeState */
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +8 -2
index e713d31619fe..85541005c1ad 100644
@@ -36,8 +36,14 @@
  #define AMDGPU_MAX_VCE_RINGS		3
  #define AMDGPU_MAX_UVD_ENC_RINGS	2
 
-#define AMDGPU_RING_PRIO_DEFAULT	1
-#define AMDGPU_RING_PRIO_MAX		AMDGPU_GFX_PIPE_PRIO_MAX
+enum amdgpu_ring_priority_level {
+	AMDGPU_RING_PRIO_0,
+	AMDGPU_RING_PRIO_1,
+	AMDGPU_RING_PRIO_DEFAULT = 1,
+	AMDGPU_RING_PRIO_2,
+	AMDGPU_RING_PRIO_3,
+	AMDGPU_RING_PRIO_MAX
+};
 
  /* some special values for the owner field */
  #define AMDGPU_FENCE_OWNER_UNDEFINED	((void *)0ul)
#2 lore raw
Quoted 17 lines · Lijo
Quoted 14 lines · Nirmoy Das

Currently AMDGPU_RING_PRIO_MAX is redefinition of a max gfx hwip priority, this won't work well when we will have a hwip with different set of priorities than gfx. Also, HW ring priorities are different from ring priorities.

Create a global enum for ring priority levels which each HWIP can use to define its own priority levels.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h  |  6 +++--- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 10 ++++++++--

  2 files changed, 11 insertions(+), 5 deletions(-)
Quoted 16 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h line 47

Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +3 -3
index d43fe2ed8116..937320293029 100644
@@ -43,9 +43,9 @@
   #define AMDGPU_MAX_COMPUTE_QUEUES KGD_MAX_QUEUES
     enum gfx_pipe_priority {
-    AMDGPU_GFX_PIPE_PRIO_NORMAL = 1,
-    AMDGPU_GFX_PIPE_PRIO_HIGH,
-    AMDGPU_GFX_PIPE_PRIO_MAX
+    AMDGPU_GFX_PIPE_PRIO_NORMAL = AMDGPU_RING_PRIO_1,
+    AMDGPU_GFX_PIPE_PRIO_HIGH = AMDGPU_RING_PRIO_2,
+    AMDGPU_GFX_PIPE_PRIO_MAX = AMDGPU_RING_PRIO_3

Is this a valid priority level? If not, better avoid it.

Yes, it not. I will resend,  Thanks!

Quoted 24 lines
Quoted 22 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +0 -0
   };
     /* Argument for PPSMC_MSG_GpuChangeState */
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +0 -0
index e713d31619fe..85541005c1ad 100644
@@ -36,8 +36,14 @@
   #define AMDGPU_MAX_VCE_RINGS        3
   #define AMDGPU_MAX_UVD_ENC_RINGS    2

  -#define AMDGPU_RING_PRIO_DEFAULT    1

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +8 -1
-#define AMDGPU_RING_PRIO_MAX        AMDGPU_GFX_PIPE_PRIO_MAX
+enum amdgpu_ring_priority_level {
+    AMDGPU_RING_PRIO_0,
+    AMDGPU_RING_PRIO_1,
+    AMDGPU_RING_PRIO_DEFAULT = 1,
+    AMDGPU_RING_PRIO_2,
+    AMDGPU_RING_PRIO_3,
+    AMDGPU_RING_PRIO_MAX
+};

    /* some special values for the owner field */ #define AMDGPU_FENCE_OWNER_UNDEFINED    ((void *)0ul)

maintainer
#3 lore raw
In reply to Lazar, Lijo

Am 26.08.21 um 11:27 schrieb Lazar, Lijo:

Quoted 31 lines · Nirmoy Das
Quoted 19 lines

Currently AMDGPU_RING_PRIO_MAX is redefinition of a max gfx hwip priority, this won't work well when we will have a hwip with different set of priorities than gfx. Also, HW ring priorities are different from ring priorities.

Create a global enum for ring priority levels which each HWIP can use to define its own priority levels.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h  |  6 +++--- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 10 ++++++++--

  2 files changed, 11 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +0 -0
index d43fe2ed8116..937320293029 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h line 47

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +3 -3
@@ -43,9 +43,9 @@
   #define AMDGPU_MAX_COMPUTE_QUEUES KGD_MAX_QUEUES
     enum gfx_pipe_priority {
-    AMDGPU_GFX_PIPE_PRIO_NORMAL = 1,
-    AMDGPU_GFX_PIPE_PRIO_HIGH,
-    AMDGPU_GFX_PIPE_PRIO_MAX
+    AMDGPU_GFX_PIPE_PRIO_NORMAL = AMDGPU_RING_PRIO_1,
+    AMDGPU_GFX_PIPE_PRIO_HIGH = AMDGPU_RING_PRIO_2,
+    AMDGPU_GFX_PIPE_PRIO_MAX = AMDGPU_RING_PRIO_3

Is this a valid priority level? If not, better avoid it.

Quoted 1 line

Is the _MAX define even used here any more? As far as I can see you removed the only use case for that below.

If it's unused just drop it completely.

Christian.

Quoted 23 lines
Quoted 23 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +0 -0
   };
     /* Argument for PPSMC_MSG_GpuChangeState */
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +0 -0
index e713d31619fe..85541005c1ad 100644
@@ -36,8 +36,14 @@
   #define AMDGPU_MAX_VCE_RINGS        3
   #define AMDGPU_MAX_UVD_ENC_RINGS    2

  -#define AMDGPU_RING_PRIO_DEFAULT    1

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +8 -1
-#define AMDGPU_RING_PRIO_MAX        AMDGPU_GFX_PIPE_PRIO_MAX
+enum amdgpu_ring_priority_level {
+    AMDGPU_RING_PRIO_0,
+    AMDGPU_RING_PRIO_1,
+    AMDGPU_RING_PRIO_DEFAULT = 1,
+    AMDGPU_RING_PRIO_2,
+    AMDGPU_RING_PRIO_3,
+    AMDGPU_RING_PRIO_MAX
+};

    /* some special values for the owner field */ #define AMDGPU_FENCE_OWNER_UNDEFINED    ((void *)0ul)

#4 lore raw
Quoted 32 lines · Christian König

Am 26.08.21 um 11:27 schrieb Lazar, Lijo:

Quoted 31 lines · Nirmoy Das
Quoted 19 lines

Currently AMDGPU_RING_PRIO_MAX is redefinition of a max gfx hwip priority, this won't work well when we will have a hwip with different set of priorities than gfx. Also, HW ring priorities are different from ring priorities.

Create a global enum for ring priority levels which each HWIP can use to define its own priority levels.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h  |  6 +++--- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 10 ++++++++--

  2 files changed, 11 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +0 -0
index d43fe2ed8116..937320293029 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h line 47

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +3 -3
@@ -43,9 +43,9 @@
   #define AMDGPU_MAX_COMPUTE_QUEUES KGD_MAX_QUEUES
     enum gfx_pipe_priority {
-    AMDGPU_GFX_PIPE_PRIO_NORMAL = 1,
-    AMDGPU_GFX_PIPE_PRIO_HIGH,
-    AMDGPU_GFX_PIPE_PRIO_MAX
+    AMDGPU_GFX_PIPE_PRIO_NORMAL = AMDGPU_RING_PRIO_1,
+    AMDGPU_GFX_PIPE_PRIO_HIGH = AMDGPU_RING_PRIO_2,
+    AMDGPU_GFX_PIPE_PRIO_MAX = AMDGPU_RING_PRIO_3

Is this a valid priority level? If not, better avoid it.

Quoted 3 lines
Quoted 1 line

Is the _MAX define even used here any more? As far as I can see you removed the only use case for that below.

Yes, not used anymore. Sending a v2.

Quoted 29 lines

If it's unused just drop it completely.

Christian.

Quoted 23 lines
Quoted 23 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +0 -0
   };
     /* Argument for PPSMC_MSG_GpuChangeState */
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +0 -0
index e713d31619fe..85541005c1ad 100644
@@ -36,8 +36,14 @@
   #define AMDGPU_MAX_VCE_RINGS        3
   #define AMDGPU_MAX_UVD_ENC_RINGS    2

  -#define AMDGPU_RING_PRIO_DEFAULT    1

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +8 -1
-#define AMDGPU_RING_PRIO_MAX        AMDGPU_GFX_PIPE_PRIO_MAX
+enum amdgpu_ring_priority_level {
+    AMDGPU_RING_PRIO_0,
+    AMDGPU_RING_PRIO_1,
+    AMDGPU_RING_PRIO_DEFAULT = 1,
+    AMDGPU_RING_PRIO_2,
+    AMDGPU_RING_PRIO_3,
+    AMDGPU_RING_PRIO_MAX
+};

    /* some special values for the owner field */ #define AMDGPU_FENCE_OWNER_UNDEFINED    ((void *)0ul)