aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m32r/kernel/smp.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/m32r/kernel/smp.c')
-rw-r--r--arch/m32r/kernel/smp.c64
1 files changed, 27 insertions, 37 deletions
diff --git a/arch/m32r/kernel/smp.c b/arch/m32r/kernel/smp.c
index fc10b39893d4..092d40a6708e 100644
--- a/arch/m32r/kernel/smp.c
+++ b/arch/m32r/kernel/smp.c
@@ -30,6 +30,7 @@
30#include <asm/io.h> 30#include <asm/io.h>
31#include <asm/mmu_context.h> 31#include <asm/mmu_context.h>
32#include <asm/m32r.h> 32#include <asm/m32r.h>
33#include <asm/tlbflush.h>
33 34
34/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 35/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
35/* Data structures and variables */ 36/* Data structures and variables */
@@ -61,33 +62,22 @@ extern spinlock_t ipi_lock[];
61/* Function Prototypes */ 62/* Function Prototypes */
62/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 63/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
63 64
64void smp_send_reschedule(int);
65void smp_reschedule_interrupt(void); 65void smp_reschedule_interrupt(void);
66
67void smp_flush_cache_all(void);
68void smp_flush_cache_all_interrupt(void); 66void smp_flush_cache_all_interrupt(void);
69 67
70void smp_flush_tlb_all(void);
71static void flush_tlb_all_ipi(void *); 68static void flush_tlb_all_ipi(void *);
72
73void smp_flush_tlb_mm(struct mm_struct *);
74void smp_flush_tlb_range(struct vm_area_struct *, unsigned long, \
75 unsigned long);
76void smp_flush_tlb_page(struct vm_area_struct *, unsigned long);
77static void flush_tlb_others(cpumask_t, struct mm_struct *, 69static void flush_tlb_others(cpumask_t, struct mm_struct *,
78 struct vm_area_struct *, unsigned long); 70 struct vm_area_struct *, unsigned long);
71
79void smp_invalidate_interrupt(void); 72void smp_invalidate_interrupt(void);
80 73
81void smp_send_stop(void);
82static void stop_this_cpu(void *); 74static void stop_this_cpu(void *);
83 75
84void smp_send_timer(void);
85void smp_ipi_timer_interrupt(struct pt_regs *); 76void smp_ipi_timer_interrupt(struct pt_regs *);
86void smp_local_timer_interrupt(void); 77void smp_local_timer_interrupt(void);
87 78
88static void send_IPI_allbutself(int, int); 79static void send_IPI_allbutself(int, int);
89static void send_IPI_mask(const struct cpumask *, int, int); 80static void send_IPI_mask(const struct cpumask *, int, int);
90unsigned long send_IPI_mask_phys(cpumask_t, int, int);
91 81
92/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 82/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
93/* Rescheduling request Routines */ 83/* Rescheduling request Routines */
@@ -162,10 +152,10 @@ void smp_flush_cache_all(void)
162 unsigned long *mask; 152 unsigned long *mask;
163 153
164 preempt_disable(); 154 preempt_disable();
165 cpumask = cpu_online_map; 155 cpumask_copy(&cpumask, cpu_online_mask);
166 cpu_clear(smp_processor_id(), cpumask); 156 cpumask_clear_cpu(smp_processor_id(), &cpumask);
167 spin_lock(&flushcache_lock); 157 spin_lock(&flushcache_lock);
168 mask=cpus_addr(cpumask); 158 mask=cpumask_bits(&cpumask);
169 atomic_set_mask(*mask, (atomic_t *)&flushcache_cpumask); 159 atomic_set_mask(*mask, (atomic_t *)&flushcache_cpumask);
170 send_IPI_mask(&cpumask, INVALIDATE_CACHE_IPI, 0); 160 send_IPI_mask(&cpumask, INVALIDATE_CACHE_IPI, 0);
171 _flush_cache_copyback_all(); 161 _flush_cache_copyback_all();
@@ -263,8 +253,8 @@ void smp_flush_tlb_mm(struct mm_struct *mm)
263 preempt_disable(); 253 preempt_disable();
264 cpu_id = smp_processor_id(); 254 cpu_id = smp_processor_id();
265 mmc = &mm->context[cpu_id]; 255 mmc = &mm->context[cpu_id];
266 cpu_mask = *mm_cpumask(mm); 256 cpumask_copy(&cpu_mask, mm_cpumask(mm));
267 cpu_clear(cpu_id, cpu_mask); 257 cpumask_clear_cpu(cpu_id, &cpu_mask);
268 258
269 if (*mmc != NO_CONTEXT) { 259 if (*mmc != NO_CONTEXT) {
270 local_irq_save(flags); 260 local_irq_save(flags);
@@ -275,7 +265,7 @@ void smp_flush_tlb_mm(struct mm_struct *mm)
275 cpumask_clear_cpu(cpu_id, mm_cpumask(mm)); 265 cpumask_clear_cpu(cpu_id, mm_cpumask(mm));
276 local_irq_restore(flags); 266 local_irq_restore(flags);
277 } 267 }
278 if (!cpus_empty(cpu_mask)) 268 if (!cpumask_empty(&cpu_mask))
279 flush_tlb_others(cpu_mask, mm, NULL, FLUSH_ALL); 269 flush_tlb_others(cpu_mask, mm, NULL, FLUSH_ALL);
280 270
281 preempt_enable(); 271 preempt_enable();
@@ -333,8 +323,8 @@ void smp_flush_tlb_page(struct vm_area_struct *vma, unsigned long va)
333 preempt_disable(); 323 preempt_disable();
334 cpu_id = smp_processor_id(); 324 cpu_id = smp_processor_id();
335 mmc = &mm->context[cpu_id]; 325 mmc = &mm->context[cpu_id];
336 cpu_mask = *mm_cpumask(mm); 326 cpumask_copy(&cpu_mask, mm_cpumask(mm));
337 cpu_clear(cpu_id, cpu_mask); 327 cpumask_clear_cpu(cpu_id, &cpu_mask);
338 328
339#ifdef DEBUG_SMP 329#ifdef DEBUG_SMP
340 if (!mm) 330 if (!mm)
@@ -348,7 +338,7 @@ void smp_flush_tlb_page(struct vm_area_struct *vma, unsigned long va)
348 __flush_tlb_page(va); 338 __flush_tlb_page(va);
349 local_irq_restore(flags); 339 local_irq_restore(flags);
350 } 340 }
351 if (!cpus_empty(cpu_mask)) 341 if (!cpumask_empty(&cpu_mask))
352 flush_tlb_others(cpu_mask, mm, vma, va); 342 flush_tlb_others(cpu_mask, mm, vma, va);
353 343
354 preempt_enable(); 344 preempt_enable();
@@ -395,14 +385,14 @@ static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm,
395 * - current CPU must not be in mask 385 * - current CPU must not be in mask
396 * - mask must exist :) 386 * - mask must exist :)
397 */ 387 */
398 BUG_ON(cpus_empty(cpumask)); 388 BUG_ON(cpumask_empty(&cpumask));
399 389
400 BUG_ON(cpu_isset(smp_processor_id(), cpumask)); 390 BUG_ON(cpumask_test_cpu(smp_processor_id(), &cpumask));
401 BUG_ON(!mm); 391 BUG_ON(!mm);
402 392
403 /* If a CPU which we ran on has gone down, OK. */ 393 /* If a CPU which we ran on has gone down, OK. */
404 cpus_and(cpumask, cpumask, cpu_online_map); 394 cpumask_and(&cpumask, &cpumask, cpu_online_mask);
405 if (cpus_empty(cpumask)) 395 if (cpumask_empty(&cpumask))
406 return; 396 return;
407 397
408 /* 398 /*
@@ -416,7 +406,7 @@ static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm,
416 flush_mm = mm; 406 flush_mm = mm;
417 flush_vma = vma; 407 flush_vma = vma;
418 flush_va = va; 408 flush_va = va;
419 mask=cpus_addr(cpumask); 409 mask=cpumask_bits(&cpumask);
420 atomic_set_mask(*mask, (atomic_t *)&flush_cpumask); 410 atomic_set_mask(*mask, (atomic_t *)&flush_cpumask);
421 411
422 /* 412 /*
@@ -425,7 +415,7 @@ static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm,
425 */ 415 */
426 send_IPI_mask(&cpumask, INVALIDATE_TLB_IPI, 0); 416 send_IPI_mask(&cpumask, INVALIDATE_TLB_IPI, 0);
427 417
428 while (!cpus_empty(flush_cpumask)) { 418 while (!cpumask_empty((cpumask_t*)&flush_cpumask)) {
429 /* nothing. lockup detection does not belong here */ 419 /* nothing. lockup detection does not belong here */
430 mb(); 420 mb();
431 } 421 }
@@ -460,7 +450,7 @@ void smp_invalidate_interrupt(void)
460 int cpu_id = smp_processor_id(); 450 int cpu_id = smp_processor_id();
461 unsigned long *mmc = &flush_mm->context[cpu_id]; 451 unsigned long *mmc = &flush_mm->context[cpu_id];
462 452
463 if (!cpu_isset(cpu_id, flush_cpumask)) 453 if (!cpumask_test_cpu(cpu_id, &flush_cpumask))
464 return; 454 return;
465 455
466 if (flush_va == FLUSH_ALL) { 456 if (flush_va == FLUSH_ALL) {
@@ -478,7 +468,7 @@ void smp_invalidate_interrupt(void)
478 __flush_tlb_page(va); 468 __flush_tlb_page(va);
479 } 469 }
480 } 470 }
481 cpu_clear(cpu_id, flush_cpumask); 471 cpumask_clear_cpu(cpu_id, (cpumask_t*)&flush_cpumask);
482} 472}
483 473
484/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 474/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
@@ -530,7 +520,7 @@ static void stop_this_cpu(void *dummy)
530 /* 520 /*
531 * Remove this CPU: 521 * Remove this CPU:
532 */ 522 */
533 cpu_clear(cpu_id, cpu_online_map); 523 set_cpu_online(cpu_id, false);
534 524
535 /* 525 /*
536 * PSW IE = 1; 526 * PSW IE = 1;
@@ -725,8 +715,8 @@ static void send_IPI_allbutself(int ipi_num, int try)
725{ 715{
726 cpumask_t cpumask; 716 cpumask_t cpumask;
727 717
728 cpumask = cpu_online_map; 718 cpumask_copy(&cpumask, cpu_online_mask);
729 cpu_clear(smp_processor_id(), cpumask); 719 cpumask_clear_cpu(smp_processor_id(), &cpumask);
730 720
731 send_IPI_mask(&cpumask, ipi_num, try); 721 send_IPI_mask(&cpumask, ipi_num, try);
732} 722}
@@ -763,13 +753,13 @@ static void send_IPI_mask(const struct cpumask *cpumask, int ipi_num, int try)
763 cpumask_and(&tmp, cpumask, cpu_online_mask); 753 cpumask_and(&tmp, cpumask, cpu_online_mask);
764 BUG_ON(!cpumask_equal(cpumask, &tmp)); 754 BUG_ON(!cpumask_equal(cpumask, &tmp));
765 755
766 physid_mask = CPU_MASK_NONE; 756 cpumask_clear(&physid_mask);
767 for_each_cpu(cpu_id, cpumask) { 757 for_each_cpu(cpu_id, cpumask) {
768 if ((phys_id = cpu_to_physid(cpu_id)) != -1) 758 if ((phys_id = cpu_to_physid(cpu_id)) != -1)
769 cpu_set(phys_id, physid_mask); 759 cpumask_set_cpu(phys_id, &physid_mask);
770 } 760 }
771 761
772 send_IPI_mask_phys(physid_mask, ipi_num, try); 762 send_IPI_mask_phys(&physid_mask, ipi_num, try);
773} 763}
774 764
775/*==========================================================================* 765/*==========================================================================*
@@ -792,14 +782,14 @@ static void send_IPI_mask(const struct cpumask *cpumask, int ipi_num, int try)
792 * ---------- --- -------------------------------------------------------- 782 * ---------- --- --------------------------------------------------------
793 * 783 *
794 *==========================================================================*/ 784 *==========================================================================*/
795unsigned long send_IPI_mask_phys(cpumask_t physid_mask, int ipi_num, 785unsigned long send_IPI_mask_phys(const cpumask_t *physid_mask, int ipi_num,
796 int try) 786 int try)
797{ 787{
798 spinlock_t *ipilock; 788 spinlock_t *ipilock;
799 volatile unsigned long *ipicr_addr; 789 volatile unsigned long *ipicr_addr;
800 unsigned long ipicr_val; 790 unsigned long ipicr_val;
801 unsigned long my_physid_mask; 791 unsigned long my_physid_mask;
802 unsigned long mask = cpus_addr(physid_mask)[0]; 792 unsigned long mask = cpumask_bits(physid_mask)[0];
803 793
804 794
805 if (mask & ~physids_coerce(phys_cpu_present_map)) 795 if (mask & ~physids_coerce(phys_cpu_present_map))