Page MenuHomeFreeBSD

powerpc: Implement atomic_(f)cmpset_ for short and char
ClosedPublic

Authored by jhibbits on Sep 17 2019, 3:14 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Mar 22, 11:47 PM
Unknown Object (File)
Jan 9 2024, 1:03 PM
Unknown Object (File)
Dec 22 2023, 11:51 PM
Unknown Object (File)
Nov 10 2023, 8:25 PM
Unknown Object (File)
Nov 7 2023, 4:51 PM
Unknown Object (File)
Nov 7 2023, 10:00 AM
Unknown Object (File)
Nov 7 2023, 5:35 AM
Unknown Object (File)
Oct 9 2023, 7:14 PM
Subscribers

Details

Summary

This adds two implementations for each atomic_fcmpset_ and
atomic_cmpset_ short and char functions, selectable at compile time for
the target architecture. By default, it uses a shift-and-mask to
perform atomic updates to sub-components of 32-bit words. However, if
ISA_206_ATOMICS is defined it uses the ll/sc instructions for halfword and
bytes, introduced in PowerISA 2.06. These instructions are supported by
all IBM processors from POWER7 on, as well as the Freescale/NXP e6500
core. Although the e5500 and e500mc both implement PowerISA 2.06 they
do not implement these instructions.

As part of this, clean up the atomic_(f)cmpset_acq and _rel wrappers, by
using macros to reduce code duplication.

ISA_206_ATOMICS requires clang or newer binutils (2.20 or later).

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 26528
Build 24925: arc lint + arc unit

Event Timeline

I have applied this patch on top of yours: https://people.freebsd.org/~kevans/ppc-nonisa206.diff -- to just have powerpc/ use the common sys/_atomic_subword.h version entirely if ISA_206_ATOMICS is not defined. That diff also includes atomic_fcmpset_{,acq_,rel_}{8,16} #defines, as those were missed here.

This revision was not accepted when it landed; it landed in state Needs Review.Oct 8 2019, 1:36 AM
This revision was automatically updated to reflect the committed changes.