Skip to contentSkip to conversation

drm/amdgpu: skip kfd init if GFX is not ready.

PATCH In review Yifan Zhang 3 participants 3 messages Jul 22, 2024 – Jul 23, 2024

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

PATCH 1/1 drm/amdgpu: skip kfd init if GFX is not ready.

avoid kfd init crash in that case.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -1
index bcacf2e35eba..730dae77570c 100644
@@ -2471,6 +2471,7 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
  */
 static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
 {
+	struct amdgpu_ip_block *ip_block;
 	struct pci_dev *parent;
 	int i, r;
 	bool total;
@@ -2608,7 +2609,10 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
 	if (!total)
 		return -ENODEV;
 
-	amdgpu_amdkfd_device_probe(adev);
+	ip_block = amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_GFX);
+	if (ip_block->status.valid != false)
+		amdgpu_amdkfd_device_probe(adev);
+
 	adev->cg_flags &= amdgpu_cg_mask;
 	adev->pg_flags &= amdgpu_pg_mask;
 
Signature · 1 line
2.37.3
maintainer Acked-by on v1 1/1
#1 lore raw

[Public]

________________________________
From: Zhang, Yifan <[email protected]>
Sent: Sunday, July 21, 2024 10:25 PM
To: [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Zhang, Yifan <[email protected]>
Subject: [PATCH] drm/amdgpu: skip kfd init if GFX is not ready.

avoid kfd init crash in that case.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -1
index bcacf2e35eba..730dae77570c 100644
@@ -2471,6 +2471,7 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
  */
 static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
 {
+       struct amdgpu_ip_block *ip_block;
         struct pci_dev *parent;
         int i, r;
         bool total;
@@ -2608,7 +2609,10 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
         if (!total)
                 return -ENODEV;
 
-       amdgpu_amdkfd_device_probe(adev);
+       ip_block = amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_GFX);
+       if (ip_block->status.valid != false)
+               amdgpu_amdkfd_device_probe(adev);
+
         adev->cg_flags &= amdgpu_cg_mask;
         adev->pg_flags &= amdgpu_pg_mask;
 

--
2.37.3

#2 lore raw
In reply to Yifan Zhang

[AMD Official Use Only - AMD Internal Distribution Only]

This patch look good for me.

Tested-and-Reviewed-by Jesse Zhang <[email protected]>

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Yifan Zhang
Sent: Monday, July 22, 2024 10:25 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Zhang, Yifan <[email protected]>
Subject: [PATCH] drm/amdgpu: skip kfd init if GFX is not ready.

avoid kfd init crash in that case.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -1
index bcacf2e35eba..730dae77570c 100644
@@ -2471,6 +2471,7 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
  */
 static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)  {
+       struct amdgpu_ip_block *ip_block;
        struct pci_dev *parent;
        int i, r;
        bool total;
@@ -2608,7 +2609,10 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
        if (!total)
                return -ENODEV;
 
-       amdgpu_amdkfd_device_probe(adev);
+       ip_block = amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_GFX);
+       if (ip_block->status.valid != false)
+               amdgpu_amdkfd_device_probe(adev);
+
        adev->cg_flags &= amdgpu_cg_mask;
        adev->pg_flags &= amdgpu_pg_mask;
 

--
2.37.3