diff options
Diffstat (limited to 'arch/arm/mm')
-rw-r--r-- | arch/arm/mm/Kconfig | 2 | ||||
-rw-r--r-- | arch/arm/mm/copypage-v6.c | 6 | ||||
-rw-r--r-- | arch/arm/mm/fault-armv.c | 31 | ||||
-rw-r--r-- | arch/arm/mm/flush.c | 44 | ||||
-rw-r--r-- | arch/arm/mm/ioremap.c | 47 |
5 files changed, 79 insertions, 51 deletions
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig index 3fefb43c67f7..95606b4a3ba6 100644 --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig | |||
@@ -62,7 +62,7 @@ config CPU_ARM720T | |||
62 | # ARM920T | 62 | # ARM920T |
63 | config CPU_ARM920T | 63 | config CPU_ARM920T |
64 | bool "Support ARM920T processor" if !ARCH_S3C2410 | 64 | bool "Support ARM920T processor" if !ARCH_S3C2410 |
65 | depends on ARCH_INTEGRATOR || ARCH_S3C2410 || ARCH_IMX | 65 | depends on ARCH_INTEGRATOR || ARCH_S3C2410 || ARCH_IMX || ARCH_AAEC2000 |
66 | default y if ARCH_S3C2410 | 66 | default y if ARCH_S3C2410 |
67 | select CPU_32v4 | 67 | select CPU_32v4 |
68 | select CPU_ABRT_EV4T | 68 | select CPU_ABRT_EV4T |
diff --git a/arch/arm/mm/copypage-v6.c b/arch/arm/mm/copypage-v6.c index a8c00236bd3d..27d041574ea7 100644 --- a/arch/arm/mm/copypage-v6.c +++ b/arch/arm/mm/copypage-v6.c | |||
@@ -30,8 +30,6 @@ | |||
30 | 30 | ||
31 | static DEFINE_SPINLOCK(v6_lock); | 31 | static DEFINE_SPINLOCK(v6_lock); |
32 | 32 | ||
33 | #define DCACHE_COLOUR(vaddr) ((vaddr & (SHMLBA - 1)) >> PAGE_SHIFT) | ||
34 | |||
35 | /* | 33 | /* |
36 | * Copy the user page. No aliasing to deal with so we can just | 34 | * Copy the user page. No aliasing to deal with so we can just |
37 | * attack the kernel's existing mapping of these pages. | 35 | * attack the kernel's existing mapping of these pages. |
@@ -55,7 +53,7 @@ void v6_clear_user_page_nonaliasing(void *kaddr, unsigned long vaddr) | |||
55 | */ | 53 | */ |
56 | void v6_copy_user_page_aliasing(void *kto, const void *kfrom, unsigned long vaddr) | 54 | void v6_copy_user_page_aliasing(void *kto, const void *kfrom, unsigned long vaddr) |
57 | { | 55 | { |
58 | unsigned int offset = DCACHE_COLOUR(vaddr); | 56 | unsigned int offset = CACHE_COLOUR(vaddr); |
59 | unsigned long from, to; | 57 | unsigned long from, to; |
60 | 58 | ||
61 | /* | 59 | /* |
@@ -95,7 +93,7 @@ void v6_copy_user_page_aliasing(void *kto, const void *kfrom, unsigned long vadd | |||
95 | */ | 93 | */ |
96 | void v6_clear_user_page_aliasing(void *kaddr, unsigned long vaddr) | 94 | void v6_clear_user_page_aliasing(void *kaddr, unsigned long vaddr) |
97 | { | 95 | { |
98 | unsigned int offset = DCACHE_COLOUR(vaddr); | 96 | unsigned int offset = CACHE_COLOUR(vaddr); |
99 | unsigned long to = to_address + (offset << PAGE_SHIFT); | 97 | unsigned long to = to_address + (offset << PAGE_SHIFT); |
100 | 98 | ||
101 | /* | 99 | /* |
diff --git a/arch/arm/mm/fault-armv.c b/arch/arm/mm/fault-armv.c index 01967ddeef53..be4ab3d73c91 100644 --- a/arch/arm/mm/fault-armv.c +++ b/arch/arm/mm/fault-armv.c | |||
@@ -77,9 +77,8 @@ no_pmd: | |||
77 | } | 77 | } |
78 | 78 | ||
79 | static void | 79 | static void |
80 | make_coherent(struct vm_area_struct *vma, unsigned long addr, struct page *page, int dirty) | 80 | make_coherent(struct address_space *mapping, struct vm_area_struct *vma, unsigned long addr, unsigned long pfn) |
81 | { | 81 | { |
82 | struct address_space *mapping = page_mapping(page); | ||
83 | struct mm_struct *mm = vma->vm_mm; | 82 | struct mm_struct *mm = vma->vm_mm; |
84 | struct vm_area_struct *mpnt; | 83 | struct vm_area_struct *mpnt; |
85 | struct prio_tree_iter iter; | 84 | struct prio_tree_iter iter; |
@@ -87,9 +86,6 @@ make_coherent(struct vm_area_struct *vma, unsigned long addr, struct page *page, | |||
87 | pgoff_t pgoff; | 86 | pgoff_t pgoff; |
88 | int aliases = 0; | 87 | int aliases = 0; |
89 | 88 | ||
90 | if (!mapping) | ||
91 | return; | ||
92 | |||
93 | pgoff = vma->vm_pgoff + ((addr - vma->vm_start) >> PAGE_SHIFT); | 89 | pgoff = vma->vm_pgoff + ((addr - vma->vm_start) >> PAGE_SHIFT); |
94 | 90 | ||
95 | /* | 91 | /* |
@@ -115,9 +111,11 @@ make_coherent(struct vm_area_struct *vma, unsigned long addr, struct page *page, | |||
115 | if (aliases) | 111 | if (aliases) |
116 | adjust_pte(vma, addr); | 112 | adjust_pte(vma, addr); |
117 | else | 113 | else |
118 | flush_cache_page(vma, addr, page_to_pfn(page)); | 114 | flush_cache_page(vma, addr, pfn); |
119 | } | 115 | } |
120 | 116 | ||
117 | void __flush_dcache_page(struct address_space *mapping, struct page *page); | ||
118 | |||
121 | /* | 119 | /* |
122 | * Take care of architecture specific things when placing a new PTE into | 120 | * Take care of architecture specific things when placing a new PTE into |
123 | * a page table, or changing an existing PTE. Basically, there are two | 121 | * a page table, or changing an existing PTE. Basically, there are two |
@@ -134,29 +132,22 @@ make_coherent(struct vm_area_struct *vma, unsigned long addr, struct page *page, | |||
134 | void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr, pte_t pte) | 132 | void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr, pte_t pte) |
135 | { | 133 | { |
136 | unsigned long pfn = pte_pfn(pte); | 134 | unsigned long pfn = pte_pfn(pte); |
135 | struct address_space *mapping; | ||
137 | struct page *page; | 136 | struct page *page; |
138 | 137 | ||
139 | if (!pfn_valid(pfn)) | 138 | if (!pfn_valid(pfn)) |
140 | return; | 139 | return; |
140 | |||
141 | page = pfn_to_page(pfn); | 141 | page = pfn_to_page(pfn); |
142 | if (page_mapping(page)) { | 142 | mapping = page_mapping(page); |
143 | if (mapping) { | ||
143 | int dirty = test_and_clear_bit(PG_dcache_dirty, &page->flags); | 144 | int dirty = test_and_clear_bit(PG_dcache_dirty, &page->flags); |
144 | 145 | ||
145 | if (dirty) { | 146 | if (dirty) |
146 | /* | 147 | __flush_dcache_page(mapping, page); |
147 | * This is our first userspace mapping of this page. | ||
148 | * Ensure that the physical page is coherent with | ||
149 | * the kernel mapping. | ||
150 | * | ||
151 | * FIXME: only need to do this on VIVT and aliasing | ||
152 | * VIPT cache architectures. We can do that | ||
153 | * by choosing whether to set this bit... | ||
154 | */ | ||
155 | __cpuc_flush_dcache_page(page_address(page)); | ||
156 | } | ||
157 | 148 | ||
158 | if (cache_is_vivt()) | 149 | if (cache_is_vivt()) |
159 | make_coherent(vma, addr, page, dirty); | 150 | make_coherent(mapping, vma, addr, pfn); |
160 | } | 151 | } |
161 | } | 152 | } |
162 | 153 | ||
diff --git a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c index 4085ed983e46..191788fb18d1 100644 --- a/arch/arm/mm/flush.c +++ b/arch/arm/mm/flush.c | |||
@@ -37,13 +37,8 @@ static void flush_pfn_alias(unsigned long pfn, unsigned long vaddr) | |||
37 | #define flush_pfn_alias(pfn,vaddr) do { } while (0) | 37 | #define flush_pfn_alias(pfn,vaddr) do { } while (0) |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | static void __flush_dcache_page(struct address_space *mapping, struct page *page) | 40 | void __flush_dcache_page(struct address_space *mapping, struct page *page) |
41 | { | 41 | { |
42 | struct mm_struct *mm = current->active_mm; | ||
43 | struct vm_area_struct *mpnt; | ||
44 | struct prio_tree_iter iter; | ||
45 | pgoff_t pgoff; | ||
46 | |||
47 | /* | 42 | /* |
48 | * Writeback any data associated with the kernel mapping of this | 43 | * Writeback any data associated with the kernel mapping of this |
49 | * page. This ensures that data in the physical page is mutually | 44 | * page. This ensures that data in the physical page is mutually |
@@ -52,24 +47,21 @@ static void __flush_dcache_page(struct address_space *mapping, struct page *page | |||
52 | __cpuc_flush_dcache_page(page_address(page)); | 47 | __cpuc_flush_dcache_page(page_address(page)); |
53 | 48 | ||
54 | /* | 49 | /* |
55 | * If there's no mapping pointer here, then this page isn't | 50 | * If this is a page cache page, and we have an aliasing VIPT cache, |
56 | * visible to userspace yet, so there are no cache lines | 51 | * we only need to do one flush - which would be at the relevant |
57 | * associated with any other aliases. | ||
58 | */ | ||
59 | if (!mapping) | ||
60 | return; | ||
61 | |||
62 | /* | ||
63 | * This is a page cache page. If we have a VIPT cache, we | ||
64 | * only need to do one flush - which would be at the relevant | ||
65 | * userspace colour, which is congruent with page->index. | 52 | * userspace colour, which is congruent with page->index. |
66 | */ | 53 | */ |
67 | if (cache_is_vipt()) { | 54 | if (mapping && cache_is_vipt_aliasing()) |
68 | if (cache_is_vipt_aliasing()) | 55 | flush_pfn_alias(page_to_pfn(page), |
69 | flush_pfn_alias(page_to_pfn(page), | 56 | page->index << PAGE_CACHE_SHIFT); |
70 | page->index << PAGE_CACHE_SHIFT); | 57 | } |
71 | return; | 58 | |
72 | } | 59 | static void __flush_dcache_aliases(struct address_space *mapping, struct page *page) |
60 | { | ||
61 | struct mm_struct *mm = current->active_mm; | ||
62 | struct vm_area_struct *mpnt; | ||
63 | struct prio_tree_iter iter; | ||
64 | pgoff_t pgoff; | ||
73 | 65 | ||
74 | /* | 66 | /* |
75 | * There are possible user space mappings of this page: | 67 | * There are possible user space mappings of this page: |
@@ -116,12 +108,12 @@ void flush_dcache_page(struct page *page) | |||
116 | { | 108 | { |
117 | struct address_space *mapping = page_mapping(page); | 109 | struct address_space *mapping = page_mapping(page); |
118 | 110 | ||
119 | if (cache_is_vipt_nonaliasing()) | ||
120 | return; | ||
121 | |||
122 | if (mapping && !mapping_mapped(mapping)) | 111 | if (mapping && !mapping_mapped(mapping)) |
123 | set_bit(PG_dcache_dirty, &page->flags); | 112 | set_bit(PG_dcache_dirty, &page->flags); |
124 | else | 113 | else { |
125 | __flush_dcache_page(mapping, page); | 114 | __flush_dcache_page(mapping, page); |
115 | if (mapping && cache_is_vivt()) | ||
116 | __flush_dcache_aliases(mapping, page); | ||
117 | } | ||
126 | } | 118 | } |
127 | EXPORT_SYMBOL(flush_dcache_page); | 119 | EXPORT_SYMBOL(flush_dcache_page); |
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c index 00bb8fd37a59..7110e54182b1 100644 --- a/arch/arm/mm/ioremap.c +++ b/arch/arm/mm/ioremap.c | |||
@@ -170,3 +170,50 @@ void __iounmap(void __iomem *addr) | |||
170 | vfree((void *) (PAGE_MASK & (unsigned long) addr)); | 170 | vfree((void *) (PAGE_MASK & (unsigned long) addr)); |
171 | } | 171 | } |
172 | EXPORT_SYMBOL(__iounmap); | 172 | EXPORT_SYMBOL(__iounmap); |
173 | |||
174 | #ifdef __io | ||
175 | void __iomem *ioport_map(unsigned long port, unsigned int nr) | ||
176 | { | ||
177 | return __io(port); | ||
178 | } | ||
179 | EXPORT_SYMBOL(ioport_map); | ||
180 | |||
181 | void ioport_unmap(void __iomem *addr) | ||
182 | { | ||
183 | } | ||
184 | EXPORT_SYMBOL(ioport_unmap); | ||
185 | #endif | ||
186 | |||
187 | #ifdef CONFIG_PCI | ||
188 | #include <linux/pci.h> | ||
189 | #include <linux/ioport.h> | ||
190 | |||
191 | void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) | ||
192 | { | ||
193 | unsigned long start = pci_resource_start(dev, bar); | ||
194 | unsigned long len = pci_resource_len(dev, bar); | ||
195 | unsigned long flags = pci_resource_flags(dev, bar); | ||
196 | |||
197 | if (!len || !start) | ||
198 | return NULL; | ||
199 | if (maxlen && len > maxlen) | ||
200 | len = maxlen; | ||
201 | if (flags & IORESOURCE_IO) | ||
202 | return ioport_map(start, len); | ||
203 | if (flags & IORESOURCE_MEM) { | ||
204 | if (flags & IORESOURCE_CACHEABLE) | ||
205 | return ioremap(start, len); | ||
206 | return ioremap_nocache(start, len); | ||
207 | } | ||
208 | return NULL; | ||
209 | } | ||
210 | EXPORT_SYMBOL(pci_iomap); | ||
211 | |||
212 | void pci_iounmap(struct pci_dev *dev, void __iomem *addr) | ||
213 | { | ||
214 | if ((unsigned long)addr >= VMALLOC_START && | ||
215 | (unsigned long)addr < VMALLOC_END) | ||
216 | iounmap(addr); | ||
217 | } | ||
218 | EXPORT_SYMBOL(pci_iounmap); | ||
219 | #endif | ||