diff options
| author | riastradh <riastradh@NetBSD.org> | 2022-07-20 10:07:49 +0000 |
|---|---|---|
| committer | riastradh <riastradh@NetBSD.org> | 2022-07-20 10:07:49 +0000 |
| commit | de8ed7dabc93eee42aed85d002fe823cc1b039d0 (patch) | |
| tree | 630d964247243d6755ba77de3f4114a7b34db29f /sys | |
| parent | 54a6d68a47f366530b5abe334284027cc6eeaa14 (diff) | |
mips: Fix cpuids synchronization at boot.
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/arch/mips/mips/cpu_subr.c | 10 | ||||
| -rw-r--r-- | sys/arch/mips/mips/locore_octeon.S | 12 |
2 files changed, 13 insertions, 9 deletions
diff --git a/sys/arch/mips/mips/cpu_subr.c b/sys/arch/mips/mips/cpu_subr.c index 6ded272faf3..4eed4ff8d5b 100644 --- a/sys/arch/mips/mips/cpu_subr.c +++ b/sys/arch/mips/mips/cpu_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: cpu_subr.c,v 1.61 2022/03/28 12:38:58 riastradh Exp $ */ +/* $NetBSD: cpu_subr.c,v 1.62 2022/07/20 10:07:49 riastradh Exp $ */ /*- * Copyright (c) 2010, 2019 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.61 2022/03/28 12:38:58 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.62 2022/07/20 10:07:49 riastradh Exp $"); #include "opt_cputype.h" #include "opt_ddb.h" @@ -273,10 +273,12 @@ cpu_attach_common(device_t self, struct cpu_info *ci) if (ci != &cpu_info_store) { /* * Tail insert this onto the list of cpu_info's. + * atomic_store_release matches PTR_L/SYNC_ACQ in + * locore_octeon.S (XXX what about non-Octeon?). */ KASSERT(cpuid_infos[ci->ci_cpuid] == NULL); - cpuid_infos[ci->ci_cpuid] = ci; - membar_producer(); + atomic_store_release(&cpuid_infos[ci->ci_cpuid], ci); + membar_producer(); /* Cavium sync plunger */ } KASSERT(cpuid_infos[ci->ci_cpuid] != NULL); evcnt_attach_dynamic(&ci->ci_evcnt_synci_activate_rqst, diff --git a/sys/arch/mips/mips/locore_octeon.S b/sys/arch/mips/mips/locore_octeon.S index 676360c23af..45ea204fb6d 100644 --- a/sys/arch/mips/mips/locore_octeon.S +++ b/sys/arch/mips/mips/locore_octeon.S @@ -1,4 +1,4 @@ -/* $NetBSD: locore_octeon.S,v 1.13 2020/07/28 00:35:38 simonb Exp $ */ +/* $NetBSD: locore_octeon.S,v 1.14 2022/07/20 10:07:49 riastradh Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -27,7 +27,7 @@ */ #include <mips/asm.h> -RCSID("$NetBSD: locore_octeon.S,v 1.13 2020/07/28 00:35:38 simonb Exp $") +RCSID("$NetBSD: locore_octeon.S,v 1.14 2022/07/20 10:07:49 riastradh Exp $") #include "cpunode.h" /* for NWDOG */ #include "opt_cputype.h" @@ -37,7 +37,7 @@ RCSID("$NetBSD: locore_octeon.S,v 1.13 2020/07/28 00:35:38 simonb Exp $") #include <mips/cpuregs.h> #include <arch/mips/cavium/dev/octeon_corereg.h> -RCSID("$NetBSD: locore_octeon.S,v 1.13 2020/07/28 00:35:38 simonb Exp $") +RCSID("$NetBSD: locore_octeon.S,v 1.14 2022/07/20 10:07:49 riastradh Exp $") #include "assym.h" @@ -141,8 +141,10 @@ NESTED_NOPROFILE(octeon_cpu_spinup, 0, ra) PTR_LA a1, _C_LABEL(cpuid_infos) dsll v0, s0, PTR_SCALESHIFT # cpunum -> array index PTR_ADD t0, a1, v0 # add to array start -1: sync - PTR_L a1, (t0) # get cpu_info pointer +1: PTR_L a1, (t0) # get cpu_info pointer + SYNC_ACQ # PTR_L/SYNC_ACQ matches + # atomic_store_release in + # cpu_attach_common beqz a1, 1b # loop until non-NULL nop |
