drm/amdkfd: set coherent host access capability flag
Subsystems (3)
PATCH 1/1 drm/amdkfd: set coherent host access capability flag
This flag determines whether the host possesses coherent access to the memory of the device.
--- drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +4 -0
@@ -2107,6 +2107,10 @@ int kfd_topology_add_device(struct kfd_node *gpu)if (KFD_IS_SVM_API_SUPPORTED (dev->gpu->adev)) dev->node_props.capability |=HSA_CAP_SVMAPI_SUPPORTED ; +if (dev->gpu->adev->gmc.is_app_apu | + dev->gpu->adev->gmc.xgmi.connected_to_cpu) + dev->node_props.capability |=HSA_CAP_FLAGS_COHERENTHOSTACCESS ; +kfd_debug_print_topology ();kfd_notify_gpu_change (gpu_id,1 );
Signature · 1 line
2.32.0
[AMD Official Use Only - General]
Quoted 37 lines
-----Original Message-----
From: Sierra Guiza, Alejandro (Alex) <[email protected]>
Sent: Thursday, June 15, 2023 5:55 PM
To: [email protected]; Kuehling, Felix <[email protected]>
Cc: Yat Sin, David <[email protected]>; Sierra Guiza, Alejandro (Alex) <[email protected]>
Subject: [PATCH] drm/amdkfd: set coherent host access capability flagThis flag determines whether the host possesses coherent access to the memory of the device.
Signed-off-by Alex Sierra <[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/gpu/drm/amd/amdkfd/kfd_topology.c +4
-0@@ -2107,6 +2107,10 @@ int kfd_topology_add_device(struct kfd_node *gpu)if (KFD_IS_SVM_API_SUPPORTED (dev->gpu->adev)) dev->node_props.capability |=HSA_CAP_SVMAPI_SUPPORTED ; +if (dev->gpu->adev->gmc.is_app_apu | + dev->gpu->adev->gmc.xgmi.connected_to_cpu) + dev->node_props.capability |=HSA_CAP_FLAGS_COHERENTHOSTACCESS ; +kfd_debug_print_topology(); kfd_notify_gpu_change(gpu_id, 1);--
2.32.0
Felix Kuehling
maintainerAm 2023-06-15 um 18:54 schrieb Alex Sierra:
Quoted 13 lines
This flag determines whether the host possesses coherent access to the memory of the device.
Signed-off-by Alex Sierra <[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/gpu/drm/amd/amdkfd/kfd_topology.c +0
-0
drivers/gpu/drm/amd/amdkfd/kfd_topology.c int kfd_topology_add_device(struct kfd_node *gpu) · line 2112
Quoted 6 lines
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +3
-0@@ -2107,6 +2107,10 @@ int kfd_topology_add_device(struct kfd_node *gpu)if (KFD_IS_SVM_API_SUPPORTED (dev->gpu->adev)) dev->node_props.capability |=HSA_CAP_SVMAPI_SUPPORTED ; +if (dev->gpu->adev->gmc.is_app_apu | + dev->gpu->adev->gmc.xgmi.connected_to_cpu) + dev->node_props.capability |=HSA_CAP_FLAGS_COHERENTHOSTACCESS ;
I believe this is not true for "small APUs" because they map the framebuffer as WC on the CPU. I think you need to check specifically for APP APU.
Regards,
Felix
Quoted 4 lines
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +1
-0+kfd_debug_print_topology ();kfd_notify_gpu_change (gpu_id,1 );
Am 2023-06-16 um 00:29 schrieb Felix Kuehling:
Quoted 10 lines
Am 2023-06-15 um 18:54 schrieb Alex Sierra:
Quoted 8 lines
This flag determines whether the host possesses coherent access to the memory of the device.
Signed-off-by Alex Sierra <[email protected]>---
drivers/gpu/drm/amd/amdkfd/kfd_topology.c| 4 ++++1 file changed, 4 insertions(+)
Quoted 12 lines
Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +0
-0@@ -2107,6 +2107,10 @@ int kfd_topology_add_device(struct kfd_node *gpu) if (KFD_IS_SVM_API_SUPPORTED(dev->gpu->adev)) dev->node_props.capability |= HSA_CAP_SVMAPI_SUPPORTED;+ if (
dev->gpu->adev->gmc.is_app_apu|
+dev->gpu->adev->gmc.xgmi.connected_to_cpu)
+dev->node_props.capability|=HSA_CAP_FLAGS_COHERENTHOSTACCESS;I believe this is not true for "small APUs" because they map the framebuffer as WC on the CPU. I think you need to check specifically for APP APU.
Never mind, I read it wrong. You are checking the correct APP APU flag. Just one more nit-pick, in the condition you should use logical OR (a || b), not bit-wise OR (a | b). With that fixed, the patch is
Quoted 8 lines
Regards,
FelixQuoted 3 lines
+
kfd_debug_print_topology();
kfd_notify_gpu_change(gpu_id, 1);