From nobody Sat Sep 20 20:21:51 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4cTglK4L01z68LwT; Sat, 20 Sep 2025 20:22:05 +0000 (UTC) (envelope-from chmeee@has.gonegalt.net) Received: from mail.gonegalt.net (mail.gonegalt.net [208.167.253.104]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4cTglK1f7Jz3J8N; Sat, 20 Sep 2025 20:22:05 +0000 (UTC) (envelope-from chmeee@has.gonegalt.net) Authentication-Results: mx1.freebsd.org; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gonegalt.net; s=dkim; t=1758399723; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TSHUOs5KaH+MIKofAkszlBM0j+bLwv+wuXnd7HkfUek=; b=cH8/YcVIHFv2GWSNgUsEEf61syVpFYYJmRAgku6v9qncpmzmL5LGwAzOrwq5fSJX4UY52N uegA8FVxqFwB7oAQnCBaTba3FwZUhqcQzj+6bj+7Ly7w0pUQ+IYjB8yxA5D6sMseP5T0I8 UBNiqZurFEAkFzM3XkzrktW2T4LIhjo= Received: by localhost (OpenSMTPD) with ESMTP id 10ba77dc; Sat, 20 Sep 2025 16:22:03 -0400 (EDT) Received: from ralga.knownspace ([2600:2b00:a720:d301:9f03:382a:d672:81f0]) by mail.gonegalt.net with ESMTPSA id 0fh1F+sMz2hTegEA0J78UA (envelope-from ); Sat, 20 Sep 2025 16:22:03 -0400 Date: Sat, 20 Sep 2025 16:21:51 -0400 From: Justin Hibbits To: Konstantin Belousov Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: b31abc95eb73 - main - arm, powerpc, riscv: implement atomic_set/clear_16 Message-ID: <20250920162151.05aad15b@ralga.knownspace> In-Reply-To: <202509201934.58KJYO0O040235@gitrepo.freebsd.org> References: <202509201934.58KJYO0O040235@gitrepo.freebsd.org> X-Mailer: Claws Mail 4.3.1 (GTK 3.24.50; powerpc64le-unknown-linux-gnu) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Queue-Id: 4cTglK1f7Jz3J8N On Sat, 20 Sep 2025 19:34:24 GMT Konstantin Belousov wrote: > The branch main has been updated by kib: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=b31abc95eb730d566891e134ba14af852645f772 > > commit b31abc95eb730d566891e134ba14af852645f772 > Author: Konstantin Belousov > AuthorDate: 2025-09-19 18:01:47 +0000 > Commit: Konstantin Belousov > CommitDate: 2025-09-20 19:23:54 +0000 > > arm, powerpc, riscv: implement atomic_set/clear_16 > > Reviewed by: jrtc27, markj > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D52626 > --- > sys/arm/include/atomic.h | 3 +++ > sys/powerpc/include/atomic.h | 33 ++++++++++++++++++++++++++++++++- > sys/riscv/include/atomic.h | 3 +++ > sys/sys/_atomic_subword.h | 28 ++++++++++++++++++++++++++++ > 4 files changed, 66 insertions(+), 1 deletion(-) > > diff --git a/sys/arm/include/atomic.h b/sys/arm/include/atomic.h > index f3313b136656..c180ceaca142 100644 > --- a/sys/arm/include/atomic.h > +++ b/sys/arm/include/atomic.h > @@ -1110,4 +1110,7 @@ atomic_thread_fence_seq_cst(void) > */ > #include > > +#define atomic_set_short atomic_set_16 > +#define atomic_clear_short atomic_clear_16 > + > #endif /* _MACHINE_ATOMIC_H_ */ > diff --git a/sys/powerpc/include/atomic.h > b/sys/powerpc/include/atomic.h index 015a283e2de7..b2d7549e5bd0 100644 > --- a/sys/powerpc/include/atomic.h > +++ b/sys/powerpc/include/atomic.h > @@ -1137,7 +1137,38 @@ atomic_thread_fence_seq_cst(void) > #define atomic_cmpset_short atomic_cmpset_16 > #define atomic_fcmpset_char atomic_fcmpset_8 > #define atomic_fcmpset_short atomic_fcmpset_16 > -#endif > +#define atomic_set_short atomic_set_16 > +#define atomic_clear_short atomic_clear_16 > +#else > + > +static __inline void > +atomic_set_short(volatile u_short *p, u_short bit) > +{ > + u_short v; > + > + v = atomic_load_short(p); > + for (;;) { > + if (atomic_fcmpset_16(p, &v, v | bit)) > + break; > + } > +} > + > +static __inline void > +atomic_clear_short(volatile u_short *p, u_short bit) > +{ > + u_short v; > + > + v = atomic_load_short(p); > + for (;;) { > + if (atomic_fcmpset_16(p, &v, v & ~bit)) > + break; > + } > +} > + > +#define atomic_set_16 atomic_set_short > +#define atomic_clear_16 atomic_clear_short > + > +#endif /* ISA_206_ATOMICS */ > > /* These need sys/_atomic_subword.h on non-ISA-2.06-atomic > platforms. */ ATOMIC_CMPSET_ACQ_REL(char); > diff --git a/sys/riscv/include/atomic.h b/sys/riscv/include/atomic.h > index 74ffc171b028..c90cb02c482c 100644 > --- a/sys/riscv/include/atomic.h > +++ b/sys/riscv/include/atomic.h > @@ -656,4 +656,7 @@ atomic_thread_fence_seq_cst(void) > > #include > > +#define atomic_set_short atomic_set_16 > +#define atomic_clear_short atomic_clear_16 > + > #endif /* _MACHINE_ATOMIC_H_ */ > diff --git a/sys/sys/_atomic_subword.h b/sys/sys/_atomic_subword.h > index dee5a3bed871..284e2bfa340f 100644 > --- a/sys/sys/_atomic_subword.h > +++ b/sys/sys/_atomic_subword.h > @@ -205,4 +205,32 @@ atomic_load_acq_16(const volatile uint16_t *p) > #undef _ATOMIC_BYTE_SHIFT > #undef _ATOMIC_HWORD_SHIFT > > +#ifndef atomic_set_16 > +static __inline void > +atomic_set_16(volatile uint16_t *p, uint16_t bit) > +{ > + uint16_t v; > + > + v = atomic_load_16(p); > + for (;;) { > + if (atomic_fcmpset_16(p, &v, v | bit)) > + break; > + } > +} > +#endif > + > +#ifndef atomic_clear_16 > +static __inline void > +atomic_clear_16(volatile uint16_t *p, uint16_t bit) > +{ > + uint16_t v; > + > + v = atomic_load_16(p); > + for (;;) { > + if (atomic_fcmpset_16(p, &v, v & ~bit)) > + break; > + } > +} > +#endif > + > #endif /* _SYS__ATOMIC_SUBWORD_H_ */ I'll do a follow-up on this soon (next few days) for the ISA_206_ATOMICS case. - Justin