aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2018-04-16 11:22:28 -0400
committerChristoph Hellwig <hch@lst.de>2018-05-08 07:02:42 -0400
commit15b28bbcd567a9199481ecfef39702b258f9baff (patch)
treedb5428916f2f231b602bad88b202ffc7540afd16 /arch
parent325ef1857fff8b2049322921e19421b6c5ad74e5 (diff)
dma-debug: move initialization to common code
Most mainstream architectures are using 65536 entries, so lets stick to that. If someone is really desperate to override it that can still be done through <asm/dma-mapping.h>, but I'd rather see a really good rationale for that. dma_debug_init is now called as a core_initcall, which for many architectures means much earlier, and provides dma-debug functionality earlier in the boot process. This should be safe as it only relies on the memory allocator already being available. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mm/dma-mapping-nommu.c9
-rw-r--r--arch/arm/mm/dma-mapping.c9
-rw-r--r--arch/arm64/mm/dma-mapping.c10
-rw-r--r--arch/c6x/kernel/dma.c11
-rw-r--r--arch/ia64/kernel/dma-mapping.c10
-rw-r--r--arch/microblaze/kernel/dma.c11
-rw-r--r--arch/mips/mm/dma-default.c10
-rw-r--r--arch/openrisc/kernel/dma.c11
-rw-r--r--arch/powerpc/kernel/dma.c3
-rw-r--r--arch/s390/pci/pci_dma.c9
-rw-r--r--arch/sh/mm/consistent.c9
-rw-r--r--arch/sparc/kernel/Makefile2
-rw-r--r--arch/sparc/kernel/dma.c13
-rw-r--r--arch/x86/kernel/pci-dma.c4
-rw-r--r--arch/xtensa/kernel/pci-dma.c9
15 files changed, 0 insertions, 130 deletions
diff --git a/arch/arm/mm/dma-mapping-nommu.c b/arch/arm/mm/dma-mapping-nommu.c
index 619f24a42d09..f448a0663b10 100644
--- a/arch/arm/mm/dma-mapping-nommu.c
+++ b/arch/arm/mm/dma-mapping-nommu.c
@@ -241,12 +241,3 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
241void arch_teardown_dma_ops(struct device *dev) 241void arch_teardown_dma_ops(struct device *dev)
242{ 242{
243} 243}
244
245#define PREALLOC_DMA_DEBUG_ENTRIES 4096
246
247static int __init dma_debug_do_init(void)
248{
249 dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
250 return 0;
251}
252core_initcall(dma_debug_do_init);
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 8c398fedbbb6..c26bf83f44ca 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -1165,15 +1165,6 @@ int arm_dma_supported(struct device *dev, u64 mask)
1165 return __dma_supported(dev, mask, false); 1165 return __dma_supported(dev, mask, false);
1166} 1166}
1167 1167
1168#define PREALLOC_DMA_DEBUG_ENTRIES 4096
1169
1170static int __init dma_debug_do_init(void)
1171{
1172 dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
1173 return 0;
1174}
1175core_initcall(dma_debug_do_init);
1176
1177#ifdef CONFIG_ARM_DMA_USE_IOMMU 1168#ifdef CONFIG_ARM_DMA_USE_IOMMU
1178 1169
1179static int __dma_info_to_prot(enum dma_data_direction dir, unsigned long attrs) 1170static int __dma_info_to_prot(enum dma_data_direction dir, unsigned long attrs)
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index a96ec0181818..db01f2709842 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -508,16 +508,6 @@ static int __init arm64_dma_init(void)
508} 508}
509arch_initcall(arm64_dma_init); 509arch_initcall(arm64_dma_init);
510 510
511#define PREALLOC_DMA_DEBUG_ENTRIES 4096
512
513static int __init dma_debug_do_init(void)
514{
515 dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
516 return 0;
517}
518fs_initcall(dma_debug_do_init);
519
520
521#ifdef CONFIG_IOMMU_DMA 511#ifdef CONFIG_IOMMU_DMA
522#include <linux/dma-iommu.h> 512#include <linux/dma-iommu.h>
523#include <linux/platform_device.h> 513#include <linux/platform_device.h>
diff --git a/arch/c6x/kernel/dma.c b/arch/c6x/kernel/dma.c
index 9fff8be75f58..31e1a9ec3a9c 100644
--- a/arch/c6x/kernel/dma.c
+++ b/arch/c6x/kernel/dma.c
@@ -136,14 +136,3 @@ const struct dma_map_ops c6x_dma_ops = {
136 .sync_sg_for_cpu = c6x_dma_sync_sg_for_cpu, 136 .sync_sg_for_cpu = c6x_dma_sync_sg_for_cpu,
137}; 137};
138EXPORT_SYMBOL(c6x_dma_ops); 138EXPORT_SYMBOL(c6x_dma_ops);
139
140/* Number of entries preallocated for DMA-API debugging */
141#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
142
143static int __init dma_init(void)
144{
145 dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
146
147 return 0;
148}
149fs_initcall(dma_init);
diff --git a/arch/ia64/kernel/dma-mapping.c b/arch/ia64/kernel/dma-mapping.c
index f2d57e66fd86..7a471d8d67d4 100644
--- a/arch/ia64/kernel/dma-mapping.c
+++ b/arch/ia64/kernel/dma-mapping.c
@@ -9,16 +9,6 @@ int iommu_detected __read_mostly;
9const struct dma_map_ops *dma_ops; 9const struct dma_map_ops *dma_ops;
10EXPORT_SYMBOL(dma_ops); 10EXPORT_SYMBOL(dma_ops);
11 11
12#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
13
14static int __init dma_init(void)
15{
16 dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
17
18 return 0;
19}
20fs_initcall(dma_init);
21
22const struct dma_map_ops *dma_get_ops(struct device *dev) 12const struct dma_map_ops *dma_get_ops(struct device *dev)
23{ 13{
24 return dma_ops; 14 return dma_ops;
diff --git a/arch/microblaze/kernel/dma.c b/arch/microblaze/kernel/dma.c
index c91e8cef98dd..3145e7dc8ab1 100644
--- a/arch/microblaze/kernel/dma.c
+++ b/arch/microblaze/kernel/dma.c
@@ -184,14 +184,3 @@ const struct dma_map_ops dma_nommu_ops = {
184 .sync_sg_for_device = dma_nommu_sync_sg_for_device, 184 .sync_sg_for_device = dma_nommu_sync_sg_for_device,
185}; 185};
186EXPORT_SYMBOL(dma_nommu_ops); 186EXPORT_SYMBOL(dma_nommu_ops);
187
188/* Number of entries preallocated for DMA-API debugging */
189#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
190
191static int __init dma_init(void)
192{
193 dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
194
195 return 0;
196}
197fs_initcall(dma_init);
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index dcafa43613b6..f9fef0028ca2 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -402,13 +402,3 @@ static const struct dma_map_ops mips_default_dma_map_ops = {
402 402
403const struct dma_map_ops *mips_dma_map_ops = &mips_default_dma_map_ops; 403const struct dma_map_ops *mips_dma_map_ops = &mips_default_dma_map_ops;
404EXPORT_SYMBOL(mips_dma_map_ops); 404EXPORT_SYMBOL(mips_dma_map_ops);
405
406#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
407
408static int __init mips_dma_init(void)
409{
410 dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
411
412 return 0;
413}
414fs_initcall(mips_dma_init);
diff --git a/arch/openrisc/kernel/dma.c b/arch/openrisc/kernel/dma.c
index a945f00011b4..ec7fd45704d2 100644
--- a/arch/openrisc/kernel/dma.c
+++ b/arch/openrisc/kernel/dma.c
@@ -247,14 +247,3 @@ const struct dma_map_ops or1k_dma_map_ops = {
247 .sync_single_for_device = or1k_sync_single_for_device, 247 .sync_single_for_device = or1k_sync_single_for_device,
248}; 248};
249EXPORT_SYMBOL(or1k_dma_map_ops); 249EXPORT_SYMBOL(or1k_dma_map_ops);
250
251/* Number of entries preallocated for DMA-API debugging */
252#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
253
254static int __init dma_init(void)
255{
256 dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
257
258 return 0;
259}
260fs_initcall(dma_init);
diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c
index da20569de9d4..138157deeadf 100644
--- a/arch/powerpc/kernel/dma.c
+++ b/arch/powerpc/kernel/dma.c
@@ -309,8 +309,6 @@ int dma_set_coherent_mask(struct device *dev, u64 mask)
309} 309}
310EXPORT_SYMBOL(dma_set_coherent_mask); 310EXPORT_SYMBOL(dma_set_coherent_mask);
311 311
312#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
313
314int dma_set_mask(struct device *dev, u64 dma_mask) 312int dma_set_mask(struct device *dev, u64 dma_mask)
315{ 313{
316 if (ppc_md.dma_set_mask) 314 if (ppc_md.dma_set_mask)
@@ -361,7 +359,6 @@ EXPORT_SYMBOL_GPL(dma_get_required_mask);
361 359
362static int __init dma_init(void) 360static int __init dma_init(void)
363{ 361{
364 dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
365#ifdef CONFIG_PCI 362#ifdef CONFIG_PCI
366 dma_debug_add_bus(&pci_bus_type); 363 dma_debug_add_bus(&pci_bus_type);
367#endif 364#endif
diff --git a/arch/s390/pci/pci_dma.c b/arch/s390/pci/pci_dma.c
index 10abf5ed6187..d387a0fbdd7e 100644
--- a/arch/s390/pci/pci_dma.c
+++ b/arch/s390/pci/pci_dma.c
@@ -668,15 +668,6 @@ void zpci_dma_exit(void)
668 kmem_cache_destroy(dma_region_table_cache); 668 kmem_cache_destroy(dma_region_table_cache);
669} 669}
670 670
671#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
672
673static int __init dma_debug_do_init(void)
674{
675 dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
676 return 0;
677}
678fs_initcall(dma_debug_do_init);
679
680const struct dma_map_ops s390_pci_dma_ops = { 671const struct dma_map_ops s390_pci_dma_ops = {
681 .alloc = s390_dma_alloc, 672 .alloc = s390_dma_alloc,
682 .free = s390_dma_free, 673 .free = s390_dma_free,
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index 8ce98691d822..35ea3099a3b6 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -20,18 +20,9 @@
20#include <asm/cacheflush.h> 20#include <asm/cacheflush.h>
21#include <asm/addrspace.h> 21#include <asm/addrspace.h>
22 22
23#define PREALLOC_DMA_DEBUG_ENTRIES 4096
24
25const struct dma_map_ops *dma_ops; 23const struct dma_map_ops *dma_ops;
26EXPORT_SYMBOL(dma_ops); 24EXPORT_SYMBOL(dma_ops);
27 25
28static int __init dma_init(void)
29{
30 dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
31 return 0;
32}
33fs_initcall(dma_init);
34
35void *dma_generic_alloc_coherent(struct device *dev, size_t size, 26void *dma_generic_alloc_coherent(struct device *dev, size_t size,
36 dma_addr_t *dma_handle, gfp_t gfp, 27 dma_addr_t *dma_handle, gfp_t gfp,
37 unsigned long attrs) 28 unsigned long attrs)
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index 76cb57750dda..84cfc5a428d6 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -74,8 +74,6 @@ obj-$(CONFIG_SPARC64) += pcr.o
74obj-$(CONFIG_SPARC64) += nmi.o 74obj-$(CONFIG_SPARC64) += nmi.o
75obj-$(CONFIG_SPARC64_SMP) += cpumap.o 75obj-$(CONFIG_SPARC64_SMP) += cpumap.o
76 76
77obj-y += dma.o
78
79obj-$(CONFIG_PCIC_PCI) += pcic.o 77obj-$(CONFIG_PCIC_PCI) += pcic.o
80obj-$(CONFIG_LEON_PCI) += leon_pci.o 78obj-$(CONFIG_LEON_PCI) += leon_pci.o
81obj-$(CONFIG_SPARC_GRPCI2)+= leon_pci_grpci2.o 79obj-$(CONFIG_SPARC_GRPCI2)+= leon_pci_grpci2.o
diff --git a/arch/sparc/kernel/dma.c b/arch/sparc/kernel/dma.c
deleted file mode 100644
index f73e7597c971..000000000000
--- a/arch/sparc/kernel/dma.c
+++ /dev/null
@@ -1,13 +0,0 @@
1// SPDX-License-Identifier: GPL-2.0
2#include <linux/kernel.h>
3#include <linux/dma-mapping.h>
4#include <linux/dma-debug.h>
5
6#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 15)
7
8static int __init dma_init(void)
9{
10 dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
11 return 0;
12}
13fs_initcall(dma_init);
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 77625b60a510..bcbaa2e8031e 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -55,9 +55,6 @@ struct device x86_dma_fallback_dev = {
55}; 55};
56EXPORT_SYMBOL(x86_dma_fallback_dev); 56EXPORT_SYMBOL(x86_dma_fallback_dev);
57 57
58/* Number of entries preallocated for DMA-API debugging */
59#define PREALLOC_DMA_DEBUG_ENTRIES 65536
60
61void __init pci_iommu_alloc(void) 58void __init pci_iommu_alloc(void)
62{ 59{
63 struct iommu_table_entry *p; 60 struct iommu_table_entry *p;
@@ -189,7 +186,6 @@ EXPORT_SYMBOL(arch_dma_supported);
189static int __init pci_iommu_init(void) 186static int __init pci_iommu_init(void)
190{ 187{
191 struct iommu_table_entry *p; 188 struct iommu_table_entry *p;
192 dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
193 189
194#ifdef CONFIG_PCI 190#ifdef CONFIG_PCI
195 dma_debug_add_bus(&pci_bus_type); 191 dma_debug_add_bus(&pci_bus_type);
diff --git a/arch/xtensa/kernel/pci-dma.c b/arch/xtensa/kernel/pci-dma.c
index 732631ce250f..392b4a80ebc2 100644
--- a/arch/xtensa/kernel/pci-dma.c
+++ b/arch/xtensa/kernel/pci-dma.c
@@ -261,12 +261,3 @@ const struct dma_map_ops xtensa_dma_map_ops = {
261 .mapping_error = xtensa_dma_mapping_error, 261 .mapping_error = xtensa_dma_mapping_error,
262}; 262};
263EXPORT_SYMBOL(xtensa_dma_map_ops); 263EXPORT_SYMBOL(xtensa_dma_map_ops);
264
265#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
266
267static int __init xtensa_dma_init(void)
268{
269 dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
270 return 0;
271}
272fs_initcall(xtensa_dma_init);