Skip to contentSkip to conversation

drm/amdkfd: correct sdma queue number in kfd device init (v2)

PATCH In review Guchun Chen 3 participants 6 messages Dec 20, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdkfd: correct sdma queue number in kfd device init (v2)

sdma queue number is not correct like on vega20, this patch promises the setting keeps the same after code refactor. Additionally, improve code to use switch case to list IP version to complete kfd device_info structure filling. This keeps consistency with the IP parse code in amdgpu_discovery.c.

v2: use dev_warn for the default switch case;
set default sdma queue per engine(8) and IH handler to v9. (Jonathan)

Fixes a9e2c4dc6cc4("drm/amdkfd: add kfd_device_info_init function")
---
 drivers/gpu/drm/amd/amdkfd/kfd_device.c | 77 ++++++++++++++++++++++---
 1 file changed, 68 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +68 -9
index facc28f58c1f..36406a261203 100644
@@ -59,11 +59,75 @@ static void kfd_gtt_sa_fini(struct kfd_dev *kfd);
 
 static int kfd_resume(struct kfd_dev *kfd);
 
+static void kfd_device_info_set_sdma_queue_num(struct kfd_dev *kfd)
+{
+	uint32_t sdma_version = kfd->adev->ip_versions[SDMA0_HWIP][0];
+
+	switch (sdma_version) {
+		case IP_VERSION(4, 0, 0):/* VEGA10 */
+		case IP_VERSION(4, 0, 1):/* VEGA12 */
+		case IP_VERSION(4, 1, 0):/* RAVEN */
+		case IP_VERSION(4, 1, 1):/* RAVEN */
+		case IP_VERSION(4, 1, 2):/* RENIOR */
+		case IP_VERSION(5, 2, 1):/* VANGOGH */
+		case IP_VERSION(5, 2, 3):/* YELLOW_CARP */
+			kfd->device_info.num_sdma_queues_per_engine = 2;
+			break;
+		case IP_VERSION(4, 2, 0):/* VEGA20 */
+		case IP_VERSION(4, 2, 2):/* ARCTUTUS */
+		case IP_VERSION(4, 4, 0):/* ALDEBARAN */
+		case IP_VERSION(5, 0, 0):/* NAVI10 */
+		case IP_VERSION(5, 0, 1):/* CYAN_SKILLFISH */
+		case IP_VERSION(5, 0, 2):/* NAVI14 */
+		case IP_VERSION(5, 0, 5):/* NAVI12 */
+		case IP_VERSION(5, 2, 0):/* SIENNA_CICHLID */
+		case IP_VERSION(5, 2, 2):/* NAVY_FLOUDER */
+		case IP_VERSION(5, 2, 4):/* DIMGREY_CAVEFISH */
+			kfd->device_info.num_sdma_queues_per_engine = 8;
+			break;
+		default:
+			dev_warn(kfd_device,
+				"Default sdma queue per engine(8) is set due to "
+				"mismatch of sdma ip block(SDMA_HWIP:0x%x).\n",
+                                sdma_version);
+			kfd->device_info.num_sdma_queues_per_engine = 8;
+	}
+}
+
+static void kfd_device_info_set_event_interrupt_class(struct kfd_dev *kfd)
+{
+	uint32_t gc_version = KFD_GC_VERSION(kfd);
+
+	switch (gc_version) {
+	case IP_VERSION(9, 0, 1): /* VEGA10 */
+	case IP_VERSION(9, 2, 1): /* VEGA12 */
+	case IP_VERSION(9, 3, 0): /* RENOIR */
+	case IP_VERSION(9, 4, 0): /* VEGA20 */
+	case IP_VERSION(9, 4, 1): /* ARCTURUS */
+	case IP_VERSION(9, 4, 2): /* ALDEBARAN */
+	case IP_VERSION(10, 3, 1): /* VANGOGH */
+	case IP_VERSION(10, 3, 3): /* YELLOW_CARP */
+	case IP_VERSION(10, 1, 3): /* CYAN_SKILLFISH */
+	case IP_VERSION(10, 1, 10): /* NAVI10 */
+	case IP_VERSION(10, 1, 2): /* NAVI12 */
+	case IP_VERSION(10, 1, 1): /* NAVI14 */
+	case IP_VERSION(10, 3, 0): /* SIENNA_CICHLID */
+	case IP_VERSION(10, 3, 2): /* NAVY_FLOUNDER */
+	case IP_VERSION(10, 3, 4): /* DIMGREY_CAVEFISH */
+	case IP_VERSION(10, 3, 5): /* BEIGE_GOBY */
+		kfd->device_info.event_interrupt_class = &event_interrupt_class_v9;
+		break;
+	default:
+		dev_warn(kfd_device, "v9 event interrupt handler is set due to "
+			"mismatch of gc ip block(GC_HWIP:0x%x).\n", gc_version);
+		kfd->device_info.event_interrupt_class = &event_interrupt_class_v9;
+	}
+}
+
 static void kfd_device_info_init(struct kfd_dev *kfd,
 				 bool vf, uint32_t gfx_target_version)
 {
 	uint32_t gc_version = KFD_GC_VERSION(kfd);
-	uint32_t sdma_version = kfd->adev->ip_versions[SDMA0_HWIP][0];
 	uint32_t asic_type = kfd->adev->asic_type;
 
 	kfd->device_info.max_pasid_bits = 16;
@@ -75,16 +139,11 @@ static void kfd_device_info_init(struct kfd_dev *kfd,
 	if (KFD_IS_SOC15(kfd)) {
 		kfd->device_info.doorbell_size = 8;
 		kfd->device_info.ih_ring_entry_size = 8 * sizeof(uint32_t);
-		kfd->device_info.event_interrupt_class = &event_interrupt_class_v9;
 		kfd->device_info.supports_cwsr = true;
 
-		if ((sdma_version >= IP_VERSION(4, 0, 0)  &&
-		     sdma_version <= IP_VERSION(4, 2, 0)) ||
-		     sdma_version == IP_VERSION(5, 2, 1)  ||
-		     sdma_version == IP_VERSION(5, 2, 3))
-			kfd->device_info.num_sdma_queues_per_engine = 2;
-		else
-			kfd->device_info.num_sdma_queues_per_engine = 8;
+		kfd_device_info_set_sdma_queue_num(kfd);
+
+		kfd_device_info_set_event_interrupt_class(kfd);
 
 		/* Raven */
 		if (gc_version == IP_VERSION(9, 1, 0) ||
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only]

Quoted 11 lines

-----Original Message-----
From: Chen, Guchun <[email protected]>
Sent: December 19, 2021 10:09 PM
To: [email protected]; Deucher, Alexander <[email protected]>; Sider, Graham <[email protected]>; Kuehling, Felix <[email protected]>; Kim, Jonathan <[email protected]>
Cc: Chen, Guchun <[email protected]>
Subject: [PATCH] drm/amdkfd: correct sdma queue number in kfd device init (v2)

Quoted 1 line

sdma queue number is not correct like on vega20, this patch promises the

I think you've also fixed Vega12 and Raven (they were being set to 8 before rather than 2). No need to mention this in your description, just double checking.

Quoted 10 lines

setting keeps the same after code refactor.
Additionally, improve code to use switch case to list IP version to complete kfd device_info structure filling.
This keeps consistency with the IP parse code in amdgpu_discovery.c.

v2: use dev_warn for the default switch case;
set default sdma queue per engine(8) and IH handler to v9. (Jonathan)

Fixes a9e2c4dc6cc4("drm/amdkfd: add kfd_device_info_init function")

Other than the missing checks for Raven when setting the interrupt class (see inline comments and reference kgd2kfd_probe in kfd_device.c) and one nit-pick inline, this looks good to me.

With those fixed, this patch is

Quoted 11 lines
---
 drivers/gpu/drm/amd/amdkfd/kfd_device.c | 77
++++++++++++++++++++++---
 1 file changed, 68 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -0
index facc28f58c1f..36406a261203 100644

drivers/gpu/drm/amd/amdkfd/kfd_device.c static void kfd_gtt_sa_fini(struct kfd_dev *kfd); · line 66

Quoted 8 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +4 -0
@@ -59,11 +59,75 @@ static void kfd_gtt_sa_fini(struct kfd_dev *kfd);
 
 static int kfd_resume(struct kfd_dev *kfd);
 
+static void kfd_device_info_set_sdma_queue_num(struct kfd_dev *kfd) {
+     uint32_t sdma_version = kfd->adev-
 >ip_versions[SDMA0_HWIP][0];
+
+     switch (sdma_version) {

Please pull in the indentation for all cases to line up with the switch block.

drivers/gpu/drm/amd/amdkfd/kfd_device.c static void kfd_gtt_sa_fini(struct kfd_dev *kfd); · line 70

Quoted 4 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +4 -0
+             case IP_VERSION(4, 0, 0):/* VEGA10 */
+             case IP_VERSION(4, 0, 1):/* VEGA12 */
+             case IP_VERSION(4, 1, 0):/* RAVEN */
+             case IP_VERSION(4, 1, 1):/* RAVEN */

As mentioned, you've also fixed Vega12 & Raven here I presume since afaik, they're based off Vega10?

Quoted 28 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +20 -0
+             case IP_VERSION(4, 1, 2):/* RENIOR */
+             case IP_VERSION(5, 2, 1):/* VANGOGH */
+             case IP_VERSION(5, 2, 3):/* YELLOW_CARP */
+                     kfd->device_info.num_sdma_queues_per_engine =
 2;
+                     break;
+             case IP_VERSION(4, 2, 0):/* VEGA20 */
+             case IP_VERSION(4, 2, 2):/* ARCTUTUS */
+             case IP_VERSION(4, 4, 0):/* ALDEBARAN */
+             case IP_VERSION(5, 0, 0):/* NAVI10 */
+             case IP_VERSION(5, 0, 1):/* CYAN_SKILLFISH */
+             case IP_VERSION(5, 0, 2):/* NAVI14 */
+             case IP_VERSION(5, 0, 5):/* NAVI12 */
+             case IP_VERSION(5, 2, 0):/* SIENNA_CICHLID */
+             case IP_VERSION(5, 2, 2):/* NAVY_FLOUDER */
+             case IP_VERSION(5, 2, 4):/* DIMGREY_CAVEFISH */
+                     kfd->device_info.num_sdma_queues_per_engine =
 8;
+                     break;
+             default:
+                     dev_warn(kfd_device,
+                             "Default sdma queue per engine(8) is set due

to "
+ "mismatch of sdma ip
block(SDMA_HWIP:0x%x).\n",

drivers/gpu/drm/amd/amdkfd/kfd_device.c +2 -0
+                                sdma_version);
+                     kfd->device_info.num_sdma_queues_per_engine =

8;

drivers/gpu/drm/amd/amdkfd/kfd_device.c static void kfd_gtt_sa_fini(struct kfd_dev *kfd); · line 102

Quoted 9 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +9 -0
+     }
+}
+
+static void kfd_device_info_set_event_interrupt_class(struct kfd_dev
+*kfd) {
+     uint32_t gc_version = KFD_GC_VERSION(kfd);
+
+     switch (gc_version) {
+     case IP_VERSION(9, 0, 1): /* VEGA10 */

Missing check for case IP_VERSION(9, 1, 0): /* RAVEN */

Quoted 1 line

+ case IP_VERSION(9, 2, 1): /* VEGA12 */

Missing check for case IP_VERSION(9, 2, 2): /* RAVEN */

Thanks,

Jon

Quoted 61 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +15 -0
+     case IP_VERSION(9, 3, 0): /* RENOIR */
+     case IP_VERSION(9, 4, 0): /* VEGA20 */
+     case IP_VERSION(9, 4, 1): /* ARCTURUS */
+     case IP_VERSION(9, 4, 2): /* ALDEBARAN */
+     case IP_VERSION(10, 3, 1): /* VANGOGH */
+     case IP_VERSION(10, 3, 3): /* YELLOW_CARP */
+     case IP_VERSION(10, 1, 3): /* CYAN_SKILLFISH */
+     case IP_VERSION(10, 1, 10): /* NAVI10 */
+     case IP_VERSION(10, 1, 2): /* NAVI12 */
+     case IP_VERSION(10, 1, 1): /* NAVI14 */
+     case IP_VERSION(10, 3, 0): /* SIENNA_CICHLID */
+     case IP_VERSION(10, 3, 2): /* NAVY_FLOUNDER */
+     case IP_VERSION(10, 3, 4): /* DIMGREY_CAVEFISH */
+     case IP_VERSION(10, 3, 5): /* BEIGE_GOBY */
+             kfd->device_info.event_interrupt_class =

&event_interrupt_class_v9;

drivers/gpu/drm/amd/amdkfd/kfd_device.c +3 -0
+             break;
+     default:
+             dev_warn(kfd_device, "v9 event interrupt handler is set due

to "
+ "mismatch of gc ip block(GC_HWIP:0x%x).\n",
gc_version);
+ kfd->device_info.event_interrupt_class =
&event_interrupt_class_v9;

drivers/gpu/drm/amd/amdkfd/kfd_device.c +3 -1
+     }
+}
+
 static void kfd_device_info_init(struct kfd_dev *kfd,
                               bool vf, uint32_t gfx_target_version)  {
      uint32_t gc_version = KFD_GC_VERSION(kfd);
-     uint32_t sdma_version = kfd->adev-
Quoted 1 line

ip_versions[SDMA0_HWIP][0];

      uint32_t asic_type = kfd->adev->asic_type;

      kfd->device_info.max_pasid_bits = 16;
drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -8
@@ -75,16 +139,11 @@ static void kfd_device_info_init(struct kfd_dev
 *kfd,
      if (KFD_IS_SOC15(kfd)) {
              kfd->device_info.doorbell_size = 8;
              kfd->device_info.ih_ring_entry_size = 8 * sizeof(uint32_t);
-             kfd->device_info.event_interrupt_class =
 &event_interrupt_class_v9;
              kfd->device_info.supports_cwsr = true;
 
-             if ((sdma_version >= IP_VERSION(4, 0, 0)  &&
-                  sdma_version <= IP_VERSION(4, 2, 0)) ||
-                  sdma_version == IP_VERSION(5, 2, 1)  ||
-                  sdma_version == IP_VERSION(5, 2, 3))
-                     kfd->device_info.num_sdma_queues_per_engine =
 2;
-             else
-                     kfd->device_info.num_sdma_queues_per_engine =

8;

drivers/gpu/drm/amd/amdkfd/kfd_device.c +3 -1
+             kfd_device_info_set_sdma_queue_num(kfd);
+
+             kfd_device_info_set_event_interrupt_class(kfd);
 
              /* Raven */
              if (gc_version == IP_VERSION(9, 1, 0) ||
--

2.17.1

Reviewed-by
#2 lore raw

[Public]

Quoted 24 lines

-----Original Message-----
From: Kim, Jonathan <[email protected]>
Sent: Monday, December 20, 2021 12:44 AM
To: Chen, Guchun <[email protected]>; amd- [email protected]; Deucher, Alexander <[email protected]>; Sider, Graham <[email protected]>; Kuehling, Felix <[email protected]>
Subject: RE: [PATCH] drm/amdkfd: correct sdma queue number in kfd device init (v2)

[AMD Official Use Only]

Quoted 5 lines

-----Original Message-----
From: Chen, Guchun <[email protected]>
Sent: December 19, 2021 10:09 PM
To: [email protected]; Deucher, Alexander <[email protected]>; Sider, Graham

<[email protected]>;

Quoted 6 lines

Kuehling, Felix <[email protected]>; Kim, Jonathan <[email protected]>
Cc: Chen, Guchun <[email protected]>
Subject: [PATCH] drm/amdkfd: correct sdma queue number in kfd device init (v2)

Quoted 7 lines
Quoted 2 lines

sdma queue number is not correct like on vega20, this patch promises the

I think you've also fixed Vega12 and Raven (they were being set to 8 before rather than 2). No need to mention this in your description, just double checking.

I believe it was only Vega20 that was being set incorrectly. The condition was:

	sdma_version >= IP_VERSION(4, 0, 0)  &&
	sdma_version <= IP_VERSION(4, 2, 0))

which encapsulates Vega12 and Raven setting sdma_queues_per_engine to 2, but also accidently encapsulates Vega20.

Quoted 12 lines
Quoted 11 lines

setting keeps the same after code refactor.
Additionally, improve code to use switch case to list IP version to complete kfd device_info structure filling.
This keeps consistency with the IP parse code in amdgpu_discovery.c.

v2: use dev_warn for the default switch case;
set default sdma queue per engine(8) and IH handler to v9.
(Jonathan)

Fixes a9e2c4dc6cc4("drm/amdkfd: add kfd_device_info_init function")
Quoted 7 lines

Other than the missing checks for Raven when setting the interrupt class (see inline comments and reference kgd2kfd_probe in kfd_device.c) and one nit-pick inline, this looks good to me.

With those fixed, this patch is

Other than Jon's comments, this patch is also

Quoted 142 lines
Quoted 11 lines
---
 drivers/gpu/drm/amd/amdkfd/kfd_device.c | 77
++++++++++++++++++++++---
 1 file changed, 68 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -0
index facc28f58c1f..36406a261203 100644

drivers/gpu/drm/amd/amdkfd/kfd_device.c static void kfd_gtt_sa_fini(struct kfd_dev *kfd); · line 62

Quoted 4 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +1 -0
@@ -59,11 +59,75 @@ static void kfd_gtt_sa_fini(struct kfd_dev *kfd);
 
 static int kfd_resume(struct kfd_dev *kfd);
 
+static void kfd_device_info_set_sdma_queue_num(struct kfd_dev *kfd)

{

drivers/gpu/drm/amd/amdkfd/kfd_device.c static void kfd_gtt_sa_fini(struct kfd_dev *kfd); · line 66

Quoted 4 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +3 -0
+     uint32_t sdma_version = kfd->adev-
 >ip_versions[SDMA0_HWIP][0];
+
+     switch (sdma_version) {

Please pull in the indentation for all cases to line up with the switch block.

drivers/gpu/drm/amd/amdkfd/kfd_device.c static void kfd_gtt_sa_fini(struct kfd_dev *kfd); · line 70

Quoted 4 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +4 -0
+             case IP_VERSION(4, 0, 0):/* VEGA10 */
+             case IP_VERSION(4, 0, 1):/* VEGA12 */
+             case IP_VERSION(4, 1, 0):/* RAVEN */
+             case IP_VERSION(4, 1, 1):/* RAVEN */

As mentioned, you've also fixed Vega12 & Raven here I presume since afaik, they're based off Vega10?

Quoted 29 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +21 -0
+             case IP_VERSION(4, 1, 2):/* RENIOR */
+             case IP_VERSION(5, 2, 1):/* VANGOGH */
+             case IP_VERSION(5, 2, 3):/* YELLOW_CARP */
+                     kfd->device_info.num_sdma_queues_per_engine =
 2;
+                     break;
+             case IP_VERSION(4, 2, 0):/* VEGA20 */
+             case IP_VERSION(4, 2, 2):/* ARCTUTUS */
+             case IP_VERSION(4, 4, 0):/* ALDEBARAN */
+             case IP_VERSION(5, 0, 0):/* NAVI10 */
+             case IP_VERSION(5, 0, 1):/* CYAN_SKILLFISH */
+             case IP_VERSION(5, 0, 2):/* NAVI14 */
+             case IP_VERSION(5, 0, 5):/* NAVI12 */
+             case IP_VERSION(5, 2, 0):/* SIENNA_CICHLID */
+             case IP_VERSION(5, 2, 2):/* NAVY_FLOUDER */
+             case IP_VERSION(5, 2, 4):/* DIMGREY_CAVEFISH */
+                     kfd->device_info.num_sdma_queues_per_engine =
 8;
+                     break;
+             default:
+                     dev_warn(kfd_device,
+                             "Default sdma queue per engine(8) is set
+ due

to "
+ "mismatch of sdma ip
block(SDMA_HWIP:0x%x).\n",

drivers/gpu/drm/amd/amdkfd/kfd_device.c +2 -0
+                                sdma_version);
+                     kfd->device_info.num_sdma_queues_per_engine =

8;

drivers/gpu/drm/amd/amdkfd/kfd_device.c static void kfd_gtt_sa_fini(struct kfd_dev *kfd); · line 102

Quoted 9 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +9 -0
+     }
+}
+
+static void kfd_device_info_set_event_interrupt_class(struct kfd_dev
+*kfd) {
+     uint32_t gc_version = KFD_GC_VERSION(kfd);
+
+     switch (gc_version) {
+     case IP_VERSION(9, 0, 1): /* VEGA10 */

Missing check for case IP_VERSION(9, 1, 0): /* RAVEN */

Quoted 1 line

+ case IP_VERSION(9, 2, 1): /* VEGA12 */

Missing check for case IP_VERSION(9, 2, 2): /* RAVEN */

Thanks,

Jon

Quoted 61 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +15 -0
+     case IP_VERSION(9, 3, 0): /* RENOIR */
+     case IP_VERSION(9, 4, 0): /* VEGA20 */
+     case IP_VERSION(9, 4, 1): /* ARCTURUS */
+     case IP_VERSION(9, 4, 2): /* ALDEBARAN */
+     case IP_VERSION(10, 3, 1): /* VANGOGH */
+     case IP_VERSION(10, 3, 3): /* YELLOW_CARP */
+     case IP_VERSION(10, 1, 3): /* CYAN_SKILLFISH */
+     case IP_VERSION(10, 1, 10): /* NAVI10 */
+     case IP_VERSION(10, 1, 2): /* NAVI12 */
+     case IP_VERSION(10, 1, 1): /* NAVI14 */
+     case IP_VERSION(10, 3, 0): /* SIENNA_CICHLID */
+     case IP_VERSION(10, 3, 2): /* NAVY_FLOUNDER */
+     case IP_VERSION(10, 3, 4): /* DIMGREY_CAVEFISH */
+     case IP_VERSION(10, 3, 5): /* BEIGE_GOBY */
+             kfd->device_info.event_interrupt_class =

&event_interrupt_class_v9;

drivers/gpu/drm/amd/amdkfd/kfd_device.c +4 -0
+             break;
+     default:
+             dev_warn(kfd_device, "v9 event interrupt handler is set
+ due

to "
+ "mismatch of gc ip block(GC_HWIP:0x%x).\n",
gc_version);
+ kfd->device_info.event_interrupt_class =
&event_interrupt_class_v9;

drivers/gpu/drm/amd/amdkfd/kfd_device.c +3 -1
+     }
+}
+
 static void kfd_device_info_init(struct kfd_dev *kfd,
                               bool vf, uint32_t gfx_target_version)  {
      uint32_t gc_version = KFD_GC_VERSION(kfd);
-     uint32_t sdma_version = kfd->adev-
Quoted 1 line

ip_versions[SDMA0_HWIP][0];

      uint32_t asic_type = kfd->adev->asic_type;

      kfd->device_info.max_pasid_bits = 16; @@ -75,16 +139,11 @@
static void kfd_device_info_init(struct kfd_dev *kfd,
      if (KFD_IS_SOC15(kfd)) {
              kfd->device_info.doorbell_size = 8;
              kfd->device_info.ih_ring_entry_size = 8 * sizeof(uint32_t);
-             kfd->device_info.event_interrupt_class =
&event_interrupt_class_v9;
              kfd->device_info.supports_cwsr = true;
drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -5
-             if ((sdma_version >= IP_VERSION(4, 0, 0)  &&
-                  sdma_version <= IP_VERSION(4, 2, 0)) ||
-                  sdma_version == IP_VERSION(5, 2, 1)  ||
-                  sdma_version == IP_VERSION(5, 2, 3))
-                     kfd->device_info.num_sdma_queues_per_engine =

2;

drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -2
-             else
-                     kfd->device_info.num_sdma_queues_per_engine =

8;

drivers/gpu/drm/amd/amdkfd/kfd_device.c +3 -1
+             kfd_device_info_set_sdma_queue_num(kfd);
+
+             kfd_device_info_set_event_interrupt_class(kfd);
 
              /* Raven */
              if (gc_version == IP_VERSION(9, 1, 0) ||
--

2.17.1

author Reviewed-by Graham Sider
#3 lore raw

[Public]

Email crossed:).

Graham, I have sent v3 to review, and will add you as another reviewed-by when pushing this patch. Thanks for the review from you and Jonathan.

Merry Xmas!

Regards,
Guchun

-----Original Message-----
From: Sider, Graham <[email protected]>
Sent: Monday, December 20, 2021 2:19 PM
To: Kim, Jonathan <[email protected]>; Chen, Guchun <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Kuehling, Felix <[email protected]>
Subject: RE: [PATCH] drm/amdkfd: correct sdma queue number in kfd device init (v2)

[Public]

Quoted 24 lines

-----Original Message-----
From: Kim, Jonathan <[email protected]>
Sent: Monday, December 20, 2021 12:44 AM
To: Chen, Guchun <[email protected]>; amd- [email protected]; Deucher, Alexander <[email protected]>; Sider, Graham <[email protected]>; Kuehling, Felix <[email protected]>
Subject: RE: [PATCH] drm/amdkfd: correct sdma queue number in kfd device init (v2)

[AMD Official Use Only]

Quoted 5 lines

-----Original Message-----
From: Chen, Guchun <[email protected]>
Sent: December 19, 2021 10:09 PM
To: [email protected]; Deucher, Alexander <[email protected]>; Sider, Graham

<[email protected]>;

Quoted 6 lines

Kuehling, Felix <[email protected]>; Kim, Jonathan <[email protected]>
Cc: Chen, Guchun <[email protected]>
Subject: [PATCH] drm/amdkfd: correct sdma queue number in kfd device init (v2)

Quoted 7 lines
Quoted 2 lines

sdma queue number is not correct like on vega20, this patch promises the

I think you've also fixed Vega12 and Raven (they were being set to 8 before rather than 2). No need to mention this in your description, just double checking.

I believe it was only Vega20 that was being set incorrectly. The condition was:

	sdma_version >= IP_VERSION(4, 0, 0)  &&
	sdma_version <= IP_VERSION(4, 2, 0))

which encapsulates Vega12 and Raven setting sdma_queues_per_engine to 2, but also accidently encapsulates Vega20.

Quoted 12 lines
Quoted 11 lines

setting keeps the same after code refactor.
Additionally, improve code to use switch case to list IP version to complete kfd device_info structure filling.
This keeps consistency with the IP parse code in amdgpu_discovery.c.

v2: use dev_warn for the default switch case;
set default sdma queue per engine(8) and IH handler to v9.
(Jonathan)

Fixes a9e2c4dc6cc4("drm/amdkfd: add kfd_device_info_init function")
Quoted 7 lines

Other than the missing checks for Raven when setting the interrupt class (see inline comments and reference kgd2kfd_probe in kfd_device.c) and one nit-pick inline, this looks good to me.

With those fixed, this patch is

Other than Jon's comments, this patch is also

Quoted 144 lines
Quoted 11 lines
---
 drivers/gpu/drm/amd/amdkfd/kfd_device.c | 77
++++++++++++++++++++++---
 1 file changed, 68 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -0
index facc28f58c1f..36406a261203 100644

drivers/gpu/drm/amd/amdkfd/kfd_device.c static void kfd_gtt_sa_fini(struct kfd_dev · line 63

Quoted 5 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +1 -0
@@ -59,11 +59,75 @@ static void kfd_gtt_sa_fini(struct kfd_dev 
 *kfd);
 
 static int kfd_resume(struct kfd_dev *kfd);
 
+static void kfd_device_info_set_sdma_queue_num(struct kfd_dev *kfd)

{

drivers/gpu/drm/amd/amdkfd/kfd_device.c static void kfd_gtt_sa_fini(struct kfd_dev *kfd); · line 66

Quoted 4 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +3 -0
+     uint32_t sdma_version = kfd->adev-
 >ip_versions[SDMA0_HWIP][0];
+
+     switch (sdma_version) {

Please pull in the indentation for all cases to line up with the switch block.

drivers/gpu/drm/amd/amdkfd/kfd_device.c static void kfd_gtt_sa_fini(struct kfd_dev *kfd); · line 70

Quoted 4 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +4 -0
+             case IP_VERSION(4, 0, 0):/* VEGA10 */
+             case IP_VERSION(4, 0, 1):/* VEGA12 */
+             case IP_VERSION(4, 1, 0):/* RAVEN */
+             case IP_VERSION(4, 1, 1):/* RAVEN */

As mentioned, you've also fixed Vega12 & Raven here I presume since afaik, they're based off Vega10?

Quoted 29 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +21 -0
+             case IP_VERSION(4, 1, 2):/* RENIOR */
+             case IP_VERSION(5, 2, 1):/* VANGOGH */
+             case IP_VERSION(5, 2, 3):/* YELLOW_CARP */
+                     kfd->device_info.num_sdma_queues_per_engine =
 2;
+                     break;
+             case IP_VERSION(4, 2, 0):/* VEGA20 */
+             case IP_VERSION(4, 2, 2):/* ARCTUTUS */
+             case IP_VERSION(4, 4, 0):/* ALDEBARAN */
+             case IP_VERSION(5, 0, 0):/* NAVI10 */
+             case IP_VERSION(5, 0, 1):/* CYAN_SKILLFISH */
+             case IP_VERSION(5, 0, 2):/* NAVI14 */
+             case IP_VERSION(5, 0, 5):/* NAVI12 */
+             case IP_VERSION(5, 2, 0):/* SIENNA_CICHLID */
+             case IP_VERSION(5, 2, 2):/* NAVY_FLOUDER */
+             case IP_VERSION(5, 2, 4):/* DIMGREY_CAVEFISH */
+                     kfd->device_info.num_sdma_queues_per_engine =
 8;
+                     break;
+             default:
+                     dev_warn(kfd_device,
+                             "Default sdma queue per engine(8) is 
+ set due

to "
+ "mismatch of sdma ip
block(SDMA_HWIP:0x%x).\n",

drivers/gpu/drm/amd/amdkfd/kfd_device.c +2 -0
+                                sdma_version);
+                     kfd->device_info.num_sdma_queues_per_engine =

8;

drivers/gpu/drm/amd/amdkfd/kfd_device.c static void kfd_gtt_sa_fini(struct kfd_dev *kfd); · line 102

Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +10 -0
+     }
+}
+
+static void kfd_device_info_set_event_interrupt_class(struct 
+kfd_dev
+*kfd) {
+     uint32_t gc_version = KFD_GC_VERSION(kfd);
+
+     switch (gc_version) {
+     case IP_VERSION(9, 0, 1): /* VEGA10 */

Missing check for case IP_VERSION(9, 1, 0): /* RAVEN */

Quoted 1 line

+ case IP_VERSION(9, 2, 1): /* VEGA12 */

Missing check for case IP_VERSION(9, 2, 2): /* RAVEN */

Thanks,

Jon

Quoted 61 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +15 -0
+     case IP_VERSION(9, 3, 0): /* RENOIR */
+     case IP_VERSION(9, 4, 0): /* VEGA20 */
+     case IP_VERSION(9, 4, 1): /* ARCTURUS */
+     case IP_VERSION(9, 4, 2): /* ALDEBARAN */
+     case IP_VERSION(10, 3, 1): /* VANGOGH */
+     case IP_VERSION(10, 3, 3): /* YELLOW_CARP */
+     case IP_VERSION(10, 1, 3): /* CYAN_SKILLFISH */
+     case IP_VERSION(10, 1, 10): /* NAVI10 */
+     case IP_VERSION(10, 1, 2): /* NAVI12 */
+     case IP_VERSION(10, 1, 1): /* NAVI14 */
+     case IP_VERSION(10, 3, 0): /* SIENNA_CICHLID */
+     case IP_VERSION(10, 3, 2): /* NAVY_FLOUNDER */
+     case IP_VERSION(10, 3, 4): /* DIMGREY_CAVEFISH */
+     case IP_VERSION(10, 3, 5): /* BEIGE_GOBY */
+             kfd->device_info.event_interrupt_class =

&event_interrupt_class_v9;

drivers/gpu/drm/amd/amdkfd/kfd_device.c +4 -0
+             break;
+     default:
+             dev_warn(kfd_device, "v9 event interrupt handler is 
+ set due

to "
+ "mismatch of gc ip block(GC_HWIP:0x%x).\n",
gc_version);
+ kfd->device_info.event_interrupt_class =
&event_interrupt_class_v9;

drivers/gpu/drm/amd/amdkfd/kfd_device.c +3 -1
+     }
+}
+
 static void kfd_device_info_init(struct kfd_dev *kfd,
                               bool vf, uint32_t gfx_target_version)  {
      uint32_t gc_version = KFD_GC_VERSION(kfd);
-     uint32_t sdma_version = kfd->adev-
Quoted 1 line

ip_versions[SDMA0_HWIP][0];

      uint32_t asic_type = kfd->adev->asic_type;

      kfd->device_info.max_pasid_bits = 16; @@ -75,16 +139,11 @@ 
static void kfd_device_info_init(struct kfd_dev *kfd,
      if (KFD_IS_SOC15(kfd)) {
              kfd->device_info.doorbell_size = 8;
              kfd->device_info.ih_ring_entry_size = 8 * sizeof(uint32_t);
-             kfd->device_info.event_interrupt_class =
&event_interrupt_class_v9;
              kfd->device_info.supports_cwsr = true;
drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -5
-             if ((sdma_version >= IP_VERSION(4, 0, 0)  &&
-                  sdma_version <= IP_VERSION(4, 2, 0)) ||
-                  sdma_version == IP_VERSION(5, 2, 1)  ||
-                  sdma_version == IP_VERSION(5, 2, 3))
-                     kfd->device_info.num_sdma_queues_per_engine =

2;

drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -2
-             else
-                     kfd->device_info.num_sdma_queues_per_engine =

8;

drivers/gpu/drm/amd/amdkfd/kfd_device.c +3 -1
+             kfd_device_info_set_sdma_queue_num(kfd);
+
+             kfd_device_info_set_event_interrupt_class(kfd);
 
              /* Raven */
              if (gc_version == IP_VERSION(9, 1, 0) ||
--

2.17.1

#4 lore raw
In reply to Sider, Graham
Quoted 48 lines

-----Original Message-----
From: Sider, Graham <[email protected]>
Sent: December 20, 2021 1:19 AM
To: Kim, Jonathan <[email protected]>; Chen, Guchun <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Kuehling, Felix <[email protected]>
Subject: RE: [PATCH] drm/amdkfd: correct sdma queue number in kfd device init (v2)

[Public]

Quoted 6 lines

-----Original Message-----
From: Kim, Jonathan <[email protected]>
Sent: Monday, December 20, 2021 12:44 AM
To: Chen, Guchun <[email protected]>; amd-
[email protected]; Deucher, Alexander
<[email protected]>; Sider, Graham

<[email protected]>;

Quoted 4 lines

Kuehling, Felix <[email protected]>
Subject: RE: [PATCH] drm/amdkfd: correct sdma queue number in kfd device init (v2)

Quoted 12 lines

[AMD Official Use Only]

Quoted 5 lines

-----Original Message-----
From: Chen, Guchun <[email protected]>
Sent: December 19, 2021 10:09 PM
To: [email protected]; Deucher, Alexander <[email protected]>; Sider, Graham

<[email protected]>;

Quoted 4 lines

Kuehling, Felix <[email protected]>; Kim, Jonathan <[email protected]>
Cc: Chen, Guchun <[email protected]>
Subject: [PATCH] drm/amdkfd: correct sdma queue number in kfd

device

Quoted 9 lines
Quoted 4 lines

init (v2)

sdma queue number is not correct like on vega20, this patch promises the

I think you've also fixed Vega12 and Raven (they were being set to 8 before rather than 2). No need to mention this in your description, just double checking.

Quoted 8 lines

I believe it was only Vega20 that was being set incorrectly. The condition was:

	sdma_version >= IP_VERSION(4, 0, 0)  &&
	sdma_version <= IP_VERSION(4, 2, 0))

which encapsulates Vega12 and Raven setting sdma_queues_per_engine to 2, but also accidently encapsulates Vega20.

Ah right. It was a range check before.

Thanks,

Jon

Quoted 170 lines
Quoted 13 lines
Quoted 6 lines

setting keeps the same after code refactor.
Additionally, improve code to use switch case to list IP version to complete kfd device_info structure filling.
This keeps consistency with the IP parse code in amdgpu_discovery.c.

Quoted 6 lines

v2: use dev_warn for the default switch case;
set default sdma queue per engine(8) and IH handler to v9.
(Jonathan)

Fixes a9e2c4dc6cc4("drm/amdkfd: add kfd_device_info_init function")
Quoted 7 lines

Other than the missing checks for Raven when setting the interrupt class (see inline comments and reference kgd2kfd_probe in kfd_device.c) and one nit-pick inline, this looks good to me.

With those fixed, this patch is

Other than Jon's comments, this patch is also

Quoted 13 lines
Quoted 13 lines
---
 drivers/gpu/drm/amd/amdkfd/kfd_device.c | 77
++++++++++++++++++++++---
 1 file changed, 68 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -0
index facc28f58c1f..36406a261203 100644
@@ -59,11 +59,75 @@ static void kfd_gtt_sa_fini(struct kfd_dev
 *kfd);
 
Quoted 3 lines

drivers/gpu/drm/amd/amdkfd/kfd_device.c static void kfd_gtt_sa_fini(struct kfd_dev *kfd);

Quoted 3 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +1 -0
 static int kfd_resume(struct kfd_dev *kfd);
 
+static void kfd_device_info_set_sdma_queue_num(struct kfd_dev

*kfd)

Quoted 128 lines

{

drivers/gpu/drm/amd/amdkfd/kfd_device.c static void kfd_gtt_sa_fini(struct kfd_dev *kfd); · line 66

Quoted 4 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +3 -0
+     uint32_t sdma_version = kfd->adev-
 >ip_versions[SDMA0_HWIP][0];
+
+     switch (sdma_version) {

Please pull in the indentation for all cases to line up with the switch block.

drivers/gpu/drm/amd/amdkfd/kfd_device.c static void kfd_gtt_sa_fini(struct kfd_dev *kfd); · line 70

Quoted 4 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +4 -0
+             case IP_VERSION(4, 0, 0):/* VEGA10 */
+             case IP_VERSION(4, 0, 1):/* VEGA12 */
+             case IP_VERSION(4, 1, 0):/* RAVEN */
+             case IP_VERSION(4, 1, 1):/* RAVEN */

As mentioned, you've also fixed Vega12 & Raven here I presume since afaik, they're based off Vega10?

Quoted 29 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +21 -0
+             case IP_VERSION(4, 1, 2):/* RENIOR */
+             case IP_VERSION(5, 2, 1):/* VANGOGH */
+             case IP_VERSION(5, 2, 3):/* YELLOW_CARP */
+                     kfd->device_info.num_sdma_queues_per_engine =
 2;
+                     break;
+             case IP_VERSION(4, 2, 0):/* VEGA20 */
+             case IP_VERSION(4, 2, 2):/* ARCTUTUS */
+             case IP_VERSION(4, 4, 0):/* ALDEBARAN */
+             case IP_VERSION(5, 0, 0):/* NAVI10 */
+             case IP_VERSION(5, 0, 1):/* CYAN_SKILLFISH */
+             case IP_VERSION(5, 0, 2):/* NAVI14 */
+             case IP_VERSION(5, 0, 5):/* NAVI12 */
+             case IP_VERSION(5, 2, 0):/* SIENNA_CICHLID */
+             case IP_VERSION(5, 2, 2):/* NAVY_FLOUDER */
+             case IP_VERSION(5, 2, 4):/* DIMGREY_CAVEFISH */
+                     kfd->device_info.num_sdma_queues_per_engine =
 8;
+                     break;
+             default:
+                     dev_warn(kfd_device,
+                             "Default sdma queue per engine(8) is
+ set due

to "
+ "mismatch of sdma ip
block(SDMA_HWIP:0x%x).\n",

drivers/gpu/drm/amd/amdkfd/kfd_device.c +2 -0
+                                sdma_version);
+                     kfd->device_info.num_sdma_queues_per_engine =

8;

drivers/gpu/drm/amd/amdkfd/kfd_device.c static void kfd_gtt_sa_fini(struct kfd_dev *kfd); · line 102

Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +10 -0
+     }
+}
+
+static void kfd_device_info_set_event_interrupt_class(struct
+kfd_dev
+*kfd) {
+     uint32_t gc_version = KFD_GC_VERSION(kfd);
+
+     switch (gc_version) {
+     case IP_VERSION(9, 0, 1): /* VEGA10 */

Missing check for case IP_VERSION(9, 1, 0): /* RAVEN */

Quoted 1 line

+ case IP_VERSION(9, 2, 1): /* VEGA12 */

Missing check for case IP_VERSION(9, 2, 2): /* RAVEN */

Thanks,

Jon

Quoted 61 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +15 -0
+     case IP_VERSION(9, 3, 0): /* RENOIR */
+     case IP_VERSION(9, 4, 0): /* VEGA20 */
+     case IP_VERSION(9, 4, 1): /* ARCTURUS */
+     case IP_VERSION(9, 4, 2): /* ALDEBARAN */
+     case IP_VERSION(10, 3, 1): /* VANGOGH */
+     case IP_VERSION(10, 3, 3): /* YELLOW_CARP */
+     case IP_VERSION(10, 1, 3): /* CYAN_SKILLFISH */
+     case IP_VERSION(10, 1, 10): /* NAVI10 */
+     case IP_VERSION(10, 1, 2): /* NAVI12 */
+     case IP_VERSION(10, 1, 1): /* NAVI14 */
+     case IP_VERSION(10, 3, 0): /* SIENNA_CICHLID */
+     case IP_VERSION(10, 3, 2): /* NAVY_FLOUNDER */
+     case IP_VERSION(10, 3, 4): /* DIMGREY_CAVEFISH */
+     case IP_VERSION(10, 3, 5): /* BEIGE_GOBY */
+             kfd->device_info.event_interrupt_class =

&event_interrupt_class_v9;

drivers/gpu/drm/amd/amdkfd/kfd_device.c +4 -0
+             break;
+     default:
+             dev_warn(kfd_device, "v9 event interrupt handler is
+ set due

to "
+ "mismatch of gc ip block(GC_HWIP:0x%x).\n",
gc_version);
+ kfd->device_info.event_interrupt_class =
&event_interrupt_class_v9;

drivers/gpu/drm/amd/amdkfd/kfd_device.c +3 -1
+     }
+}
+
 static void kfd_device_info_init(struct kfd_dev *kfd,
                               bool vf, uint32_t gfx_target_version)  {
      uint32_t gc_version = KFD_GC_VERSION(kfd);
-     uint32_t sdma_version = kfd->adev-
Quoted 1 line

ip_versions[SDMA0_HWIP][0];

      uint32_t asic_type = kfd->adev->asic_type;

      kfd->device_info.max_pasid_bits = 16; @@ -75,16 +139,11 @@
static void kfd_device_info_init(struct kfd_dev *kfd,
      if (KFD_IS_SOC15(kfd)) {
              kfd->device_info.doorbell_size = 8;
              kfd->device_info.ih_ring_entry_size = 8 * sizeof(uint32_t);
-             kfd->device_info.event_interrupt_class =
&event_interrupt_class_v9;
              kfd->device_info.supports_cwsr = true;
drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -5
-             if ((sdma_version >= IP_VERSION(4, 0, 0)  &&
-                  sdma_version <= IP_VERSION(4, 2, 0)) ||
-                  sdma_version == IP_VERSION(5, 2, 1)  ||
-                  sdma_version == IP_VERSION(5, 2, 3))
-                     kfd->device_info.num_sdma_queues_per_engine =

2;

drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -2
-             else
-                     kfd->device_info.num_sdma_queues_per_engine =

8;

drivers/gpu/drm/amd/amdkfd/kfd_device.c +3 -1
+             kfd_device_info_set_sdma_queue_num(kfd);
+
+             kfd_device_info_set_event_interrupt_class(kfd);
 
              /* Raven */
              if (gc_version == IP_VERSION(9, 1, 0) ||
--

2.17.1

author Reviewed-by Jonathan Kim
#5 lore raw
In reply to Kim, Jonathan

[Public]

Quoted 2 lines

sdma queue number is not correct like on vega20, this patch promises the

I think you've also fixed Vega12 and Raven (they were being set to 8 before rather than 2). No need to mention this in your description, just double checking.

No, sdma queue number on vega12 and Raven is correct, it's 2. Anyway, I have dropped it in the commit message of V3.

Regards,
Guchun

-----Original Message-----
From: Kim, Jonathan <[email protected]>
Sent: Monday, December 20, 2021 1:44 PM
To: Chen, Guchun <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Sider, Graham <[email protected]>; Kuehling, Felix <[email protected]>
Subject: RE: [PATCH] drm/amdkfd: correct sdma queue number in kfd device init (v2)

[AMD Official Use Only]

Quoted 11 lines

-----Original Message-----
From: Chen, Guchun <[email protected]>
Sent: December 19, 2021 10:09 PM
To: [email protected]; Deucher, Alexander <[email protected]>; Sider, Graham <[email protected]>; Kuehling, Felix <[email protected]>; Kim, Jonathan <[email protected]>
Cc: Chen, Guchun <[email protected]>
Subject: [PATCH] drm/amdkfd: correct sdma queue number in kfd device init (v2)

Quoted 2 lines

sdma queue number is not correct like on vega20, this patch promises the

I think you've also fixed Vega12 and Raven (they were being set to 8 before rather than 2). No need to mention this in your description, just double checking.

Quoted 11 lines

setting keeps the same after code refactor.
Additionally, improve code to use switch case to list IP version to complete kfd device_info structure filling.
This keeps consistency with the IP parse code in amdgpu_discovery.c.

v2: use dev_warn for the default switch case;
set default sdma queue per engine(8) and IH handler to v9.
(Jonathan)

Fixes a9e2c4dc6cc4("drm/amdkfd: add kfd_device_info_init function")

Other than the missing checks for Raven when setting the interrupt class (see inline comments and reference kgd2kfd_probe in kfd_device.c) and one nit-pick inline, this looks good to me.

With those fixed, this patch is

Quoted 11 lines
---
 drivers/gpu/drm/amd/amdkfd/kfd_device.c | 77
++++++++++++++++++++++---
 1 file changed, 68 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -0
index facc28f58c1f..36406a261203 100644

drivers/gpu/drm/amd/amdkfd/kfd_device.c static void kfd_gtt_sa_fini(struct kfd_dev *kfd); · line 66

Quoted 8 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +4 -0
@@ -59,11 +59,75 @@ static void kfd_gtt_sa_fini(struct kfd_dev *kfd);
 
 static int kfd_resume(struct kfd_dev *kfd);
 
+static void kfd_device_info_set_sdma_queue_num(struct kfd_dev *kfd) {
+     uint32_t sdma_version = kfd->adev-
 >ip_versions[SDMA0_HWIP][0];
+
+     switch (sdma_version) {

Please pull in the indentation for all cases to line up with the switch block.

drivers/gpu/drm/amd/amdkfd/kfd_device.c static void kfd_gtt_sa_fini(struct kfd_dev *kfd); · line 70

Quoted 4 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +4 -0
+             case IP_VERSION(4, 0, 0):/* VEGA10 */
+             case IP_VERSION(4, 0, 1):/* VEGA12 */
+             case IP_VERSION(4, 1, 0):/* RAVEN */
+             case IP_VERSION(4, 1, 1):/* RAVEN */

As mentioned, you've also fixed Vega12 & Raven here I presume since afaik, they're based off Vega10?

Quoted 29 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +21 -0
+             case IP_VERSION(4, 1, 2):/* RENIOR */
+             case IP_VERSION(5, 2, 1):/* VANGOGH */
+             case IP_VERSION(5, 2, 3):/* YELLOW_CARP */
+                     kfd->device_info.num_sdma_queues_per_engine =
 2;
+                     break;
+             case IP_VERSION(4, 2, 0):/* VEGA20 */
+             case IP_VERSION(4, 2, 2):/* ARCTUTUS */
+             case IP_VERSION(4, 4, 0):/* ALDEBARAN */
+             case IP_VERSION(5, 0, 0):/* NAVI10 */
+             case IP_VERSION(5, 0, 1):/* CYAN_SKILLFISH */
+             case IP_VERSION(5, 0, 2):/* NAVI14 */
+             case IP_VERSION(5, 0, 5):/* NAVI12 */
+             case IP_VERSION(5, 2, 0):/* SIENNA_CICHLID */
+             case IP_VERSION(5, 2, 2):/* NAVY_FLOUDER */
+             case IP_VERSION(5, 2, 4):/* DIMGREY_CAVEFISH */
+                     kfd->device_info.num_sdma_queues_per_engine =
 8;
+                     break;
+             default:
+                     dev_warn(kfd_device,
+                             "Default sdma queue per engine(8) is set 
+ due

to "
+ "mismatch of sdma ip
block(SDMA_HWIP:0x%x).\n",

drivers/gpu/drm/amd/amdkfd/kfd_device.c +2 -0
+                                sdma_version);
+                     kfd->device_info.num_sdma_queues_per_engine =

8;

drivers/gpu/drm/amd/amdkfd/kfd_device.c static void kfd_gtt_sa_fini(struct kfd_dev *kfd); · line 102

Quoted 9 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +9 -0
+     }
+}
+
+static void kfd_device_info_set_event_interrupt_class(struct kfd_dev
+*kfd) {
+     uint32_t gc_version = KFD_GC_VERSION(kfd);
+
+     switch (gc_version) {
+     case IP_VERSION(9, 0, 1): /* VEGA10 */

Missing check for case IP_VERSION(9, 1, 0): /* RAVEN */

Quoted 1 line

+ case IP_VERSION(9, 2, 1): /* VEGA12 */

Missing check for case IP_VERSION(9, 2, 2): /* RAVEN */

Thanks,

Jon

Quoted 61 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +15 -0
+     case IP_VERSION(9, 3, 0): /* RENOIR */
+     case IP_VERSION(9, 4, 0): /* VEGA20 */
+     case IP_VERSION(9, 4, 1): /* ARCTURUS */
+     case IP_VERSION(9, 4, 2): /* ALDEBARAN */
+     case IP_VERSION(10, 3, 1): /* VANGOGH */
+     case IP_VERSION(10, 3, 3): /* YELLOW_CARP */
+     case IP_VERSION(10, 1, 3): /* CYAN_SKILLFISH */
+     case IP_VERSION(10, 1, 10): /* NAVI10 */
+     case IP_VERSION(10, 1, 2): /* NAVI12 */
+     case IP_VERSION(10, 1, 1): /* NAVI14 */
+     case IP_VERSION(10, 3, 0): /* SIENNA_CICHLID */
+     case IP_VERSION(10, 3, 2): /* NAVY_FLOUNDER */
+     case IP_VERSION(10, 3, 4): /* DIMGREY_CAVEFISH */
+     case IP_VERSION(10, 3, 5): /* BEIGE_GOBY */
+             kfd->device_info.event_interrupt_class =

&event_interrupt_class_v9;

drivers/gpu/drm/amd/amdkfd/kfd_device.c +4 -0
+             break;
+     default:
+             dev_warn(kfd_device, "v9 event interrupt handler is set 
+ due

to "
+ "mismatch of gc ip block(GC_HWIP:0x%x).\n",
gc_version);
+ kfd->device_info.event_interrupt_class =
&event_interrupt_class_v9;

drivers/gpu/drm/amd/amdkfd/kfd_device.c +3 -1
+     }
+}
+
 static void kfd_device_info_init(struct kfd_dev *kfd,
                               bool vf, uint32_t gfx_target_version)  {
      uint32_t gc_version = KFD_GC_VERSION(kfd);
-     uint32_t sdma_version = kfd->adev-
Quoted 1 line

ip_versions[SDMA0_HWIP][0];

      uint32_t asic_type = kfd->adev->asic_type;

      kfd->device_info.max_pasid_bits = 16; @@ -75,16 +139,11 @@ 
static void kfd_device_info_init(struct kfd_dev *kfd,
      if (KFD_IS_SOC15(kfd)) {
              kfd->device_info.doorbell_size = 8;
              kfd->device_info.ih_ring_entry_size = 8 * sizeof(uint32_t);
-             kfd->device_info.event_interrupt_class =
&event_interrupt_class_v9;
              kfd->device_info.supports_cwsr = true;
drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -5
-             if ((sdma_version >= IP_VERSION(4, 0, 0)  &&
-                  sdma_version <= IP_VERSION(4, 2, 0)) ||
-                  sdma_version == IP_VERSION(5, 2, 1)  ||
-                  sdma_version == IP_VERSION(5, 2, 3))
-                     kfd->device_info.num_sdma_queues_per_engine =

2;

drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -2
-             else
-                     kfd->device_info.num_sdma_queues_per_engine =

8;

drivers/gpu/drm/amd/amdkfd/kfd_device.c +3 -1
+             kfd_device_info_set_sdma_queue_num(kfd);
+
+             kfd_device_info_set_event_interrupt_class(kfd);
 
              /* Raven */
              if (gc_version == IP_VERSION(9, 1, 0) ||
--

2.17.1