[PATCH] drm/amdkfd: set coherent host access capability flag

Felix Kuehling felix.kuehling at amd.com
Fri Jun 16 04:36:15 UTC 2023


Am 2023-06-16 um 00:29 schrieb Felix Kuehling:
>
> Am 2023-06-15 um 18:54 schrieb Alex Sierra:
>> This flag determines whether the host possesses coherent access to
>> the memory of the device.
>>
>> Signed-off-by: Alex Sierra <alex.sierra at amd.com>
>> ---
>>   drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c 
>> b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
>> index 90b86a6ac7bd..7ede3de4f7fb 100644
>> --- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
>> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
>> @@ -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

Reviewed-by: Felix Kuehling <Felix.Kuehling at amd.com>


>
> Regards,
>   Felix
>
>
>> +
>>       kfd_debug_print_topology();
>>         kfd_notify_gpu_change(gpu_id, 1);


More information about the amd-gfx mailing list