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)
Oct 4 2024, 5:23 AM
Unknown Object (File)
Oct 4 2024, 1:38 AM
Unknown Object (File)
Oct 1 2024, 11:19 AM
Unknown Object (File)
Sep 24 2024, 4:08 PM
Unknown Object (File)
Sep 9 2024, 9:15 AM
Unknown Object (File)
Sep 7 2024, 4:27 PM
Unknown Object (File)
Aug 20 2024, 9:07 PM
Unknown Object (File)
Aug 18 2024, 5:38 AM
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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.