Skip to content
Commit 1c449636 authored by Nathan Huckleberry's avatar Nathan Huckleberry Committed by Paul Gortmaker
Browse files

riscv/atomic: Fix sign extension for RV64I

commit 6c58f25e upstream.

The argument passed to cmpxchg is not guaranteed to be sign
extended, but lr.w sign extends on RV64I. This makes cmpxchg
fail on clang built kernels when __old is negative.

To fix this, we just cast __old to long which sign extends on
RV64I. With this fix, clang built RISC-V kernels now boot.

Link: https://github.com/ClangBuiltLinux/linux/issues/867


Signed-off-by: default avatarNathan Huckleberry <nhuck@google.com>
Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
parent c92e32d8
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment