Index: sys/arch/evbmips/cavium/machdep.c =================================================================== RCS file: /cvsroot/src/sys/arch/evbmips/cavium/machdep.c,v retrieving revision 1.10 diff -u -p -r1.10 machdep.c --- sys/arch/evbmips/cavium/machdep.c 28 Dec 2016 03:27:08 -0000 1.10 +++ sys/arch/evbmips/cavium/machdep.c 24 Jan 2018 07:15:01 -0000 @@ -364,8 +364,11 @@ mach_init_memory(u_quad_t memsize) #ifdef MULTIPROCESSOR - const u_int cores = mipsNN_cp0_ebase_read() & MIPS_EBASE_CPUNUM; - mem_clusters[0].start = cores * 4096; + //const u_int cores = mipsNN_cp0_ebase_read() & MIPS_EBASE_CPUNUM; + //KASSERTMSG(cores == 2, "cores %d", cores); + const u_int cores = 2; + mem_clusters[0].start += cores * PAGE_SIZE; + mem_clusters[0].size -= cores * PAGE_SIZE; #endif /* Index: sys/arch/mips/mips/cpu_subr.c =================================================================== RCS file: /cvsroot/src/sys/arch/mips/mips/cpu_subr.c,v retrieving revision 1.33 diff -u -p -r1.33 cpu_subr.c --- sys/arch/mips/mips/cpu_subr.c 20 Aug 2017 11:06:35 -0000 1.33 +++ sys/arch/mips/mips/cpu_subr.c 24 Jan 2018 07:15:05 -0000 @@ -124,10 +124,11 @@ cpu_info_alloc(struct pmap_tlb_info *ti, KASSERT(cpu_id < MAXCPUS); #ifdef MIPS64_OCTEON - vaddr_t exc_page = MIPS_UTLB_MISS_EXC_VEC + 0x1000*cpu_id; - __CTASSERT(sizeof(struct cpu_info) + sizeof(struct pmap_tlb_info) <= 0x1000 - 0x280); + KASSERT(cpu_id == 1); + vaddr_t exc_page = MIPS_UTLB_MISS_EXC_VEC + PAGE_SIZE*cpu_id; + __CTASSERT(sizeof(struct cpu_info) + sizeof(struct pmap_tlb_info) <= PAGE_SIZE - 0x280); - struct cpu_info * const ci = ((struct cpu_info *)(exc_page + 0x1000)) - 1; + struct cpu_info * const ci = ((struct cpu_info *)(exc_page + PAGE_SIZE)) - 1; memset((void *)exc_page, 0, PAGE_SIZE); if (ti == NULL) { Index: sys/arch/mips/mips/lock_stubs_llsc.S =================================================================== RCS file: /cvsroot/src/sys/arch/mips/mips/lock_stubs_llsc.S,v retrieving revision 1.8 diff -u -p -r1.8 lock_stubs_llsc.S --- sys/arch/mips/mips/lock_stubs_llsc.S 24 Aug 2017 14:26:16 -0000 1.8 +++ sys/arch/mips/mips/lock_stubs_llsc.S 24 Jan 2018 07:15:05 -0000 @@ -185,13 +185,13 @@ END(llsc_ucaserr) * void mutex_enter(kmutex_t *mtx); */ STATIC_LEAF(llsc_mutex_enter) - PTR_LL t0, MTX_OWNER(a0) 1: + PTR_LL t0, MTX_OWNER(a0) bnez t0, 2f move t2, MIPS_CURLWP PTR_SC t2, MTX_OWNER(a0) beqz t2, 1b - PTR_LL t0, MTX_OWNER(a0) + nop j ra BDSYNC 2: @@ -223,9 +223,9 @@ END(llsc_mutex_exit) */ STATIC_NESTED(llsc_mutex_spin_enter, CALLFRAME_SIZ, ra) move t0, a0 - PTR_L t2, L_CPU(MIPS_CURLWP) INT_L a0, MTX_IPL(t0) #ifdef PARANOIA + PTR_L t2, L_CPU(MIPS_CURLWP) INT_L ta1, CPU_INFO_CPL(t2) #endif @@ -243,6 +243,7 @@ STATIC_NESTED(llsc_mutex_spin_enter, CAL nop #endif /* PARANOIA */ + PTR_L t2, L_CPU(MIPS_CURLWP) /* * If this is the first lock of the mutex, store the previous IPL for * exit. Even if an interrupt happens, the mutex count will not change.