aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-20 13:07:25 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-20 13:07:25 -0500
commit787314c35fbb97e02823a1b8eb8cfa58f366cd49 (patch)
tree3fe5a484c1846c80361217a726997484533e8344 /arch
parent6491d4d02893d9787ba67279595990217177b351 (diff)
parent9c6ecf6a3ade2dc4b03a239af68058b22897af41 (diff)
Merge tag 'iommu-updates-v3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu
Pull IOMMU updates from Joerg Roedel: "A few new features this merge-window. The most important one is probably, that dma-debug now warns if a dma-handle is not checked with dma_mapping_error by the device driver. This requires minor changes to some architectures which make use of dma-debug. Most of these changes have the respective Acks by the Arch-Maintainers. Besides that there are updates to the AMD IOMMU driver for refactor the IOMMU-Groups support and to make sure it does not trigger a hardware erratum. The OMAP changes (for which I pulled in a branch from Tony Lindgren's tree) have a conflict in linux-next with the arm-soc tree. The conflict is in the file arch/arm/mach-omap2/clock44xx_data.c which is deleted in the arm-soc tree. It is safe to delete the file too so solve the conflict. Similar changes are done in the arm-soc tree in the common clock framework migration. A missing hunk from the patch in the IOMMU tree will be submitted as a seperate patch when the merge-window is closed." * tag 'iommu-updates-v3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (29 commits) ARM: dma-mapping: support debug_dma_mapping_error ARM: OMAP4: hwmod data: ipu and dsp to use parent clocks instead of leaf clocks iommu/omap: Adapt to runtime pm iommu/omap: Migrate to hwmod framework iommu/omap: Keep mmu enabled when requested iommu/omap: Remove redundant clock handling on ISR iommu/amd: Remove obsolete comment iommu/amd: Don't use 512GB pages iommu/tegra: smmu: Move bus_set_iommu after probe for multi arch iommu/tegra: gart: Move bus_set_iommu after probe for multi arch iommu/tegra: smmu: Remove unnecessary PTC/TLB flush all tile: dma_debug: add debug_dma_mapping_error support sh: dma_debug: add debug_dma_mapping_error support powerpc: dma_debug: add debug_dma_mapping_error support mips: dma_debug: add debug_dma_mapping_error support microblaze: dma-mapping: support debug_dma_mapping_error ia64: dma_debug: add debug_dma_mapping_error support c6x: dma_debug: add debug_dma_mapping_error support ARM64: dma_debug: add debug_dma_mapping_error support intel-iommu: Prevent devices with RMRRs from being placed into SI Domain ...
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/include/asm/dma-mapping.h1
-rw-r--r--arch/arm/mach-omap2/devices.c2
-rw-r--r--arch/arm/mach-omap2/omap-iommu.c167
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c4
-rw-r--r--arch/arm64/include/asm/dma-mapping.h1
-rw-r--r--arch/c6x/include/asm/dma-mapping.h1
-rw-r--r--arch/ia64/include/asm/dma-mapping.h1
-rw-r--r--arch/microblaze/include/asm/dma-mapping.h2
-rw-r--r--arch/mips/include/asm/dma-mapping.h2
-rw-r--r--arch/powerpc/include/asm/dma-mapping.h1
-rw-r--r--arch/sh/include/asm/dma-mapping.h1
-rw-r--r--arch/sparc/include/asm/dma-mapping.h1
-rw-r--r--arch/tile/include/asm/dma-mapping.h1
-rw-r--r--arch/x86/include/asm/dma-mapping.h1
14 files changed, 53 insertions, 133 deletions
diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
index 67d06324e74a..5b579b951503 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -91,6 +91,7 @@ static inline dma_addr_t virt_to_dma(struct device *dev, void *addr)
91 */ 91 */
92static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) 92static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
93{ 93{
94 debug_dma_mapping_error(dev, dma_addr);
94 return dma_addr == DMA_ERROR_CODE; 95 return dma_addr == DMA_ERROR_CODE;
95} 96}
96 97
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 4abb8b5e9bc0..5e304d0719a2 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -226,7 +226,7 @@ static struct platform_device omap3isp_device = {
226}; 226};
227 227
228static struct omap_iommu_arch_data omap3_isp_iommu = { 228static struct omap_iommu_arch_data omap3_isp_iommu = {
229 .name = "isp", 229 .name = "mmu_isp",
230}; 230};
231 231
232int omap3_init_camera(struct isp_platform_data *pdata) 232int omap3_init_camera(struct isp_platform_data *pdata)
diff --git a/arch/arm/mach-omap2/omap-iommu.c b/arch/arm/mach-omap2/omap-iommu.c
index a6a4ff8744b7..7642fc4672c1 100644
--- a/arch/arm/mach-omap2/omap-iommu.c
+++ b/arch/arm/mach-omap2/omap-iommu.c
@@ -12,153 +12,60 @@
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/err.h>
16#include <linux/slab.h>
15 17
16#include <linux/platform_data/iommu-omap.h> 18#include <linux/platform_data/iommu-omap.h>
19#include <plat/omap_hwmod.h>
20#include <plat/omap_device.h>
17 21
18#include "soc.h" 22static int __init omap_iommu_dev_init(struct omap_hwmod *oh, void *unused)
19#include "common.h"
20
21struct iommu_device {
22 resource_size_t base;
23 int irq;
24 struct iommu_platform_data pdata;
25 struct resource res[2];
26};
27static struct iommu_device *devices;
28static int num_iommu_devices;
29
30#ifdef CONFIG_ARCH_OMAP3
31static struct iommu_device omap3_devices[] = {
32 {
33 .base = 0x480bd400,
34 .irq = 24 + OMAP_INTC_START,
35 .pdata = {
36 .name = "isp",
37 .nr_tlb_entries = 8,
38 .clk_name = "cam_ick",
39 .da_start = 0x0,
40 .da_end = 0xFFFFF000,
41 },
42 },
43#if defined(CONFIG_OMAP_IOMMU_IVA2)
44 {
45 .base = 0x5d000000,
46 .irq = 28 + OMAP_INTC_START,
47 .pdata = {
48 .name = "iva2",
49 .nr_tlb_entries = 32,
50 .clk_name = "iva2_ck",
51 .da_start = 0x11000000,
52 .da_end = 0xFFFFF000,
53 },
54 },
55#endif
56};
57#define NR_OMAP3_IOMMU_DEVICES ARRAY_SIZE(omap3_devices)
58static struct platform_device *omap3_iommu_pdev[NR_OMAP3_IOMMU_DEVICES];
59#else
60#define omap3_devices NULL
61#define NR_OMAP3_IOMMU_DEVICES 0
62#define omap3_iommu_pdev NULL
63#endif
64
65#ifdef CONFIG_ARCH_OMAP4
66static struct iommu_device omap4_devices[] = {
67 {
68 .base = OMAP4_MMU1_BASE,
69 .irq = 100 + OMAP44XX_IRQ_GIC_START,
70 .pdata = {
71 .name = "ducati",
72 .nr_tlb_entries = 32,
73 .clk_name = "ipu_fck",
74 .da_start = 0x0,
75 .da_end = 0xFFFFF000,
76 },
77 },
78 {
79 .base = OMAP4_MMU2_BASE,
80 .irq = 28 + OMAP44XX_IRQ_GIC_START,
81 .pdata = {
82 .name = "tesla",
83 .nr_tlb_entries = 32,
84 .clk_name = "dsp_fck",
85 .da_start = 0x0,
86 .da_end = 0xFFFFF000,
87 },
88 },
89};
90#define NR_OMAP4_IOMMU_DEVICES ARRAY_SIZE(omap4_devices)
91static struct platform_device *omap4_iommu_pdev[NR_OMAP4_IOMMU_DEVICES];
92#else
93#define omap4_devices NULL
94#define NR_OMAP4_IOMMU_DEVICES 0
95#define omap4_iommu_pdev NULL
96#endif
97
98static struct platform_device **omap_iommu_pdev;
99
100static int __init omap_iommu_init(void)
101{ 23{
102 int i, err; 24 struct platform_device *pdev;
103 struct resource res[] = { 25 struct iommu_platform_data *pdata;
104 { .flags = IORESOURCE_MEM }, 26 struct omap_mmu_dev_attr *a = (struct omap_mmu_dev_attr *)oh->dev_attr;
105 { .flags = IORESOURCE_IRQ }, 27 static int i;
106 }; 28
29 pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
30 if (!pdata)
31 return -ENOMEM;
32
33 pdata->name = oh->name;
34 pdata->nr_tlb_entries = a->nr_tlb_entries;
35 pdata->da_start = a->da_start;
36 pdata->da_end = a->da_end;
37
38 if (oh->rst_lines_cnt == 1) {
39 pdata->reset_name = oh->rst_lines->name;
40 pdata->assert_reset = omap_device_assert_hardreset;
41 pdata->deassert_reset = omap_device_deassert_hardreset;
42 }
107 43
108 if (cpu_is_omap34xx()) { 44 pdev = omap_device_build("omap-iommu", i, oh, pdata, sizeof(*pdata),
109 devices = omap3_devices; 45 NULL, 0, 0);
110 omap_iommu_pdev = omap3_iommu_pdev;
111 num_iommu_devices = NR_OMAP3_IOMMU_DEVICES;
112 } else if (cpu_is_omap44xx()) {
113 devices = omap4_devices;
114 omap_iommu_pdev = omap4_iommu_pdev;
115 num_iommu_devices = NR_OMAP4_IOMMU_DEVICES;
116 } else
117 return -ENODEV;
118 46
119 for (i = 0; i < num_iommu_devices; i++) { 47 kfree(pdata);
120 struct platform_device *pdev;
121 const struct iommu_device *d = &devices[i];
122 48
123 pdev = platform_device_alloc("omap-iommu", i); 49 if (IS_ERR(pdev)) {
124 if (!pdev) { 50 pr_err("%s: device build err: %ld\n", __func__, PTR_ERR(pdev));
125 err = -ENOMEM; 51 return PTR_ERR(pdev);
126 goto err_out; 52 }
127 }
128 53
129 res[0].start = d->base; 54 i++;
130 res[0].end = d->base + MMU_REG_SIZE - 1;
131 res[1].start = res[1].end = d->irq;
132 55
133 err = platform_device_add_resources(pdev, res,
134 ARRAY_SIZE(res));
135 if (err)
136 goto err_out;
137 err = platform_device_add_data(pdev, &d->pdata,
138 sizeof(d->pdata));
139 if (err)
140 goto err_out;
141 err = platform_device_add(pdev);
142 if (err)
143 goto err_out;
144 omap_iommu_pdev[i] = pdev;
145 }
146 return 0; 56 return 0;
57}
147 58
148err_out: 59static int __init omap_iommu_init(void)
149 while (i--) 60{
150 platform_device_put(omap_iommu_pdev[i]); 61 return omap_hwmod_for_each_by_class("mmu", omap_iommu_dev_init, NULL);
151 return err;
152} 62}
153/* must be ready before omap3isp is probed */ 63/* must be ready before omap3isp is probed */
154subsys_initcall(omap_iommu_init); 64subsys_initcall(omap_iommu_init);
155 65
156static void __exit omap_iommu_exit(void) 66static void __exit omap_iommu_exit(void)
157{ 67{
158 int i; 68 /* Do nothing */
159
160 for (i = 0; i < num_iommu_devices; i++)
161 platform_device_unregister(omap_iommu_pdev[i]);
162} 69}
163module_exit(omap_iommu_exit); 70module_exit(omap_iommu_exit);
164 71
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 272b0178dba6..f9fab942d5ba 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -653,7 +653,7 @@ static struct omap_hwmod omap44xx_dsp_hwmod = {
653 .mpu_irqs = omap44xx_dsp_irqs, 653 .mpu_irqs = omap44xx_dsp_irqs,
654 .rst_lines = omap44xx_dsp_resets, 654 .rst_lines = omap44xx_dsp_resets,
655 .rst_lines_cnt = ARRAY_SIZE(omap44xx_dsp_resets), 655 .rst_lines_cnt = ARRAY_SIZE(omap44xx_dsp_resets),
656 .main_clk = "dsp_fck", 656 .main_clk = "dpll_iva_m4x2_ck",
657 .prcm = { 657 .prcm = {
658 .omap4 = { 658 .omap4 = {
659 .clkctrl_offs = OMAP4_CM_TESLA_TESLA_CLKCTRL_OFFSET, 659 .clkctrl_offs = OMAP4_CM_TESLA_TESLA_CLKCTRL_OFFSET,
@@ -1679,7 +1679,7 @@ static struct omap_hwmod omap44xx_ipu_hwmod = {
1679 .mpu_irqs = omap44xx_ipu_irqs, 1679 .mpu_irqs = omap44xx_ipu_irqs,
1680 .rst_lines = omap44xx_ipu_resets, 1680 .rst_lines = omap44xx_ipu_resets,
1681 .rst_lines_cnt = ARRAY_SIZE(omap44xx_ipu_resets), 1681 .rst_lines_cnt = ARRAY_SIZE(omap44xx_ipu_resets),
1682 .main_clk = "ipu_fck", 1682 .main_clk = "ducati_clk_mux_ck",
1683 .prcm = { 1683 .prcm = {
1684 .omap4 = { 1684 .omap4 = {
1685 .clkctrl_offs = OMAP4_CM_DUCATI_DUCATI_CLKCTRL_OFFSET, 1685 .clkctrl_offs = OMAP4_CM_DUCATI_DUCATI_CLKCTRL_OFFSET,
diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h
index 538f4b44db5d..994776894198 100644
--- a/arch/arm64/include/asm/dma-mapping.h
+++ b/arch/arm64/include/asm/dma-mapping.h
@@ -50,6 +50,7 @@ static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t dev_addr)
50static inline int dma_mapping_error(struct device *dev, dma_addr_t dev_addr) 50static inline int dma_mapping_error(struct device *dev, dma_addr_t dev_addr)
51{ 51{
52 struct dma_map_ops *ops = get_dma_ops(dev); 52 struct dma_map_ops *ops = get_dma_ops(dev);
53 debug_dma_mapping_error(dev, dev_addr);
53 return ops->mapping_error(dev, dev_addr); 54 return ops->mapping_error(dev, dev_addr);
54} 55}
55 56
diff --git a/arch/c6x/include/asm/dma-mapping.h b/arch/c6x/include/asm/dma-mapping.h
index 03579fd99dba..3c694065030f 100644
--- a/arch/c6x/include/asm/dma-mapping.h
+++ b/arch/c6x/include/asm/dma-mapping.h
@@ -32,6 +32,7 @@ static inline int dma_set_mask(struct device *dev, u64 dma_mask)
32 */ 32 */
33static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) 33static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
34{ 34{
35 debug_dma_mapping_error(dev, dma_addr);
35 return dma_addr == ~0; 36 return dma_addr == ~0;
36} 37}
37 38
diff --git a/arch/ia64/include/asm/dma-mapping.h b/arch/ia64/include/asm/dma-mapping.h
index 4f5e8148440d..cf3ab7e784b5 100644
--- a/arch/ia64/include/asm/dma-mapping.h
+++ b/arch/ia64/include/asm/dma-mapping.h
@@ -58,6 +58,7 @@ static inline void dma_free_attrs(struct device *dev, size_t size,
58static inline int dma_mapping_error(struct device *dev, dma_addr_t daddr) 58static inline int dma_mapping_error(struct device *dev, dma_addr_t daddr)
59{ 59{
60 struct dma_map_ops *ops = platform_dma_get_ops(dev); 60 struct dma_map_ops *ops = platform_dma_get_ops(dev);
61 debug_dma_mapping_error(dev, daddr);
61 return ops->mapping_error(dev, daddr); 62 return ops->mapping_error(dev, daddr);
62} 63}
63 64
diff --git a/arch/microblaze/include/asm/dma-mapping.h b/arch/microblaze/include/asm/dma-mapping.h
index 01d228286cb0..46460f1c49c4 100644
--- a/arch/microblaze/include/asm/dma-mapping.h
+++ b/arch/microblaze/include/asm/dma-mapping.h
@@ -114,6 +114,8 @@ static inline void __dma_sync(unsigned long paddr,
114static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) 114static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
115{ 115{
116 struct dma_map_ops *ops = get_dma_ops(dev); 116 struct dma_map_ops *ops = get_dma_ops(dev);
117
118 debug_dma_mapping_error(dev, dma_addr);
117 if (ops->mapping_error) 119 if (ops->mapping_error)
118 return ops->mapping_error(dev, dma_addr); 120 return ops->mapping_error(dev, dma_addr);
119 121
diff --git a/arch/mips/include/asm/dma-mapping.h b/arch/mips/include/asm/dma-mapping.h
index be39a12901c6..006b43e38a9c 100644
--- a/arch/mips/include/asm/dma-mapping.h
+++ b/arch/mips/include/asm/dma-mapping.h
@@ -40,6 +40,8 @@ static inline int dma_supported(struct device *dev, u64 mask)
40static inline int dma_mapping_error(struct device *dev, u64 mask) 40static inline int dma_mapping_error(struct device *dev, u64 mask)
41{ 41{
42 struct dma_map_ops *ops = get_dma_ops(dev); 42 struct dma_map_ops *ops = get_dma_ops(dev);
43
44 debug_dma_mapping_error(dev, mask);
43 return ops->mapping_error(dev, mask); 45 return ops->mapping_error(dev, mask);
44} 46}
45 47
diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h
index 78160874809a..e27e9ad6818e 100644
--- a/arch/powerpc/include/asm/dma-mapping.h
+++ b/arch/powerpc/include/asm/dma-mapping.h
@@ -172,6 +172,7 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
172{ 172{
173 struct dma_map_ops *dma_ops = get_dma_ops(dev); 173 struct dma_map_ops *dma_ops = get_dma_ops(dev);
174 174
175 debug_dma_mapping_error(dev, dma_addr);
175 if (dma_ops->mapping_error) 176 if (dma_ops->mapping_error)
176 return dma_ops->mapping_error(dev, dma_addr); 177 return dma_ops->mapping_error(dev, dma_addr);
177 178
diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h
index 8bd965e00a15..b437f2c780b8 100644
--- a/arch/sh/include/asm/dma-mapping.h
+++ b/arch/sh/include/asm/dma-mapping.h
@@ -46,6 +46,7 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
46{ 46{
47 struct dma_map_ops *ops = get_dma_ops(dev); 47 struct dma_map_ops *ops = get_dma_ops(dev);
48 48
49 debug_dma_mapping_error(dev, dma_addr);
49 if (ops->mapping_error) 50 if (ops->mapping_error)
50 return ops->mapping_error(dev, dma_addr); 51 return ops->mapping_error(dev, dma_addr);
51 52
diff --git a/arch/sparc/include/asm/dma-mapping.h b/arch/sparc/include/asm/dma-mapping.h
index 8493fd3c7ba5..05fe53f5346e 100644
--- a/arch/sparc/include/asm/dma-mapping.h
+++ b/arch/sparc/include/asm/dma-mapping.h
@@ -59,6 +59,7 @@ static inline void dma_free_attrs(struct device *dev, size_t size,
59 59
60static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) 60static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
61{ 61{
62 debug_dma_mapping_error(dev, dma_addr);
62 return (dma_addr == DMA_ERROR_CODE); 63 return (dma_addr == DMA_ERROR_CODE);
63} 64}
64 65
diff --git a/arch/tile/include/asm/dma-mapping.h b/arch/tile/include/asm/dma-mapping.h
index 4b6247d1a315..f2ff191376b4 100644
--- a/arch/tile/include/asm/dma-mapping.h
+++ b/arch/tile/include/asm/dma-mapping.h
@@ -72,6 +72,7 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
72static inline int 72static inline int
73dma_mapping_error(struct device *dev, dma_addr_t dma_addr) 73dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
74{ 74{
75 debug_dma_mapping_error(dev, dma_addr);
75 return get_dma_ops(dev)->mapping_error(dev, dma_addr); 76 return get_dma_ops(dev)->mapping_error(dev, dma_addr);
76} 77}
77 78
diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h
index f7b4c7903e7e..808dae63eeea 100644
--- a/arch/x86/include/asm/dma-mapping.h
+++ b/arch/x86/include/asm/dma-mapping.h
@@ -47,6 +47,7 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)
47static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) 47static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
48{ 48{
49 struct dma_map_ops *ops = get_dma_ops(dev); 49 struct dma_map_ops *ops = get_dma_ops(dev);
50 debug_dma_mapping_error(dev, dma_addr);
50 if (ops->mapping_error) 51 if (ops->mapping_error)
51 return ops->mapping_error(dev, dma_addr); 52 return ops->mapping_error(dev, dma_addr);
52 53