Skip to contentSkip to conversation

drm/amdgpu: reduce the full gpu access time in amdgpu_device_init.

PATCH In review chong li 2 participants 2 messages Nov 7, 2025

Subsystems (2)
lore
Share & tools
lore

chong li

author
#0 lore raw

PATCH 1/1 drm/amdgpu: reduce the full gpu access time in amdgpu_device_init.

[Why]
function "devm_memremap_pages" in function "kgd2kfd_init_zone_device", sometimes cost too much time.

[How]
move the function "kgd2kfd_init_zone_device" after release full gpu access(amdgpu_virt_release_full_gpu).

Change-Id I3eebd7272b8f0c85d08fec80acee67a2c9e59e52
---
 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 1e8725abcded..9aacf8fdb38a 100644
@@ -3314,7 +3314,6 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)
 
 	/* Don't init kfd if whole hive need to be reset during init */
 	if (adev->init_lvl->level != AMDGPU_INIT_LEVEL_MINIMAL_XGMI) {
-		kgd2kfd_init_zone_device(adev);
 		amdgpu_amdkfd_device_init(adev);
 	}
 
@@ -4929,6 +4928,11 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 
 	if (adev->init_lvl->level == AMDGPU_INIT_LEVEL_MINIMAL_XGMI)
 		amdgpu_xgmi_reset_on_init(adev);
+
+    /* Don't init kfd if whole hive need to be reset during init */
+    if (adev->init_lvl->level != AMDGPU_INIT_LEVEL_MINIMAL_XGMI)
+		kgd2kfd_init_zone_device(adev);
+
 	/*
 	 * Place those sysfs registering after `late_init`. As some of those
 	 * operations performed in `late_init` might affect the sysfs
Signature · 1 line
2.48.1
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

Emily Deng
Best Wishes

Quoted 50 lines

-----Original Message-----
From: Li, Chong(Alan) <[email protected]>
Sent: Friday, November 7, 2025 3:08 PM
To: [email protected]
Cc: Deng, Emily <[email protected]>; Li, Chong(Alan) <[email protected]>
Subject: [PATCH] drm/amdgpu: reduce the full gpu access time in amdgpu_device_init.

[Why]
function "devm_memremap_pages" in function "kgd2kfd_init_zone_device", sometimes cost too much time.

[How]
move the function "kgd2kfd_init_zone_device" after release full gpu access(amdgpu_virt_release_full_gpu).

Change-Id I3eebd7272b8f0c85d08fec80acee67a2c9e59e52

---
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 -2
index 1e8725abcded..9aacf8fdb38a 100644
@@ -3314,7 +3314,6 @@ static int amdgpu_device_ip_init(struct amdgpu_device
 *adev)
 
      /* Don't init kfd if whole hive need to be reset during init */
      if (adev->init_lvl->level != AMDGPU_INIT_LEVEL_MINIMAL_XGMI) {
-              kgd2kfd_init_zone_device(adev);
              amdgpu_amdkfd_device_init(adev);
      }
@@ -4929,6 +4928,11 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 
      if (adev->init_lvl->level == AMDGPU_INIT_LEVEL_MINIMAL_XGMI)
              amdgpu_xgmi_reset_on_init(adev);
+
+    /* Don't init kfd if whole hive need to be reset during init */
+    if (adev->init_lvl->level != AMDGPU_INIT_LEVEL_MINIMAL_XGMI)
+              kgd2kfd_init_zone_device(adev);
+
      /*
       * Place those sysfs registering after `late_init`. As some of those
       * operations performed in `late_init` might affect the sysfs
--

2.48.1