Skip to contentSkip to conversation

drm/amdkfd: Check int source id for utcl2 poison event

PATCH Superseded Hawking Zhang 2 participants 4 messages Aug 20, 2024

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

PATCH 1/3 drm/amdkfd: Check int source id for utcl2 poison event

Traditional utcl2 fault_status polling does not work in SRIOV environment. The polling of fault status register from guest side will be dropped by hardware.

Driver should switch to check utcl2 interrupt source id to identify utcl2 poison event. It is set to 1 when poisoned data interrupts are signaled.

v2: drop the unused local variable (Tao)

---
 .../gpu/drm/amd/amdkfd/kfd_int_process_v9.c    | 18 +-----------------
 drivers/gpu/drm/amd/amdkfd/soc15_int.h         |  1 +
 2 files changed, 2 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_int_process_v9.c +1 -17
index a9c3580be8c9..fecdbbab9894 100644
@@ -431,25 +431,9 @@ static void event_interrupt_wq_v9(struct kfd_node *dev,
 		   client_id == SOC15_IH_CLIENTID_UTCL2) {
 		struct kfd_vm_fault_info info = {0};
 		uint16_t ring_id = SOC15_RING_ID_FROM_IH_ENTRY(ih_ring_entry);
-		uint32_t node_id = SOC15_NODEID_FROM_IH_ENTRY(ih_ring_entry);
-		uint32_t vmid_type = SOC15_VMID_TYPE_FROM_IH_ENTRY(ih_ring_entry);
-		int hub_inst = 0;
 		struct kfd_hsa_memory_exception_data exception_data;
 
-		/* gfxhub */
-		if (!vmid_type && dev->adev->gfx.funcs->ih_node_to_logical_xcc) {
-			hub_inst = dev->adev->gfx.funcs->ih_node_to_logical_xcc(dev->adev,
-				node_id);
-			if (hub_inst < 0)
-				hub_inst = 0;
-		}
-
-		/* mmhub */
-		if (vmid_type && client_id == SOC15_IH_CLIENTID_VMC)
-			hub_inst = node_id / 4;
-
-		if (amdgpu_amdkfd_ras_query_utcl2_poison_status(dev->adev,
-					hub_inst, vmid_type)) {
+		if (source_id == SOC15_INTSRC_VMC_UTCL2_POISON) {
 			event_interrupt_poison_consumption_v9(dev, pasid, client_id);
 			return;
 		}
drivers/gpu/drm/amd/amdkfd/soc15_int.h +1 -0
index 10138676f27f..e5c0205f2618 100644
@@ -29,6 +29,7 @@
 #define SOC15_INTSRC_CP_BAD_OPCODE	183
 #define SOC15_INTSRC_SQ_INTERRUPT_MSG	239
 #define SOC15_INTSRC_VMC_FAULT		0
+#define SOC15_INTSRC_VMC_UTCL2_POISON	1
 #define SOC15_INTSRC_SDMA_TRAP		224
 #define SOC15_INTSRC_SDMA_ECC		220
 #define SOC21_INTSRC_SDMA_TRAP		49
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/3 drm/amdkfd: Check int source id for utcl2 poison event

Traditional utcl2 fault_status polling does not work in SRIOV environment. The polling of fault status register from guest side will be dropped by hardware.

Driver should switch to check utcl2 interrupt source id to identify utcl2 poison event. It is set to 1 when poisoned data interrupts are signaled.

v2: drop the unused local variable (Tao)

---
 .../gpu/drm/amd/amdkfd/kfd_int_process_v9.c    | 18 +-----------------
 drivers/gpu/drm/amd/amdkfd/soc15_int.h         |  1 +
 2 files changed, 2 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_int_process_v9.c +1 -17
index a9c3580be8c9..fecdbbab9894 100644
@@ -431,25 +431,9 @@ static void event_interrupt_wq_v9(struct kfd_node *dev,
 		   client_id == SOC15_IH_CLIENTID_UTCL2) {
 		struct kfd_vm_fault_info info = {0};
 		uint16_t ring_id = SOC15_RING_ID_FROM_IH_ENTRY(ih_ring_entry);
-		uint32_t node_id = SOC15_NODEID_FROM_IH_ENTRY(ih_ring_entry);
-		uint32_t vmid_type = SOC15_VMID_TYPE_FROM_IH_ENTRY(ih_ring_entry);
-		int hub_inst = 0;
 		struct kfd_hsa_memory_exception_data exception_data;
 
-		/* gfxhub */
-		if (!vmid_type && dev->adev->gfx.funcs->ih_node_to_logical_xcc) {
-			hub_inst = dev->adev->gfx.funcs->ih_node_to_logical_xcc(dev->adev,
-				node_id);
-			if (hub_inst < 0)
-				hub_inst = 0;
-		}
-
-		/* mmhub */
-		if (vmid_type && client_id == SOC15_IH_CLIENTID_VMC)
-			hub_inst = node_id / 4;
-
-		if (amdgpu_amdkfd_ras_query_utcl2_poison_status(dev->adev,
-					hub_inst, vmid_type)) {
+		if (source_id == SOC15_INTSRC_VMC_UTCL2_POISON) {
 			event_interrupt_poison_consumption_v9(dev, pasid, client_id);
 			return;
 		}
drivers/gpu/drm/amd/amdkfd/soc15_int.h +1 -0
index 10138676f27f..e5c0205f2618 100644
@@ -29,6 +29,7 @@
 #define SOC15_INTSRC_CP_BAD_OPCODE	183
 #define SOC15_INTSRC_SQ_INTERRUPT_MSG	239
 #define SOC15_INTSRC_VMC_FAULT		0
+#define SOC15_INTSRC_VMC_UTCL2_POISON	1
 #define SOC15_INTSRC_SDMA_TRAP		224
 #define SOC15_INTSRC_SDMA_ECC		220
 #define SOC21_INTSRC_SDMA_TRAP		49
Signature · 1 line
2.17.1
Reviewed-by on v2 1/3
#2 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

The series is:

Quoted 77 lines

-----Original Message-----
From: Hawking Zhang <[email protected]>
Sent: Tuesday, August 20, 2024 2:05 PM
To: [email protected]; Zhou1, Tao <[email protected]>; Yang, Stanley <[email protected]>
Cc: Zhang, Hawking <[email protected]>; Fan, Shikang <[email protected]>
Subject: [PATCH v2 1/3] drm/amdkfd: Check int source id for utcl2 poison event

Traditional utcl2 fault_status polling does not work in SRIOV environment. The polling of fault status register from guest side will be dropped by hardware.

Driver should switch to check utcl2 interrupt source id to identify utcl2 poison event. It is set to 1 when poisoned data interrupts are signaled.

v2: drop the unused local variable (Tao)

---
 .../gpu/drm/amd/amdkfd/kfd_int_process_v9.c    | 18 +-----------------
 drivers/gpu/drm/amd/amdkfd/soc15_int.h         |  1 +
 2 files changed, 2 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_int_process_v9.c +0 -5
index a9c3580be8c9..fecdbbab9894 100644
@@ -431,25 +431,9 @@ static void event_interrupt_wq_v9(struct kfd_node
 *dev,
                 client_id == SOC15_IH_CLIENTID_UTCL2) {
              struct kfd_vm_fault_info info = {0};
              uint16_t ring_id =
 SOC15_RING_ID_FROM_IH_ENTRY(ih_ring_entry);
-             uint32_t node_id =
 SOC15_NODEID_FROM_IH_ENTRY(ih_ring_entry);
-             uint32_t vmid_type =
 SOC15_VMID_TYPE_FROM_IH_ENTRY(ih_ring_entry);
-             int hub_inst = 0;
              struct kfd_hsa_memory_exception_data exception_data;
 
-             /* gfxhub */
-             if (!vmid_type && dev->adev->gfx.funcs-
Quoted 1 line

ih_node_to_logical_xcc) {

- hub_inst = dev->adev->gfx.funcs-

Quoted 1 line

ih_node_to_logical_xcc(dev->adev,

drivers/gpu/drm/amd/amdkfd/kfd_int_process_v9.c +1 -11
-                             node_id);
-                     if (hub_inst < 0)
-                             hub_inst = 0;
-             }
-
-             /* mmhub */
-             if (vmid_type && client_id == SOC15_IH_CLIENTID_VMC)
-                     hub_inst = node_id / 4;
-
-             if (amdgpu_amdkfd_ras_query_utcl2_poison_status(dev->adev,
-                                     hub_inst, vmid_type)) {
+             if (source_id == SOC15_INTSRC_VMC_UTCL2_POISON) {
                      event_interrupt_poison_consumption_v9(dev, pasid,
client_id);
                      return;
              }
drivers/gpu/drm/amd/amdkfd/soc15_int.h +1 -1
index 10138676f27f..e5c0205f2618 100644
@@ -29,6 +29,7 @@
 #define SOC15_INTSRC_CP_BAD_OPCODE   183
 #define SOC15_INTSRC_SQ_INTERRUPT_MSG        239
 #define SOC15_INTSRC_VMC_FAULT               0
+#define SOC15_INTSRC_VMC_UTCL2_POISON        1
 #define SOC15_INTSRC_SDMA_TRAP               224
 #define SOC15_INTSRC_SDMA_ECC                220
 #define SOC21_INTSRC_SDMA_TRAP               49
--

2.17.1

#3 lore raw
In reply to Hawking Zhang

[AMD Official Use Only - AMD Internal Distribution Only]

Ignore this one. please review [PATCH v2 1/3] drm/amdkfd: Check int source id for utcl2 poison event

Regards,
Hawking

-----Original Message-----
From: Hawking Zhang <[email protected]>
Sent: Tuesday, August 20, 2024 14:05
To: [email protected]; Zhou1, Tao <[email protected]>; Yang, Stanley <[email protected]>
Cc: Zhang, Hawking <[email protected]>; Fan, Shikang <[email protected]>
Subject: [PATCH 1/3] drm/amdkfd: Check int source id for utcl2 poison event

Traditional utcl2 fault_status polling does not work in SRIOV environment. The polling of fault status register from guest side will be dropped by hardware.

Driver should switch to check utcl2 interrupt source id to identify utcl2 poison event. It is set to 1 when poisoned data interrupts are signaled.

v2: drop the unused local variable (Tao)

---
 .../gpu/drm/amd/amdkfd/kfd_int_process_v9.c    | 18 +-----------------
 drivers/gpu/drm/amd/amdkfd/soc15_int.h         |  1 +
 2 files changed, 2 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_int_process_v9.c +1 -17
index a9c3580be8c9..fecdbbab9894 100644
@@ -431,25 +431,9 @@ static void event_interrupt_wq_v9(struct kfd_node *dev,
                   client_id == SOC15_IH_CLIENTID_UTCL2) {
                struct kfd_vm_fault_info info = {0};
                uint16_t ring_id = SOC15_RING_ID_FROM_IH_ENTRY(ih_ring_entry);
-               uint32_t node_id = SOC15_NODEID_FROM_IH_ENTRY(ih_ring_entry);
-               uint32_t vmid_type = SOC15_VMID_TYPE_FROM_IH_ENTRY(ih_ring_entry);
-               int hub_inst = 0;
                struct kfd_hsa_memory_exception_data exception_data;
 
-               /* gfxhub */
-               if (!vmid_type && dev->adev->gfx.funcs->ih_node_to_logical_xcc) {
-                       hub_inst = dev->adev->gfx.funcs->ih_node_to_logical_xcc(dev->adev,
-                               node_id);
-                       if (hub_inst < 0)
-                               hub_inst = 0;
-               }
-
-               /* mmhub */
-               if (vmid_type && client_id == SOC15_IH_CLIENTID_VMC)
-                       hub_inst = node_id / 4;
-
-               if (amdgpu_amdkfd_ras_query_utcl2_poison_status(dev->adev,
-                                       hub_inst, vmid_type)) {
+               if (source_id == SOC15_INTSRC_VMC_UTCL2_POISON) {
                        event_interrupt_poison_consumption_v9(dev, pasid, client_id);
                        return;
                }
drivers/gpu/drm/amd/amdkfd/soc15_int.h +1 -0
index 10138676f27f..e5c0205f2618 100644
@@ -29,6 +29,7 @@
 #define SOC15_INTSRC_CP_BAD_OPCODE     183
 #define SOC15_INTSRC_SQ_INTERRUPT_MSG  239
 #define SOC15_INTSRC_VMC_FAULT         0
+#define SOC15_INTSRC_VMC_UTCL2_POISON  1
 #define SOC15_INTSRC_SDMA_TRAP         224
 #define SOC15_INTSRC_SDMA_ECC          220
 #define SOC21_INTSRC_SDMA_TRAP         49

--
2.17.1