History log of /netbsd/sys/arch/mips/include/asm.h (Results 1 – 25 of 74)
Revision Date Author Comments
# 487e496d 23-Feb-2023 riastradh <riastradh@NetBSD.org>

mips: Add missing barriers in cpu_switchto.

Details in comments.

PR kern/57240

XXX pullup-8
XXX pullup-9
XXX pullup-10


# 5305eb5c 20-Feb-2023 riastradh <riastradh@NetBSD.org>

mips/asm.h: Make membar macros conditional on MULTIPROCESSOR.

For !MULTIPROCESSOR, define them to be empty or nop as appropriate.


# 375a4a37 13-Feb-2023 riastradh <riastradh@NetBSD.org>

mips/asm.h: Cite source for Cavium sync plunger business.


# 1f66147a 21-Apr-2022 riastradh <riastradh@NetBSD.org>

mips/cavium: Take advantage of Octeon's guaranteed r/rw ordering.


# c41e7acc 09-Apr-2022 riastradh <riastradh@NetBSD.org>

mips/rmi: Hack to get XLSATX64.MP kernel building again.

Using <mips/asm.h> in a .c file is kinda grody but CALLFRAME_SIZ
doesn't seem to be defined anywhere else. Not sure how this was ever
suppos

mips/rmi: Hack to get XLSATX64.MP kernel building again.

Using <mips/asm.h> in a .c file is kinda grody but CALLFRAME_SIZ
doesn't seem to be defined anywhere else. Not sure how this was ever
supposed to work...

show more ...


# e9e65603 27-Feb-2022 riastradh <riastradh@NetBSD.org>

mips: Redefine LLSCSYNC as empty on non-Octeon MP.

This change deletes memory barriers on non-Octeon MP. However, all
the appropriate acquire and release barriers are already used in
mutex stubs, a

mips: Redefine LLSCSYNC as empty on non-Octeon MP.

This change deletes memory barriers on non-Octeon MP. However, all
the appropriate acquire and release barriers are already used in
mutex stubs, and no barriers are needed in atomic_* unless we set
__HAVE_ATOMIC_AS_MEMBAR which we don't on MIPS. So this should be
safe.

Unclear whether we need this even on Octeon -- don't have a clear
reference on why it's here.

show more ...


# 37a0443e 27-Feb-2022 riastradh <riastradh@NetBSD.org>

mips: Redefine BDSYNC as sync on Octeon, not syncw.

BDSYNC is used for membar_sync, which is supposed to be a full
sequential consistency barrier, which is not provided by syncw, so
this is necessar

mips: Redefine BDSYNC as sync on Octeon, not syncw.

BDSYNC is used for membar_sync, which is supposed to be a full
sequential consistency barrier, which is not provided by syncw, so
this is necessary for correctness.

BDSYNC is not used for anything else, so this can't hurt performance,
except where it was necessary for correctness anyway or where the
semantic choice of membar_sync was too strong anyway.

show more ...


# f003b0fd 27-Feb-2022 riastradh <riastradh@NetBSD.org>

mips: Omit needless SYNC in mutex_exit.

This change deletes a memory barrier. However, it should be safe:
The semantic requirement for this is already provided by the SYNC_REL
above, before the ll.

mips: Omit needless SYNC in mutex_exit.

This change deletes a memory barrier. However, it should be safe:
The semantic requirement for this is already provided by the SYNC_REL
above, before the ll. And as currently defined, SYNC_REL is at least
as strong as SYNC, so this change can't hurt correctness on its own
(barring CPU errata, which would apply to other users of SYNC_REL and
can be addressed in the definition of SYNC_REL).

Later, perhaps we can relax SYNC_REL to syncw on Octeon if we prove
that it is correct (e.g., if Octeon follows the SPARCv9 partial store
order semantics).

Nix now-unused SYNC macro in asm.h.

show more ...


# d7d35e4c 27-Feb-2022 riastradh <riastradh@NetBSD.org>

mips: Membar audit.

This change should be safe because it doesn't remove or weaken any
memory barriers, but does add, clarify, or strengthen barriers.

