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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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)
-- 
2.12.0



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux