mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-25 05:04:09 +08:00
RISC-V Fixes for 6.3-rc4
* A fix to match the CSR ASID masking rules when passing ASIDs to firmware. * Force GCC to use ISA 2.2, to avoid a host of compatibily issues between toolchains. -----BEGIN PGP SIGNATURE----- iQJHBAABCAAxFiEEKzw3R0RoQ7JKlDp6LhMZ81+7GIkFAmQdtzITHHBhbG1lckBk YWJiZWx0LmNvbQAKCRAuExnzX7sYiV/cD/oDpfixwripxGxnVXaRcQiNbQLrrY3U Ft2paTcBBlD0pOIRi9NlMWS0GTxYUqOvTrxZmgMUu6yq7lZ/CegOKjhwqeCnzAV2 c0O1ZNQ5ljSJHflDQEeu9cM6VGpb9UWozWOKwS23MLnObGN1DvzhQ9zLR9vKd5bh ErqSAuFpeWS53UvXtrbAR72U5Hdy+hCz9syYQkubpjCxvKl9yA9n1c0eevcfjO/6 epzABtW+UVRfm7zHRFEarqy9rkLn9e35Oo1nn5+owwglCtCVAikIXQm/eGZcvV2e al2DoMXazSK92hbP/+R3MNdUgJ0PPv9CDpL++5jYtolmYszj1qPff8O2lhaPzTH/ 947aVNdlmfeBpbCwNACTQHAQGw6KEta6a9bnr/FXF4ruSJTy/YTq0aa611MsJ532 jCcGB76HHefk0WHsOFaZCG75TWsacM1uohwZ6wZ73x2xl+2BunWKGKnac7wb0hnQ JDikhiEOA6J2hAltRutQTHcKoKCdFOzGWpYmh+86AefMOzUbW5UKVEsT/cTi0nBb 03m9M5FiHgDCFD9HJPpJwDYIuntbbmzXVHGZx5afgxCsfnE33Pi3vPI4GOZw9eY1 HBKapZM2jfeC9ptNkePlA8Il51DtAwBi+McL9DpfbcSNLJRRaBJMedx8uZU92CWY fkbSwdhhEob1rQ== =13qD -----END PGP SIGNATURE----- Merge tag 'riscv-for-linus-6.3-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux Pull RISC-V fixes from Palmer Dabbelt: - A fix to match the CSR ASID masking rules when passing ASIDs to firmware - Force GCC to use ISA 2.2, to avoid a host of compatibily issues between toolchains * tag 'riscv-for-linus-6.3-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: riscv: Handle zicsr/zifencei issues between clang and binutils riscv: mm: Fix incorrect ASID argument when flushing TLB
This commit is contained in:
commit
19a6b66ca5
@ -464,6 +464,28 @@ config TOOLCHAIN_HAS_ZIHINTPAUSE
|
||||
depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zihintpause)
|
||||
depends on LLD_VERSION >= 150000 || LD_VERSION >= 23600
|
||||
|
||||
config TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
|
||||
def_bool y
|
||||
# https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=aed44286efa8ae8717a77d94b51ac3614e2ca6dc
|
||||
depends on AS_IS_GNU && AS_VERSION >= 23800
|
||||
help
|
||||
Newer binutils versions default to ISA spec version 20191213 which
|
||||
moves some instructions from the I extension to the Zicsr and Zifencei
|
||||
extensions.
|
||||
|
||||
config TOOLCHAIN_NEEDS_OLD_ISA_SPEC
|
||||
def_bool y
|
||||
depends on TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
|
||||
# https://github.com/llvm/llvm-project/commit/22e199e6afb1263c943c0c0d4498694e15bf8a16
|
||||
depends on CC_IS_CLANG && CLANG_VERSION < 170000
|
||||
help
|
||||
Certain versions of clang do not support zicsr and zifencei via -march
|
||||
but newer versions of binutils require it for the reasons noted in the
|
||||
help text of CONFIG_TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI. This
|
||||
option causes an older ISA spec compatible with these older versions
|
||||
of clang to be passed to GAS, which has the same result as passing zicsr
|
||||
and zifencei to -march.
|
||||
|
||||
config FPU
|
||||
bool "FPU support"
|
||||
default y
|
||||
|
@ -57,10 +57,12 @@ riscv-march-$(CONFIG_ARCH_RV64I) := rv64ima
|
||||
riscv-march-$(CONFIG_FPU) := $(riscv-march-y)fd
|
||||
riscv-march-$(CONFIG_RISCV_ISA_C) := $(riscv-march-y)c
|
||||
|
||||
# Newer binutils versions default to ISA spec version 20191213 which moves some
|
||||
# instructions from the I extension to the Zicsr and Zifencei extensions.
|
||||
toolchain-need-zicsr-zifencei := $(call cc-option-yn, -march=$(riscv-march-y)_zicsr_zifencei)
|
||||
riscv-march-$(toolchain-need-zicsr-zifencei) := $(riscv-march-y)_zicsr_zifencei
|
||||
ifdef CONFIG_TOOLCHAIN_NEEDS_OLD_ISA_SPEC
|
||||
KBUILD_CFLAGS += -Wa,-misa-spec=2.2
|
||||
KBUILD_AFLAGS += -Wa,-misa-spec=2.2
|
||||
else
|
||||
riscv-march-$(CONFIG_TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI) := $(riscv-march-y)_zicsr_zifencei
|
||||
endif
|
||||
|
||||
# Check if the toolchain supports Zihintpause extension
|
||||
riscv-march-$(CONFIG_TOOLCHAIN_HAS_ZIHINTPAUSE) := $(riscv-march-y)_zihintpause
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include <asm/errata_list.h>
|
||||
|
||||
#ifdef CONFIG_MMU
|
||||
extern unsigned long asid_mask;
|
||||
|
||||
static inline void local_flush_tlb_all(void)
|
||||
{
|
||||
__asm__ __volatile__ ("sfence.vma" : : : "memory");
|
||||
|
@ -22,7 +22,7 @@ DEFINE_STATIC_KEY_FALSE(use_asid_allocator);
|
||||
|
||||
static unsigned long asid_bits;
|
||||
static unsigned long num_asids;
|
||||
static unsigned long asid_mask;
|
||||
unsigned long asid_mask;
|
||||
|
||||
static atomic_long_t current_version;
|
||||
|
||||
|
@ -42,7 +42,7 @@ static void __sbi_tlb_flush_range(struct mm_struct *mm, unsigned long start,
|
||||
/* check if the tlbflush needs to be sent to other CPUs */
|
||||
broadcast = cpumask_any_but(cmask, cpuid) < nr_cpu_ids;
|
||||
if (static_branch_unlikely(&use_asid_allocator)) {
|
||||
unsigned long asid = atomic_long_read(&mm->context.id);
|
||||
unsigned long asid = atomic_long_read(&mm->context.id) & asid_mask;
|
||||
|
||||
if (broadcast) {
|
||||
sbi_remote_sfence_vma_asid(cmask, start, size, asid);
|
||||
|
Loading…
Reference in New Issue
Block a user