[PATCH] drm/amd/amdgpu: Fix iova debugfs for non-iommu case

Christian König ckoenig.leichtzumerken at gmail.com
Tue Sep 19 17:10:51 UTC 2017


As far as I know we don't need #ifdefs cause there are dummy functions 
when IOMMU is not compiled in.

But this patch is a NAK since it circumvents the /dev/mem restriction 
when IOMMU is disabled and that is not something we can easily allow.

Regards,
Christian.

Am 19.09.2017 um 17:36 schrieb Tom St Denis:
> Do we need to put #ifdefs of IOMMU_SUPPORT around this too?
>
> The cavium driver doesn't seem to have any depends on IOMMU_* 
> anywhere... (for instance)
>
> Tom
>
>
> On 19/09/17 11:30 AM, Tom St Denis wrote:
>> Signed-off-by: Tom St Denis <tom.stdenis at amd.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 14 ++++++++------
>>   1 file changed, 8 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> index 0e5f78f3a97e..1ee51a15a56c 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> @@ -1791,13 +1791,14 @@ static ssize_t 
>> amdgpu_iova_to_phys_read(struct file *f, char __user *buf,
>>       struct iommu_domain *dom;
>>         dom = iommu_get_domain_for_dev(adev->dev);
>> -    if (!dom)
>> -        return -EFAULT;
>>         result = 0;
>>       while (size) {
>>           // get physical address and map
>> -        phys = iommu_iova_to_phys(dom, *pos);
>> +        if (dom)
>> +            phys = iommu_iova_to_phys(dom, *pos);
>> +        else
>> +            phys = *pos;
>>             // copy upto one page
>>           if (size > PAGE_SIZE)
>> @@ -1837,13 +1838,14 @@ static ssize_t 
>> amdgpu_iova_to_phys_write(struct file *f, const char __user *buf,
>>       struct iommu_domain *dom;
>>         dom = iommu_get_domain_for_dev(adev->dev);
>> -    if (!dom)
>> -        return -EFAULT;
>>         result = 0;
>>       while (size) {
>>           // get physical address and map
>> -        phys = iommu_iova_to_phys(dom, *pos);
>> +        if (dom)
>> +            phys = iommu_iova_to_phys(dom, *pos);
>> +        else
>> +            phys = *pos;
>>             // copy upto one page
>>           if (size > PAGE_SIZE)
>>
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx




More information about the amd-gfx mailing list