]> git.hungrycats.org Git - linux/commitdiff
[PATCH] sparse: missing cpumask_t bits on sparc
authorAlexander Viro <viro@parcelfarce.linux.theplanet.co.uk>
Wed, 14 Jul 2004 02:37:15 +0000 (19:37 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Wed, 14 Jul 2004 02:37:15 +0000 (19:37 -0700)
(no, it still doesn't fix sparc32-smp - just partial compile
fixes ;-/)

arch/sparc/kernel/smp.c
arch/sparc/kernel/sun4m_smp.c

index cb2399ee4aac995565505f0ec211b7da2ae16938..fd065fb3e00c73a587e1f1930d91ca8150ed1214 100644 (file)
@@ -127,7 +127,9 @@ void smp_flush_tlb_all(void)
 void smp_flush_cache_mm(struct mm_struct *mm)
 {
        if(mm->context != NO_CONTEXT) {
-               if(mm->cpu_vm_mask != (1 << smp_processor_id()))
+               cpumask_t cpu_mask = mm->cpu_vm_mask;
+               cpu_clear(smp_processor_id(), cpu_mask);
+               if (!cpus_empty(cpu_mask))
                        xc1((smpfunc_t) BTFIXUP_CALL(local_flush_cache_mm), (unsigned long) mm);
                local_flush_cache_mm(mm);
        }
@@ -136,10 +138,12 @@ void smp_flush_cache_mm(struct mm_struct *mm)
 void smp_flush_tlb_mm(struct mm_struct *mm)
 {
        if(mm->context != NO_CONTEXT) {
-               if(mm->cpu_vm_mask != (1 << smp_processor_id())) {
+               cpumask_t cpu_mask = mm->cpu_vm_mask;
+               cpu_clear(smp_processor_id(), cpu_mask);
+               if (!cpus_empty(cpu_mask)) {
                        xc1((smpfunc_t) BTFIXUP_CALL(local_flush_tlb_mm), (unsigned long) mm);
                        if(atomic_read(&mm->mm_users) == 1 && current->active_mm == mm)
-                               mm->cpu_vm_mask = (1 << smp_processor_id());
+                               mm->cpu_vm_mask = cpumask_of_cpu(smp_processor_id());
                }
                local_flush_tlb_mm(mm);
        }
@@ -151,7 +155,9 @@ void smp_flush_cache_range(struct vm_area_struct *vma, unsigned long start,
        struct mm_struct *mm = vma->vm_mm;
 
        if (mm->context != NO_CONTEXT) {
-               if(mm->cpu_vm_mask != (1 << smp_processor_id()))
+               cpumask_t cpu_mask = mm->cpu_vm_mask;
+               cpu_clear(smp_processor_id(), cpu_mask);
+               if (!cpus_empty(cpu_mask))
                        xc3((smpfunc_t) BTFIXUP_CALL(local_flush_cache_range), (unsigned long) vma, start, end);
                local_flush_cache_range(vma, start, end);
        }
@@ -163,7 +169,9 @@ void smp_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
        struct mm_struct *mm = vma->vm_mm;
 
        if (mm->context != NO_CONTEXT) {
-               if(mm->cpu_vm_mask != (1 << smp_processor_id()))
+               cpumask_t cpu_mask = mm->cpu_vm_mask;
+               cpu_clear(smp_processor_id(), cpu_mask);
+               if (!cpus_empty(cpu_mask))
                        xc3((smpfunc_t) BTFIXUP_CALL(local_flush_tlb_range), (unsigned long) vma, start, end);
                local_flush_tlb_range(vma, start, end);
        }
@@ -174,7 +182,9 @@ void smp_flush_cache_page(struct vm_area_struct *vma, unsigned long page)
        struct mm_struct *mm = vma->vm_mm;
 
        if(mm->context != NO_CONTEXT) {
-               if(mm->cpu_vm_mask != (1 << smp_processor_id()))
+               cpumask_t cpu_mask = mm->cpu_vm_mask;
+               cpu_clear(smp_processor_id(), cpu_mask);
+               if (!cpus_empty(cpu_mask))
                        xc2((smpfunc_t) BTFIXUP_CALL(local_flush_cache_page), (unsigned long) vma, page);
                local_flush_cache_page(vma, page);
        }
@@ -185,7 +195,9 @@ void smp_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
        struct mm_struct *mm = vma->vm_mm;
 
        if(mm->context != NO_CONTEXT) {
-               if(mm->cpu_vm_mask != (1 << smp_processor_id()))
+               cpumask_t cpu_mask = mm->cpu_vm_mask;
+               cpu_clear(smp_processor_id(), cpu_mask);
+               if (!cpus_empty(cpu_mask))
                        xc2((smpfunc_t) BTFIXUP_CALL(local_flush_tlb_page), (unsigned long) vma, page);
                local_flush_tlb_page(vma, page);
        }
@@ -207,7 +219,9 @@ void smp_flush_page_to_ram(unsigned long page)
 
 void smp_flush_sig_insns(struct mm_struct *mm, unsigned long insn_addr)
 {
-       if(mm->cpu_vm_mask != (1 << smp_processor_id()))
+       cpumask_t cpu_mask = mm->cpu_vm_mask;
+       cpu_clear(smp_processor_id(), cpu_mask);
+       if (!cpus_empty(cpu_mask))
                xc2((smpfunc_t) BTFIXUP_CALL(local_flush_sig_insns), (unsigned long) mm, insn_addr);
        local_flush_sig_insns(mm, insn_addr);
 }
index 65bb10ff3353b7fa4b854491886e9313270f4c78..01587b1608195b0eeb537a2edd1d1ff5353b7507 100644 (file)
@@ -40,7 +40,6 @@ extern ctxd_t *srmmu_ctx_table_phys;
 extern void calibrate_delay(void);
 
 extern volatile int smp_processors_ready;
-extern unsigned long cpu_present_map;
 extern int smp_num_cpus;
 extern int smp_threads_ready;
 extern volatile unsigned long cpu_callin_map[NR_CPUS];
@@ -146,10 +145,10 @@ void __init smp4m_boot_cpus(void)
        printk("Entering SMP Mode...\n");
 
        local_irq_enable();
-       cpu_present_map = 0;
+       cpus_clear(cpu_present_map);
 
        for (i = 0; !cpu_find_by_instance(i, NULL, &mid); i++)
-               cpu_present_map |= (1<<mid);
+               cpu_set(mid, cpu_present_map);
 
        for(i=0; i < NR_CPUS; i++) {
                __cpu_number_map[i] = -1;
@@ -170,7 +169,7 @@ void __init smp4m_boot_cpus(void)
                if(i == boot_cpu_id)
                        continue;
 
-               if(cpu_present_map & (1 << i)) {
+               if (cpu_isset(i, cpu_present_map)) {
                        extern unsigned long sun4m_cpu_startup;
                        unsigned long *entry = &sun4m_cpu_startup;
                        struct task_struct *p;
@@ -223,18 +222,18 @@ void __init smp4m_boot_cpus(void)
                        }
                }
                if(!(cpu_callin_map[i])) {
-                       cpu_present_map &= ~(1 << i);
+                       cpu_clear(i, cpu_present_map);
                        __cpu_number_map[i] = -1;
                }
        }
        local_flush_cache_all();
        if(cpucount == 0) {
                printk("Error: only one Processor found.\n");
-               cpu_present_map = (1 << smp_processor_id());
+               cpu_present_map = cpumask_of_cpu(smp_processor_id());
        } else {
                unsigned long bogosum = 0;
                for(i = 0; i < NR_CPUS; i++) {
-                       if(cpu_present_map & (1 << i))
+                       if (cpu_isset(i, cpu_present_map))
                                bogosum += cpu_data(i).udelay_val;
                }
                printk("Total of %d Processors activated (%lu.%02lu BogoMIPS).\n",
@@ -246,21 +245,21 @@ void __init smp4m_boot_cpus(void)
        }
 
        /* Free unneeded trap tables */
-       if (!(cpu_present_map & (1 << 1))) {
+       if (!cpu_isset(i, cpu_present_map)) {
                ClearPageReserved(virt_to_page(trapbase_cpu1));
                set_page_count(virt_to_page(trapbase_cpu1), 1);
                free_page((unsigned long)trapbase_cpu1);
                totalram_pages++;
                num_physpages++;
        }
-       if (!(cpu_present_map & (1 << 2))) {
+       if (!cpu_isset(2, cpu_present_map)) {
                ClearPageReserved(virt_to_page(trapbase_cpu2));
                set_page_count(virt_to_page(trapbase_cpu2), 1);
                free_page((unsigned long)trapbase_cpu2);
                totalram_pages++;
                num_physpages++;
        }
-       if (!(cpu_present_map & (1 << 3))) {
+       if (!cpu_isset(3, cpu_present_map)) {
                ClearPageReserved(virt_to_page(trapbase_cpu3));
                set_page_count(virt_to_page(trapbase_cpu3), 1);
                free_page((unsigned long)trapbase_cpu3);
@@ -289,7 +288,7 @@ void smp4m_irq_rotate(int cpu)
 void smp4m_message_pass(int target, int msg, unsigned long data, int wait)
 {
        static unsigned long smp_cpu_in_msg[NR_CPUS];
-       unsigned long mask;
+       cpumask_t mask;
        int me = smp_processor_id();
        int irq, i;
 
@@ -308,9 +307,9 @@ void smp4m_message_pass(int target, int msg, unsigned long data, int wait)
        if(target == MSG_ALL_BUT_SELF || target == MSG_ALL) {
                mask = cpu_present_map;
                if(target == MSG_ALL_BUT_SELF)
-                       mask &= ~(1 << me);
+                       cpu_clear(me, mask);
                for(i = 0; i < 4; i++) {
-                       if(mask & (1 << i))
+                       if (cpu_isset(i, mask))
                                set_cpu_int(i, irq);
                }
        } else {
@@ -357,12 +356,12 @@ void smp4m_cross_call(smpfunc_t func, unsigned long arg1, unsigned long arg2,
 
                /* Init receive/complete mapping, plus fire the IPI's off. */
                {
-                       register unsigned long mask;
+                       cpumask_t mask = cpu_present_map;
                        register int i;
 
-                       mask = (cpu_present_map & ~(1 << smp_processor_id()));
+                       cpu_clear(smp_processor_id(), mask);
                        for(i = 0; i < ncpus; i++) {
-                               if(mask & (1 << i)) {
+                               if (cpu_isset(i, mask)) {
                                        ccall_info.processors_in[i] = 0;
                                        ccall_info.processors_out[i] = 0;
                                        set_cpu_int(i, IRQ_CROSS_CALL);