ARC: smp: Introduce smp hook @init_early_smp for Master core
authorVineet Gupta <vgupta@synopsys.com>
Mon, 12 Oct 2015 10:58:55 +0000 (16:28 +0530)
committerVineet Gupta <vgupta@synopsys.com>
Wed, 28 Oct 2015 10:43:40 +0000 (16:13 +0530)
This adds a platform agnostic early SMP init hook which is called on
Master core before calling setup_processor()

  setup_arch()
     smp_init_cpus()
         smp_ops.init_early_smp()
     ...
     setup_processor()

How this helps:
 - Used for one time init of certain SMP centric IP blocks, before
   calling setup_processor() which probes various bits of core,
   possibly including this block

 - Currently platforms need to call this IP block init from their
   init routines, which doesn't make sense as this is specific to ARC
   core and not platform and otherwise requires copy/paste in all
   (and hence a possible point of failure)

e.g. MCIP init is called from 2 platforms currently (axs10x and sim)
which will go away once we have this.

This change only adds the hooks but they are empty for now. Next commit
will populate them and remove the explicit init calls from platforms.

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
arch/arc/include/asm/smp.h
arch/arc/kernel/setup.c
arch/arc/kernel/smp.c

index 3845b9e94f69b0ee5dbda11fe9467c3d4b517aed..5ea4cf8cd1a8ec61a739243dc7c521c15dc93791 100644 (file)
@@ -45,12 +45,16 @@ extern int smp_ipi_irq_setup(int cpu, int irq);
  * struct plat_smp_ops - SMP callbacks provided by platform to ARC SMP
  *
  * @info:              SoC SMP specific info for /proc/cpuinfo etc
+ * @init_early_smp:    A SMP specific h/w block can init itself
+ *                     Could be common across platforms so not covered by
+ *                     mach_desc->init_early()
  * @cpu_kick:          For Master to kickstart a cpu (optionally at a PC)
  * @ipi_send:          To send IPI to a @cpu
  * @ips_clear:         To clear IPI received at @irq
  */
 struct plat_smp_ops {
        const char      *info;
+       void            (*init_early_smp)(void);
        void            (*cpu_kick)(int cpu, unsigned long pc);
        void            (*ipi_send)(int cpu);
        void            (*ipi_clear)(int irq);
index 68d3e181a82ff91cf6f83cf3fa24b011172f6217..c33e77c0ad3e9eb60367b6c2510c4e35c60d3b52 100644 (file)
@@ -411,8 +411,9 @@ void __init setup_arch(char **cmdline_p)
        if (machine_desc->init_early)
                machine_desc->init_early();
 
-       setup_processor();
        smp_init_cpus();
+
+       setup_processor();
        setup_arch_memory();
 
        /* copy flat DT out of .init and then unflatten it */
index f6175fc5f2bb139bafb68fd85586f425e73cef01..a59a53f988770c8079785da31b4948fbf0df97c2 100644 (file)
@@ -42,8 +42,13 @@ void __init smp_prepare_boot_cpu(void)
 }
 
 /*
- * Initialise the CPU possible map early - this describes the CPUs
- * which may be present or become present in the system.
+ * Called from setup_arch() before calling setup_processor()
+ *
+ * - Initialise the CPU possible map early - this describes the CPUs
+ *   which may be present or become present in the system.
+ * - Call early smp init hook. This can initialize a specific multi-core
+ *   IP which is say common to several platforms (hence not part of
+ *   platform specific int_early() hook)
  */
 void __init smp_init_cpus(void)
 {
@@ -51,6 +56,9 @@ void __init smp_init_cpus(void)
 
        for (i = 0; i < NR_CPUS; i++)
                set_cpu_possible(i, true);
+
+       if (plat_smp_ops.init_early_smp)
+               plat_smp_ops.init_early_smp();
 }
 
 /* called from init ( ) =>  process 1 */
This page took 0.028458 seconds and 5 git commands to generate.