Skip to contentSkip to conversation

iommu/amd: Set AMD iommu callbacks for platform bus driver

PATCH Applied Wan Zongshun 3 participants 3 messages May 10, 2016 – Jun 15, 2016 IOMMU

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 iommu/amd: Set AMD iommu callbacks for platform bus driver

From: Wan Zongshun <[email protected]>

AMD has more drivers will use ACPI to platform bus driver later, all those devices need iommu support, for example: eMMC driver.

For latest AMD eMMC controller, it will utilize sdhci-acpi.c driver, which will rely on platform bus to match device and driver, where we will set 'dev' of struct platform_device as map_sg parameter passing to iommu driver for DMA request, so the iommu-ops are needed on the platform bus.

---
changes from v1: Add comment why the iommu-ops are needed on platform bus.

---
 drivers/iommu/amd_iommu.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/iommu/amd_iommu.c +4 -0
index c430c10..547cdd4 100644
@@ -21,6 +21,7 @@
 #include <linux/pci.h>
 #include <linux/acpi.h>
 #include <linux/amba/bus.h>
+#include <linux/platform_device.h>
 #include <linux/pci-ats.h>
 #include <linux/bitmap.h>
 #include <linux/slab.h>
@@ -2980,6 +2981,9 @@ int __init amd_iommu_init_api(void)
 	if (err)
 		return err;
 #endif
+	err = bus_set_iommu(&platform_bus_type, &amd_iommu_ops);
+	if (err)
+		return err;
 	return 0;
 }
 
Signature · 1 line
1.9.1
#1 lore raw

2016-05-10 21:21 GMT+08:00 Wan Zongshun <[email protected]>:

Quoted 10 lines

From: Wan Zongshun <[email protected]>

AMD has more drivers will use ACPI to platform bus driver later, all those devices need iommu support, for example: eMMC driver.

For latest AMD eMMC controller, it will utilize sdhci-acpi.c driver, which will rely on platform bus to match device and driver, where we will set 'dev' of struct platform_device as map_sg parameter passing to iommu driver for DMA request, so the iommu-ops are needed on the platform bus.

Joerg,

How about this patch? it will impact our new eMMC controller driver bringup.

Thanks.

Quoted 34 lines

---
changes from v1: Add comment why the iommu-ops are needed on platform bus.

---
 drivers/iommu/amd_iommu.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/iommu/amd_iommu.c +4 -1
index c430c10..547cdd4 100644
@@ -21,6 +21,7 @@
 #include <linux/pci.h>
 #include <linux/acpi.h>
 #include <linux/amba/bus.h>
+#include <linux/platform_device.h>
 #include <linux/pci-ats.h>
 #include <linux/bitmap.h>
 #include <linux/slab.h>
@@ -2980,6 +2981,9 @@ int __init amd_iommu_init_api(void)
        if (err)
                return err;
 #endif
+       err = bus_set_iommu(&platform_bus_type, &amd_iommu_ops);
+       if (err)
+               return err;
        return 0;
 }
 
--

1.9.1

Signature · 3 lines
---
Vincent Wan(Zongshun)
www.mcuos.com
maintainer Applied
#2 lore raw
In reply to Wan Zongshun
Quoted 5 lines · Wan Zongshun

From: Wan Zongshun <[email protected]>

AMD has more drivers will use ACPI to platform bus driver later, all those devices need iommu support, for example: eMMC driver.

Quoted 7 lines

For latest AMD eMMC controller, it will utilize sdhci-acpi.c driver, which will rely on platform bus to match device and driver, where we will set 'dev' of struct platform_device as map_sg parameter passing to iommu driver for DMA request, so the iommu-ops are needed on the platform bus.

Applied, thanks.