lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210525140232.53872-6-mark.rutland@arm.com>
Date:   Tue, 25 May 2021 15:02:04 +0100
From:   Mark Rutland <mark.rutland@....com>
To:     linux-kernel@...r.kernel.org, will@...nel.org,
        boqun.feng@...il.com, peterz@...radead.org
Cc:     aou@...s.berkeley.edu, arnd@...db.de, bcain@...eaurora.org,
        benh@...nel.crashing.org, chris@...kel.net, dalias@...c.org,
        davem@...emloft.net, deanbo422@...il.com, deller@....de,
        geert@...ux-m68k.org, gerg@...ux-m68k.org, green.hu@...il.com,
        guoren@...nel.org, ink@...assic.park.msu.ru,
        James.Bottomley@...senPartnership.com, jcmvbkbc@...il.com,
        jonas@...thpole.se, ley.foon.tan@...el.com, linux@...linux.org.uk,
        mark.rutland@....com, mattst88@...il.com, monstr@...str.eu,
        mpe@...erman.id.au, nickhu@...estech.com, palmerdabbelt@...gle.com,
        paulus@...ba.org, paul.walmsley@...ive.com, rth@...ddle.net,
        shorne@...il.com, stefan.kristiansson@...nalahti.fi,
        tsbogend@...ha.franken.de, vgupta@...opsys.com,
        ysato@...rs.sourceforge.jp
Subject: [PATCH v2 05/33] locking/atomic: openrisc: avoid asm-generic/atomic.h

OpenRISC is the only architecture which uses asm-generic/atomic.h and
also provides its own implementation of some functions, requiring
ifdeferry in the asm-generic header. As OpenRISC provides the vast
majority of functions itself, it would be simpler overall if it also
provided the few functions it cribs from asm-generic.

This patch decouples OpenRISC from asm-generic/atomic.h. Subsequent
patches will simplify the asm-generic implementation and remove the now
unnecessary ifdeferry.

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland <mark.rutland@....com>
Acked-by: Stafford Horne <shorne@...il.com>
Cc: Boqun Feng <boqun.feng@...il.com>
Cc: Jonas Bonn <jonas@...thpole.se>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Stefan Kristiansson <stefan.kristiansson@...nalahti.fi>
Cc: Will Deacon <will@...nel.org>
---
 arch/openrisc/include/asm/atomic.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/openrisc/include/asm/atomic.h b/arch/openrisc/include/asm/atomic.h
index b589fac39b92..cb86970d3859 100644
--- a/arch/openrisc/include/asm/atomic.h
+++ b/arch/openrisc/include/asm/atomic.h
@@ -121,6 +121,12 @@ static inline int atomic_fetch_add_unless(atomic_t *v, int a, int u)
 }
 #define atomic_fetch_add_unless	atomic_fetch_add_unless
 
-#include <asm-generic/atomic.h>
+#define atomic_read(v)			READ_ONCE((v)->counter)
+#define atomic_set(v,i)			WRITE_ONCE((v)->counter, (i))
+
+#include <asm/cmpxchg.h>
+
+#define atomic_xchg(ptr, v)		(xchg(&(ptr)->counter, (v)))
+#define atomic_cmpxchg(v, old, new)	(cmpxchg(&((v)->counter), (old), (new)))
 
 #endif /* __ASM_OPENRISC_ATOMIC_H */
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