rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/2] Rust enablement for AArch64
@ 2023-10-20 15:50 Jamie Cunliffe
  2023-10-20 15:50 ` [PATCH v4 1/2] rust: Refactor the build target to allow the use of builtin targets Jamie Cunliffe
                   ` (2 more replies)
  0 siblings, 3 replies; 41+ messages in thread
From: Jamie Cunliffe @ 2023-10-20 15:50 UTC (permalink / raw)
  To: linux-arm-kernel, rust-for-linux
  Cc: Miguel Ojeda, Catalin Marinas, Will Deacon, steve.capper,
	Asahi Lina, boqun.feng, andrew

Enable Rust support for the AArch64 architecture.

Since the v3 this has been refactored to split up the x86 Makefile
changes. Updated the x86-64 conditionals as suggested by Boqun and
addressed the formatting issues Miguel raised.


Jamie Cunliffe (2):
  rust: Refactor the build target to allow the use of builtin targets
  arm64: rust: Enable Rust support for AArch64

 Documentation/rust/arch-support.rst | 1 +
 Makefile                            | 1 -
 arch/arm64/Kconfig                  | 1 +
 arch/arm64/Makefile                 | 4 ++++
 arch/x86/Makefile                   | 1 +
 rust/Makefile                       | 6 +++++-
 scripts/Makefile                    | 4 +++-
 scripts/generate_rust_target.rs     | 4 +++-
 8 files changed, 18 insertions(+), 4 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 41+ messages in thread
