Rust-for-Linux / linux

Adding support for the Rust language to the Linux kernel.
https://rust-for-linux.com
Other
3.84k stars 399 forks source link

Support powerpc #105

Open alex opened 3 years ago

alex commented 3 years ago

PowerPC 64-bits little-endian is supported by Ubuntu, Red Hat and Debian, which means we should eventually support the ppc64el architecture.

Linux powerpc targets with official Ubuntu binutils etc. support:

Linux arch  QEMU target     LLVM target  Ubuntu binutils                 Example Rust triple
----------  --------------  -----------  ------------------------------  -------------------

powerpc     ppc-softmmu     PowerPC      binutils-powerpc-linux-gnu      powerpc-unknown-linux-gnu
powerpc     ppc64-softmmu   PowerPC      binutils-powerpc64le-linux-gnu  powerpc64-unknown-linux-gnu
alex commented 3 years ago

These platforms selected because they're also well supported by Rust-for-LLVM.

Which leads me to a question... both MIPS and PPC come in BE and LE variants, does anyone know off hand which the kernel implements (or both?)? /cc @nickdesaulniers

ojeda commented 3 years ago

Both, although little-endian are the important one (e.g. ppc64el is supported by Ubuntu and Red Hat, mipsel and mips64el by Debian).

Let me split the arches into issues, I will also create the s390x and add a couple details that may help.

alex commented 3 years ago

Sounds good, thanks!

On Sun, Mar 14, 2021 at 3:12 PM Miguel Ojeda @.***> wrote:

Both, although little-endian are the important one (e.g. ppc64el is supported by Ubuntu and Red Hat, mipsel and mips64el by Debian).

Let me split the arches into issues, I will also create the s390x and add a couple details that may help.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Rust-for-Linux/linux/issues/105#issuecomment-798962197, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAAGBFUVEU63DBHL2VSCOTTDUDADANCNFSM4ZFG5XWQ .

-- All that is necessary for evil to succeed is for good people to do nothing.

alex commented 3 years ago

Patchset for ppc64le was sent to the mailing list.

ojeda commented 3 years ago

Link: https://lore.kernel.org/rust-for-linux/20210323032624.1039422-1-mpe@ellerman.id.au/

alex commented 3 years ago

Basic support landed -- we should add this to the documentation and close this issue.

ojeda commented 3 years ago

We could keep this open, at least until we get "most" of the ppc support in place (e.g. the rest of the CI, GCC or not, etc.).

jhamby commented 3 years ago

I'm interested in testing ppc64 big-endian mode on my PowerMac quad G5, which is missing little-endian support at the CPU level. I've been working to add features to the KVM module for the usermode emulation (the G5 also lacks the hypervisor added in POWER7, so it only runs the KVM-PR module, not KVM-HV).

I like how the ppc C code is written to be correct whether built for 32-bit or 64-bit, big-endian or little-endian, and 4K or 64K page sizes, based on preprocessor defines. You already have PAGE_SIZE and byte order support in Rust, and types that map to long and ulong. If you can write conditional code based on whether CONFIG_64BIT is set in the kernel config, there shouldn't be any problems getting all eight combinations working on ppc. I've had good luck so far with Rust itself on ppc64 BE.