mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
RISC-V Fixes for 6.10-rc2
* A fix to avoid pt_regs aliasing with idle thread stacks on secondary harts. * HAVE_ARCH_HUGE_VMAP is enabled on XIP kernels, which fixes boot issues on XIP systems with huge pages. * An update to the uABI documentation clarifying that only scalar misaligned accesses were grandfathered in as supported, as the vector extension did not exist at the time the uABI was frozen. * A fix for the recently-added byte/half atomics to avoid losing the fully ordered decorations. -----BEGIN PGP SIGNATURE----- iQJHBAABCAAxFiEEKzw3R0RoQ7JKlDp6LhMZ81+7GIkFAmZZ9VkTHHBhbG1lckBk YWJiZWx0LmNvbQAKCRAuExnzX7sYiW5HD/93b41B8trlOWwDdLoMtHYT0qyPy6yC 4YG20Yi0hXjLqw+6ZxmxUkUVwMU2T5l3RlIW9dsG0i/YXzAF73nNlOU62ihfMdyx /qG2zdo+Q/Z82ahQowgs4R+FaNUJrxGXrXFmO2A2PSZUb/SW7fzTUPzDQsSBlte9 6SHpVXdaDSBkLLpH06Gy2IbQ2xtrBLEPxjjsK3YUIgW00a0VN3dw3MZzIAawYt1c dAF5yGLy8VP0ay/MTbdDHupV9EU74pdpyrCkOStjCrGYHiJ6WBGEbLsfi7OM1eRy KTJ/HuVeIm38vh+Q1LClm+vizr81FE7i/+x/3dQ+S0tw7+4O+BNbxKYeT0RqNHDF 2JMup3EZulIJ2Ob4lBvamJP5Yid0VeChEiH43xm4TbJdUiAh9xS2RISru+dgxXhl nFHrqs/wwDxRmzaOB38nbq3OpkP2dEq+agON1dioH3OCWDLPrm6nUbl3bYR3IXSS LWbeBQOe4cImdVOt1QTF66he6PT/H7Ly9E+PxWHFjdFXwtZNF0xrjoAEyk4fj0Rf E17H2QdTLzqpdvu16OdxAtMFQiWjxsE/luwz2rYvfXvtPaIwcMu3oWuxZDRY8xCW i/snVIVdnHNaXnJRm9ttDLc0aX5Fuq7MMH8nqZH5RQnSUn7La9qBDoftjSoH4imL AccsI6pVOaipvg== =KSav -----END PGP SIGNATURE----- Merge tag 'riscv-for-linus-6.10-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux Pull RISC-V fixes from Palmer Dabbelt: - A fix to avoid pt_regs aliasing with idle thread stacks on secondary harts. - HAVE_ARCH_HUGE_VMAP is enabled on XIP kernels, which fixes boot issues on XIP systems with huge pages. - An update to the uABI documentation clarifying that only scalar misaligned accesses were grandfathered in as supported, as the vector extension did not exist at the time the uABI was frozen. - A fix for the recently-added byte/half atomics to avoid losing the fully ordered decorations. * tag 'riscv-for-linus-6.10-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: riscv: Fix fully ordered LR/SC xchg[8|16]() implementations Documentation: RISC-V: uabi: Only scalar misaligned loads are supported riscv: enable HAVE_ARCH_HUGE_VMAP for XIP kernel riscv: prevent pt_regs corruption for secondary idle threads
This commit is contained in:
commit
c6cc9799b4
@ -65,4 +65,6 @@ the extension, or may have deliberately removed it from the listing.
|
||||
Misaligned accesses
|
||||
-------------------
|
||||
|
||||
Misaligned accesses are supported in userspace, but they may perform poorly.
|
||||
Misaligned scalar accesses are supported in userspace, but they may perform
|
||||
poorly. Misaligned vector accesses are only supported if the Zicclsm extension
|
||||
is supported.
|
||||
|
@ -106,7 +106,7 @@ config RISCV
|
||||
select HAS_IOPORT if MMU
|
||||
select HAVE_ARCH_AUDITSYSCALL
|
||||
select HAVE_ARCH_HUGE_VMALLOC if HAVE_ARCH_HUGE_VMAP
|
||||
select HAVE_ARCH_HUGE_VMAP if MMU && 64BIT && !XIP_KERNEL
|
||||
select HAVE_ARCH_HUGE_VMAP if MMU && 64BIT
|
||||
select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
|
||||
select HAVE_ARCH_JUMP_LABEL_RELATIVE if !XIP_KERNEL
|
||||
select HAVE_ARCH_KASAN if MMU && 64BIT
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include <asm/fence.h>
|
||||
|
||||
#define __arch_xchg_masked(prepend, append, r, p, n) \
|
||||
#define __arch_xchg_masked(sc_sfx, prepend, append, r, p, n) \
|
||||
({ \
|
||||
u32 *__ptr32b = (u32 *)((ulong)(p) & ~0x3); \
|
||||
ulong __s = ((ulong)(p) & (0x4 - sizeof(*p))) * BITS_PER_BYTE; \
|
||||
@ -25,7 +25,7 @@
|
||||
"0: lr.w %0, %2\n" \
|
||||
" and %1, %0, %z4\n" \
|
||||
" or %1, %1, %z3\n" \
|
||||
" sc.w %1, %1, %2\n" \
|
||||
" sc.w" sc_sfx " %1, %1, %2\n" \
|
||||
" bnez %1, 0b\n" \
|
||||
append \
|
||||
: "=&r" (__retx), "=&r" (__rc), "+A" (*(__ptr32b)) \
|
||||
@ -46,7 +46,8 @@
|
||||
: "memory"); \
|
||||
})
|
||||
|
||||
#define _arch_xchg(ptr, new, sfx, prepend, append) \
|
||||
#define _arch_xchg(ptr, new, sc_sfx, swap_sfx, prepend, \
|
||||
sc_append, swap_append) \
|
||||
({ \
|
||||
__typeof__(ptr) __ptr = (ptr); \
|
||||
__typeof__(*(__ptr)) __new = (new); \
|
||||
@ -55,15 +56,15 @@
|
||||
switch (sizeof(*__ptr)) { \
|
||||
case 1: \
|
||||
case 2: \
|
||||
__arch_xchg_masked(prepend, append, \
|
||||
__arch_xchg_masked(sc_sfx, prepend, sc_append, \
|
||||
__ret, __ptr, __new); \
|
||||
break; \
|
||||
case 4: \
|
||||
__arch_xchg(".w" sfx, prepend, append, \
|
||||
__arch_xchg(".w" swap_sfx, prepend, swap_append, \
|
||||
__ret, __ptr, __new); \
|
||||
break; \
|
||||
case 8: \
|
||||
__arch_xchg(".d" sfx, prepend, append, \
|
||||
__arch_xchg(".d" swap_sfx, prepend, swap_append, \
|
||||
__ret, __ptr, __new); \
|
||||
break; \
|
||||
default: \
|
||||
@ -73,16 +74,17 @@
|
||||
})
|
||||
|
||||
#define arch_xchg_relaxed(ptr, x) \
|
||||
_arch_xchg(ptr, x, "", "", "")
|
||||
_arch_xchg(ptr, x, "", "", "", "", "")
|
||||
|
||||
#define arch_xchg_acquire(ptr, x) \
|
||||
_arch_xchg(ptr, x, "", "", RISCV_ACQUIRE_BARRIER)
|
||||
_arch_xchg(ptr, x, "", "", "", \
|
||||
RISCV_ACQUIRE_BARRIER, RISCV_ACQUIRE_BARRIER)
|
||||
|
||||
#define arch_xchg_release(ptr, x) \
|
||||
_arch_xchg(ptr, x, "", RISCV_RELEASE_BARRIER, "")
|
||||
_arch_xchg(ptr, x, "", "", RISCV_RELEASE_BARRIER, "", "")
|
||||
|
||||
#define arch_xchg(ptr, x) \
|
||||
_arch_xchg(ptr, x, ".aqrl", "", "")
|
||||
_arch_xchg(ptr, x, ".rl", ".aqrl", "", RISCV_FULL_BARRIER, "")
|
||||
|
||||
#define xchg32(ptr, x) \
|
||||
({ \
|
||||
|
@ -72,7 +72,7 @@ static int sbi_cpu_start(unsigned int cpuid, struct task_struct *tidle)
|
||||
/* Make sure tidle is updated */
|
||||
smp_mb();
|
||||
bdata->task_ptr = tidle;
|
||||
bdata->stack_ptr = task_stack_page(tidle) + THREAD_SIZE;
|
||||
bdata->stack_ptr = task_pt_regs(tidle);
|
||||
/* Make sure boot data is updated */
|
||||
smp_mb();
|
||||
hsm_data = __pa(bdata);
|
||||
|
@ -34,8 +34,7 @@ static void cpu_update_secondary_bootdata(unsigned int cpuid,
|
||||
|
||||
/* Make sure tidle is updated */
|
||||
smp_mb();
|
||||
WRITE_ONCE(__cpu_spinwait_stack_pointer[hartid],
|
||||
task_stack_page(tidle) + THREAD_SIZE);
|
||||
WRITE_ONCE(__cpu_spinwait_stack_pointer[hartid], task_pt_regs(tidle));
|
||||
WRITE_ONCE(__cpu_spinwait_task_pointer[hartid], tidle);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user