Skip to content

Commit 15b28bb

Browse files
author
Christoph Hellwig
committed
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>
1 parent 325ef18 commit 15b28bb

17 files changed

Lines changed: 14 additions & 143 deletions

File tree

‎arch/arm/mm/dma-mapping-nommu.c‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -241,12 +241,3 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
241241
void arch_teardown_dma_ops(struct device *dev)
242242
{
243243
}
244-
245-
#define PREALLOC_DMA_DEBUG_ENTRIES 4096
246-
247-
static int __init dma_debug_do_init(void)
248-
{
249-
dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
250-
return 0;
251-
}
252-
core_initcall(dma_debug_do_init);

‎arch/arm/mm/dma-mapping.c‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,15 +1165,6 @@ int arm_dma_supported(struct device *dev, u64 mask)
11651165
return __dma_supported(dev, mask, false);
11661166
}
11671167

1168-
#define PREALLOC_DMA_DEBUG_ENTRIES 4096
1169-
1170-
static int __init dma_debug_do_init(void)
1171-
{
1172-
dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
1173-
return 0;
1174-
}
1175-
core_initcall(dma_debug_do_init);
1176-
11771168
#ifdef CONFIG_ARM_DMA_USE_IOMMU
11781169

11791170
static int __dma_info_to_prot(enum dma_data_direction dir, unsigned long attrs)

‎arch/arm64/mm/dma-mapping.c‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -508,16 +508,6 @@ static int __init arm64_dma_init(void)
508508
}
509509
arch_initcall(arm64_dma_init);
510510

511-
#define PREALLOC_DMA_DEBUG_ENTRIES 4096
512-
513-
static int __init dma_debug_do_init(void)
514-
{
515-
dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
516-
return 0;
517-
}
518-
fs_initcall(dma_debug_do_init);
519-
520-
521511
#ifdef CONFIG_IOMMU_DMA
522512
#include <linux/dma-iommu.h>
523513
#include <linux/platform_device.h>

‎arch/c6x/kernel/dma.c‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,3 @@ const struct dma_map_ops c6x_dma_ops = {
136136
.sync_sg_for_cpu = c6x_dma_sync_sg_for_cpu,
137137
};
138138
EXPORT_SYMBOL(c6x_dma_ops);
139-
140-
/* Number of entries preallocated for DMA-API debugging */
141-
#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
142-
143-
static int __init dma_init(void)
144-
{
145-
dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
146-
147-
return 0;
148-
}
149-
fs_initcall(dma_init);

‎arch/ia64/kernel/dma-mapping.c‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,6 @@ int iommu_detected __read_mostly;
99
const struct dma_map_ops *dma_ops;
1010
EXPORT_SYMBOL(dma_ops);
1111

12-
#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
13-
14-
static int __init dma_init(void)
15-
{
16-
dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
17-
18-
return 0;
19-
}
20-
fs_initcall(dma_init);
21-
2212
const struct dma_map_ops *dma_get_ops(struct device *dev)
2313
{
2414
return dma_ops;

‎arch/microblaze/kernel/dma.c‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,3 @@ const struct dma_map_ops dma_nommu_ops = {
184184
.sync_sg_for_device = dma_nommu_sync_sg_for_device,
185185
};
186186
EXPORT_SYMBOL(dma_nommu_ops);
187-
188-
/* Number of entries preallocated for DMA-API debugging */
189-
#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
190-
191-
static int __init dma_init(void)
192-
{
193-
dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
194-
195-
return 0;
196-
}
197-
fs_initcall(dma_init);

‎arch/mips/mm/dma-default.c‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -402,13 +402,3 @@ static const struct dma_map_ops mips_default_dma_map_ops = {
402402

403403
const struct dma_map_ops *mips_dma_map_ops = &mips_default_dma_map_ops;
404404
EXPORT_SYMBOL(mips_dma_map_ops);
405-
406-
#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
407-
408-
static int __init mips_dma_init(void)
409-
{
410-
dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
411-
412-
return 0;
413-
}
414-
fs_initcall(mips_dma_init);

‎arch/openrisc/kernel/dma.c‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -247,14 +247,3 @@ const struct dma_map_ops or1k_dma_map_ops = {
247247
.sync_single_for_device = or1k_sync_single_for_device,
248248
};
249249
EXPORT_SYMBOL(or1k_dma_map_ops);
250-
251-
/* Number of entries preallocated for DMA-API debugging */
252-
#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
253-
254-
static int __init dma_init(void)
255-
{
256-
dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
257-
258-
return 0;
259-
}
260-
fs_initcall(dma_init);

‎arch/powerpc/kernel/dma.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,6 @@ int dma_set_coherent_mask(struct device *dev, u64 mask)
309309
}
310310
EXPORT_SYMBOL(dma_set_coherent_mask);
311311

312-
#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
313-
314312
int dma_set_mask(struct device *dev, u64 dma_mask)
315313
{
316314
if (ppc_md.dma_set_mask)
@@ -361,7 +359,6 @@ EXPORT_SYMBOL_GPL(dma_get_required_mask);
361359

362360
static int __init dma_init(void)
363361
{
364-
dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
365362
#ifdef CONFIG_PCI
366363
dma_debug_add_bus(&pci_bus_type);
367364
#endif

‎arch/s390/pci/pci_dma.c‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -668,15 +668,6 @@ void zpci_dma_exit(void)
668668
kmem_cache_destroy(dma_region_table_cache);
669669
}
670670

671-
#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
672-
673-
static int __init dma_debug_do_init(void)
674-
{
675-
dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
676-
return 0;
677-
}
678-
fs_initcall(dma_debug_do_init);
679-
680671
const struct dma_map_ops s390_pci_dma_ops = {
681672
.alloc = s390_dma_alloc,
682673
.free = s390_dma_free,

0 commit comments

Comments
 (0)