diff options
Diffstat (limited to 'arch/m32r/kernel/smp.c')
-rw-r--r-- | arch/m32r/kernel/smp.c | 60 |
1 files changed, 20 insertions, 40 deletions
diff --git a/arch/m32r/kernel/smp.c b/arch/m32r/kernel/smp.c index 48b187f2d2b..8b1f6eb7687 100644 --- a/arch/m32r/kernel/smp.c +++ b/arch/m32r/kernel/smp.c | |||
@@ -275,12 +275,14 @@ static void flush_tlb_all_ipi(void *info) | |||
275 | *==========================================================================*/ | 275 | *==========================================================================*/ |
276 | void smp_flush_tlb_mm(struct mm_struct *mm) | 276 | void smp_flush_tlb_mm(struct mm_struct *mm) |
277 | { | 277 | { |
278 | int cpu_id = smp_processor_id(); | 278 | int cpu_id; |
279 | cpumask_t cpu_mask; | 279 | cpumask_t cpu_mask; |
280 | unsigned long *mmc = &mm->context[cpu_id]; | 280 | unsigned long *mmc; |
281 | unsigned long flags; | 281 | unsigned long flags; |
282 | 282 | ||
283 | preempt_disable(); | 283 | preempt_disable(); |
284 | cpu_id = smp_processor_id(); | ||
285 | mmc = &mm->context[cpu_id]; | ||
284 | cpu_mask = mm->cpu_vm_mask; | 286 | cpu_mask = mm->cpu_vm_mask; |
285 | cpu_clear(cpu_id, cpu_mask); | 287 | cpu_clear(cpu_id, cpu_mask); |
286 | 288 | ||
@@ -343,12 +345,14 @@ void smp_flush_tlb_range(struct vm_area_struct *vma, unsigned long start, | |||
343 | void smp_flush_tlb_page(struct vm_area_struct *vma, unsigned long va) | 345 | void smp_flush_tlb_page(struct vm_area_struct *vma, unsigned long va) |
344 | { | 346 | { |
345 | struct mm_struct *mm = vma->vm_mm; | 347 | struct mm_struct *mm = vma->vm_mm; |
346 | int cpu_id = smp_processor_id(); | 348 | int cpu_id; |
347 | cpumask_t cpu_mask; | 349 | cpumask_t cpu_mask; |
348 | unsigned long *mmc = &mm->context[cpu_id]; | 350 | unsigned long *mmc; |
349 | unsigned long flags; | 351 | unsigned long flags; |
350 | 352 | ||
351 | preempt_disable(); | 353 | preempt_disable(); |
354 | cpu_id = smp_processor_id(); | ||
355 | mmc = &mm->context[cpu_id]; | ||
352 | cpu_mask = mm->cpu_vm_mask; | 356 | cpu_mask = mm->cpu_vm_mask; |
353 | cpu_clear(cpu_id, cpu_mask); | 357 | cpu_clear(cpu_id, cpu_mask); |
354 | 358 | ||
@@ -892,7 +896,6 @@ unsigned long send_IPI_mask_phys(cpumask_t physid_mask, int ipi_num, | |||
892 | int try) | 896 | int try) |
893 | { | 897 | { |
894 | spinlock_t *ipilock; | 898 | spinlock_t *ipilock; |
895 | unsigned long flags = 0; | ||
896 | volatile unsigned long *ipicr_addr; | 899 | volatile unsigned long *ipicr_addr; |
897 | unsigned long ipicr_val; | 900 | unsigned long ipicr_val; |
898 | unsigned long my_physid_mask; | 901 | unsigned long my_physid_mask; |
@@ -916,50 +919,27 @@ unsigned long send_IPI_mask_phys(cpumask_t physid_mask, int ipi_num, | |||
916 | * write IPICRi (send IPIi) | 919 | * write IPICRi (send IPIi) |
917 | * unlock ipi_lock[i] | 920 | * unlock ipi_lock[i] |
918 | */ | 921 | */ |
922 | spin_lock(ipilock); | ||
919 | __asm__ __volatile__ ( | 923 | __asm__ __volatile__ ( |
920 | ";; LOCK ipi_lock[i] \n\t" | 924 | ";; CHECK IPICRi == 0 \n\t" |
921 | ".fillinsn \n" | 925 | ".fillinsn \n" |
922 | "1: \n\t" | 926 | "1: \n\t" |
923 | "mvfc %1, psw \n\t" | 927 | "ld %0, @%1 \n\t" |
924 | "clrpsw #0x40 -> nop \n\t" | 928 | "and %0, %4 \n\t" |
925 | DCACHE_CLEAR("r4", "r5", "%2") | 929 | "beqz %0, 2f \n\t" |
926 | "lock r4, @%2 \n\t" | 930 | "bnez %3, 3f \n\t" |
927 | "addi r4, #-1 \n\t" | ||
928 | "unlock r4, @%2 \n\t" | ||
929 | "mvtc %1, psw \n\t" | ||
930 | "bnez r4, 2f \n\t" | ||
931 | LOCK_SECTION_START(".balign 4 \n\t") | ||
932 | ".fillinsn \n" | ||
933 | "2: \n\t" | ||
934 | "ld r4, @%2 \n\t" | ||
935 | "blez r4, 2b \n\t" | ||
936 | "bra 1b \n\t" | 931 | "bra 1b \n\t" |
937 | LOCK_SECTION_END | ||
938 | ";; CHECK IPICRi == 0 \n\t" | ||
939 | ".fillinsn \n" | ||
940 | "3: \n\t" | ||
941 | "ld %0, @%3 \n\t" | ||
942 | "and %0, %6 \n\t" | ||
943 | "beqz %0, 4f \n\t" | ||
944 | "bnez %5, 5f \n\t" | ||
945 | "bra 3b \n\t" | ||
946 | ";; WRITE IPICRi (send IPIi) \n\t" | 932 | ";; WRITE IPICRi (send IPIi) \n\t" |
947 | ".fillinsn \n" | 933 | ".fillinsn \n" |
948 | "4: \n\t" | 934 | "2: \n\t" |
949 | "st %4, @%3 \n\t" | 935 | "st %2, @%1 \n\t" |
950 | ";; UNLOCK ipi_lock[i] \n\t" | ||
951 | ".fillinsn \n" | 936 | ".fillinsn \n" |
952 | "5: \n\t" | 937 | "3: \n\t" |
953 | "ldi r4, #1 \n\t" | ||
954 | "st r4, @%2 \n\t" | ||
955 | : "=&r"(ipicr_val) | 938 | : "=&r"(ipicr_val) |
956 | : "r"(flags), "r"(&ipilock->slock), "r"(ipicr_addr), | 939 | : "r"(ipicr_addr), "r"(mask), "r"(try), "r"(my_physid_mask) |
957 | "r"(mask), "r"(try), "r"(my_physid_mask) | 940 | : "memory" |
958 | : "memory", "r4" | ||
959 | #ifdef CONFIG_CHIP_M32700_TS1 | ||
960 | , "r5" | ||
961 | #endif /* CONFIG_CHIP_M32700_TS1 */ | ||
962 | ); | 941 | ); |
942 | spin_unlock(ipilock); | ||
963 | 943 | ||
964 | return ipicr_val; | 944 | return ipicr_val; |
965 | } | 945 | } |