Goals:

- Make sure mutex_enter/exit and mutex

mips: Membar audit.

This change should be safe because it doesn't remove or weaken any
memory barriers, but does add, clarify, or strengthen barriers.

Goals:

- Make sure mutex_enter/exit and mutex_spin_enter/exit have
acquire/release semantics.

- New macros make maintenance easier and purpose clearer:

. SYNC_ACQ is for load-before-load/store barrier, and BDSYNC_ACQ
for a branch delay slot -- currently defined as plain sync for MP
and nothing, or nop, for UP; thus it is no weaker than SYNC and
BDSYNC as currently defined, which is syncw on Octeon, plain sync
on non-Octeon MP, and nothing/nop on UP.

It is not clear to me whether load-then-syncw or ll/sc-then-syncw
or even bare load provides load-acquire semantics on Octeon -- if
no, this will fix bugs; if yes (like it is on SPARC PSO), we can
relax SYNC_ACQ to be syncw or nothing later.

. SYNC_REL is for load/store-before-store barrier -- currently
defined as plain sync for MP and nothing for UP.

It is not clear to me whether syncw-then-store is enough for
store-release on Octeon -- if no, we can leave this as is; if
yes, we can relax SYNC_REL to be syncw on Octeon.

. SYNC_PLUNGER is there to flush clogged Cavium store buffers, and
BDSYNC_PLUNGER for a branch delay slot -- syncw on Octeon,
nothing or nop on non-Octeon.

