Commit 538380da authored by Jesper Nilsson's avatar Jesper Nilsson

CRIS v32: Update kernel/smp.c for CRIS v32.

- Change include paths to machine specific headers (asm/arch/hwregs -> hwregs)
- Add cpu_possible_map as cpumask_t and export it.
- Drop struct pt_regs parameter from crisv32_ipi_interrupt.
- timer -> timer0
parent 574852a2
#include <linux/types.h>
#include <asm/delay.h> #include <asm/delay.h>
#include <asm/arch/irq.h> #include <irq.h>
#include <asm/arch/hwregs/intr_vect.h> #include <hwregs/intr_vect.h>
#include <asm/arch/hwregs/intr_vect_defs.h> #include <hwregs/intr_vect_defs.h>
#include <asm/tlbflush.h> #include <asm/tlbflush.h>
#include <asm/mmu_context.h> #include <asm/mmu_context.h>
#include <asm/arch/hwregs/mmu_defs_asm.h> #include <hwregs/asm/mmu_defs_asm.h>
#include <asm/arch/hwregs/supp_reg.h> #include <hwregs/supp_reg.h>
#include <asm/atomic.h> #include <asm/atomic.h>
#include <linux/err.h> #include <linux/err.h>
...@@ -20,6 +21,7 @@ ...@@ -20,6 +21,7 @@
#define IPI_SCHEDULE 1 #define IPI_SCHEDULE 1
#define IPI_CALL 2 #define IPI_CALL 2
#define IPI_FLUSH_TLB 4 #define IPI_FLUSH_TLB 4
#define IPI_BOOT 8
#define FLUSH_ALL (void*)0xffffffff #define FLUSH_ALL (void*)0xffffffff
...@@ -30,6 +32,8 @@ spinlock_t cris_atomic_locks[] = { [0 ... LOCK_COUNT - 1] = SPIN_LOCK_UNLOCKED}; ...@@ -30,6 +32,8 @@ spinlock_t cris_atomic_locks[] = { [0 ... LOCK_COUNT - 1] = SPIN_LOCK_UNLOCKED};
cpumask_t cpu_online_map = CPU_MASK_NONE; cpumask_t cpu_online_map = CPU_MASK_NONE;
EXPORT_SYMBOL(cpu_online_map); EXPORT_SYMBOL(cpu_online_map);
cpumask_t phys_cpu_present_map = CPU_MASK_NONE; cpumask_t phys_cpu_present_map = CPU_MASK_NONE;
cpumask_t cpu_possible_map;
EXPORT_SYMBOL(cpu_possible_map);
EXPORT_SYMBOL(phys_cpu_present_map); EXPORT_SYMBOL(phys_cpu_present_map);
/* Variables used during SMP boot */ /* Variables used during SMP boot */
...@@ -55,13 +59,12 @@ static unsigned long flush_addr; ...@@ -55,13 +59,12 @@ static unsigned long flush_addr;
extern int setup_irq(int, struct irqaction *); extern int setup_irq(int, struct irqaction *);
/* Mode registers */ /* Mode registers */
static unsigned long irq_regs[NR_CPUS] = static unsigned long irq_regs[NR_CPUS] = {
{
regi_irq, regi_irq,
regi_irq2 regi_irq2
}; };
static irqreturn_t crisv32_ipi_interrupt(int irq, void *dev_id, struct pt_regs *regs); static irqreturn_t crisv32_ipi_interrupt(int irq, void *dev_id);
static int send_ipi(int vector, int wait, cpumask_t cpu_mask); static int send_ipi(int vector, int wait, cpumask_t cpu_mask);
static struct irqaction irq_ipi = { static struct irqaction irq_ipi = {
.handler = crisv32_ipi_interrupt, .handler = crisv32_ipi_interrupt,
...@@ -101,6 +104,7 @@ void __devinit smp_prepare_boot_cpu(void) ...@@ -101,6 +104,7 @@ void __devinit smp_prepare_boot_cpu(void)
cpu_set(0, cpu_online_map); cpu_set(0, cpu_online_map);
cpu_set(0, phys_cpu_present_map); cpu_set(0, phys_cpu_present_map);
cpu_set(0, cpu_possible_map);
} }
void __init smp_cpus_done(unsigned int max_cpus) void __init smp_cpus_done(unsigned int max_cpus)
...@@ -113,6 +117,7 @@ smp_boot_one_cpu(int cpuid) ...@@ -113,6 +117,7 @@ smp_boot_one_cpu(int cpuid)
{ {
unsigned timeout; unsigned timeout;
struct task_struct *idle; struct task_struct *idle;
cpumask_t cpu_mask = CPU_MASK_NONE;
idle = fork_idle(cpuid); idle = fork_idle(cpuid);
if (IS_ERR(idle)) if (IS_ERR(idle))
...@@ -124,6 +129,12 @@ smp_boot_one_cpu(int cpuid) ...@@ -124,6 +129,12 @@ smp_boot_one_cpu(int cpuid)
smp_init_current_idle_thread = task_thread_info(idle); smp_init_current_idle_thread = task_thread_info(idle);
cpu_now_booting = cpuid; cpu_now_booting = cpuid;
/* Kick it */
cpu_set(cpuid, cpu_online_map);
cpu_set(cpuid, cpu_mask);
send_ipi(IPI_BOOT, 0, cpu_mask);
cpu_clear(cpuid, cpu_online_map);
/* Wait for CPU to come online */ /* Wait for CPU to come online */
for (timeout = 0; timeout < 10000; timeout++) { for (timeout = 0; timeout < 10000; timeout++) {
if(cpu_online(cpuid)) { if(cpu_online(cpuid)) {
...@@ -165,7 +176,7 @@ void __init smp_callin(void) ...@@ -165,7 +176,7 @@ void __init smp_callin(void)
/* Enable IRQ and idle */ /* Enable IRQ and idle */
REG_WR(intr_vect, irq_regs[cpu], rw_mask, vect_mask); REG_WR(intr_vect, irq_regs[cpu], rw_mask, vect_mask);
unmask_irq(IPI_INTR_VECT); unmask_irq(IPI_INTR_VECT);
unmask_irq(TIMER_INTR_VECT); unmask_irq(TIMER0_INTR_VECT);
preempt_disable(); preempt_disable();
local_irq_enable(); local_irq_enable();
...@@ -328,7 +339,7 @@ int smp_call_function(void (*func)(void *info), void *info, ...@@ -328,7 +339,7 @@ int smp_call_function(void (*func)(void *info), void *info,
return ret; return ret;
} }
irqreturn_t crisv32_ipi_interrupt(int irq, void *dev_id, struct pt_regs *regs) irqreturn_t crisv32_ipi_interrupt(int irq, void *dev_id)
{ {
void (*func) (void *info) = call_data->func; void (*func) (void *info) = call_data->func;
void *info = call_data->info; void *info = call_data->info;
......
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