Skip to contentSkip to conversation

drm/amdgpu: add print for iommu translation mode

PATCH In review Graham Sider 2 participants 3 messages Mar 20, 2023 – Apr 4, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/amdgpu: add print for iommu translation mode

Add log to display whether RAM is direct vs DMA mapped.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -1
index 3bd6c5aef796..83774824694b 100644
@@ -3528,8 +3528,12 @@ static void amdgpu_device_check_iommu_direct_map(struct amdgpu_device *adev)
 	struct iommu_domain *domain;
 
 	domain = iommu_get_domain_for_dev(adev->dev);
-	if (!domain || domain->type == IOMMU_DOMAIN_IDENTITY)
+	if (!domain || domain->type == IOMMU_DOMAIN_IDENTITY) {
+		dev_info(adev->dev, "RAM is direct mapped to GPU (not translated by IOMMU)\n");
 		adev->ram_is_direct_mapped = true;
+	} else {
+		dev_info(adev->dev, "RAM is DMA mapped to GPU (translated by IOMMU)\n");
+	}
 }
 
 static const struct attribute *amdgpu_dev_attributes[] = {
Signature · 1 line
2.25.1
Acked-by on v2 1/1
#1 lore raw
Quoted 3 lines · Graham Sider

Add log to display whether RAM is direct vs DMA mapped.

Quoted 22 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -1
index 3bd6c5aef796..83774824694b 100644
@@ -3528,8 +3528,12 @@ static void amdgpu_device_check_iommu_direct_map(struct amdgpu_device *adev)
  	struct iommu_domain *domain;
 
  	domain = iommu_get_domain_for_dev(adev->dev);
-	if (!domain || domain->type == IOMMU_DOMAIN_IDENTITY)
+	if (!domain || domain->type == IOMMU_DOMAIN_IDENTITY) {
+		dev_info(adev->dev, "RAM is direct mapped to GPU (not translated by IOMMU)\n");
  		adev->ram_is_direct_mapped = true;
+	} else {
+		dev_info(adev->dev, "RAM is DMA mapped to GPU (translated by IOMMU)\n");
+	}
  }
 
  static const struct attribute *amdgpu_dev_attributes[] = {
#2 lore raw

[AMD Official Use Only - General]

Ping :)

Best,
Graham

Quoted 41 lines

-----Original Message-----
From: Kuehling, Felix <[email protected]>
Sent: Monday, March 20, 2023 12:16 PM
To: Sider, Graham <[email protected]>; amd- [email protected]
Subject: Re: [PATCH v2] drm/amdgpu: add print for iommu translation mode

Quoted 3 lines · Graham Sider

Add log to display whether RAM is direct vs DMA mapped.

Review

Quoted 5 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static void

Quoted 4 lines

index 3bd6c5aef796..83774824694b 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
@@ -3528,8 +3528,12 @@ static void

amdgpu_device_check_iommu_direct_map(struct amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static void amdgpu_device_check_iommu_direct_map(struct amdgpu_device *adev)

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -1
  	struct iommu_domain *domain;
 
  	domain = iommu_get_domain_for_dev(adev->dev);
-	if (!domain || domain->type == IOMMU_DOMAIN_IDENTITY)
+	if (!domain || domain->type == IOMMU_DOMAIN_IDENTITY) {
+		dev_info(adev->dev, "RAM is direct mapped to GPU (not

translated by IOMMU)\n");

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static void amdgpu_device_check_iommu_direct_map(struct amdgpu_device *adev)

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
  		adev->ram_is_direct_mapped = true;
+	} else {
+		dev_info(adev->dev, "RAM is DMA mapped to GPU

(translated by IOMMU)\n");

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
+	}
  }
 
  static const struct attribute *amdgpu_dev_attributes[] = {