Commit 10b12718 authored by Vineet Gupta's avatar Vineet Gupta

ARC: [Review] Multi-platform image #7: SMP common code to use callbacks

This again is for switch from singleton platform SMP API to
multi-platform paradigm

Platform code is not yet setup to populate the callbacks, that happens
in next commit
Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
parent fc7943d2
...@@ -31,6 +31,7 @@ extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); ...@@ -31,6 +31,7 @@ extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
*/ */
extern void __init smp_init_cpus(void); extern void __init smp_init_cpus(void);
extern void __init first_lines_of_secondary(void); extern void __init first_lines_of_secondary(void);
extern const char *arc_platform_smp_cpuinfo(void);
/* /*
* API expected BY platform smp code (FROM arch smp code) * API expected BY platform smp code (FROM arch smp code)
...@@ -41,29 +42,22 @@ extern void __init first_lines_of_secondary(void); ...@@ -41,29 +42,22 @@ extern void __init first_lines_of_secondary(void);
extern int smp_ipi_irq_setup(int cpu, int irq); extern int smp_ipi_irq_setup(int cpu, int irq);
/* /*
* APIs expected FROM platform smp code * struct plat_smp_ops - SMP callbacks provided by platform to ARC SMP
*
* arc_platform_smp_cpuinfo:
* returns a string containing info for /proc/cpuinfo
*
* arc_platform_smp_wait_to_boot:
* Called from early bootup code for non-Master CPUs to "park" them
* *
* arc_platform_smp_wakeup_cpu: * @info: SoC SMP specific info for /proc/cpuinfo etc
* Called from __cpu_up (Master CPU) to kick start another one * @cpu_kick: For Master to kickstart a cpu (optionally at a PC)
* * @ipi_send: To send IPI to a @cpumask
* arc_platform_ipi_send: * @ips_clear: To clear IPI received by @cpu at @irq
* Takes @cpumask to which IPI(s) would be sent.
* The actual msg-id/buffer is manager in arch-common code
*
* arc_platform_ipi_clear:
* Takes @cpu which got IPI at @irq to do any IPI clearing
*/ */
extern const char *arc_platform_smp_cpuinfo(void); struct plat_smp_ops {
extern void arc_platform_smp_wait_to_boot(int cpu); const char *info;
extern void arc_platform_smp_wakeup_cpu(int cpu, unsigned long pc); void (*cpu_kick)(int cpu, unsigned long pc);
extern void arc_platform_ipi_send(const struct cpumask *callmap); void (*ipi_send)(void *callmap);
extern void arc_platform_ipi_clear(int cpu, int irq); void (*ipi_clear)(int cpu, int irq);
};
/* TBD: stop exporting it for direct population by platform */
extern struct plat_smp_ops plat_smp_ops;
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
......
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
arch_spinlock_t smp_atomic_ops_lock = __ARCH_SPIN_LOCK_UNLOCKED; arch_spinlock_t smp_atomic_ops_lock = __ARCH_SPIN_LOCK_UNLOCKED;
arch_spinlock_t smp_bitops_lock = __ARCH_SPIN_LOCK_UNLOCKED; arch_spinlock_t smp_bitops_lock = __ARCH_SPIN_LOCK_UNLOCKED;
struct plat_smp_ops plat_smp_ops;
/* XXX: per cpu ? Only needed once in early seconday boot */ /* XXX: per cpu ? Only needed once in early seconday boot */
struct task_struct *secondary_idle_tsk; struct task_struct *secondary_idle_tsk;
...@@ -105,6 +107,11 @@ void __attribute__((weak)) arc_platform_smp_wait_to_boot(int cpu) ...@@ -105,6 +107,11 @@ void __attribute__((weak)) arc_platform_smp_wait_to_boot(int cpu)
" b 1b \n"); " b 1b \n");
} }
const char *arc_platform_smp_cpuinfo(void)
{
return plat_smp_ops.info;
}
/* /*
* The very first "C" code executed by secondary * The very first "C" code executed by secondary
* Called from asm stub in head.S * Called from asm stub in head.S
...@@ -156,7 +163,8 @@ int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle) ...@@ -156,7 +163,8 @@ int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle)
pr_info("Idle Task [%d] %p", cpu, idle); pr_info("Idle Task [%d] %p", cpu, idle);
pr_info("Trying to bring up CPU%u ...\n", cpu); pr_info("Trying to bring up CPU%u ...\n", cpu);
arc_platform_smp_wakeup_cpu(cpu, if (plat_smp_ops.cpu_kick)
plat_smp_ops.cpu_kick(cpu,
(unsigned long)first_lines_of_secondary); (unsigned long)first_lines_of_secondary);
/* wait for 1 sec after kicking the secondary */ /* wait for 1 sec after kicking the secondary */
...@@ -225,7 +233,8 @@ static void ipi_send_msg(const struct cpumask *callmap, enum ipi_msg_type msg) ...@@ -225,7 +233,8 @@ static void ipi_send_msg(const struct cpumask *callmap, enum ipi_msg_type msg)
} }
/* Call the platform specific cross-CPU call function */ /* Call the platform specific cross-CPU call function */
arc_platform_ipi_send(callmap); if (plat_smp_ops.ipi_send)
plat_smp_ops.ipi_send((void *)callmap);
local_irq_restore(flags); local_irq_restore(flags);
} }
...@@ -299,7 +308,8 @@ irqreturn_t do_IPI(int irq, void *dev_id) ...@@ -299,7 +308,8 @@ irqreturn_t do_IPI(int irq, void *dev_id)
struct ipi_data *ipi = &per_cpu(ipi_data, cpu); struct ipi_data *ipi = &per_cpu(ipi_data, cpu);
unsigned long ops; unsigned long ops;
arc_platform_ipi_clear(cpu, irq); if (plat_smp_ops.ipi_clear)
plat_smp_ops.ipi_clear(cpu, irq);
/* /*
* XXX: is this loop really needed * XXX: is this loop really needed
......
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