Skip to contentSkip to conversation

drm/amdkfd: move TBA/TMA back to system memory

PATCH Superseded Alex Deucher 2 participants 2 messages Nov 16

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/1 drm/amdkfd: move TBA/TMA back to system memory

For non-MI parts, move TBA/TMA back to system memory. Results in GPU resets in some apps after suspend.

Fixes fe5966d4fdcb ("drm/amdkfd: move TBA/TMA from system to device memory")
Cc James Zhu <[email protected]>
Cc Vladimir Indic <[email protected]>
Cc Harish Kasiviswanathan <[email protected]>
Cc Philip Yang <[email protected]>
---
 drivers/gpu/drm/amd/amdkfd/kfd_process.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_process.c +4 -1
index 546721b4d59ac..7a424184a4a3c 100644
@@ -1554,7 +1554,10 @@ static int kfd_process_device_init_cwsr_dgpu(struct kfd_process_device *pdd)
 	if (!dev->kfd->cwsr_enabled || !iosys_map_is_null(&qpd->cwsr_map) || !qpd->cwsr_base)
 		return 0;
 
-	if (KFD_GC_VERSION(dev) >= IP_VERSION(9, 4, 2) && !dev->adev->apu_prefer_gtt)
+	if ((KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2) ||
+	     KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 3) ||
+	     KFD_GC_VERSION(dev) == IP_VERSION(12, 1, 0)) &&
+	    !dev->adev->apu_prefer_gtt)
 		flags |= KFD_IOC_ALLOC_MEM_FLAGS_VRAM;
 	else
 		flags |= KFD_IOC_ALLOC_MEM_FLAGS_GTT;
Signature · 1 line
2.56.0
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] drm/amdkfd: missing GC 9.4.4 and 9.5.0 in kfd_process_device_init_cwsr_dgpu() --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Medium] drm/amdkfd: missing GC 9.4.4 and 9.5.0 in kfd_process_device_init_cwsr_dgpu()
--

commit cc9ef3d2bb074c200e9b29b42b4feba716d6b86b
Author: Alex Deucher <[email protected]>

drm/amdkfd: move TBA/TMA back to system memory

This commit restricts CWSR TBA/TMA VRAM allocation to specific MI GC IP versions so that non-MI parts allocate TBA/TMA in GTT memory.

Quoted 6 lines
drivers/gpu/drm/amd/amdkfd/kfd_process.c +0 -0
index 546721b4d59ac..7a424184a4a3c 100644
@@ -1554,7 +1554,10 @@ static int kfd_process_device_init_cwsr_dgpu(struct kfd_process_device *pdd)
 	if (!dev->kfd->cwsr_enabled || !iosys_map_is_null(&qpd->cwsr_map) || !qpd->cwsr_base)

drivers/gpu/drm/amd/amdkfd/kfd_process.c static int kfd_process_device_init_cwsr_dgpu(struct kfd_process_device *pdd) · line 1563

Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_process.c +4 -1
 		return 0;
 
-	if (KFD_GC_VERSION(dev) >= IP_VERSION(9, 4, 2) && !dev->adev->apu_prefer_gtt)
+	if ((KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2) ||
+	     KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 3) ||
+	     KFD_GC_VERSION(dev) == IP_VERSION(12, 1, 0)) &&
+	    !dev->adev->apu_prefer_gtt)
 		flags |= KFD_IOC_ALLOC_MEM_FLAGS_VRAM;
 	else
 		flags |= KFD_IOC_ALLOC_MEM_FLAGS_GTT;

[Severity: Medium]
Should this condition also include IP_VERSION(9, 4, 4) and IP_VERSION(9, 5, 0)?

Other MI checks such as mqd_on_vram(), kfd_process_close_interrupt_drain(), and KFD_SUPPORT_XNACK_PER_PROCESS() list GC 9.4.4 and 9.5.0 alongside 9.4.2 and 9.4.3. Omitting them here causes kfd_process_device_init_cwsr_dgpu() to regress to KFD_IOC_ALLOC_MEM_FLAGS_GTT on those MI parts instead of keeping TBA/TMA in VRAM.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1