Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support powerpc #105

Open
alex opened this issue Mar 14, 2021 · 8 comments
Open

Support powerpc #105

alex opened this issue Mar 14, 2021 · 8 comments
Labels
• arch Related to a particular arch, `arch/` support in general...

Comments

@alex
Copy link
Member

alex commented Mar 14, 2021

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 alex added upstream - optional • misc Related to other topics (e.g. CI). labels Mar 14, 2021
@alex
Copy link
Member Author

alex commented Mar 14, 2021

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
Copy link
Member

ojeda commented Mar 14, 2021

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.

@ojeda ojeda changed the title Add powerpc and mips support Support powerpc Mar 14, 2021
@alex
Copy link
Member Author

alex commented Mar 14, 2021 via email

@ojeda ojeda added • arch Related to a particular arch, `arch/` support in general... prio: normal and removed • misc Related to other topics (e.g. CI). upstream - optional labels Mar 18, 2021
@alex
Copy link
Member Author

alex commented Mar 23, 2021

Patchset for ppc64le was sent to the mailing list.

@ojeda
Copy link
Member

ojeda commented Mar 23, 2021

@alex
Copy link
Member Author

alex commented Mar 31, 2021

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

@ojeda
Copy link
Member

ojeda commented Mar 31, 2021

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
Copy link

jhamby commented Apr 14, 2021

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.

ojeda pushed a commit that referenced this issue May 4, 2022
On PREEMPT_RT kernel and KASAN is enabled.  the kasan_record_aux_stack()
may call alloc_pages(), and the rt-spinlock will be acquired, if currently
in atomic context, will trigger warning:

  BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:46
  in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 239, name: bootlogd
  Preemption disabled at:
  [<ffffffffbab1a531>] rt_mutex_slowunlock+0xa1/0x4e0
  CPU: 3 PID: 239 Comm: bootlogd Tainted: G        W 5.17.1-rt17-yocto-preempt-rt+ #105
  Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.15.0-0-g2dd4b9b3f840-prebuilt.qemu.org 04/01/2014
  Call Trace:
     __might_resched.cold+0x13b/0x173
     rt_spin_lock+0x5b/0xf0
     get_page_from_freelist+0x20c/0x1610
     __alloc_pages+0x25e/0x5e0
     __stack_depot_save+0x3c0/0x4a0
     kasan_save_stack+0x3a/0x50
     __kasan_record_aux_stack+0xb6/0xc0
     kasan_record_aux_stack+0xe/0x10
     irq_work_queue_on+0x6a/0x1c0
     pull_rt_task+0x631/0x6b0
     do_balance_callbacks+0x56/0x80
     __balance_callbacks+0x63/0x90
     rt_mutex_setprio+0x349/0x880
     rt_mutex_slowunlock+0x22a/0x4e0
     rt_spin_unlock+0x49/0x80
     uart_write+0x186/0x2b0
     do_output_char+0x2e9/0x3a0
     n_tty_write+0x306/0x800
     file_tty_write.isra.0+0x2af/0x450
     tty_write+0x22/0x30
     new_sync_write+0x27c/0x3a0
     vfs_write+0x3f7/0x5d0
     ksys_write+0xd9/0x180
     __x64_sys_write+0x43/0x50
     do_syscall_64+0x44/0x90
     entry_SYSCALL_64_after_hwframe+0x44/0xae

Fix it by using kasan_record_aux_stack_noalloc() to avoid the call to
alloc_pages().

Link: https://lkml.kernel.org/r/20220402142555.2699582-1-qiang1.zhang@intel.com
Signed-off-by: Zqiang <qiang1.zhang@intel.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
y86-dev pushed a commit to y86-dev/linux that referenced this issue Oct 3, 2022
Broadcom 4377 controllers found in Apple x86 Macs with the T2 chip
claim to support extended scanning when querying supported states,

< HCI Command: LE Read Supported St.. (0x08|0x001c) plen 0  Rust-for-Linux#27 [hci0] 2.971839
> HCI Event: Command Complete (0x0e) plen 12                Rust-for-Linux#28 [hci0] 2.972730
      LE Read Supported States (0x08|0x001c) ncmd 1
        Status: Success (0x00)
        States: 0x000003ffffffffff
[...]
          LE Set Extended Scan Parameters (Octet 37 - Bit 5)
          LE Set Extended Scan Enable (Octet 37 - Bit 6)
[...]

, but then fail to actually implement the extended scanning:

< HCI Command: LE Set Extended Sca.. (0x08|0x0041) plen 8  Rust-for-Linux#105 [hci0] 5.460776
        Own address type: Random (0x01)
        Filter policy: Accept all advertisement (0x00)
        PHYs: 0x01
        Entry 0: LE 1M
          Type: Active (0x01)
          Interval: 11.250 msec (0x0012)
          Window: 11.250 msec (0x0012)
> HCI Event: Command Complete (0x0e) plen 4                Rust-for-Linux#106 [hci0] 5.461777
      LE Set Extended Scan Parameters (0x08|0x0041) ncmd 1
        Status: Unknown HCI Command (0x01)

Signed-off-by: Sven Peter <sven@svenpeter.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
• arch Related to a particular arch, `arch/` support in general...
Development

No branches or pull requests

3 participants