Skip to contentSkip to conversation

media: nvidia: tegra: Use iommu_paging_domain_alloc()

PATCH In review Lu Baolu 5 participants 8 messages Aug 12, 2024 – Sep 15, 2024

Subsystems (6)
lore
Share & tools
lore

Lu Baolu

author
#0 lore raw

PATCH 1/2 media: nvidia: tegra: Use iommu_paging_domain_alloc()

An iommu domain is allocated in tegra_vde_iommu_init() and is attached to vde->dev. Use iommu_paging_domain_alloc() to make it explicit.

---
 drivers/media/platform/nvidia/tegra-vde/iommu.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/media/platform/nvidia/tegra-vde/iommu.c +4 -3
index 5521ed3e465f..b1d9d841d944 100644
@@ -78,9 +78,10 @@ int tegra_vde_iommu_init(struct tegra_vde *vde)
 		arm_iommu_release_mapping(mapping);
 	}
 #endif
-	vde->domain = iommu_domain_alloc(&platform_bus_type);
-	if (!vde->domain) {
-		err = -ENOMEM;
+	vde->domain = iommu_paging_domain_alloc(dev);
+	if (IS_ERR(vde->domain)) {
+		err = PTR_ERR(vde->domain);
+		vde->domain = NULL;
 		goto put_group;
 	}
 
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 2/2 media: venus: firmware: Use iommu_paging_domain_alloc()

An iommu domain is allocated in venus_firmware_init() and is attached to core->fw.dev in the same function. Use iommu_paging_domain_alloc() to make it explicit.

---
 drivers/media/platform/qcom/venus/firmware.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/platform/qcom/venus/firmware.c +3 -3
index fe7da2b30482..66a18830e66d 100644
@@ -316,10 +316,10 @@ int venus_firmware_init(struct venus_core *core)
 
 	core->fw.dev = &pdev->dev;
 
-	iommu_dom = iommu_domain_alloc(&platform_bus_type);
-	if (!iommu_dom) {
+	iommu_dom = iommu_paging_domain_alloc(core->fw.dev);
+	if (IS_ERR(iommu_dom)) {
 		dev_err(core->fw.dev, "Failed to allocate iommu domain\n");
-		ret = -ENOMEM;
+		ret = PTR_ERR(iommu_dom);
 		goto err_unregister;
 	}
 
Signature · 1 line
2.34.1
Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] media: venus: firmware: Use iommu_paging_domain_alloc()

Hi,

Thank you for the patch!

drivers/media/platform/qcom/venus/firmware.ced

Quoted 15 lines · Lu Baolu

An iommu domain is allocated in venus_firmware_init() and is attached to core->fw.dev in the same function. Use iommu_paging_domain_alloc() to make it explicit.

---
  drivers/media/platform/qcom/venus/firmware.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/platform/qcom/venus/firmware.ced renamed from drivers/media/platform/qcom/venus/firmware.c +0 -0
index fe7da2b30482..66a18830e66d 100644

I'll take the patch through linux-media tree.

Quoted 14 lines
drivers/media/platform/qcom/venus/firmware.ced renamed from drivers/media/platform/qcom/venus/firmware.c +3 -3
@@ -316,10 +316,10 @@ int venus_firmware_init(struct venus_core *core)
 
  	core->fw.dev = &pdev->dev;
 
-	iommu_dom = iommu_domain_alloc(&platform_bus_type);
-	if (!iommu_dom) {
+	iommu_dom = iommu_paging_domain_alloc(core->fw.dev);
+	if (IS_ERR(iommu_dom)) {
  		dev_err(core->fw.dev, "Failed to allocate iommu domain\n");
-		ret = -ENOMEM;
+		ret = PTR_ERR(iommu_dom);
  		goto err_unregister;
  	}
 
Signature · 2 lines
regards,
Stan
#3 lore raw

Re: [PATCH 2/2] media: venus: firmware: Use iommu_paging_domain_alloc()

Quoted 16 lines · Stanimir Varbanov

Hi,

Thank you for the patch!

Quoted 11 lines · Lu Baolu

An iommu domain is allocated in venus_firmware_init() and is attached to core->fw.dev in the same function. Use iommu_paging_domain_alloc() to make it explicit.

---
  drivers/media/platform/qcom/venus/firmware.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
Quoted 8 lines

drivers/media/platform/qcom/venus/firmware.ced

Quoted 4 lines
drivers/media/platform/qcom/venus/firmware.ced renamed from drivers/media/platform/qcom/venus/firmware.c +0 -0
index fe7da2b30482..66a18830e66d 100644

I'll take the patch through linux-media tree.

Did this patch and the 1/2:

https://lore.kernel.org/linux-iommu/[email protected]/

Get picked up for media? I don't see it in linux-next?

Thanks,
Jason

#4 lore raw

Re: [PATCH 2/2] media: venus: firmware: Use iommu_paging_domain_alloc()

Hi Jason,

Quoted 24 lines · Jason Gunthorpe
Quoted 23 lines · Stanimir Varbanov

Hi,

Thank you for the patch!

drivers/media/platform/qcom/venus/firmware.ced

Quoted 15 lines · Lu Baolu

An iommu domain is allocated in venus_firmware_init() and is attached to core->fw.dev in the same function. Use iommu_paging_domain_alloc() to make it explicit.

---
  drivers/media/platform/qcom/venus/firmware.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/platform/qcom/venus/firmware.ced renamed from drivers/media/platform/qcom/venus/firmware.c +0 -0
index fe7da2b30482..66a18830e66d 100644
Quoted 3 lines
Quoted 1 line

I'll take the patch through linux-media tree.

Did this patch and the 1/2:

2/2 is in linux-next now.

~Stan

#5 lore raw

Re: [PATCH 2/2] media: venus: firmware: Use iommu_paging_domain_alloc()

Quoted 19 lines · Stanimir Varbanov
Quoted 19 lines
Quoted 19 lines · Lu Baolu

drivers/media/platform/qcom/venus/firmware.ced

Quoted 15 lines

An iommu domain is allocated in venus_firmware_init() and is attached to core->fw.dev in the same function. Use iommu_paging_domain_alloc() to make it explicit.

---
  drivers/media/platform/qcom/venus/firmware.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/platform/qcom/venus/firmware.ced renamed from drivers/media/platform/qcom/venus/firmware.c +0 -0
index fe7da2b30482..66a18830e66d 100644
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

I'll take the patch through linux-media tree.

Did this patch and the 1/2:

2/2 is in linux-next now.

And 1/2? Can someone pick it up too?

https://lore.kernel.org/all/2o6gpxknio4kvf5fmqgai5jaov65semmw3wvtmt4gdauwzhbti@ii3ydtlmp2sb/

Thanks,
Jason

Acked-by on v1 1/2
#6 lore raw
In reply to Lu Baolu
Quoted 9 lines · Lu Baolu

An iommu domain is allocated in tegra_vde_iommu_init() and is attached to vde->dev. Use iommu_paging_domain_alloc() to make it explicit.

---
 drivers/media/platform/nvidia/tegra-vde/iommu.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
#7 lore raw
Quoted 4 lines · Thierry Reding
Quoted 3 lines · Lu Baolu

An iommu domain is allocated in tegra_vde_iommu_init() and is attached to vde->dev. Use iommu_paging_domain_alloc() to make it explicit.

Quoted 8 lines
Quoted 6 lines
---
 drivers/media/platform/nvidia/tegra-vde/iommu.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Can someone please pick this up for this cycle? This is one of the last two call sites before we can delete this API. Things are waiting on this.

Jason