Netlogic XLP updates for 3.11
cover Netlogic XLP updates for 3.11
The major changes are:
* Move cpu initialization and reset code to a separate file that can be used in the uniprocessor case.
* Move device tree code to a separate file
The rest are fixes and minor cleanups to the existing code.
Regards,
JC.
Jayachandran C (11):
MIPS: Netlogic: Split XLP device tree code to dt.c
MIPS: Netlogic: Split reset code out of smpboot.S
MIPS: Netlogic: Initialization when !CONFIG_SMP
MIPS: Netlogic: Add nlm_get_boot_data() helper
MIPS: Netlogic: move cpu_ready array to boot area
MIPS: Netlogic: use branch instead of jump
MIPS: Netlogic: Fix sign extension in PIC write
MIPS: Netlogic: wait for all hardware threads
MIPS: Netlogic: Fixup memory regions for prefetch
MIPS: Netlogic: Remove workarounds for early SoCs
MIPS: Netlogic: Fix plat_irq_dispatch
arch/mips/include/asm/netlogic/common.h | 18 +- arch/mips/include/asm/netlogic/xlp-hal/pic.h | 2 +- arch/mips/include/asm/netlogic/xlp-hal/xlp.h | 1 + arch/mips/netlogic/common/Makefile | 1 + arch/mips/netlogic/common/irq.c | 7 +- arch/mips/netlogic/common/reset.S | 230 ++++++++++++++++++++++++++ arch/mips/netlogic/common/smp.c | 18 +- arch/mips/netlogic/common/smpboot.S | 194 +--------------------- arch/mips/netlogic/xlp/Makefile | 2 +- arch/mips/netlogic/xlp/dt.c | 99 +++++++++++ arch/mips/netlogic/xlp/setup.c | 95 +++-------- arch/mips/netlogic/xlp/wakeup.c | 26 ++- arch/mips/netlogic/xlr/setup.c | 7 + arch/mips/netlogic/xlr/wakeup.c | 3 +- 14 files changed, 417 insertions(+), 286 deletions(-) create mode 100644 arch/mips/netlogic/common/reset.S create mode 100644 arch/mips/netlogic/xlp/dt.c
Signature · 1 line
1.7.9.5
PATCH 1/11 MIPS: Netlogic: Split XLP device tree code to dt.c
Create new flle arch/mips/netlogic/xlp/dt.c and move the device tree related code there.
--- arch/mips/include/asm/netlogic/xlp-hal/xlp.h | 1 + arch/mips/netlogic/xlp/Makefile | 2 +- arch/mips/netlogic/xlp/dt.c | 99 ++++++++++++++++++++++++++ arch/mips/netlogic/xlp/setup.c | 73 ++----------------- 4 files changed, 105 insertions(+), 70 deletions(-) create mode 100644 arch/mips/netlogic/xlp/dt.c
arch/mips/include/asm/netlogic/xlp-hal/xlp.h +1 -0
@@ -59,6 +59,7 @@ void xlp_wakeup_secondary_cpus(void);void xlp_mmu_init (void );void nlm_hal_init (void ); +void *xlp_dt_init (void *fdtp);#endif /* !__ASSEMBLY__ */ #endif /* _ASM_NLM_XLP_H */
arch/mips/netlogic/xlp/Makefile +1 -1
@@ -1,3 +1,3 @@ -obj-y += setup.o nlm_hal.o cop2-ex.o +obj-y += setup.o nlm_hal.o cop2-ex.o dt.o obj-$(CONFIG_SMP) += wakeup.o obj-$(CONFIG_USB) += usb-init.o
arch/mips/netlogic/xlp/dt.c new file +99 -0
99 lines not on this page · raw message
arch/mips/netlogic/xlp/setup.c +4 -69
111 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 2/11 MIPS: Netlogic: Split reset code out of smpboot.S
In reply to Jayachandran CThe reset and core initialization code should be available for uniprocessor as well. This changes is just to take out the code into a different file, without any change to the logic.
The change for uniprocessor initialization code is in a later patch.
--- arch/mips/include/asm/netlogic/common.h | 1 + arch/mips/netlogic/common/Makefile | 2 +- arch/mips/netlogic/common/reset.S | 249 +++++++++++++++++++++++++++++++ arch/mips/netlogic/common/smpboot.S | 187 +---------------------- arch/mips/netlogic/xlp/wakeup.c | 1 + 5 files changed, 253 insertions(+), 187 deletions(-) create mode 100644 arch/mips/netlogic/common/reset.S
arch/mips/include/asm/netlogic/common.h +1 -0
@@ -71,6 +71,7 @@ nlm_set_nmi_handler(void *handler)/* * Misc. */ +void nlm_init_boot_cpu (void );unsigned int nlm_get_cpu_frequency (void );void nlm_node_init (int node);extern struct plat_smp_ops nlm_smp_ops;
arch/mips/netlogic/common/Makefile +1 -1
@@ -1,4 +1,4 @@ obj-y += irq.o time.o obj-y += nlm-dma.o -obj-$(CONFIG_SMP) += smp.o smpboot.o +obj-$(CONFIG_SMP) += smp.o smpboot.o reset.o obj-$(CONFIG_EARLY_PRINTK) += earlycons.o
arch/mips/netlogic/common/reset.S new file +249 -0
249 lines not on this page · raw message
arch/mips/netlogic/common/smpboot.S +1 -186
198 lines not on this page · raw message
arch/mips/netlogic/xlp/wakeup.c +1 -0
@@ -137,6 +137,7 @@ void xlp_wakeup_secondary_cpus()* In case of u-boot, the secondaries are in reset * first wakeup core 0 threads */ +nlm_init_boot_cpu ();xlp_boot_core0_siblings ();/* now get other cores out of reset */
Signature · 1 line
1.7.9.5
PATCH 3/11 MIPS: Netlogic: Initialization when !CONFIG_SMP
In reply to Jayachandran CThe core initialization and reset vector setup needs to be done even when booting uniprocessor. Move this code from smp.c to setup.c
--- arch/mips/netlogic/common/Makefile | 3 ++- arch/mips/netlogic/common/smp.c | 6 ------ arch/mips/netlogic/xlp/setup.c | 8 ++++++++ arch/mips/netlogic/xlp/wakeup.c | 1 - arch/mips/netlogic/xlr/setup.c | 6 ++++++ 5 files changed, 16 insertions(+), 8 deletions(-)
arch/mips/netlogic/common/Makefile +2 -1
@@ -1,4 +1,5 @@ obj-y += irq.o time.o obj-y += nlm-dma.o -obj-$(CONFIG_SMP) += smp.o smpboot.o reset.o +obj-y += reset.o +obj-$(CONFIG_SMP) += smp.o smpboot.o obj-$(CONFIG_EARLY_PRINTK) += earlycons.o
arch/mips/netlogic/common/smp.c +0 -6
@@ -254,15 +254,9 @@ unsupp:int __cpuinit nlm_wakeup_secondary_cpus (void ) { -unsigned long reset_vec;char *reset_data;int threadmode; -/* Update reset entry point with CPU init code */ - reset_vec =CKSEG1ADDR (RESET_VEC_PHYS ); -memcpy ((void *)reset_vec, (void *)nlm_reset_entry, - (nlm_reset_entry_end - nlm_reset_entry)); -/* verify the mask and setup core config variables */ threadmode =nlm_parse_cpumask (&nlm_cpumask);
arch/mips/netlogic/xlp/setup.c +8 -0
@@ -98,11 +98,19 @@ void nlm_percpu_init(int hwcpuid)void __init prom_init (void ) { +void *reset_vec; + nlm_io_base =CKSEG1ADDR (XLP_DEFAULT_IO_BASE ); +nlm_init_boot_cpu ();xlp_mmu_init ();nlm_node_init (0 );xlp_dt_init ((void *)(long )fw_arg0); +/* Update reset entry point with CPU init code */ + reset_vec = (void *)CKSEG1ADDR (RESET_VEC_PHYS ); +memcpy (reset_vec, (void *)nlm_reset_entry, + (nlm_reset_entry_end - nlm_reset_entry)); +#ifdef CONFIG_SMP cpumask_setall (&nlm_cpumask);nlm_wakeup_secondary_cpus ();
arch/mips/netlogic/xlp/wakeup.c +0 -1
@@ -137,7 +137,6 @@ void xlp_wakeup_secondary_cpus()* In case of u-boot, the secondaries are in reset * first wakeup core 0 threads */ -nlm_init_boot_cpu ();xlp_boot_core0_siblings ();/* now get other cores out of reset */
arch/mips/netlogic/xlr/setup.c +6 -0
@@ -196,6 +196,7 @@ void __init prom_init(void) {int *argv, *envp;/* passed as 32 bit ptrs */ struct psb_info *prom_infop; +void *reset_vec;#ifdef CONFIG_SMP int i;#endif
@@ -208,6 +209,11 @@ void __init prom_init(void) nlm_prom_info = *prom_infop;nlm_init_node (); +/* Update reset entry point with CPU init code */ + reset_vec = (void *)CKSEG1ADDR (RESET_VEC_PHYS ); +memcpy (reset_vec, (void *)nlm_reset_entry, + (nlm_reset_entry_end - nlm_reset_entry)); +nlm_early_serial_setup ();build_arcs_cmdline (argv);prom_add_memory ();
Signature · 1 line
1.7.9.5
PATCH 4/11 MIPS: Netlogic: Add nlm_get_boot_data() helper
In reply to Jayachandran CThis moves the calculation and casting needed to access the CPU initialization data to a function nlm_get_boot_data()
--- arch/mips/include/asm/netlogic/common.h | 11 ++++++++--- arch/mips/netlogic/common/smp.c | 6 +++--- 2 files changed, 11 insertions(+), 6 deletions(-)
arch/mips/include/asm/netlogic/common.h +8 -3
@@ -59,13 +59,18 @@ int nlm_wakeup_secondary_cpus(void);void nlm_rmiboot_preboot (void );void nlm_percpu_init (int hwcpuid); +static inline void * +nlm_get_boot_data (int offset) +{ +return (void *)(CKSEG1ADDR (RESET_DATA_PHYS ) + offset); +} +static inline void nlm_set_nmi_handler (void *handler) { -char *reset_data; +void *nmih =nlm_get_boot_data (BOOT_NMI_HANDLER ); - reset_data = (char *)CKSEG1ADDR (RESET_DATA_PHYS ); - *(int64_t *)(reset_data +BOOT_NMI_HANDLER ) = (long )handler; + *(int64_t *)nmih = (long )handler; }/*
arch/mips/netlogic/common/smp.c +3 -3
@@ -254,15 +254,15 @@ unsupp:int __cpuinit nlm_wakeup_secondary_cpus (void ) { -char *reset_data; +u32 *reset_data;int threadmode;/* verify the mask and setup core config variables */ threadmode =nlm_parse_cpumask (&nlm_cpumask);/* Setup CPU init parameters */ - reset_data = (char *)CKSEG1ADDR (RESET_DATA_PHYS ); - *(int *)(reset_data +BOOT_THREAD_MODE ) = threadmode; + reset_data =nlm_get_boot_data (BOOT_THREAD_MODE ); + *reset_data = threadmode;#ifdef CONFIG_CPU_XLP xlp_wakeup_secondary_cpus ();
Signature · 1 line
1.7.9.5
PATCH 5/11 MIPS: Netlogic: move cpu_ready array to boot area
In reply to Jayachandran CMove the nlm_cpu_ready[] array used by the cpu wakeup code to the boot area, along with rest of the boot parameter code.
--- arch/mips/include/asm/netlogic/common.h | 6 ++++++ arch/mips/netlogic/common/reset.S | 6 ++++-- arch/mips/netlogic/common/smp.c | 6 +++--- arch/mips/netlogic/common/smpboot.S | 5 +++-- arch/mips/netlogic/xlp/setup.c | 1 + arch/mips/netlogic/xlp/wakeup.c | 3 ++- arch/mips/netlogic/xlr/setup.c | 1 + arch/mips/netlogic/xlr/wakeup.c | 3 ++- 8 files changed, 22 insertions(+), 9 deletions(-)
arch/mips/include/asm/netlogic/common.h +6 -0
@@ -39,11 +39,17 @@* Common SMP definitions */ #define RESET_VEC_PHYS 0x1fc00000 +#define RESET_VEC_SIZE 8192/* 8KB reset code and data */ #define RESET_DATA_PHYS (RESET_VEC_PHYS + (1<<10)) + +/* Offsets of parameters in the RESET_DATA_PHYS area */ #define BOOT_THREAD_MODE 0#define BOOT_NMI_LOCK 4#define BOOT_NMI_HANDLER 8 +/* CPU ready flags for each CPU */ +#define BOOT_CPU_READY 2048 +#ifndef __ASSEMBLY__#include <linux/cpumask.h> #include <linux/spinlock.h>
arch/mips/netlogic/common/reset.S +4 -2
@@ -216,8 +216,10 @@ EXPORT(nlm_boot_siblings) ori t1, ST0_KX #endif mtc0 t1, CP0_STATUS - /* mark CPU ready */ - PTR_LA t1, nlm_cpu_ready + + /* mark CPU ready, careful here, previous mtcr trashed registers */ + li t3, CKSEG1ADDR(RESET_DATA_PHYS) + ADDIU t1, t3, BOOT_CPU_READY sll v1, v0, 2 PTR_ADDU t1, v1 li t2, 1
arch/mips/netlogic/common/smp.c +3 -3
@@ -145,7 +145,6 @@ void nlm_cpus_done(void)* Boot all other cpus in the system, initialize them, and bring them into * the boot function */ -int nlm_cpu_ready[NR_CPUS ];unsigned long nlm_next_gp;unsigned long nlm_next_sp;static cpumask_t phys_cpu_present_mask;
@@ -168,6 +167,7 @@ void __init nlm_smp_setup(void) {unsigned int boot_cpu;int num_cpus, i, ncore; +volatile u32 *cpu_ready =nlm_get_boot_data (BOOT_CPU_READY );char buf[64 ]; boot_cpu =hard_smp_processor_id ();
@@ -181,10 +181,10 @@ void __init nlm_smp_setup(void) num_cpus =1 ;for (i =0 ; i <NR_CPUS ; i++) {/* -* nlm_cpu_ready array is not set for the boot_cpu, +* cpu_ready array is not set for the boot_cpu, * it is only set for ASPs (see smpboot.S) */ -if (nlm_cpu_ready[i]) { +if (cpu_ready[i]) {cpumask_set_cpu (i, &phys_cpu_present_mask); __cpu_number_map[i] = num_cpus; __cpu_logical_map[num_cpus] = i;
arch/mips/netlogic/common/smpboot.S +3 -2
@@ -109,8 +109,9 @@ NESTED(nlm_rmiboot_preboot, 16, sp) andi t2, t0, 0x3 /* thread num */ sll t0, 2 /* offset in cpu array */ - PTR_LA t1, nlm_cpu_ready /* mark CPU ready */ - PTR_ADDU t1, t0 + li t3, CKSEG1ADDR(RESET_DATA_PHYS) + ADDIU t1, t3, BOOT_CPU_READY + ADDU t1, t0 li t3, 1 sw t3, 0(t1)
arch/mips/netlogic/xlp/setup.c +1 -0
@@ -108,6 +108,7 @@ void __init prom_init(void)/* Update reset entry point with CPU init code */ reset_vec = (void *)CKSEG1ADDR (RESET_VEC_PHYS ); +memset (reset_vec,0 ,RESET_VEC_SIZE );memcpy (reset_vec, (void *)nlm_reset_entry, (nlm_reset_entry_end - nlm_reset_entry));
arch/mips/netlogic/xlp/wakeup.c +2 -1
@@ -82,6 +82,7 @@ static void xlp_enable_secondary_cores(const cpumask_t *wakeup_mask)struct nlm_soc_info *nodep;uint64_t syspcibase;uint32_t syscoremask; +volatile uint32_t *cpu_ready =nlm_get_boot_data (BOOT_CPU_READY );int core, n, cpu, count, val;for (n =0 ; n <NLM_NR_NODES ; n++) {
@@ -125,7 +126,7 @@ static void xlp_enable_secondary_cores(const cpumask_t *wakeup_mask)/* spin until the first hw thread sets its ready */ count =0x20000000 ;do { - val = *(volatile int *)&nlm_cpu_ready[cpu]; + val = cpu_ready[cpu]; }while (val ==0 && --count >0 ); } }
arch/mips/netlogic/xlr/setup.c +1 -0
@@ -211,6 +211,7 @@ void __init prom_init(void)/* Update reset entry point with CPU init code */ reset_vec = (void *)CKSEG1ADDR (RESET_VEC_PHYS ); +memset (reset_vec,0 ,RESET_VEC_SIZE );memcpy (reset_vec, (void *)nlm_reset_entry, (nlm_reset_entry_end - nlm_reset_entry));
arch/mips/netlogic/xlr/wakeup.c +2 -1
@@ -53,6 +53,7 @@ int __cpuinit xlr_wakeup_secondary_cpus(void) {struct nlm_soc_info *nodep;unsigned int i, j, boot_cpu; +volatile u32 *cpu_ready =nlm_get_boot_data (BOOT_CPU_READY );/* * In case of RMI boot, hit with NMI to get the cores
@@ -71,7 +72,7 @@ int __cpuinit xlr_wakeup_secondary_cpus(void) nodep->coremask =1 ;for (i =1 ; i <NLM_CORES_PER_NODE ; i++) {for (j =1000000 ; j >0 ; j--) { -if (nlm_cpu_ready[i *NLM_THREADS_PER_CORE ]) +if (cpu_ready[i *NLM_THREADS_PER_CORE ])break ;udelay (10 ); }
Signature · 1 line
1.7.9.5
PATCH 6/11 MIPS: Netlogic: use branch instead of jump
In reply to Jayachandran CFix an issue in the reset code. Since this code is copied to the reset vector, using 'j' for looping is not correct. Use relative branch 'b'.
Update the usage of 'j' in smpboot.S to be consistent although it is not a bug there.
--- arch/mips/netlogic/common/reset.S | 2 +- arch/mips/netlogic/common/smpboot.S | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/mips/netlogic/common/reset.S +1 -1
@@ -226,7 +226,7 @@ EXPORT(nlm_boot_siblings) sw t2, 0(t1) /* Wait until NMI hits */ 3: wait - j 3b + b 3b nop /*
arch/mips/netlogic/common/smpboot.S +1 -1
@@ -137,7 +137,7 @@ NESTED(nlm_rmiboot_preboot, 16, sp) mtcr t1, t0 /* update core control */ 1: wait - j 1b + b 1b nop END(nlm_rmiboot_preboot) __FINIT
Signature · 1 line
1.7.9.5
PATCH 7/11 MIPS: Netlogic: Fix sign extension in PIC write
In reply to Jayachandran CThis does not cause a problem yet, but we do not want to write 1 to reserved bits.
--- arch/mips/include/asm/netlogic/xlp-hal/pic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/include/asm/netlogic/xlp-hal/pic.h +1 -1
@@ -315,7 +315,7 @@ nlm_pic_send_ipi(uint64_t base, int hwt, int irq, int nmi) {uint64_t ipi; - ipi = (nmi <<31 ) | (irq <<20 ); + ipi = ((uint64_t )nmi <<31 ) | (irq <<20 ); ipi |= ((hwt >>4 ) <<16 ) | (1 << (hwt &0xf ));/* cpuset and mask */ nlm_write_pic_reg (base,PIC_IPI_CTL , ipi); }
Signature · 1 line
1.7.9.5
PATCH 8/11 MIPS: Netlogic: wait for all hardware threads
In reply to Jayachandran CEarlier we just waited for the first thread of the CPU to come online before proceeding to wake up others. Update it to wait for all the CPUs in the core. This will be useful when the boot-up is slow, like while debugging or when running in a simulator.
--- arch/mips/netlogic/xlp/wakeup.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-)
arch/mips/netlogic/xlp/wakeup.c +20 -7
@@ -77,13 +77,28 @@ static int xlp_wakeup_core(uint64_t sysbase, int node, int core)return count !=0 ; } +static int wait_for_cpus (int cpu,int bootcpu) +{ +volatile uint32_t *cpu_ready =nlm_get_boot_data (BOOT_CPU_READY ); +int i, count, notready; + + count =0x20000000 ; +do { + notready = nlm_threads_per_core; +for (i =0 ; i < nlm_threads_per_core; i++) +if (cpu_ready[cpu + i] || cpu == bootcpu) + --notready; + }while (notready !=0 && --count >0 ); + +return count !=0 ; +} +static void xlp_enable_secondary_cores (const cpumask_t *wakeup_mask) {struct nlm_soc_info *nodep;uint64_t syspcibase;uint32_t syscoremask; -volatile uint32_t *cpu_ready =nlm_get_boot_data (BOOT_CPU_READY ); -int core, n, cpu, count, val; +int core, n, cpu;for (n =0 ; n <NLM_NR_NODES ; n++) { syspcibase =nlm_get_sys_pcibase (n);
@@ -123,11 +138,8 @@ static void xlp_enable_secondary_cores(const cpumask_t *wakeup_mask)/* core is up */ nodep->coremask |=1u << core; -/* spin until the first hw thread sets its ready */ - count =0x20000000 ; -do { - val = cpu_ready[cpu]; - }while (val ==0 && --count >0 ); +/* spin until the hw threads sets their ready */ +wait_for_cpus (cpu,0 ); } } }
@@ -139,6 +151,7 @@ void xlp_wakeup_secondary_cpus()* first wakeup core 0 threads */ xlp_boot_core0_siblings (); +wait_for_cpus (0 ,0 );/* now get other cores out of reset */ xlp_enable_secondary_cores (&nlm_cpumask);
Signature · 1 line
1.7.9.5
PATCH 9/11 MIPS: Netlogic: Fixup memory regions for prefetch
In reply to Jayachandran CFix a cache error found in stress test, caused by the prefetch instruction going beyond valid memory when acessing the last page of a region. Add the pref_backup logic similar to XLR in XLP too.
--- arch/mips/netlogic/xlp/setup.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
arch/mips/netlogic/xlp/setup.c +13 -0
@@ -61,6 +61,18 @@ static void nlm_linux_exit(void)cpu_wait (); } +static void nlm_fixup_mem (void ) +{ +const int pref_backup =512 ; +int i; + +for (i =0 ; i < boot_mem_map.nr_map; i++) { +if (boot_mem_map.map[i].type !=BOOT_MEM_RAM ) +continue ; + boot_mem_map.map[i].size -= pref_backup; + } +} +void __init plat_mem_setup (void ) { panic_timeout =5 ;
@@ -70,6 +82,7 @@ void __init plat_mem_setup(void)/* memory and bootargs from DT */ early_init_devtree (initial_boot_params); +nlm_fixup_mem (); }const char *get_system_type (void )
Signature · 1 line
1.7.9.5
PATCH 10/11 MIPS: Netlogic: Remove workarounds for early SoCs
In reply to Jayachandran CThe XLPs in production do not need these workarounds. Remove the code and the associated ifdef.
--- arch/mips/netlogic/common/reset.S | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-)
arch/mips/netlogic/common/reset.S +1 -22
@@ -54,8 +54,6 @@ XLP_IO_SYS_OFFSET(node) + XLP_IO_PCI_HDRSZ + \ SYS_CPU_NONCOHERENT_MODE * 4 -#define XLP_AX_WORKAROUND /* enable Ax silicon workarounds */ - /* Enable XLP features and workarounds in the LSU */ .macro xlp_config_lsu li t0, LSU_DEFEATURE
@@ -63,10 +61,6 @@ lui t2, 0xc080 /* SUE, Enable Unaligned Access, L2HPE */ or t1, t1, t2 -#ifdef XLP_AX_WORKAROUND - li t2, ~0xe /* S1RCM */ - and t1, t1, t2 -#endif mtcr t1, t0 li t0, ICU_DEFEATURE
@@ -74,12 +68,9 @@ ori t1, 0x1000 /* Enable Icache partitioning */ mtcr t1, t0 - -#ifdef XLP_AX_WORKAROUND li t0, SCHED_DEFEATURE lui t1, 0x0100 /* Disable BRU accepting ALU ops */ mtcr t1, t0 -#endif .endm /*
@@ -195,19 +186,7 @@ EXPORT(nlm_boot_siblings) mfc0 v0, CP0_EBASE, 1 andi v0, 0x3ff /* v0 <- node/core */ - /* Init MMU in the first thread after changing THREAD_MODE - * register (Ax Errata?) - */ - andi v1, v0, 0x3 /* v1 <- thread id */ - bnez v1, 2f - nop - - li t0, MMU_SETUP - li t1, 0 - mtcr t1, t0 - _ehb - -2: beqz v0, 4f /* boot cpu (cpuid == 0)? */ + beqz v0, 4f /* boot cpu (cpuid == 0)? */ nop /* setup status reg */
Signature · 1 line
1.7.9.5
PATCH 11/11 MIPS: Netlogic: Fix plat_irq_dispatch
In reply to Jayachandran CFix an issue in plat_irq_dispatch due to which it can call do_IRQ with a PIC irq that is not mapped.
When a per-cpu interrupt and a PIC interrupt are both active, the check 'eirr & PERCPU_IRQ_MASK' will be true, but the interrupt in 'i' will be the number of the PIC interrupt. In this case, we will call do_IRQ on the PIC interrupt without mapping it with nlm_irq_to_xirq().
Fix this by using __ffs64 instead of __ilog2_u64 and using the interrupt number instead of mask to identify per-cpu interrupts.
--- arch/mips/netlogic/common/irq.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
arch/mips/netlogic/common/irq.c +3 -4
@@ -253,13 +253,12 @@ asmlinkage void plat_irq_dispatch(void) node =nlm_nodeid (); eirr =read_c0_eirr_and_eimr (); - - i =__ilog2_u64 (eirr); -if (i ==-1 ) +if (eirr ==0 )return ; + i =__ffs64 (eirr);/* per-CPU IRQs don't need translation */ -if (eirr &PERCPU_IRQ_MASK ) { +if (i <PIC_IRQ_BASE ) {do_IRQ (i);return ; }
Signature · 1 line
1.7.9.5