=> This is not necessary (or, as far as I'm aware, sufficient)
for acquire semantics -- it serves only to flush store buffers
where stores might otherwise linger for hundreds of thousands
of cycles, which would, e.g., cause spin locks to be held for
unreasonably long durations.

Newerish revisions of the MIPS ISA also have finer-grained sync
variants that could be plopped in here.

Mechanism:

Insert these barriers in the right places, replacing only those where
the definition is currently equivalent, so this change is safe.

- Replace #ifdef _MIPS_ARCH_OCTEONP / syncw / #endif at the end of
atomic_cas_* by SYNC_PLUNGER, which is `sync 4' (a.k.a. syncw) if
__OCTEON__ and empty otherwise.

=> From what I can tell, __OCTEON__ is defined in at least as many
contexts as _MIPS_ARCH_OCTEONP -- i.e., there are some Octeons
with no _MIPS_ARCH_OCTEONP, but I don't know if any of them are
relevant to us or ever saw the light of day outside Cavium; we
seem to buid with `-march=octeonp' so this is unlikely to make a
difference. If it turns out that we do care, well, now there's
a central place to make the distinction for sync instructions.

- Replace post-ll/sc SYNC by SYNC_ACQ in _atomic_cas_*, which are
internal kernel versions used in sys/arch/mips/include/lock.h where
it assumes they have load-acquire semantics. Should move this to
lock.h later, since we _don't_ define __HAVE_ATOMIC_AS_MEMBAR on
MIPS and so the extra barrier might be costly.

- Insert SYNC_REL before ll/sc, and replace post-ll/sc SYNC by
SYNC_ACQ, in _ucas_*, which is used without any barriers in futex
code and doesn't mention barriers in the man page so I have to
assume it is required to be a release/acquire barrier.

- Change BDSYNC to BDSYNC_ACQ in mutex_enter and mutex_spin_enter.
This is necessary to provide load-acquire semantics -- unclear if
it was provided already by syncw on Octeon, but it seems more
likely that either (a) no sync or syncw is needed at all, or (b)
syncw is not enough and sync is needed, since syncw is only a
store-before-store ordering barrier.

- Insert SYNC_REL before ll/sc in mutex_exit and mutex_spin_exit.
This is currently redundant with the SYNC already there, but
SYNC_REL more clearly identifies the necessary semantics in case we
want to define it differently on different systems, and having a
sync in the middle of an ll/sc is a bit weird and possibly not a
good idea, so I intend to (carefully) remove the redundant SYNC in
a later change.

- Change BDSYNC to BDSYNC_PLUNGER at the end of mutex_exit. This has
no semantic change right now -- it's syncw on Octeon, sync on
non-Octeon MP, nop on UP -- but we can relax it later to nop on
non-Cavium MP.

- Leave LLSCSYNC in for now -- it is apparently there for a Cavium
erratum, but I'm not sure what the erratum is, exactly, and I have
no reference for it. I suspect these can be safely removed, but we
might have to double up some other syncw instructions -- Linux uses
it only in store-release sequences, not at the head of every ll/sc.

show more ...


# 302f127e 18-Feb-2021 simonb <simonb@NetBSD.org>

Add an abicalls version of asm mcount prologue. XXX not tested because
profiled programs fail to link, but fixes build. Thanks dholland@ for
help analysing this.

While here, rename _KERN_MCOUNT to

Add an abicalls version of asm mcount prologue. XXX not tested because
profiled programs fail to link, but fixes build. Thanks dholland@ for
help analysing this.

While here, rename _KERN_MCOUNT to _MIPS_ASM_MCOUNT - it's not kernel
specific.

show more ...


# a561501c 16-Feb-2021 simonb <simonb@NetBSD.org>

Working kernel profiling for n32/n64:
- Different MCOUNT and _KERN_MCOUNT macros for n32/n64.
- Don't profile mipsXX_lwp_trampoline().
- Allow a few new instructions in the stub fixups.


# 287443ce 04-Feb-2021 skrll <skrll@NetBSD.org>

Use t9 instead of $25 in the SETUP_GP64 macro to hopefully make things
a bit clearer. Same libc binary after.


# 40c3b8f5 26-Sep-2020 simonb <simonb@NetBSD.org>

Add EXPORT_OBJECT - export definition of symbol of symbol type Object,
visible to ksyms(4) address search.


# b3f36c18 12-Aug-2020 skrll <skrll@NetBSD.org>

Provide assmebler versions of BITS(3) macros. These are only good for
32 bit masks


# e2c79b62 10-Aug-2020 skrll <skrll@NetBSD.org>

More SYNC centralisation


# 8fb963fb 09-Aug-2020 skrll <skrll@NetBSD.org>

Use compiler defines to determine which LLSCSYNC, et al
to provide.

This should fix mips builds.


# d1fb23d8 06-Aug-2020 skrll <skrll@NetBSD.org>

Centralise SYNC/BDSYNC in asm.h and introduce a new LLCSCSYNC and use it
before any ll/sc sequences.

Define LLSCSYNC as syncw; syncw for cnMIPS - issue two as early cnMIPS
has errat{um,a} that means

Centralise SYNC/BDSYNC in asm.h and introduce a new LLCSCSYNC and use it
before any ll/sc sequences.

Define LLSCSYNC as syncw; syncw for cnMIPS - issue two as early cnMIPS
has errat{um,a} that means the first can fail.

show more ...


# 19d1a3a3 26-Jul-2020 simonb <simonb@NetBSD.org>

#define<tab>
Nuke trailing whitespace.


# b675da05 17-Apr-2020 joerg <joerg@NetBSD.org>

Mark the .ident section as mergable string section to avoid redundant
entries.


# eaf343dd 04-Sep-2018 mrg <mrg@NetBSD.org>

mark STATIC_NESTED_NOPROFILE() functions as functions.


# 8e3e92fb 25-Feb-2017 joerg <joerg@NetBSD.org>

Switch from __ABICALLS__ to __mips_abicalls like upstream GCC does in
the generic MIPS target logic.


# 0fb66eb4 11-Nov-2016 maya <maya@NetBSD.org>

switch mfc0_hazard to be superscalar nop, some mips3 are superscalar
and need this to do the right thing


# 7a8d115c 09-Nov-2016 maya <maya@NetBSD.org>

Move MFC0_HAZARD definition to asm.h instead of defining it twice


# 6d043714 13-Aug-2016 skrll <skrll@NetBSD.org>

Move the NOP_L macro into asm.h


# ba360862 13-Aug-2016 skrll <skrll@NetBSD.org>

Trailing whitespace


123