Skip to content

Commit be20902

Browse files
author
Russell King
committed
ARM: use ARM_DMA_ZONE_SIZE to adjust the zone sizes
Rather than each platform providing its own function to adjust the zone sizes, use the new ARM_DMA_ZONE_SIZE definition to perform this adjustment. This ensures that the actual DMA zone size and the ISA_DMA_THRESHOLD/MAX_DMA_ADDRESS definitions are consistent with each other, and moves this complexity out of the platform code. Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
1 parent 2fb3ec5 commit be20902

12 files changed

Lines changed: 25 additions & 144 deletions

File tree

‎arch/arm/common/sa1111.c‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,6 @@ static struct sa1111_dev_info sa1111_devices[] = {
185185
},
186186
};
187187

188-
void __init sa1111_adjust_zones(unsigned long *size, unsigned long *holes)
189-
{
190-
unsigned int sz = SZ_1M >> PAGE_SHIFT;
191-
192-
size[1] = size[0] - sz;
193-
size[0] = sz;
194-
}
195-
196188
/*
197189
* SA1111 interrupt support. Since clearing an IRQ while there are
198190
* active IRQs causes the interrupt output to pulse, the upper levels

‎arch/arm/include/asm/memory.h‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,6 @@ static inline unsigned long __phys_to_virt(unsigned long x)
215215
#define ISA_DMA_THRESHOLD (PHYS_OFFSET + ARM_DMA_ZONE_SIZE - 1)
216216
#endif
217217

218-
#ifndef arch_adjust_zones
219-
#define arch_adjust_zones(size,holes) do { } while (0)
220-
#elif !defined(CONFIG_ZONE_DMA)
221-
#error "custom arch_adjust_zones() requires CONFIG_ZONE_DMA"
222-
#endif
223-
224218
/*
225219
* PFNs are used to describe any physical page; this means
226220
* PFN 0 == physical address 0.

‎arch/arm/mach-davinci/include/mach/memory.h‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,26 +41,11 @@
4141
*/
4242
#define CONSISTENT_DMA_SIZE (14<<20)
4343

44-
#ifndef __ASSEMBLY__
4544
/*
4645
* Restrict DMA-able region to workaround silicon bug. The bug
4746
* restricts buffers available for DMA to video hardware to be
4847
* below 128M
4948
*/
50-
static inline void
51-
__arch_adjust_zones(unsigned long *size, unsigned long *holes)
52-
{
53-
unsigned int sz = (128<<20) >> PAGE_SHIFT;
54-
55-
size[1] = size[0] - sz;
56-
size[0] = sz;
57-
}
58-
59-
#define arch_adjust_zones(zone_size, holes) \
60-
if ((meminfo.bank[0].size >> 20) > 128) __arch_adjust_zones(zone_size, holes)
61-
6249
#define ARM_DMA_ZONE_SIZE SZ_128M
6350

64-
#endif
65-
6651
#endif /* __ASM_ARCH_MEMORY_H */

‎arch/arm/mach-ixp4xx/common-pci.c‎

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -342,29 +342,6 @@ int dma_needs_bounce(struct device *dev, dma_addr_t dma_addr, size_t size)
342342
return (dev->bus == &pci_bus_type ) && ((dma_addr + size) >= SZ_64M);
343343
}
344344

