diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-04-08 11:25:42 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-04-08 11:26:00 -0400 |
commit | 5af8c4e0fac9838428bd718040b664043a05f37c (patch) | |
tree | 75a01d98ed244db45fe3c734c4a81c1a3d92ac37 /arch/powerpc/lib | |
parent | 46e0bb9c12f4bab539736f1714cbf16600f681ec (diff) | |
parent | 577c9c456f0e1371cbade38eaf91ae8e8a308555 (diff) |
Merge commit 'v2.6.30-rc1' into sched/urgent
Merge reason: update to latest upstream to queue up fix
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/powerpc/lib')
-rw-r--r-- | arch/powerpc/lib/copyuser_64.S | 38 | ||||
-rw-r--r-- | arch/powerpc/lib/dma-noncoherent.c | 303 | ||||
-rw-r--r-- | arch/powerpc/lib/feature-fixups.c | 4 | ||||
-rw-r--r-- | arch/powerpc/lib/memcpy_64.S | 26 | ||||
-rw-r--r-- | arch/powerpc/lib/sstep.c | 2 |
5 files changed, 112 insertions, 261 deletions
diff --git a/arch/powerpc/lib/copyuser_64.S b/arch/powerpc/lib/copyuser_64.S index 70693a5c12a1..693b14a778fa 100644 --- a/arch/powerpc/lib/copyuser_64.S +++ b/arch/powerpc/lib/copyuser_64.S | |||
@@ -62,18 +62,19 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD) | |||
62 | 72: std r8,8(r3) | 62 | 72: std r8,8(r3) |
63 | beq+ 3f | 63 | beq+ 3f |
64 | addi r3,r3,16 | 64 | addi r3,r3,16 |
65 | 23: ld r9,8(r4) | ||
66 | .Ldo_tail: | 65 | .Ldo_tail: |
67 | bf cr7*4+1,1f | 66 | bf cr7*4+1,1f |
68 | rotldi r9,r9,32 | 67 | 23: lwz r9,8(r4) |
68 | addi r4,r4,4 | ||
69 | 73: stw r9,0(r3) | 69 | 73: stw r9,0(r3) |
70 | addi r3,r3,4 | 70 | addi r3,r3,4 |
71 | 1: bf cr7*4+2,2f | 71 | 1: bf cr7*4+2,2f |
72 | rotldi r9,r9,16 | 72 | 44: lhz r9,8(r4) |
73 | addi r4,r4,2 | ||
73 | 74: sth r9,0(r3) | 74 | 74: sth r9,0(r3) |
74 | addi r3,r3,2 | 75 | addi r3,r3,2 |
75 | 2: bf cr7*4+3,3f | 76 | 2: bf cr7*4+3,3f |
76 | rotldi r9,r9,8 | 77 | 45: lbz r9,8(r4) |
77 | 75: stb r9,0(r3) | 78 | 75: stb r9,0(r3) |
78 | 3: li r3,0 | 79 | 3: li r3,0 |
79 | blr | 80 | blr |
@@ -141,11 +142,24 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD) | |||
141 | 6: cmpwi cr1,r5,8 | 142 | 6: cmpwi cr1,r5,8 |
142 | addi r3,r3,32 | 143 | addi r3,r3,32 |
143 | sld r9,r9,r10 | 144 | sld r9,r9,r10 |
144 | ble cr1,.Ldo_tail | 145 | ble cr1,7f |
145 | 34: ld r0,8(r4) | 146 | 34: ld r0,8(r4) |
146 | srd r7,r0,r11 | 147 | srd r7,r0,r11 |
147 | or r9,r7,r9 | 148 | or r9,r7,r9 |
148 | b .Ldo_tail | 149 | 7: |
150 | bf cr7*4+1,1f | ||
151 | rotldi r9,r9,32 | ||
152 | 94: stw r9,0(r3) | ||
153 | addi r3,r3,4 | ||
154 | 1: bf cr7*4+2,2f | ||
155 | rotldi r9,r9,16 | ||
156 | 95: sth r9,0(r3) | ||
157 | addi r3,r3,2 | ||
158 | 2: bf cr7*4+3,3f | ||
159 | rotldi r9,r9,8 | ||
160 | 96: stb r9,0(r3) | ||
161 | 3: li r3,0 | ||
162 | blr | ||
149 | 163 | ||
150 | .Ldst_unaligned: | 164 | .Ldst_unaligned: |
151 | PPC_MTOCRF 0x01,r6 /* put #bytes to 8B bdry into cr7 */ | 165 | PPC_MTOCRF 0x01,r6 /* put #bytes to 8B bdry into cr7 */ |
@@ -218,7 +232,6 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD) | |||
218 | 121: | 232 | 121: |
219 | 132: | 233 | 132: |
220 | addi r3,r3,8 | 234 | addi r3,r3,8 |
221 | 123: | ||
222 | 134: | 235 | 134: |
223 | 135: | 236 | 135: |
224 | 138: | 237 | 138: |
@@ -226,6 +239,9 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD) | |||
226 | 140: | 239 | 140: |
227 | 141: | 240 | 141: |
228 | 142: | 241 | 142: |
242 | 123: | ||
243 | 144: | ||
244 | 145: | ||
229 | 245 | ||
230 | /* | 246 | /* |
231 | * here we have had a fault on a load and r3 points to the first | 247 | * here we have had a fault on a load and r3 points to the first |
@@ -309,6 +325,9 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD) | |||
309 | 187: | 325 | 187: |
310 | 188: | 326 | 188: |
311 | 189: | 327 | 189: |
328 | 194: | ||
329 | 195: | ||
330 | 196: | ||
312 | 1: | 331 | 1: |
313 | ld r6,-24(r1) | 332 | ld r6,-24(r1) |
314 | ld r5,-8(r1) | 333 | ld r5,-8(r1) |
@@ -329,7 +348,9 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD) | |||
329 | .llong 72b,172b | 348 | .llong 72b,172b |
330 | .llong 23b,123b | 349 | .llong 23b,123b |
331 | .llong 73b,173b | 350 | .llong 73b,173b |
351 | .llong 44b,144b | ||
332 | .llong 74b,174b | 352 | .llong 74b,174b |
353 | .llong 45b,145b | ||
333 | .llong 75b,175b | 354 | .llong 75b,175b |
334 | .llong 24b,124b | 355 | .llong 24b,124b |
335 | .llong 25b,125b | 356 | .llong 25b,125b |
@@ -347,6 +368,9 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD) | |||
347 | .llong 79b,179b | 368 | .llong 79b,179b |
348 | .llong 80b,180b | 369 | .llong 80b,180b |
349 | .llong 34b,134b | 370 | .llong 34b,134b |
371 | .llong 94b,194b | ||
372 | .llong 95b,195b | ||
373 | .llong 96b,196b | ||
350 | .llong 35b,135b | 374 | .llong 35b,135b |
351 | .llong 81b,181b | 375 | .llong 81b,181b |
352 | .llong 36b,136b | 376 | .llong 36b,136b |
diff --git a/arch/powerpc/lib/dma-noncoherent.c b/arch/powerpc/lib/dma-noncoherent.c index b7dc4c19f582..005a28d380af 100644 --- a/arch/powerpc/lib/dma-noncoherent.c +++ b/arch/powerpc/lib/dma-noncoherent.c | |||
@@ -29,121 +29,11 @@ | |||
29 | #include <linux/types.h> | 29 | #include <linux/types.h> |
30 | #include <linux/highmem.h> | 30 | #include <linux/highmem.h> |
31 | #include <linux/dma-mapping.h> | 31 | #include <linux/dma-mapping.h> |
32 | #include <linux/vmalloc.h> | ||
32 | 33 | ||
33 | #include <asm/tlbflush.h> | 34 | #include <asm/tlbflush.h> |
34 | 35 | ||
35 | /* | 36 | /* |
36 | * This address range defaults to a value that is safe for all | ||
37 | * platforms which currently set CONFIG_NOT_COHERENT_CACHE. It | ||
38 | * can be further configured for specific applications under | ||
39 | * the "Advanced Setup" menu. -Matt | ||
40 | */ | ||
41 | #define CONSISTENT_BASE (CONFIG_CONSISTENT_START) | ||
42 | #define CONSISTENT_END (CONFIG_CONSISTENT_START + CONFIG_CONSISTENT_SIZE) | ||
43 | #define CONSISTENT_OFFSET(x) (((unsigned long)(x) - CONSISTENT_BASE) >> PAGE_SHIFT) | ||
44 | |||
45 | /* | ||
46 | * This is the page table (2MB) covering uncached, DMA consistent allocations | ||
47 | */ | ||
48 | static pte_t *consistent_pte; | ||
49 | static DEFINE_SPINLOCK(consistent_lock); | ||
50 | |||
51 | /* | ||
52 | * VM region handling support. | ||
53 | * | ||
54 | * This should become something generic, handling VM region allocations for | ||
55 | * vmalloc and similar (ioremap, module space, etc). | ||
56 | * | ||
57 | * I envisage vmalloc()'s supporting vm_struct becoming: | ||
58 | * | ||
59 | * struct vm_struct { | ||
60 | * struct vm_region region; | ||
61 | * unsigned long flags; | ||
62 | * struct page **pages; | ||
63 | * unsigned int nr_pages; | ||
64 | * unsigned long phys_addr; | ||
65 | * }; | ||
66 | * | ||
67 | * get_vm_area() would then call vm_region_alloc with an appropriate | ||
68 | * struct vm_region head (eg): | ||
69 | * | ||
70 | * struct vm_region vmalloc_head = { | ||
71 | * .vm_list = LIST_HEAD_INIT(vmalloc_head.vm_list), | ||
72 | * .vm_start = VMALLOC_START, | ||
73 | * .vm_end = VMALLOC_END, | ||
74 | * }; | ||
75 | * | ||
76 | * However, vmalloc_head.vm_start is variable (typically, it is dependent on | ||
77 | * the amount of RAM found at boot time.) I would imagine that get_vm_area() | ||
78 | * would have to initialise this each time prior to calling vm_region_alloc(). | ||
79 | */ | ||
80 | struct ppc_vm_region { | ||
81 | struct list_head vm_list; | ||
82 | unsigned long vm_start; | ||
83 | unsigned long vm_end; | ||
84 | }; | ||
85 | |||
86 | static struct ppc_vm_region consistent_head = { | ||
87 | .vm_list = LIST_HEAD_INIT(consistent_head.vm_list), | ||
88 | .vm_start = CONSISTENT_BASE, | ||
89 | .vm_end = CONSISTENT_END, | ||
90 | }; | ||
91 | |||
92 | static struct ppc_vm_region * | ||
93 | ppc_vm_region_alloc(struct ppc_vm_region *head, size_t size, gfp_t gfp) | ||
94 | { | ||
95 | unsigned long addr = head->vm_start, end = head->vm_end - size; | ||
96 | unsigned long flags; | ||
97 | struct ppc_vm_region *c, *new; | ||
98 | |||
99 | new = kmalloc(sizeof(struct ppc_vm_region), gfp); | ||
100 | if (!new) | ||
101 | goto out; | ||
102 | |||
103 | spin_lock_irqsave(&consistent_lock, flags); | ||
104 | |||
105 | list_for_each_entry(c, &head->vm_list, vm_list) { | ||
106 | if ((addr + size) < addr) | ||
107 | goto nospc; | ||
108 | if ((addr + size) <= c->vm_start) | ||
109 | goto found; | ||
110 | addr = c->vm_end; | ||
111 | if (addr > end) | ||
112 | goto nospc; | ||
113 | } | ||
114 | |||
115 | found: | ||
116 | /* | ||
117 | * Insert this entry _before_ the one we found. | ||
118 | */ | ||
119 | list_add_tail(&new->vm_list, &c->vm_list); | ||
120 | new->vm_start = addr; | ||
121 | new->vm_end = addr + size; | ||
122 | |||
123 | spin_unlock_irqrestore(&consistent_lock, flags); | ||
124 | return new; | ||
125 | |||
126 | nospc: | ||
127 | spin_unlock_irqrestore(&consistent_lock, flags); | ||
128 | kfree(new); | ||
129 | out: | ||
130 | return NULL; | ||
131 | } | ||
132 | |||
133 | static struct ppc_vm_region *ppc_vm_region_find(struct ppc_vm_region *head, unsigned long addr) | ||
134 | { | ||
135 | struct ppc_vm_region *c; | ||
136 | |||
137 | list_for_each_entry(c, &head->vm_list, vm_list) { | ||
138 | if (c->vm_start == addr) | ||
139 | goto out; | ||
140 | } | ||
141 | c = NULL; | ||
142 | out: | ||
143 | return c; | ||
144 | } | ||
145 | |||
146 | /* | ||
147 | * Allocate DMA-coherent memory space and return both the kernel remapped | 37 | * Allocate DMA-coherent memory space and return both the kernel remapped |
148 | * virtual and bus address for that space. | 38 | * virtual and bus address for that space. |
149 | */ | 39 | */ |
@@ -151,21 +41,21 @@ void * | |||
151 | __dma_alloc_coherent(size_t size, dma_addr_t *handle, gfp_t gfp) | 41 | __dma_alloc_coherent(size_t size, dma_addr_t *handle, gfp_t gfp) |
152 | { | 42 | { |
153 | struct page *page; | 43 | struct page *page; |
154 | struct ppc_vm_region *c; | ||
155 | unsigned long order; | 44 | unsigned long order; |
45 | int i; | ||
46 | unsigned int nr_pages = PAGE_ALIGN(size)>>PAGE_SHIFT; | ||
47 | unsigned int array_size = nr_pages * sizeof(struct page *); | ||
48 | struct page **pages; | ||
49 | struct page *end; | ||
156 | u64 mask = 0x00ffffff, limit; /* ISA default */ | 50 | u64 mask = 0x00ffffff, limit; /* ISA default */ |
51 | struct vm_struct *area; | ||
157 | 52 | ||
158 | if (!consistent_pte) { | 53 | BUG_ON(!mem_init_done); |
159 | printk(KERN_ERR "%s: not initialised\n", __func__); | ||
160 | dump_stack(); | ||
161 | return NULL; | ||
162 | } | ||
163 | |||
164 | size = PAGE_ALIGN(size); | 54 | size = PAGE_ALIGN(size); |
165 | limit = (mask + 1) & ~mask; | 55 | limit = (mask + 1) & ~mask; |
166 | if ((limit && size >= limit) || size >= (CONSISTENT_END - CONSISTENT_BASE)) { | 56 | if (limit && size >= limit) { |
167 | printk(KERN_WARNING "coherent allocation too big (requested %#x mask %#Lx)\n", | 57 | printk(KERN_WARNING "coherent allocation too big (requested " |
168 | size, mask); | 58 | "%#x mask %#Lx)\n", size, mask); |
169 | return NULL; | 59 | return NULL; |
170 | } | 60 | } |
171 | 61 | ||
@@ -178,6 +68,8 @@ __dma_alloc_coherent(size_t size, dma_addr_t *handle, gfp_t gfp) | |||
178 | if (!page) | 68 | if (!page) |
179 | goto no_page; | 69 | goto no_page; |
180 | 70 | ||
71 | end = page + (1 << order); | ||
72 | |||
181 | /* | 73 | /* |
182 | * Invalidate any data that might be lurking in the | 74 | * Invalidate any data that might be lurking in the |
183 | * kernel direct-mapped region for device DMA. | 75 | * kernel direct-mapped region for device DMA. |
@@ -188,48 +80,59 @@ __dma_alloc_coherent(size_t size, dma_addr_t *handle, gfp_t gfp) | |||
188 | flush_dcache_range(kaddr, kaddr + size); | 80 | flush_dcache_range(kaddr, kaddr + size); |
189 | } | 81 | } |
190 | 82 | ||
83 | split_page(page, order); | ||
84 | |||
191 | /* | 85 | /* |
192 | * Allocate a virtual address in the consistent mapping region. | 86 | * Set the "dma handle" |
193 | */ | 87 | */ |
194 | c = ppc_vm_region_alloc(&consistent_head, size, | 88 | *handle = page_to_phys(page); |
195 | gfp & ~(__GFP_DMA | __GFP_HIGHMEM)); | 89 | |
196 | if (c) { | 90 | area = get_vm_area_caller(size, VM_IOREMAP, |
197 | unsigned long vaddr = c->vm_start; | 91 | __builtin_return_address(1)); |
198 | pte_t *pte = consistent_pte + CONSISTENT_OFFSET(vaddr); | 92 | if (!area) |
199 | struct page *end = page + (1 << order); | 93 | goto out_free_pages; |
200 | 94 | ||
201 | split_page(page, order); | 95 | if (array_size > PAGE_SIZE) { |
202 | 96 | pages = vmalloc(array_size); | |
203 | /* | 97 | area->flags |= VM_VPAGES; |
204 | * Set the "dma handle" | 98 | } else { |
205 | */ | 99 | pages = kmalloc(array_size, GFP_KERNEL); |
206 | *handle = page_to_phys(page); | 100 | } |
101 | if (!pages) | ||
102 | goto out_free_area; | ||
207 | 103 | ||
208 | do { | 104 | area->pages = pages; |
209 | BUG_ON(!pte_none(*pte)); | 105 | area->nr_pages = nr_pages; |
210 | 106 | ||
211 | SetPageReserved(page); | 107 | for (i = 0; i < nr_pages; i++) |
212 | set_pte_at(&init_mm, vaddr, | 108 | pages[i] = page + i; |
213 | pte, mk_pte(page, pgprot_noncached(PAGE_KERNEL))); | ||
214 | page++; | ||
215 | pte++; | ||
216 | vaddr += PAGE_SIZE; | ||
217 | } while (size -= PAGE_SIZE); | ||
218 | 109 | ||
219 | /* | 110 | if (map_vm_area(area, pgprot_noncached(PAGE_KERNEL), &pages)) |
220 | * Free the otherwise unused pages. | 111 | goto out_unmap; |
221 | */ | ||
222 | while (page < end) { | ||
223 | __free_page(page); | ||
224 | page++; | ||
225 | } | ||
226 | 112 | ||
227 | return (void *)c->vm_start; | 113 | /* |
114 | * Free the otherwise unused pages. | ||
115 | */ | ||
116 | page += nr_pages; | ||
117 | while (page < end) { | ||
118 | __free_page(page); | ||
119 | page++; | ||
228 | } | 120 | } |
229 | 121 | ||
122 | return area->addr; | ||
123 | out_unmap: | ||
124 | vunmap(area->addr); | ||
125 | if (array_size > PAGE_SIZE) | ||
126 | vfree(pages); | ||
127 | else | ||
128 | kfree(pages); | ||
129 | goto out_free_pages; | ||
130 | out_free_area: | ||
131 | free_vm_area(area); | ||
132 | out_free_pages: | ||
230 | if (page) | 133 | if (page) |
231 | __free_pages(page, order); | 134 | __free_pages(page, order); |
232 | no_page: | 135 | no_page: |
233 | return NULL; | 136 | return NULL; |
234 | } | 137 | } |
235 | EXPORT_SYMBOL(__dma_alloc_coherent); | 138 | EXPORT_SYMBOL(__dma_alloc_coherent); |
@@ -239,104 +142,12 @@ EXPORT_SYMBOL(__dma_alloc_coherent); | |||
239 | */ | 142 | */ |
240 | void __dma_free_coherent(size_t size, void *vaddr) | 143 | void __dma_free_coherent(size_t size, void *vaddr) |
241 | { | 144 | { |
242 | struct ppc_vm_region *c; | 145 | vfree(vaddr); |
243 | unsigned long flags, addr; | ||
244 | pte_t *ptep; | ||
245 | |||
246 | size = PAGE_ALIGN(size); | ||
247 | |||
248 | spin_lock_irqsave(&consistent_lock, flags); | ||
249 | |||
250 | c = ppc_vm_region_find(&consistent_head, (unsigned long)vaddr); | ||
251 | if (!c) | ||
252 | goto no_area; | ||
253 | |||
254 | if ((c->vm_end - c->vm_start) != size) { | ||
255 | printk(KERN_ERR "%s: freeing wrong coherent size (%ld != %d)\n", | ||
256 | __func__, c->vm_end - c->vm_start, size); | ||
257 | dump_stack(); | ||
258 | size = c->vm_end - c->vm_start; | ||
259 | } | ||
260 | |||
261 | ptep = consistent_pte + CONSISTENT_OFFSET(c->vm_start); | ||
262 | addr = c->vm_start; | ||
263 | do { | ||
264 | pte_t pte = ptep_get_and_clear(&init_mm, addr, ptep); | ||
265 | unsigned long pfn; | ||
266 | |||
267 | ptep++; | ||
268 | addr += PAGE_SIZE; | ||
269 | 146 | ||
270 | if (!pte_none(pte) && pte_present(pte)) { | ||
271 | pfn = pte_pfn(pte); | ||
272 | |||
273 | if (pfn_valid(pfn)) { | ||
274 | struct page *page = pfn_to_page(pfn); | ||
275 | ClearPageReserved(page); | ||
276 | |||
277 | __free_page(page); | ||
278 | continue; | ||
279 | } | ||
280 | } | ||
281 | |||
282 | printk(KERN_CRIT "%s: bad page in kernel page table\n", | ||
283 | __func__); | ||
284 | } while (size -= PAGE_SIZE); | ||
285 | |||
286 | flush_tlb_kernel_range(c->vm_start, c->vm_end); | ||
287 | |||
288 | list_del(&c->vm_list); | ||
289 | |||
290 | spin_unlock_irqrestore(&consistent_lock, flags); | ||
291 | |||
292 | kfree(c); | ||
293 | return; | ||
294 | |||
295 | no_area: | ||
296 | spin_unlock_irqrestore(&consistent_lock, flags); | ||
297 | printk(KERN_ERR "%s: trying to free invalid coherent area: %p\n", | ||
298 | __func__, vaddr); | ||
299 | dump_stack(); | ||
300 | } | 147 | } |
301 | EXPORT_SYMBOL(__dma_free_coherent); | 148 | EXPORT_SYMBOL(__dma_free_coherent); |
302 | 149 | ||
303 | /* | 150 | /* |
304 | * Initialise the consistent memory allocation. | ||
305 | */ | ||
306 | static int __init dma_alloc_init(void) | ||
307 | { | ||
308 | pgd_t *pgd; | ||
309 | pud_t *pud; | ||
310 | pmd_t *pmd; | ||
311 | pte_t *pte; | ||
312 | int ret = 0; | ||
313 | |||
314 | do { | ||
315 | pgd = pgd_offset(&init_mm, CONSISTENT_BASE); | ||
316 | pud = pud_alloc(&init_mm, pgd, CONSISTENT_BASE); | ||
317 | pmd = pmd_alloc(&init_mm, pud, CONSISTENT_BASE); | ||
318 | if (!pmd) { | ||
319 | printk(KERN_ERR "%s: no pmd tables\n", __func__); | ||
320 | ret = -ENOMEM; | ||
321 | break; | ||
322 | } | ||
323 | |||
324 | pte = pte_alloc_kernel(pmd, CONSISTENT_BASE); | ||
325 | if (!pte) { | ||
326 | printk(KERN_ERR "%s: no pte tables\n", __func__); | ||
327 | ret = -ENOMEM; | ||
328 | break; | ||
329 | } | ||
330 | |||
331 | consistent_pte = pte; | ||
332 | } while (0); | ||
333 | |||
334 | return ret; | ||
335 | } | ||
336 | |||
337 | core_initcall(dma_alloc_init); | ||
338 | |||
339 | /* | ||
340 | * make an area consistent. | 151 | * make an area consistent. |
341 | */ | 152 | */ |
342 | void __dma_sync(void *vaddr, size_t size, int direction) | 153 | void __dma_sync(void *vaddr, size_t size, int direction) |
diff --git a/arch/powerpc/lib/feature-fixups.c b/arch/powerpc/lib/feature-fixups.c index 8c5a03be31e0..7e8865bcd683 100644 --- a/arch/powerpc/lib/feature-fixups.c +++ b/arch/powerpc/lib/feature-fixups.c | |||
@@ -85,7 +85,7 @@ static int patch_feature_section(unsigned long value, struct fixup_entry *fcur) | |||
85 | } | 85 | } |
86 | 86 | ||
87 | for (; dest < end; dest++) | 87 | for (; dest < end; dest++) |
88 | patch_instruction(dest, PPC_NOP_INSTR); | 88 | patch_instruction(dest, PPC_INST_NOP); |
89 | 89 | ||
90 | return 0; | 90 | return 0; |
91 | } | 91 | } |
@@ -122,7 +122,7 @@ void do_lwsync_fixups(unsigned long value, void *fixup_start, void *fixup_end) | |||
122 | 122 | ||
123 | for (; start < end; start++) { | 123 | for (; start < end; start++) { |
124 | dest = (void *)start + *start; | 124 | dest = (void *)start + *start; |
125 | patch_instruction(dest, PPC_LWSYNC_INSTR); | 125 | patch_instruction(dest, PPC_INST_LWSYNC); |
126 | } | 126 | } |
127 | } | 127 | } |
128 | 128 | ||
diff --git a/arch/powerpc/lib/memcpy_64.S b/arch/powerpc/lib/memcpy_64.S index fe2d34e5332d..e178922b2c21 100644 --- a/arch/powerpc/lib/memcpy_64.S +++ b/arch/powerpc/lib/memcpy_64.S | |||
@@ -53,18 +53,19 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD) | |||
53 | 3: std r8,8(r3) | 53 | 3: std r8,8(r3) |
54 | beq 3f | 54 | beq 3f |
55 | addi r3,r3,16 | 55 | addi r3,r3,16 |
56 | ld r9,8(r4) | ||
57 | .Ldo_tail: | 56 | .Ldo_tail: |
58 | bf cr7*4+1,1f | 57 | bf cr7*4+1,1f |
59 | rotldi r9,r9,32 | 58 | lwz r9,8(r4) |
59 | addi r4,r4,4 | ||
60 | stw r9,0(r3) | 60 | stw r9,0(r3) |
61 | addi r3,r3,4 | 61 | addi r3,r3,4 |
62 | 1: bf cr7*4+2,2f | 62 | 1: bf cr7*4+2,2f |
63 | rotldi r9,r9,16 | 63 | lhz r9,8(r4) |
64 | addi r4,r4,2 | ||
64 | sth r9,0(r3) | 65 | sth r9,0(r3) |
65 | addi r3,r3,2 | 66 | addi r3,r3,2 |
66 | 2: bf cr7*4+3,3f | 67 | 2: bf cr7*4+3,3f |
67 | rotldi r9,r9,8 | 68 | lbz r9,8(r4) |
68 | stb r9,0(r3) | 69 | stb r9,0(r3) |
69 | 3: ld r3,48(r1) /* return dest pointer */ | 70 | 3: ld r3,48(r1) /* return dest pointer */ |
70 | blr | 71 | blr |
@@ -133,11 +134,24 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD) | |||
133 | cmpwi cr1,r5,8 | 134 | cmpwi cr1,r5,8 |
134 | addi r3,r3,32 | 135 | addi r3,r3,32 |
135 | sld r9,r9,r10 | 136 | sld r9,r9,r10 |
136 | ble cr1,.Ldo_tail | 137 | ble cr1,6f |
137 | ld r0,8(r4) | 138 | ld r0,8(r4) |
138 | srd r7,r0,r11 | 139 | srd r7,r0,r11 |
139 | or r9,r7,r9 | 140 | or r9,r7,r9 |
140 | b .Ldo_tail | 141 | 6: |
142 | bf cr7*4+1,1f | ||
143 | rotldi r9,r9,32 | ||
144 | stw r9,0(r3) | ||
145 | addi r3,r3,4 | ||
146 | 1: bf cr7*4+2,2f | ||
147 | rotldi r9,r9,16 | ||
148 | sth r9,0(r3) | ||
149 | addi r3,r3,2 | ||
150 | 2: bf cr7*4+3,3f | ||
151 | rotldi r9,r9,8 | ||
152 | stb r9,0(r3) | ||
153 | 3: ld r3,48(r1) /* return dest pointer */ | ||
154 | blr | ||
141 | 155 | ||
142 | .Ldst_unaligned: | 156 | .Ldst_unaligned: |
143 | PPC_MTOCRF 0x01,r6 # put #bytes to 8B bdry into cr7 | 157 | PPC_MTOCRF 0x01,r6 # put #bytes to 8B bdry into cr7 |
diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c index 4aae0c387645..13b7d54f185b 100644 --- a/arch/powerpc/lib/sstep.c +++ b/arch/powerpc/lib/sstep.c | |||
@@ -172,6 +172,8 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr) | |||
172 | } | 172 | } |
173 | break; | 173 | break; |
174 | case 0x378: /* orx */ | 174 | case 0x378: /* orx */ |
175 | if (instr & 1) | ||
176 | break; | ||
175 | rs = (instr >> 21) & 0x1f; | 177 | rs = (instr >> 21) & 0x1f; |
176 | rb = (instr >> 11) & 0x1f; | 178 | rb = (instr >> 11) & 0x1f; |
177 | if (rs == rb) { /* mr */ | 179 | if (rs == rb) { /* mr */ |