Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: Netlogic: SMP wakeup code update

Update for core intialization code. Initialize status register
after receiving NMI for CPU wakeup. Add the low level L1D flush
code before enabling threads in core.

Also convert the ehb to _ehb so that it works under more GCC
versions.

Signed-off-by: Jayachandran C <jayachandranc@netlogicmicro.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/3755/
Patchwork: https://patchwork.linux-mips.org/patch/4095/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Jayachandran C and committed by
Ralf Baechle
51d1eac0 cedc8ef8

+45 -6
+3 -1
arch/mips/include/asm/netlogic/xlp-hal/cpucontrol.h
··· 47 47 #define CPU_BLOCKID_MAP 10 48 48 49 49 #define LSU_DEFEATURE 0x304 50 - #define LSU_CERRLOG_REGID 0x09 50 + #define LSU_DEBUG_ADDR 0x305 51 + #define LSU_DEBUG_DATA0 0x306 52 + #define LSU_CERRLOG_REGID 0x309 51 53 #define SCHED_DEFEATURE 0x700 52 54 53 55 /* Offsets of interest from the 'MAP' Block */
+42 -5
arch/mips/netlogic/common/smpboot.S
··· 80 80 * This is the code that will be copied to the reset entry point for 81 81 * XLR and XLP. The XLP cores start here when they are woken up. This 82 82 * is also the NMI entry point. 83 + */ 84 + .macro xlp_flush_l1_dcache 85 + li t0, LSU_DEBUG_DATA0 86 + li t1, LSU_DEBUG_ADDR 87 + li t2, 0 /* index */ 88 + li t3, 0x1000 /* loop count */ 89 + 1: 90 + sll v0, t2, 5 91 + mtcr zero, t0 92 + ori v1, v0, 0x3 /* way0 | write_enable | write_active */ 93 + mtcr v1, t1 94 + 2: 95 + mfcr v1, t1 96 + andi v1, 0x1 /* wait for write_active == 0 */ 97 + bnez v1, 2b 98 + nop 99 + mtcr zero, t0 100 + ori v1, v0, 0x7 /* way1 | write_enable | write_active */ 101 + mtcr v1, t1 102 + 3: 103 + mfcr v1, t1 104 + andi v1, 0x1 /* wait for write_active == 0 */ 105 + bnez v1, 3b 106 + nop 107 + addi t2, 1 108 + bne t3, t2, 1b 109 + nop 110 + .endm 111 + 112 + /* 113 + * The cores can come start when they are woken up. This is also the NMI 114 + * entry, so check that first. 83 115 * 84 116 * The data corresponding to reset/NMI is stored at RESET_DATA_PHYS 85 117 * location, this will have the thread mask (used when core is woken up) ··· 170 138 * a core. 171 139 */ 172 140 EXPORT(nlm_boot_siblings) 141 + /* core L1D flush before enable threads */ 142 + xlp_flush_l1_dcache 173 143 /* Enable hw threads by writing to MAP_THREADMODE of the core */ 174 144 li t0, CKSEG1ADDR(RESET_DATA_PHYS) 175 145 lw t1, BOOT_THREAD_MODE(t0) /* t1 <- thread mode */ ··· 198 164 li t0, MMU_SETUP 199 165 li t1, 0 200 166 mtcr t1, t0 201 - ehb 167 + _ehb 202 168 203 169 2: beqz v0, 4f /* boot cpu (cpuid == 0)? */ 204 170 nop 205 171 206 172 /* setup status reg */ 207 - mfc0 t1, CP0_STATUS 208 - li t0, ST0_BEV 209 - or t1, t0 210 - xor t1, t0 173 + move t1, zero 211 174 #ifdef CONFIG_64BIT 212 175 ori t1, ST0_KX 213 176 #endif ··· 251 220 252 221 __CPUINIT 253 222 NESTED(nlm_boot_secondary_cpus, 16, sp) 223 + /* Initialize CP0 Status */ 224 + move t1, zero 225 + #ifdef CONFIG_64BIT 226 + ori t1, ST0_KX 227 + #endif 228 + mtc0 t1, CP0_STATUS 254 229 PTR_LA t1, nlm_next_sp 255 230 PTR_L sp, 0(t1) 256 231 PTR_LA t1, nlm_next_gp