diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-28 15:02:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-28 15:02:27 -0400 |
commit | 1fdb24e969110fafea36d3b393bea438f702c87f (patch) | |
tree | 47a1dfef8a259e7922285315f8a02d31b4efe2f1 /arch/arm/mm/dma-mapping.c | |
parent | f362f98e7c445643d27c610bb7a86b79727b592e (diff) | |
parent | 531a6a941745e1e045dd2a6bd09e1dc01247a5f3 (diff) |
Merge branch 'devel-stable' of http://ftp.arm.linux.org.uk/pub/linux/arm/kernel/git-cur/linux-2.6-arm
* 'devel-stable' of http://ftp.arm.linux.org.uk/pub/linux/arm/kernel/git-cur/linux-2.6-arm: (178 commits)
ARM: 7139/1: fix compilation with CONFIG_ARM_ATAG_DTB_COMPAT and large TEXT_OFFSET
ARM: gic, local timers: use the request_percpu_irq() interface
ARM: gic: consolidate PPI handling
ARM: switch from NO_MACH_MEMORY_H to NEED_MACH_MEMORY_H
ARM: mach-s5p64x0: remove mach/memory.h
ARM: mach-s3c64xx: remove mach/memory.h
ARM: plat-mxc: remove mach/memory.h
ARM: mach-prima2: remove mach/memory.h
ARM: mach-zynq: remove mach/memory.h
ARM: mach-bcmring: remove mach/memory.h
ARM: mach-davinci: remove mach/memory.h
ARM: mach-pxa: remove mach/memory.h
ARM: mach-ixp4xx: remove mach/memory.h
ARM: mach-h720x: remove mach/memory.h
ARM: mach-vt8500: remove mach/memory.h
ARM: mach-s5pc100: remove mach/memory.h
ARM: mach-tegra: remove mach/memory.h
ARM: plat-tcc: remove mach/memory.h
ARM: mach-mmp: remove mach/memory.h
ARM: mach-cns3xxx: remove mach/memory.h
...
Fix up mostly pretty trivial conflicts in:
- arch/arm/Kconfig
- arch/arm/include/asm/localtimer.h
- arch/arm/kernel/Makefile
- arch/arm/mach-shmobile/board-ap4evb.c
- arch/arm/mach-u300/core.c
- arch/arm/mm/dma-mapping.c
- arch/arm/mm/proc-v7.S
- arch/arm/plat-omap/Kconfig
largely due to some CONFIG option renaming (ie CONFIG_PM_SLEEP ->
CONFIG_ARM_CPU_SUSPEND for the arm-specific suspend code etc) and
addition of NEED_MACH_MEMORY_H next to HAVE_IDE.
Diffstat (limited to 'arch/arm/mm/dma-mapping.c')
-rw-r--r-- | arch/arm/mm/dma-mapping.c | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 235eb775fc78..e4e7f6cba1ab 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
@@ -18,12 +18,14 @@ | |||
18 | #include <linux/device.h> | 18 | #include <linux/device.h> |
19 | #include <linux/dma-mapping.h> | 19 | #include <linux/dma-mapping.h> |
20 | #include <linux/highmem.h> | 20 | #include <linux/highmem.h> |
21 | #include <linux/slab.h> | ||
21 | 22 | ||
22 | #include <asm/memory.h> | 23 | #include <asm/memory.h> |
23 | #include <asm/highmem.h> | 24 | #include <asm/highmem.h> |
24 | #include <asm/cacheflush.h> | 25 | #include <asm/cacheflush.h> |
25 | #include <asm/tlbflush.h> | 26 | #include <asm/tlbflush.h> |
26 | #include <asm/sizes.h> | 27 | #include <asm/sizes.h> |
28 | #include <asm/mach/arch.h> | ||
27 | 29 | ||
28 | #include "mm.h" | 30 | #include "mm.h" |
29 | 31 | ||
@@ -117,26 +119,36 @@ static void __dma_free_buffer(struct page *page, size_t size) | |||
117 | } | 119 | } |
118 | 120 | ||
119 | #ifdef CONFIG_MMU | 121 | #ifdef CONFIG_MMU |
120 | /* Sanity check size */ | ||
121 | #if (CONSISTENT_DMA_SIZE % SZ_2M) | ||
122 | #error "CONSISTENT_DMA_SIZE must be multiple of 2MiB" | ||
123 | #endif | ||
124 | 122 | ||
125 | #define CONSISTENT_OFFSET(x) (((unsigned long)(x) - CONSISTENT_BASE) >> PAGE_SHIFT) | 123 | #define CONSISTENT_OFFSET(x) (((unsigned long)(x) - consistent_base) >> PAGE_SHIFT) |
126 | #define CONSISTENT_PTE_INDEX(x) (((unsigned long)(x) - CONSISTENT_BASE) >> PMD_SHIFT) | 124 | #define CONSISTENT_PTE_INDEX(x) (((unsigned long)(x) - consistent_base) >> PMD_SHIFT) |
127 | #define NUM_CONSISTENT_PTES (CONSISTENT_DMA_SIZE >> PMD_SHIFT) | ||
128 | 125 | ||
129 | /* | 126 | /* |
130 | * These are the page tables (2MB each) covering uncached, DMA consistent allocations | 127 | * These are the page tables (2MB each) covering uncached, DMA consistent allocations |
131 | */ | 128 | */ |
132 | static pte_t *consistent_pte[NUM_CONSISTENT_PTES]; | 129 | static pte_t **consistent_pte; |
130 | |||
131 | #define DEFAULT_CONSISTENT_DMA_SIZE SZ_2M | ||
132 | |||
133 | unsigned long consistent_base = CONSISTENT_END - DEFAULT_CONSISTENT_DMA_SIZE; | ||
134 | |||
135 | void __init init_consistent_dma_size(unsigned long size) | ||
136 | { | ||
137 | unsigned long base = CONSISTENT_END - ALIGN(size, SZ_2M); | ||
138 | |||
139 | BUG_ON(consistent_pte); /* Check we're called before DMA region init */ | ||
140 | BUG_ON(base < VMALLOC_END); | ||
141 | |||
142 | /* Grow region to accommodate specified size */ | ||
143 | if (base < consistent_base) | ||
144 | consistent_base = base; | ||
145 | } | ||
133 | 146 | ||
134 | #include "vmregion.h" | 147 | #include "vmregion.h" |
135 | 148 | ||
136 | static struct arm_vmregion_head consistent_head = { | 149 | static struct arm_vmregion_head consistent_head = { |
137 | .vm_lock = __SPIN_LOCK_UNLOCKED(&consistent_head.vm_lock), | 150 | .vm_lock = __SPIN_LOCK_UNLOCKED(&consistent_head.vm_lock), |
138 | .vm_list = LIST_HEAD_INIT(consistent_head.vm_list), | 151 | .vm_list = LIST_HEAD_INIT(consistent_head.vm_list), |
139 | .vm_start = CONSISTENT_BASE, | ||
140 | .vm_end = CONSISTENT_END, | 152 | .vm_end = CONSISTENT_END, |
141 | }; | 153 | }; |
142 | 154 | ||
@@ -155,7 +167,17 @@ static int __init consistent_init(void) | |||
155 | pmd_t *pmd; | 167 | pmd_t *pmd; |
156 | pte_t *pte; | 168 | pte_t *pte; |
157 | int i = 0; | 169 | int i = 0; |
158 | u32 base = CONSISTENT_BASE; | 170 | unsigned long base = consistent_base; |
171 | unsigned long num_ptes = (CONSISTENT_END - base) >> PGDIR_SHIFT; | ||
172 | |||
173 | consistent_pte = kmalloc(num_ptes * sizeof(pte_t), GFP_KERNEL); | ||
174 | if (!consistent_pte) { | ||
175 | pr_err("%s: no memory\n", __func__); | ||
176 | return -ENOMEM; | ||
177 | } | ||
178 | |||
179 | pr_debug("DMA memory: 0x%08lx - 0x%08lx:\n", base, CONSISTENT_END); | ||
180 | consistent_head.vm_start = base; | ||
159 | 181 | ||
160 | do { | 182 | do { |
161 | pgd = pgd_offset(&init_mm, base); | 183 | pgd = pgd_offset(&init_mm, base); |
@@ -198,7 +220,7 @@ __dma_alloc_remap(struct page *page, size_t size, gfp_t gfp, pgprot_t prot) | |||
198 | size_t align; | 220 | size_t align; |
199 | int bit; | 221 | int bit; |
200 | 222 | ||
201 | if (!consistent_pte[0]) { | 223 | if (!consistent_pte) { |
202 | printk(KERN_ERR "%s: not initialised\n", __func__); | 224 | printk(KERN_ERR "%s: not initialised\n", __func__); |
203 | dump_stack(); | 225 | dump_stack(); |
204 | return NULL; | 226 | return NULL; |