* Re: [PATCH v4 2/2] arm64: rust: Enable Rust support for AArch64
@ 2023-10-24 14:17 Pratham Patel
  2023-10-24 15:19 ` Miguel Ojeda
  0 siblings, 1 reply; 41+ messages in thread
From: Pratham Patel @ 2023-10-24 14:17 UTC (permalink / raw)
  To: boqun.feng
  Cc: Jamie.Cunliffe, andrew, catalin.marinas, lina, linux-arm-kernel,
	linux-clk, mturquette, ojeda, rust-for-linux, sboyd, steve.capper,
	will

On Fri, 20 Oct 2023 11:33:10 -0700, Boqun Feng wrote:
> FWIW, I tried the following:
>
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 8784284988e5..b697c2d7da68 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -227,7 +227,7 @@ config ARM64
>         select HAVE_FUNCTION_ARG_ACCESS_API
>         select MMU_GATHER_RCU_TABLE_FREE
>         select HAVE_RSEQ
> -       select HAVE_RUST if CPU_LITTLE_ENDIAN
> +       select HAVE_RUST
>         select HAVE_STACKPROTECTOR
>         select HAVE_SYSCALL_TRACEPOINTS
>         select HAVE_KPROBES
> diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
> index 4562a8173e90..4621f1e00e06 100644
> --- a/arch/arm64/Makefile
> +++ b/arch/arm64/Makefile
> @@ -41,7 +41,11 @@ KBUILD_CFLAGS        += -mgeneral-regs-only  \
>  KBUILD_CFLAGS  += $(call cc-disable-warning, psabi)
>  KBUILD_AFLAGS  += $(compat_vdso)
>
> +ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
> +KBUILD_RUSTFLAGS += --target aarch64_be-unknown-linux-gnu -C target-feature="-neon"
> +else
>  KBUILD_RUSTFLAGS += --target aarch64-unknown-none -C target-feature="-neon"
> +endif
>
>  KBUILD_CFLAGS  += $(call cc-option,-mabi=lp64)
>  KBUILD_AFLAGS  += $(call cc-option,-mabi=lp64)
>

This comes from a nobody (quite literally my first email on the kernel
mailing list), but I would rather that the support for AArch64 BE be
not added at all. My reasoning for this is because the rustc target
`aarch64_be-unknown-linux-gnu` is in the tier 3 of support. More
details can be found in the official documentation [0], but a few,
**select** key points from that section:

> At this tier, the Rust project provides no official support for a target, so we place minimal requirements on the introduction of targets.

> Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate (core for most targets, alloc for targets that can support dynamic memory allocation, std for targets with an operating system or equivalent layer of system-provided functionality), but may leave some code unimplemented (either unavailable or stubbed out as appropriate), whether because the target makes it impossible to implement or challenging to implement. The authors of pull requests are not obligated to avoid calling any portions of the standard library on the basis of a tier 3 target not implementing those portions.

I am not an owner of any AArch64 BE machines, but if I were, this
would be concerning to _me_. I would prefer waiting for the Rust side
to be a bit more stable, at least in tier 2 support, for adding
AArch64 BE support. Though from the user of the Linux kernel, it may
not be that much of an issue, but from a developer's and packager's
perspective, this will lead to a few wasted hours until the
metaphorical person figures out why said Rust code failed to build for
AArch64 BE.

[0]: https://doc.rust-lang.org/rustc/target-tier-policy.html#tier-3-target-policy

P.S. This is my first time sending an email to a mailing list, sorry
if I mucked something up.

^ permalink raw reply	[flat|nested] 41+ messages in thread

end of thread, other threads:[~2024-02-09 21:41 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-20 15:50 [PATCH v4 0/2] Rust enablement for AArch64 Jamie Cunliffe
2023-10-20 15:50 ` [PATCH v4 1/2] rust: Refactor the build target to allow the use of builtin targets Jamie Cunliffe
2023-10-22 10:55   ` Catalin Marinas
2023-10-22 11:07     ` Ingo Molnar
2023-10-31  0:24       ` Trevor Gross
2023-10-31 11:58         ` Catalin Marinas
2023-10-31 19:01           ` Trevor Gross
2023-12-12 16:47           ` Will Deacon
2024-01-22  9:17   ` Trevor Gross
2024-01-25  3:19     ` WANG Rui
2024-01-26 19:37       ` Masahiro Yamada
2024-01-27  5:08         ` WANG Rui
2024-01-27 17:31           ` Miguel Ojeda
2024-01-22  9:29   ` Alice Ryhl
2024-01-24  9:12   ` Masahiro Yamada
2023-10-20 15:50 ` [PATCH v4 2/2] arm64: rust: Enable Rust support for AArch64 Jamie Cunliffe
2023-10-20 16:45   ` Catalin Marinas
2023-10-21 13:40     ` Miguel Ojeda
2023-10-22 10:48       ` Catalin Marinas
2023-10-22 12:14         ` Miguel Ojeda
2023-10-20 17:21   ` Andrew Lunn
2023-10-20 18:33     ` Boqun Feng
2023-10-20 18:47       ` Andrew Lunn
2023-10-21 12:50       ` Alice Ryhl
2023-10-21 13:41       ` Miguel Ojeda
2023-10-21 16:03         ` Andrew Lunn
2023-10-22 12:57           ` Miguel Ojeda
2023-10-24  0:57       ` Stephen Boyd
2023-10-25 23:55         ` Boqun Feng
2023-11-01 15:04       ` Linus Walleij
2023-10-31 18:31   ` Matthew Maurer
2023-11-28 18:29     ` Boqun Feng
2023-12-13 19:00     ` Miguel Ojeda
2024-01-22  2:01   ` Fabien Parent
2024-01-22  5:27   ` Behme Dirk (CM/ESO2)
2024-01-22  9:30   ` Alice Ryhl
2024-02-09 17:38 ` [PATCH v4 0/2] Rust enablement " Catalin Marinas
2024-02-09 21:41   ` Miguel Ojeda
  -- strict thread matches above, loose matches on Subject: below --
2023-10-24 14:17 [PATCH v4 2/2] arm64: rust: Enable Rust support " Pratham Patel
2023-10-24 15:19 ` Miguel Ojeda
2023-10-25  2:01   ` Pratham Patel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).