mirror of https://gitee.com/openkylin/linux.git
RISC-V Fixes for 5.13-rc6
* A pair of XIP fixes: one to fix alternatives, and one to turn off the rest of the features that require code modification. * A fix to a type that was causing some alternatives to break. * A build fix for BUILTIN_DTB. -----BEGIN PGP SIGNATURE----- iQJHBAABCgAxFiEEKzw3R0RoQ7JKlDp6LhMZ81+7GIkFAmDE1gATHHBhbG1lckBk YWJiZWx0LmNvbQAKCRAuExnzX7sYiZUxD/wJCNTks+q/reK6CjbpqhBtYvi2TnfG Mg6fOlblQRgApnfPbEy1tJEsZAIFClD7OtmUPM+5O2P7CoDp62VYqD1SoCMruXX2 9lJVhfpz0ZYGGaJyBf5SJ73TMgowI8WlryhYnqfp1sjcpKUjN0ncINc8vI9UveXB p248/0IKK6ZMqsuLvUbQl4knPgV7AgGxyh0f3Iahj/GkRnqtWU38/9RABjCfGB59 6uGO9lGQbCs4enQSXqNs0xpzVrmo8TK31jwOgGGv4t9yTyY+AYaRrx0vvm9CIs+i n9/H77GlUw3Jka0QpiV9pdwY+eHfmoEr5ywL/tFw1W6A7jqkaiPLOzVP84cMob5f BbBJj5mES4pZfZBJYlwsnaet8UfOCaGBzcyoAt/IAe5FTudo5DCXLAWa+Zm84mj1 disMlG6pgl85Za7DRVvvXbhxO1ENaN6cWAXg1E5T2MkILdqmle31C37JtO3W0Uj/ dw9qa9wYW4G04xxFuMRZFLGNzEpwULQXcY5ixrnB64v8traOaIbyIzL+cy3bYSR8 yhU9A0AYTKA41irYokr4VyT6+qiYEP6e1Yg+iC3YEMQfdmbPheTJotm2DjoI+lKK UH8dJWiHAJro653VWPnpB08SpXo0HEKdWfCJSlxbMTeY0u62KG+KWNJlcRQTaxZF LJsLZLXuY2VYMw== =c3op -----END PGP SIGNATURE----- Merge tag 'riscv-for-linus-5.13-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux Pull RISC-V fixes from Palmer Dabbelt: - A pair of XIP fixes: one to fix alternatives, and one to turn off the rest of the features that require code modification - A fix to a type that was causing some alternatives to break - A build fix for BUILTIN_DTB * tag 'riscv-for-linus-5.13-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: riscv: Fix BUILTIN_DTB for sifive and microchip soc riscv: alternative: fix typo in macro name riscv: code patching only works on !XIP_KERNEL riscv: xip: support runtime trap patching
This commit is contained in:
commit
8ecfa36cd4
|
@ -61,11 +61,11 @@ config RISCV
|
||||||
select GENERIC_TIME_VSYSCALL if MMU && 64BIT
|
select GENERIC_TIME_VSYSCALL if MMU && 64BIT
|
||||||
select HANDLE_DOMAIN_IRQ
|
select HANDLE_DOMAIN_IRQ
|
||||||
select HAVE_ARCH_AUDITSYSCALL
|
select HAVE_ARCH_AUDITSYSCALL
|
||||||
select HAVE_ARCH_JUMP_LABEL
|
select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
|
||||||
select HAVE_ARCH_JUMP_LABEL_RELATIVE
|
select HAVE_ARCH_JUMP_LABEL_RELATIVE if !XIP_KERNEL
|
||||||
select HAVE_ARCH_KASAN if MMU && 64BIT
|
select HAVE_ARCH_KASAN if MMU && 64BIT
|
||||||
select HAVE_ARCH_KASAN_VMALLOC if MMU && 64BIT
|
select HAVE_ARCH_KASAN_VMALLOC if MMU && 64BIT
|
||||||
select HAVE_ARCH_KGDB
|
select HAVE_ARCH_KGDB if !XIP_KERNEL
|
||||||
select HAVE_ARCH_KGDB_QXFER_PKT
|
select HAVE_ARCH_KGDB_QXFER_PKT
|
||||||
select HAVE_ARCH_MMAP_RND_BITS if MMU
|
select HAVE_ARCH_MMAP_RND_BITS if MMU
|
||||||
select HAVE_ARCH_SECCOMP_FILTER
|
select HAVE_ARCH_SECCOMP_FILTER
|
||||||
|
@ -80,9 +80,9 @@ config RISCV
|
||||||
select HAVE_GCC_PLUGINS
|
select HAVE_GCC_PLUGINS
|
||||||
select HAVE_GENERIC_VDSO if MMU && 64BIT
|
select HAVE_GENERIC_VDSO if MMU && 64BIT
|
||||||
select HAVE_IRQ_TIME_ACCOUNTING
|
select HAVE_IRQ_TIME_ACCOUNTING
|
||||||
select HAVE_KPROBES
|
select HAVE_KPROBES if !XIP_KERNEL
|
||||||
select HAVE_KPROBES_ON_FTRACE
|
select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL
|
||||||
select HAVE_KRETPROBES
|
select HAVE_KRETPROBES if !XIP_KERNEL
|
||||||
select HAVE_PCI
|
select HAVE_PCI
|
||||||
select HAVE_PERF_EVENTS
|
select HAVE_PERF_EVENTS
|
||||||
select HAVE_PERF_REGS
|
select HAVE_PERF_REGS
|
||||||
|
@ -231,11 +231,11 @@ config ARCH_RV64I
|
||||||
bool "RV64I"
|
bool "RV64I"
|
||||||
select 64BIT
|
select 64BIT
|
||||||
select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 && GCC_VERSION >= 50000
|
select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 && GCC_VERSION >= 50000
|
||||||
select HAVE_DYNAMIC_FTRACE if MMU && $(cc-option,-fpatchable-function-entry=8)
|
select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && $(cc-option,-fpatchable-function-entry=8)
|
||||||
select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE
|
select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE
|
||||||
select HAVE_FTRACE_MCOUNT_RECORD
|
select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
|
||||||
select HAVE_FUNCTION_GRAPH_TRACER
|
select HAVE_FUNCTION_GRAPH_TRACER
|
||||||
select HAVE_FUNCTION_TRACER
|
select HAVE_FUNCTION_TRACER if !XIP_KERNEL
|
||||||
select SWIOTLB if MMU
|
select SWIOTLB if MMU
|
||||||
|
|
||||||
endchoice
|
endchoice
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
dtb-$(CONFIG_SOC_MICROCHIP_POLARFIRE) += microchip-mpfs-icicle-kit.dtb
|
dtb-$(CONFIG_SOC_MICROCHIP_POLARFIRE) += microchip-mpfs-icicle-kit.dtb
|
||||||
|
obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .o, $(dtb-y))
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
dtb-$(CONFIG_SOC_SIFIVE) += hifive-unleashed-a00.dtb \
|
dtb-$(CONFIG_SOC_SIFIVE) += hifive-unleashed-a00.dtb \
|
||||||
hifive-unmatched-a00.dtb
|
hifive-unmatched-a00.dtb
|
||||||
|
obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .o, $(dtb-y))
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
REG_ASM " " newlen "\n" \
|
REG_ASM " " newlen "\n" \
|
||||||
".word " errata_id "\n"
|
".word " errata_id "\n"
|
||||||
|
|
||||||
#define ALT_NEW_CONSTENT(vendor_id, errata_id, enable, new_c) \
|
#define ALT_NEW_CONTENT(vendor_id, errata_id, enable, new_c) \
|
||||||
".if " __stringify(enable) " == 1\n" \
|
".if " __stringify(enable) " == 1\n" \
|
||||||
".pushsection .alternative, \"a\"\n" \
|
".pushsection .alternative, \"a\"\n" \
|
||||||
ALT_ENTRY("886b", "888f", __stringify(vendor_id), __stringify(errata_id), "889f - 888f") \
|
ALT_ENTRY("886b", "888f", __stringify(vendor_id), __stringify(errata_id), "889f - 888f") \
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
"886 :\n" \
|
"886 :\n" \
|
||||||
old_c "\n" \
|
old_c "\n" \
|
||||||
"887 :\n" \
|
"887 :\n" \
|
||||||
ALT_NEW_CONSTENT(vendor_id, errata_id, enable, new_c)
|
ALT_NEW_CONTENT(vendor_id, errata_id, enable, new_c)
|
||||||
|
|
||||||
#define _ALTERNATIVE_CFG(old_c, new_c, vendor_id, errata_id, CONFIG_k) \
|
#define _ALTERNATIVE_CFG(old_c, new_c, vendor_id, errata_id, CONFIG_k) \
|
||||||
__ALTERNATIVE_CFG(old_c, new_c, vendor_id, errata_id, IS_ENABLED(CONFIG_k))
|
__ALTERNATIVE_CFG(old_c, new_c, vendor_id, errata_id, IS_ENABLED(CONFIG_k))
|
||||||
|
|
|
@ -86,8 +86,13 @@ static void do_trap_error(struct pt_regs *regs, int signo, int code,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined (CONFIG_XIP_KERNEL) && defined (CONFIG_RISCV_ERRATA_ALTERNATIVE)
|
||||||
|
#define __trap_section __section(".xip.traps")
|
||||||
|
#else
|
||||||
|
#define __trap_section
|
||||||
|
#endif
|
||||||
#define DO_ERROR_INFO(name, signo, code, str) \
|
#define DO_ERROR_INFO(name, signo, code, str) \
|
||||||
asmlinkage __visible void name(struct pt_regs *regs) \
|
asmlinkage __visible __trap_section void name(struct pt_regs *regs) \
|
||||||
{ \
|
{ \
|
||||||
do_trap_error(regs, signo, code, regs->epc, "Oops - " str); \
|
do_trap_error(regs, signo, code, regs->epc, "Oops - " str); \
|
||||||
}
|
}
|
||||||
|
@ -111,7 +116,7 @@ DO_ERROR_INFO(do_trap_store_misaligned,
|
||||||
int handle_misaligned_load(struct pt_regs *regs);
|
int handle_misaligned_load(struct pt_regs *regs);
|
||||||
int handle_misaligned_store(struct pt_regs *regs);
|
int handle_misaligned_store(struct pt_regs *regs);
|
||||||
|
|
||||||
asmlinkage void do_trap_load_misaligned(struct pt_regs *regs)
|
asmlinkage void __trap_section do_trap_load_misaligned(struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
if (!handle_misaligned_load(regs))
|
if (!handle_misaligned_load(regs))
|
||||||
return;
|
return;
|
||||||
|
@ -119,7 +124,7 @@ asmlinkage void do_trap_load_misaligned(struct pt_regs *regs)
|
||||||
"Oops - load address misaligned");
|
"Oops - load address misaligned");
|
||||||
}
|
}
|
||||||
|
|
||||||
asmlinkage void do_trap_store_misaligned(struct pt_regs *regs)
|
asmlinkage void __trap_section do_trap_store_misaligned(struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
if (!handle_misaligned_store(regs))
|
if (!handle_misaligned_store(regs))
|
||||||
return;
|
return;
|
||||||
|
@ -146,7 +151,7 @@ static inline unsigned long get_break_insn_length(unsigned long pc)
|
||||||
return GET_INSN_LENGTH(insn);
|
return GET_INSN_LENGTH(insn);
|
||||||
}
|
}
|
||||||
|
|
||||||
asmlinkage __visible void do_trap_break(struct pt_regs *regs)
|
asmlinkage __visible __trap_section void do_trap_break(struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_KPROBES
|
#ifdef CONFIG_KPROBES
|
||||||
if (kprobe_single_step_handler(regs))
|
if (kprobe_single_step_handler(regs))
|
||||||
|
|
|
@ -99,9 +99,22 @@ SECTIONS
|
||||||
}
|
}
|
||||||
PERCPU_SECTION(L1_CACHE_BYTES)
|
PERCPU_SECTION(L1_CACHE_BYTES)
|
||||||
|
|
||||||
. = ALIGN(PAGE_SIZE);
|
. = ALIGN(8);
|
||||||
|
.alternative : {
|
||||||
|
__alt_start = .;
|
||||||
|
*(.alternative)
|
||||||
|
__alt_end = .;
|
||||||
|
}
|
||||||
__init_end = .;
|
__init_end = .;
|
||||||
|
|
||||||
|
. = ALIGN(16);
|
||||||
|
.xip.traps : {
|
||||||
|
__xip_traps_start = .;
|
||||||
|
*(.xip.traps)
|
||||||
|
__xip_traps_end = .;
|
||||||
|
}
|
||||||
|
|
||||||
|
. = ALIGN(PAGE_SIZE);
|
||||||
.sdata : {
|
.sdata : {
|
||||||
__global_pointer$ = . + 0x800;
|
__global_pointer$ = . + 0x800;
|
||||||
*(.sdata*)
|
*(.sdata*)
|
||||||
|
|
Loading…
Reference in New Issue