static void smp_cross_call_masked(unsigned long *func, u32 ctx, u64 data1, u64 data2, cpumask_t mask)
{
u64 data0 = (((u64)ctx)<<32 | (((u64)func) & 0xffffffff));
+ int this_cpu = get_cpu();
cpus_and(mask, mask, cpu_online_map);
- cpu_clear(smp_processor_id(), mask);
+ cpu_clear(this_cpu, mask);
if (tlb_type == spitfire)
spitfire_xcall_deliver(data0, data1, data2, mask);
else
cheetah_xcall_deliver(data0, data1, data2, mask);
/* NOTE: Caller runs local copy on master. */
+
+ put_cpu();
}
extern unsigned long xcall_sync_tick;
if (!cpus)
return 0;
+ /* Can deadlock when called with interrupts disabled */
+ WARN_ON(irqs_disabled());
+
data.func = func;
data.info = info;
atomic_set(&data.finished, 0);
void smp_flush_dcache_page_impl(struct page *page, int cpu)
{
cpumask_t mask = cpumask_of_cpu(cpu);
+ int this_cpu = get_cpu();
#ifdef CONFIG_DEBUG_DCFLUSH
atomic_inc(&dcpage_flushes);
#endif
- if (cpu == smp_processor_id()) {
+ if (cpu == this_cpu) {
__local_flush_dcache_page(page);
} else if (cpu_online(cpu)) {
u64 data0;
atomic_inc(&dcpage_flushes_xcall);
#endif
}
+
+ put_cpu();
}
void flush_dcache_page_all(struct mm_struct *mm, struct page *page)
{
cpumask_t mask = cpu_online_map;
u64 data0;
+ int this_cpu = get_cpu();
- cpu_clear(smp_processor_id(), mask);
+ cpu_clear(this_cpu, mask);
#ifdef CONFIG_DEBUG_DCFLUSH
atomic_inc(&dcpage_flushes);
#endif
flush_self:
__local_flush_dcache_page(page);
+
+ put_cpu();
}
void smp_receive_signal(int cpu)
{
u32 ctx = CTX_HWBITS(mm->context);
- int cpu = smp_processor_id();
+ int cpu = get_cpu();
if (atomic_read(&mm->mm_users) == 1) {
/* See smp_flush_tlb_page for info about this. */
local_flush_and_out:
__flush_tlb_mm(ctx, SECONDARY_CONTEXT);
+
+ put_cpu();
}
}
unsigned long end)
{
u32 ctx = CTX_HWBITS(mm->context);
- int cpu = smp_processor_id();
+ int cpu = get_cpu();
start &= PAGE_MASK;
end = PAGE_ALIGN(end);
local_flush_and_out:
__flush_tlb_range(ctx, start, SECONDARY_CONTEXT,
end, PAGE_SIZE, (end-start));
+
+ put_cpu();
}
void smp_flush_tlb_kernel_range(unsigned long start, unsigned long end)
{
{
u32 ctx = CTX_HWBITS(mm->context);
- int cpu = smp_processor_id();
+ int cpu = get_cpu();
page &= PAGE_MASK;
if (mm == current->active_mm &&
local_flush_and_out:
__flush_tlb_page(ctx, page, SECONDARY_CONTEXT);
+
+ put_cpu();
}
}
boot_cpu_id = hard_smp_processor_id();
current_tick_offset = timer_tick_offset;
- if (boot_cpu_id >= NR_CPUS) {
- prom_printf("Serious problem, boot cpu id >= NR_CPUS\n");
- prom_halt();
- }
-
cpu_set(boot_cpu_id, cpu_online_map);
prof_counter(boot_cpu_id) = prof_multiplier(boot_cpu_id) = 1;
}
void __devinit smp_prepare_boot_cpu(void)
{
+ if (hard_smp_processor_id() >= NR_CPUS) {
+ prom_printf("Serious problem, boot cpu id >= NR_CPUS\n");
+ prom_halt();
+ }
+
current_thread_info()->cpu = hard_smp_processor_id();
cpu_set(smp_processor_id(), cpu_online_map);
cpu_set(smp_processor_id(), phys_cpu_present_map);