drm/amdgpu: Take IOMMU remapping into account for p2p checks
authorRahul Jain <Rahul.Jain@amd.com>
Tue, 13 Aug 2024 08:11:11 +0000 (13:41 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 23 Aug 2024 14:53:05 +0000 (10:53 -0400)
commit75f0efbc4b3b088cca20864d055b3854a51b5af0
tree584d10ab925b0eb32eda550a96c431a61a6a545b
parent01bfabc2d1d8aaffe5268f8df0843a6d916dcbaa
drm/amdgpu: Take IOMMU remapping into account for p2p checks

when trying to enable p2p the amdgpu_device_is_peer_accessible()
checks the condition where address_mask overlaps the aper_base
and hence returns 0, due to which the p2p disables for this platform

IOMMU should remap the BAR addresses so the device can access
them. Hence check if peer_adev is remapping DMA

v5: (Felix, Alex)
- fixing comment as per Alex feedback
- refactor code as per Felix

v4: (Alex)
- fix the comment and description

v3:
- remove iommu_remap variable

v2: (Alex)
- Fix as per review comments
- add new function amdgpu_device_check_iommu_remap to check if iommu
  remap

Signed-off-by: Rahul Jain <Rahul.Jain@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c