Skip to contentSkip to conversation

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

PATCH In review Alex Deucher 5 participants 5 messages Nov 16 – Nov 17

Subsystems (3)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH v2 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.

v2: add additional IP versions

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 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_process.c +6 -1
index 546721b4d59ac..b1b641ddbcf68 100644
@@ -1554,7 +1554,12 @@ 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(9, 4, 4) ||
+	     KFD_GC_VERSION(dev) == IP_VERSION(9, 5, 0) ||
+	     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
Reviewed-by on v2 1/1
#1 lore raw

AMD General

________________________________
From: Alex Deucher <[email protected]>
Sent: Monday, November 16, 2026 9:47 AM
To: [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Zhu, James <[email protected]>; Indic, Vladimir <[email protected]>; Kasiviswanathan, Harish <[email protected]>; Yang, Philip <[email protected]>
Subject: [PATCH v2] 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.

v2: add additional IP versions

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 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_process.c +6 -1
index 546721b4d59ac..b1b641ddbcf68 100644
@@ -1554,7 +1554,12 @@ 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(9, 4, 4) ||
+            KFD_GC_VERSION(dev) == IP_VERSION(9, 5, 0) ||
+            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;

--
2.56.0

Reviewed-by Reviewed-by Harish Kasiviswanathan
#2 lore raw

AMD General

Hi Alex,

Thanks for the patch. I have provided some comments offline.

I'm overall fine with the change, although would recommend we use KFD_GC_VERSION(dev) >= IP_VERSION(12, 1, 0)).

Thanks,
Vladimir

________________________________
From: Kasiviswanathan, Harish <[email protected]>
Sent: Monday, November 16, 2026 10:00 PM
To: Deucher, Alexander <[email protected]>; [email protected] <[email protected]>
Cc: Zhu, James <[email protected]>; Indic, Vladimir <[email protected]>; Yang, Philip <[email protected]>
Subject: Re: [PATCH v2] drm/amdkfd: move TBA/TMA back to system memory

AMD General

________________________________
From: Alex Deucher <[email protected]>
Sent: Monday, November 16, 2026 9:47 AM
To: [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Zhu, James <[email protected]>; Indic, Vladimir <[email protected]>; Kasiviswanathan, Harish <[email protected]>; Yang, Philip <[email protected]>
Subject: [PATCH v2] 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.

v2: add additional IP versions

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 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_process.c +6 -1
index 546721b4d59ac..b1b641ddbcf68 100644
@@ -1554,7 +1554,12 @@ 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(9, 4, 4) ||
+            KFD_GC_VERSION(dev) == IP_VERSION(9, 5, 0) ||
+            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;

--
2.56.0

#3 lore raw
Quoted 9 lines · Vladimir

AMD General

Hi Alex,

Thanks for the patch. I have provided some comments offline.

I'm overall fine with the change, although would recommend we use KFD_GC_VERSION(dev) >= IP_VERSION(12, 1, 0)).

I think the underlying problem is that the TBA/TMA buffers are not properly saved and restored across a suspend and resume. @James Zhu can you double check this?

Alex

Quoted 60 lines

Thanks,
Vladimir

________________________________
From: Kasiviswanathan, Harish <[email protected]>
Sent: Monday, November 16, 2026 10:00 PM
To: Deucher, Alexander <[email protected]>; [email protected] <[email protected]>
Cc: Zhu, James <[email protected]>; Indic, Vladimir <[email protected]>; Yang, Philip <[email protected]>
Subject: Re: [PATCH v2] drm/amdkfd: move TBA/TMA back to system memory

AMD General

________________________________
From: Alex Deucher <[email protected]>
Sent: Monday, November 16, 2026 9:47 AM
To: [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Zhu, James <[email protected]>; Indic, Vladimir <[email protected]>; Kasiviswanathan, Harish <[email protected]>; Yang, Philip <[email protected]>
Subject: [PATCH v2] 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.

v2: add additional IP versions

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 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_process.c +6 -2
index 546721b4d59ac..b1b641ddbcf68 100644
@@ -1554,7 +1554,12 @@ 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(9, 4, 4) ||
+            KFD_GC_VERSION(dev) == IP_VERSION(9, 5, 0) ||
+            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;
--

2.56.0

#4 lore raw
In reply to Alex Deucher
ThispatchisReviewed-by JamesZhu<[email protected]>
Quoted 34 lines · Alex Deucher

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

v2: add additional IP versions

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 | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_process.c +6 -1
index 546721b4d59ac..b1b641ddbcf68 100644
@@ -1554,7 +1554,12 @@ 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(9, 4, 4) ||
+	     KFD_GC_VERSION(dev) == IP_VERSION(9, 5, 0) ||
+	     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;