345-
/*
346-
* Only first 64MB of memory can be accessed via PCI.
347-
* We use GFP_DMA to allocate safe buffers to do map/unmap.
348-
* This is really ugly and we need a better way of specifying
349-
* DMA-capable regions of memory.
350-
*/
351-
void __init ixp4xx_adjust_zones(unsigned long *zone_size,
352-
unsigned long *zhole_size)
353-
{
354-
unsigned int sz = SZ_64M >> PAGE_SHIFT;
355-
356-
/*
357-
* Only adjust if > 64M on current system
358-
*/
359-
if (zone_size[0] <= sz)
360-
return;
361-
362-
zone_size[1] = zone_size[0] - sz;
363-
zone_size[0] = sz;
364-
zhole_size[1] = zhole_size[0];
365-
zhole_size[0] = 0;
366-
}
367-
368345
void __init ixp4xx_pci_preinit(void)
369346
{
370347
unsigned long cpuid = read_cpuid_id();

‎arch/arm/mach-ixp4xx/include/mach/memory.h‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,8 @@
1414
*/
1515
#define PLAT_PHYS_OFFSET UL(0x00000000)
1616

17-
#if !defined(__ASSEMBLY__) && defined(CONFIG_PCI)
18-
19-
void ixp4xx_adjust_zones(unsigned long *size, unsigned long *holes);
20-
21-
#define arch_adjust_zones(size, holes) \
22-
ixp4xx_adjust_zones(size, holes)
23-
17+
#ifdef CONFIG_PCI
2418
#define ARM_DMA_ZONE_SIZE SZ_64M
25-
2619
#endif
2720

2821
#endif

‎arch/arm/mach-pxa/cm-x2xx-pci.c‎

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -29,33 +29,6 @@
2929
unsigned long it8152_base_address;
3030
static int cmx2xx_it8152_irq_gpio;
3131

32-
/*
33-
* Only first 64MB of memory can be accessed via PCI.
34-
* We use GFP_DMA to allocate safe buffers to do map/unmap.
35-
* This is really ugly and we need a better way of specifying
36-
* DMA-capable regions of memory.
37-
*/
38-
void __init cmx2xx_pci_adjust_zones(unsigned long *zone_size,
39-
unsigned long *zhole_size)
40-
{
41-
unsigned int sz = SZ_64M >> PAGE_SHIFT;
42-
43-
if (machine_is_armcore()) {
44-
pr_info("Adjusting zones for CM-X2XX\n");
45-
46-
/*
47-
* Only adjust if > 64M on current system
48-
*/
49-
if (zone_size[0] <= sz)
50-
return;
51-
52-
zone_size[1] = zone_size[0] - sz;
53-
zone_size[0] = sz;
54-
zhole_size[1] = zhole_size[0];
55-
zhole_size[0] = 0;
56-
}
57-
}
58-
5932
static void cmx2xx_it8152_irq_demux(unsigned int irq, struct irq_desc *desc)
6033
{
6134
/* clear our parent irq */

‎arch/arm/mach-pxa/include/mach/memory.h‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,7 @@
1717
*/
1818
#define PLAT_PHYS_OFFSET UL(0xa0000000)
1919

20-
#if !defined(__ASSEMBLY__) && defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI)
21-
void cmx2xx_pci_adjust_zones(unsigned long *size, unsigned long *holes);
22-
23-
#define arch_adjust_zones(size, holes) \
24-
cmx2xx_pci_adjust_zones(size, holes)
25-
20+
#if defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI)
2621
#define ARM_DMA_ZONE_SIZE SZ_64M
2722
#endif
2823

‎arch/arm/mach-realview/core.c‎

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -56,25 +56,6 @@
5656

5757
#include "core.h"
5858

59-
#ifdef CONFIG_ZONE_DMA
60-
/*
61-
* Adjust the zones if there are restrictions for DMA access.
62-
*/
63-
void __init realview_adjust_zones(unsigned long *size, unsigned long *hole)
64-
{
65-
unsigned long dma_size = SZ_256M >> PAGE_SHIFT;
66-
67-
if (!machine_is_realview_pbx() || size[0] <= dma_size)
68-
return;
69-
70-
size[ZONE_NORMAL] = size[0] - dma_size;
71-
size[ZONE_DMA] = dma_size;
72-
hole[ZONE_NORMAL] = hole[0];
73-
hole[ZONE_DMA] = 0;
74-
}
75-
#endif
76-
77-
7859
#define REALVIEW_FLASHCTRL (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_FLASH_OFFSET)
7960

8061
static int realview_flash_init(void)

‎arch/arm/mach-realview/include/mach/memory.h‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,7 @@
2929
#define PLAT_PHYS_OFFSET UL(0x00000000)
3030
#endif
3131

32-
#if !defined(__ASSEMBLY__) && defined(CONFIG_ZONE_DMA)
33-
extern void realview_adjust_zones(unsigned long *size, unsigned long *hole);
34-
#define arch_adjust_zones(size, hole) \
35-
realview_adjust_zones(size, hole)
36-
32+
#ifdef CONFIG_ZONE_DMA
3733
#define ARM_DMA_ZONE_SIZE SZ_256M
3834
#endif
3935

‎arch/arm/mach-sa1100/include/mach/memory.h‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,8 @@
1414
*/
1515
#define PLAT_PHYS_OFFSET UL(0xc0000000)
1616

17-
#ifndef __ASSEMBLY__
18-
1917
#ifdef CONFIG_SA1111
20-
void sa1111_adjust_zones(unsigned long *size, unsigned long *holes);
21-
22-
#define arch_adjust_zones(size, holes) \
23-
sa1111_adjust_zones(size, holes)
24-
2518
#define ARM_DMA_ZONE_SIZE SZ_1M
26-
27-
#endif
2819
#endif
2920

3021
/*

0 commit comments

Comments
 (0)