Re: [PATCH v5 01/10] rust: Introduce atomic API helpers

Andreas Hindborg
2025-06-26T08:44:24Z

"Boqun Feng" <boqun.feng@gmail.com> writes:

> In order to support LKMM atomics in Rust, add rust_helper_* for atomic
> APIs. These helpers ensure the implementation of LKMM atomics in Rust is
> the same as in C. This could save the maintenance burden of having two
> similar atomic implementations in asm.
>
> Originally-by: Mark Rutland <mark.rutland@arm.com>
> Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
> ---
> rust/helpers/atomic.c | 1038 +++++++++++++++++++++
> rust/helpers/helpers.c | 1 +
> scripts/atomic/gen-atomics.sh | 1 +
> scripts/atomic/gen-rust-atomic-helpers.sh | 65 ++
> 4 files changed, 1105 insertions(+)
> create mode 100644 rust/helpers/atomic.c
> create mode 100755 scripts/atomic/gen-rust-atomic-helpers.sh
>
> diff --git a/rust/helpers/atomic.c b/rust/helpers/atomic.c
> new file mode 100644
> index 000000000000..00bf10887928
> --- /dev/null
> +++ b/rust/helpers/atomic.c
> @@ -0,0 +1,1038 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +// Generated by scripts/atomic/gen-rust-atomic-helpers.sh
> +// DO NOT MODIFY THIS FILE DIRECTLY

If this file is generated, why check it in? Can't we run the generator
at build time?

Best regards,
Andreas Hindborg