Commit deea6675 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: missing cpumask_t bits on sparc

	(no, it still doesn't fix sparc32-smp - just partial compile
fixes ;-/)
parent 790d43fd
...@@ -127,7 +127,9 @@ void smp_flush_tlb_all(void) ...@@ -127,7 +127,9 @@ void smp_flush_tlb_all(void)
void smp_flush_cache_mm(struct mm_struct *mm) void smp_flush_cache_mm(struct mm_struct *mm)
{ {
if(mm->context != NO_CONTEXT) { 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); xc1((smpfunc_t) BTFIXUP_CALL(local_flush_cache_mm), (unsigned long) mm);
local_flush_cache_mm(mm); local_flush_cache_mm(mm);
} }
...@@ -136,10 +138,12 @@ void smp_flush_cache_mm(struct mm_struct *mm) ...@@ -136,10 +138,12 @@ void smp_flush_cache_mm(struct mm_struct *mm)
void smp_flush_tlb_mm(struct mm_struct *mm) void smp_flush_tlb_mm(struct mm_struct *mm)
{ {
if(mm->context != NO_CONTEXT) { 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); xc1((smpfunc_t) BTFIXUP_CALL(local_flush_tlb_mm), (unsigned long) mm);
if(atomic_read(&mm->mm_users) == 1 && current->active_mm == 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); local_flush_tlb_mm(mm);
} }
...@@ -151,7 +155,9 @@ void smp_flush_cache_range(struct vm_area_struct *vma, unsigned long start, ...@@ -151,7 +155,9 @@ void smp_flush_cache_range(struct vm_area_struct *vma, unsigned long start,
struct mm_struct *mm = vma->vm_mm; struct mm_struct *mm = vma->vm_mm;
if (mm->context != NO_CONTEXT) { 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); xc3((smpfunc_t) BTFIXUP_CALL(local_flush_cache_range), (unsigned long) vma, start, end);
local_flush_cache_range(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, ...@@ -163,7 +169,9 @@ void smp_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
struct mm_struct *mm = vma->vm_mm; struct mm_struct *mm = vma->vm_mm;
if (mm->context != NO_CONTEXT) { 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); xc3((smpfunc_t) BTFIXUP_CALL(local_flush_tlb_range), (unsigned long) vma, start, end);
local_flush_tlb_range(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) ...@@ -174,7 +182,9 @@ void smp_flush_cache_page(struct vm_area_struct *vma, unsigned long page)
struct mm_struct *mm = vma->vm_mm; struct mm_struct *mm = vma->vm_mm;
if(mm->context != NO_CONTEXT) { 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); xc2((smpfunc_t) BTFIXUP_CALL(local_flush_cache_page), (unsigned long) vma, page);
local_flush_cache_page(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) ...@@ -185,7 +195,9 @@ void smp_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
struct mm_struct *mm = vma->vm_mm; struct mm_struct *mm = vma->vm_mm;
if(mm->context != NO_CONTEXT) { 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); xc2((smpfunc_t) BTFIXUP_CALL(local_flush_tlb_page), (unsigned long) vma, page);
local_flush_tlb_page(vma, page); local_flush_tlb_page(vma, page);
} }
...@@ -207,7 +219,9 @@ void smp_flush_page_to_ram(unsigned long 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) 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); xc2((smpfunc_t) BTFIXUP_CALL(local_flush_sig_insns), (unsigned long) mm, insn_addr);
local_flush_sig_insns(mm, insn_addr); local_flush_sig_insns(mm, insn_addr);
} }
......
...@@ -40,7 +40,6 @@ extern ctxd_t *srmmu_ctx_table_phys; ...@@ -40,7 +40,6 @@ extern ctxd_t *srmmu_ctx_table_phys;
extern void calibrate_delay(void); extern void calibrate_delay(void);
extern volatile int smp_processors_ready; extern volatile int smp_processors_ready;
extern unsigned long cpu_present_map;
extern int smp_num_cpus; extern int smp_num_cpus;
extern int smp_threads_ready; extern int smp_threads_ready;
extern volatile unsigned long cpu_callin_map[NR_CPUS]; extern volatile unsigned long cpu_callin_map[NR_CPUS];
...@@ -146,10 +145,10 @@ void __init smp4m_boot_cpus(void) ...@@ -146,10 +145,10 @@ void __init smp4m_boot_cpus(void)
printk("Entering SMP Mode...\n"); printk("Entering SMP Mode...\n");
local_irq_enable(); local_irq_enable();
cpu_present_map = 0; cpus_clear(cpu_present_map);
for (i = 0; !cpu_find_by_instance(i, NULL, &mid); i++) 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++) { for(i=0; i < NR_CPUS; i++) {
__cpu_number_map[i] = -1; __cpu_number_map[i] = -1;
...@@ -170,7 +169,7 @@ void __init smp4m_boot_cpus(void) ...@@ -170,7 +169,7 @@ void __init smp4m_boot_cpus(void)
if(i == boot_cpu_id) if(i == boot_cpu_id)
continue; continue;
if(cpu_present_map & (1 << i)) { if (cpu_isset(i, cpu_present_map)) {
extern unsigned long sun4m_cpu_startup; extern unsigned long sun4m_cpu_startup;
unsigned long *entry = &sun4m_cpu_startup; unsigned long *entry = &sun4m_cpu_startup;
struct task_struct *p; struct task_struct *p;
...@@ -223,18 +222,18 @@ void __init smp4m_boot_cpus(void) ...@@ -223,18 +222,18 @@ void __init smp4m_boot_cpus(void)
} }
} }
if(!(cpu_callin_map[i])) { if(!(cpu_callin_map[i])) {
cpu_present_map &= ~(1 << i); cpu_clear(i, cpu_present_map);
__cpu_number_map[i] = -1; __cpu_number_map[i] = -1;
} }
} }
local_flush_cache_all(); local_flush_cache_all();
if(cpucount == 0) { if(cpucount == 0) {
printk("Error: only one Processor found.\n"); printk("Error: only one Processor found.\n");
cpu_present_map = (1 << smp_processor_id()); cpu_present_map = cpumask_of_cpu(smp_processor_id());
} else { } else {
unsigned long bogosum = 0; unsigned long bogosum = 0;
for(i = 0; i < NR_CPUS; i++) { 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; bogosum += cpu_data(i).udelay_val;
} }
printk("Total of %d Processors activated (%lu.%02lu BogoMIPS).\n", printk("Total of %d Processors activated (%lu.%02lu BogoMIPS).\n",
...@@ -246,21 +245,21 @@ void __init smp4m_boot_cpus(void) ...@@ -246,21 +245,21 @@ void __init smp4m_boot_cpus(void)
} }
/* Free unneeded trap tables */ /* Free unneeded trap tables */
if (!(cpu_present_map & (1 << 1))) { if (!cpu_isset(i, cpu_present_map)) {
ClearPageReserved(virt_to_page(trapbase_cpu1)); ClearPageReserved(virt_to_page(trapbase_cpu1));
set_page_count(virt_to_page(trapbase_cpu1), 1); set_page_count(virt_to_page(trapbase_cpu1), 1);
free_page((unsigned long)trapbase_cpu1); free_page((unsigned long)trapbase_cpu1);
totalram_pages++; totalram_pages++;
num_physpages++; num_physpages++;
} }
if (!(cpu_present_map & (1 << 2))) { if (!cpu_isset(2, cpu_present_map)) {
ClearPageReserved(virt_to_page(trapbase_cpu2)); ClearPageReserved(virt_to_page(trapbase_cpu2));
set_page_count(virt_to_page(trapbase_cpu2), 1); set_page_count(virt_to_page(trapbase_cpu2), 1);
free_page((unsigned long)trapbase_cpu2); free_page((unsigned long)trapbase_cpu2);
totalram_pages++; totalram_pages++;
num_physpages++; num_physpages++;
} }
if (!(cpu_present_map & (1 << 3))) { if (!cpu_isset(3, cpu_present_map)) {
ClearPageReserved(virt_to_page(trapbase_cpu3)); ClearPageReserved(virt_to_page(trapbase_cpu3));
set_page_count(virt_to_page(trapbase_cpu3), 1); set_page_count(virt_to_page(trapbase_cpu3), 1);
free_page((unsigned long)trapbase_cpu3); free_page((unsigned long)trapbase_cpu3);
...@@ -289,7 +288,7 @@ void smp4m_irq_rotate(int cpu) ...@@ -289,7 +288,7 @@ void smp4m_irq_rotate(int cpu)
void smp4m_message_pass(int target, int msg, unsigned long data, int wait) void smp4m_message_pass(int target, int msg, unsigned long data, int wait)
{ {
static unsigned long smp_cpu_in_msg[NR_CPUS]; static unsigned long smp_cpu_in_msg[NR_CPUS];
unsigned long mask; cpumask_t mask;
int me = smp_processor_id(); int me = smp_processor_id();
int irq, i; int irq, i;
...@@ -308,9 +307,9 @@ void smp4m_message_pass(int target, int msg, unsigned long data, int wait) ...@@ -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) { if(target == MSG_ALL_BUT_SELF || target == MSG_ALL) {
mask = cpu_present_map; mask = cpu_present_map;
if(target == MSG_ALL_BUT_SELF) if(target == MSG_ALL_BUT_SELF)
mask &= ~(1 << me); cpu_clear(me, mask);
for(i = 0; i < 4; i++) { for(i = 0; i < 4; i++) {
if(mask & (1 << i)) if (cpu_isset(i, mask))
set_cpu_int(i, irq); set_cpu_int(i, irq);
} }
} else { } else {
...@@ -357,12 +356,12 @@ void smp4m_cross_call(smpfunc_t func, unsigned long arg1, unsigned long arg2, ...@@ -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. */ /* Init receive/complete mapping, plus fire the IPI's off. */
{ {
register unsigned long mask; cpumask_t mask = cpu_present_map;
register int i; register int i;
mask = (cpu_present_map & ~(1 << smp_processor_id())); cpu_clear(smp_processor_id(), mask);
for(i = 0; i < ncpus; i++) { for(i = 0; i < ncpus; i++) {
if(mask & (1 << i)) { if (cpu_isset(i, mask)) {
ccall_info.processors_in[i] = 0; ccall_info.processors_in[i] = 0;
ccall_info.processors_out[i] = 0; ccall_info.processors_out[i] = 0;
set_cpu_int(i, IRQ_CROSS_CALL); set_cpu_int(i, IRQ_CROSS_CALL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment