git: cbb9027cf10e - stable/12 - Two minor issues: (1) Don't define load/store 64 atomics for o32. They aren't atomic there. (2) Add comment about why we need 64 atomic define on n32 only.

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Wed, 06 Oct 2021 19:40:25 UTC
The branch stable/12 has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=cbb9027cf10e2fa465e114e411e3132115508054

commit cbb9027cf10e2fa465e114e411e3132115508054
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2019-12-17 03:20:37 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2021-10-06 19:40:10 +0000

    Two minor issues:
    (1) Don't define load/store 64 atomics for o32. They aren't atomic
    there.
    (2) Add comment about why we need 64 atomic define on n32 only.
    
    (cherry picked from commit fa9b4635f0874eedc3d908f2cd21746680c8c2ed)
---
 sys/mips/include/atomic.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/sys/mips/include/atomic.h b/sys/mips/include/atomic.h
index 0ede70d82202..3643375351f5 100644
--- a/sys/mips/include/atomic.h
+++ b/sys/mips/include/atomic.h
@@ -344,10 +344,16 @@ atomic_store_rel_##WIDTH(__volatile uint##WIDTH##_t *p, uint##WIDTH##_t v)\
 }
 
 ATOMIC_STORE_LOAD(32)
+#if defined(__mips_n64) || defined(__mips_n32)
 ATOMIC_STORE_LOAD(64)
+#endif
 #undef ATOMIC_STORE_LOAD
 
-#ifdef __mips_n32
+/*
+ * MIPS n32 is not a LP64 API, so atomic_load_64 isn't defined there. Define it
+ * here since n32 is an oddball !LP64 but that can do 64-bit atomics.
+ */
+#if defined(__mips_n32)
 #define	atomic_load_64	atomic_load_acq_64
 #endif