MIPS: Netlogic: Merge some of XLR/XLP wakup code
PATCH 10/12 MIPS: Netlogic: Merge some of XLR/XLP wakup code
Create a common NMI and reset handler in smpboot.S and use this for both XLR and XLP. In the earlier code, the woken up CPUs would busy wait until released, switch this to wakeup by NMI.
The initial wakeup code or XLR and XLP are differ since they are started from different bootloaders (XLP from u-boot and XLR from netlogic bootloader). But in both platforms the woken up CPUs wait and are released by sending an NMI.
Add support for starting XLR and XLP in 1/2/4 threads per core.
Signed-off-by Jayachandran C <[email protected]>
--- arch/mips/include/asm/netlogic/common.h | 26 +++- arch/mips/include/asm/netlogic/xlp-hal/xlp.h | 7 +- arch/mips/include/asm/netlogic/xlr/xlr.h | 2 + arch/mips/netlogic/common/Makefile | 2 +- arch/mips/netlogic/common/smp.c | 75 +++++++- arch/mips/netlogic/common/smpboot.S | 272 ++++++++++++++++++++++++++ arch/mips/netlogic/xlp/Makefile | 2 +- arch/mips/netlogic/xlp/setup.c | 4 + arch/mips/netlogic/xlp/smpboot.S | 217 -------------------- arch/mips/netlogic/xlp/wakeup.c | 93 +++------- arch/mips/netlogic/xlr/Makefile | 2 +- arch/mips/netlogic/xlr/setup.c | 7 +- arch/mips/netlogic/xlr/smpboot.S | 100 ---------- arch/mips/netlogic/xlr/wakeup.c | 17 +- 14 files changed, 415 insertions(+), 411 deletions(-) create mode 100644 arch/mips/netlogic/common/smpboot.S delete mode 100644 arch/mips/netlogic/xlp/smpboot.S delete mode 100644 arch/mips/netlogic/xlr/smpboot.S
arch/mips/include/asm/netlogic/common.h +23 -3
@@ -38,19 +38,39 @@/* * Common SMP definitions */ +#define RESET_VEC_PHYS 0x1fc00000 +#define RESET_DATA_PHYS (RESET_VEC_PHYS + (1<<10)) +#define BOOT_THREAD_MODE 0 +#define BOOT_NMI_LOCK 4 +#define BOOT_NMI_HANDLER 8 + +#ifndef __ASSEMBLY__struct irq_desc ;extern struct plat_smp_ops nlm_smp_ops;extern char nlm_reset_entry[], nlm_reset_entry_end[];void nlm_smp_function_ipi_handler (unsigned int irq,struct irq_desc *desc);void nlm_smp_resched_ipi_handler (unsigned int irq,struct irq_desc *desc);void nlm_smp_irq_init (void ); -void prom_pre_boot_secondary_cpus (void ); +void nlm_boot_secondary_cpus (void );int nlm_wakeup_secondary_cpus (u32 wakeup_mask); -void nlm_boot_smp_nmi (void ); +void nlm_rmiboot_preboot (void ); + +static inline void +nlm_set_nmi_handler (void *handler) +{ +char *reset_data; + + reset_data = (char *)CKSEG1ADDR (RESET_DATA_PHYS ); + *(int64_t *)(reset_data +BOOT_NMI_HANDLER ) = (long )handler; +}/* * Misc. */ +unsigned int nlm_get_cpu_frequency (void ); +extern unsigned long nlm_common_ebase; -unsigned int nlm_get_cpu_frequency (void ); +extern int nlm_threads_per_core; +extern uint32_t nlm_cpumask, nlm_coremask; +#endif #endif /* _NETLOGIC_COMMON_H_ */
arch/mips/include/asm/netlogic/xlp-hal/xlp.h +2 -5
@@ -35,17 +35,14 @@#ifndef _NLM_HAL_XLP_H#define _NLM_HAL_XLP_H -#define RESET_VEC_PHYS 0x1fc00000 -#define RESET_DATA_PHYS (RESET_VEC_PHYS + (1<<10)) -#define BOOT_THREAD_MODE 0 -#define PIC_UART_0_IRQ 17#define PIC_UART_1_IRQ 18#ifndef __ASSEMBLY__/* SMP support functions */ -void nlm_boot_core0_siblings (void ); +void xlp_boot_core0_siblings (void ); +void xlp_wakeup_secondary_cpus (void );void xlp_mmu_init (void );void nlm_hal_init (void );
arch/mips/include/asm/netlogic/xlr/xlr.h +2 -0
@@ -40,6 +40,8 @@ struct uart_port;unsigned int nlm_xlr_uart_in (struct uart_port *,int );void nlm_xlr_uart_out (struct uart_port *,int ,int ); +/* SMP helpers */ +void xlr_wakeup_secondary_cpus (void );/* XLS B silicon "Rook" */ static inline unsigned int nlm_chip_is_xls_b (void )
arch/mips/netlogic/common/Makefile +1 -1
@@ -1,3 +1,3 @@ obj-y += irq.o time.o -obj-$(CONFIG_SMP) += smp.o +obj-$(CONFIG_SMP) += smp.o smpboot.o obj-$(CONFIG_EARLY_PRINTK) += earlycons.o
arch/mips/netlogic/common/smp.c +73 -2
112 lines not on this page · raw message
arch/mips/netlogic/common/smpboot.S new file +272 -0
272 lines not on this page · raw message
arch/mips/netlogic/xlp/Makefile +1 -1
@@ -1,2 +1,2 @@ obj-y += setup.o platform.o nlm_hal.o -obj-$(CONFIG_SMP) += smpboot.o wakeup.o +obj-$(CONFIG_SMP) += wakeup.o
arch/mips/netlogic/xlp/setup.c +4 -0
@@ -51,6 +51,10 @@unsigned long nlm_common_ebase =0x0 ; +/* default to uniprocessor */ +uint32_t nlm_coremask =1 , nlm_cpumask =1 ; +int nlm_threads_per_core =1 ; +static void nlm_linux_exit (void ) {nlm_write_sys_reg (nlm_sys_base,SYS_CHIP_RESET ,1 );
arch/mips/netlogic/xlp/smpboot.S deleted +0 -217
217 lines not on this page · raw message
arch/mips/netlogic/xlp/wakeup.c +23 -70
115 lines not on this page · raw message
arch/mips/netlogic/xlr/Makefile +1 -1
@@ -1,2 +1,2 @@ obj-y += setup.o platform.o -obj-$(CONFIG_SMP) += smpboot.o wakeup.o +obj-$(CONFIG_SMP) += wakeup.o
arch/mips/netlogic/xlr/setup.c +6 -1
@@ -52,9 +52,14 @@uint64_t nlm_io_base =DEFAULT_NETLOGIC_IO_BASE ;uint64_t nlm_pic_base; -unsigned long nlm_common_ebase =0x0 ;struct psb_info nlm_prom_info; +unsigned long nlm_common_ebase =0x0 ; + +/* default to uniprocessor */ +uint32_t nlm_coremask =1 , nlm_cpumask =1 ; +int nlm_threads_per_core =1 ; +static void __init nlm_early_serial_setup (void ) {struct uart_port s;
arch/mips/netlogic/xlr/smpboot.S deleted +0 -100
100 lines not on this page · raw message
arch/mips/netlogic/xlr/wakeup.c +7 -10
@@ -48,21 +48,18 @@#include <asm/netlogic/xlr/iomap.h> #include <asm/netlogic/xlr/pic.h> -unsigned long secondary_entry_point; - -int __cpuinit nlm_wakeup_secondary_cpus (u32 wakeup_mask) +int __cpuinit xlr_wakeup_secondary_cpus (void ) {unsigned int i, boot_cpu; -void *reset_vec; - secondary_entry_point = (unsigned long )prom_pre_boot_secondary_cpus; - reset_vec = (void *)CKSEG1ADDR (0x1fc00000 ); -memcpy (reset_vec, (void *)nlm_reset_entry, - (nlm_reset_entry_end - nlm_reset_entry)); +/* +* In case of RMI boot, hit with NMI to get the cores +* from bootloader to linux code. +*/ boot_cpu =hard_smp_processor_id (); - +nlm_set_nmi_handler (nlm_rmiboot_preboot);for (i =0 ; i <NR_CPUS ; i++) { -if (i == boot_cpu || (wakeup_mask & (1u << i)) ==0 ) +if (i == boot_cpu || (nlm_cpumask & (1u << i)) ==0 )continue ;nlm_pic_send_ipi (nlm_pic_base, i,1 ,1 );/* send NMI */ }
Signature · 1 line
1.7.4.1