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

Tom St Denis tom.stdenis at amd.com
Tue Sep 19 17:20:09 UTC 2017


On 19/09/17 01:18 PM, Christian König wrote:
> Am 19.09.2017 um 19:14 schrieb Tom St Denis:
>> On 19/09/17 01:10 PM, Christian König wrote:
>>> 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.
>>
>> I raised this objection 24 hours ago and was told to go ahead with the 
>> read/write methods anyways.
>>
>> Short of making a list of mappings/allocations in the ttm layer I have 
>> no idea how we would track this in the non-iommu case which means the 
>> entire iova debugfs entry should have been NAK'ed in the first place.
>>
>> I'm open to suggestions.
> 
> As long as IOMMU is enabled the entry is perfectly fine, cause only 
> memory mapped to the IOMMU is accessible to the GPU and so accessible 
> using the debugfs entry as well.

On devices where there's no translation (e.g. Carrizo) does the iommu 
layer track mappings?  I'm wondering if on those I could seek outside of 
boundaries and read system memory anyways.

> Only when IOMMU is disabled we can't go this way cause we can't know 
> which memory is mapped to the driver and which isn't (or could we 
> somehow track this?).
> 
> I suggest to not create the file in the first place if IOMMU is disabled.

I could easily do this (basically check if the domain is not null at 
debugfs init time).

Tom


More information about the amd-gfx mailing list