diff --git a/arch/loongarch/configs/loongson3_defconfig b/arch/loongarch/configs/loongson3_defconfig index 980f5f2c99a14daa01d3228c1202a3fc822fea66..fae86d20fa43b1c0f3ae60b481135a7537fdad7e 100644 --- a/arch/loongarch/configs/loongson3_defconfig +++ b/arch/loongarch/configs/loongson3_defconfig @@ -18,7 +18,6 @@ CONFIG_NUMA_BALANCING=y CONFIG_MEMCG=y CONFIG_BLK_CGROUP=y CONFIG_CFS_BANDWIDTH=y -CONFIG_RT_GROUP_SCHED=y CONFIG_CGROUP_PIDS=y CONFIG_CGROUP_RDMA=y CONFIG_CGROUP_FREEZER=y @@ -2205,4 +2204,5 @@ CONFIG_RCU_CPU_STALL_TIMEOUT=60 # CONFIG_RCU_TRACE is not set CONFIG_FUNCTION_TRACER=y # CONFIG_STRICT_DEVMEM is not set +CONFIG_UNWINDER_ORC=y # CONFIG_RUNTIME_TESTING_MENU is not set diff --git a/arch/loongarch/include/asm/fpu.h b/arch/loongarch/include/asm/fpu.h index 4d635b8e32459fa5baf05bc963d304c710022b3f..772741322785fbb0c1572b27e57f06e34f9900f8 100644 --- a/arch/loongarch/include/asm/fpu.h +++ b/arch/loongarch/include/asm/fpu.h @@ -27,16 +27,22 @@ extern void kernel_fpu_end(void); extern void _init_fpu(unsigned int); extern void _save_fp(struct loongarch_fpu *); extern void _restore_fp(struct loongarch_fpu *); +extern int _save_fp_context(void __user *fpregs, void __user *fcc, void __user *csr); +extern int _restore_fp_context(void __user *fpregs, void __user *fcc, void __user *csr); extern void _save_lsx(struct loongarch_fpu *fpu); extern void _restore_lsx(struct loongarch_fpu *fpu); extern void _init_lsx_upper(void); extern void _restore_lsx_upper(struct loongarch_fpu *fpu); +extern int _save_lsx_context(void __user *fpregs, void __user *fcc, void __user *fcsr); +extern int _restore_lsx_context(void __user *fpregs, void __user *fcc, void __user *fcsr); extern void _save_lasx(struct loongarch_fpu *fpu); extern void _restore_lasx(struct loongarch_fpu *fpu); extern void _init_lasx_upper(void); extern void _restore_lasx_upper(struct loongarch_fpu *fpu); +extern int _save_lasx_context(void __user *fpregs, void __user *fcc, void __user *fcsr); +extern int _restore_lasx_context(void __user *fpregs, void __user *fcc, void __user *fcsr); static inline void enable_lsx(void); static inline void disable_lsx(void); diff --git a/arch/loongarch/include/asm/lbt.h b/arch/loongarch/include/asm/lbt.h index e671978bf5523fba8b8f7d9da0657baed66ecd8f..24a9ee232fee642cf56fecfe63ee8456ff8410f3 100644 --- a/arch/loongarch/include/asm/lbt.h +++ b/arch/loongarch/include/asm/lbt.h @@ -15,6 +15,10 @@ extern void _init_lbt(void); extern void _save_lbt(struct loongarch_lbt *); extern void _restore_lbt(struct loongarch_lbt *); +extern int _save_lbt_context(void __user *regs, void __user *eflags); +extern int _restore_lbt_context(void __user *regs, void __user *eflags); +extern int _save_ftop_context(void __user *ftop); +extern int _restore_ftop_context(void __user *ftop); static inline int is_lbt_enabled(void) { diff --git a/arch/loongarch/kernel/Makefile b/arch/loongarch/kernel/Makefile index caf9a0b5e62d8dbf976698a7dad6641dd0bd4a1e..327af6b33cf661af246f926a001dd0802c560d5e 100644 --- a/arch/loongarch/kernel/Makefile +++ b/arch/loongarch/kernel/Makefile @@ -7,6 +7,7 @@ OBJECT_FILES_NON_STANDARD_head.o := y extra-y := vmlinux.lds +obj-y += extern.o obj-y += head.o cpu-probe.o cacheinfo.o env.o setup.o entry.o genex.o \ traps.o irq.o idle.o process.o dma.o mem.o io.o reset.o switch.o \ elf.o syscall.o signal.o time.o topology.o inst.o ptrace.o vdso.o \ diff --git a/arch/loongarch/kernel/extern.c b/arch/loongarch/kernel/extern.c new file mode 100644 index 0000000000000000000000000000000000000000..11a94c331037e5e2267173ce31bf1d1c5a22f578 --- /dev/null +++ b/arch/loongarch/kernel/extern.c @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0 +#include + +void loongarch_set_current_blocked(sigset_t *newset); +int loongarch_copy_siginfo_to_user(siginfo_t __user *to, const kernel_siginfo_t *from); +int loongarch___save_altstack(stack_t __user *uss, unsigned long sp); +int loongarch_restore_altstack(const stack_t __user *uss); + +void loongarch_set_current_blocked(sigset_t *newset) +{ + return set_current_blocked(newset); +} +EXPORT_SYMBOL_GPL(loongarch_set_current_blocked); + +int loongarch_copy_siginfo_to_user(siginfo_t __user *to, const kernel_siginfo_t *from) +{ + return copy_siginfo_to_user(to, from); +} +EXPORT_SYMBOL_GPL(loongarch_copy_siginfo_to_user); + +int loongarch___save_altstack(stack_t __user *uss, unsigned long sp) +{ + return __save_altstack(uss, sp); +} +EXPORT_SYMBOL_GPL(loongarch___save_altstack); + +int loongarch_restore_altstack(const stack_t __user *uss) +{ + return restore_altstack(uss); +} +EXPORT_SYMBOL_GPL(loongarch_restore_altstack); diff --git a/arch/loongarch/kernel/fpu.S b/arch/loongarch/kernel/fpu.S index 6ab640101457cc4d222716de1ab17f8b4090f9c4..28caf416ae36e6a6395874e32777e6a2a82694cf 100644 --- a/arch/loongarch/kernel/fpu.S +++ b/arch/loongarch/kernel/fpu.S @@ -458,6 +458,7 @@ SYM_FUNC_START(_save_fp_context) li.w a0, 0 # success jr ra SYM_FUNC_END(_save_fp_context) +EXPORT_SYMBOL_GPL(_save_fp_context) /* * a0: fpregs @@ -471,6 +472,7 @@ SYM_FUNC_START(_restore_fp_context) li.w a0, 0 # success jr ra SYM_FUNC_END(_restore_fp_context) +EXPORT_SYMBOL_GPL(_restore_fp_context) /* * a0: fpregs @@ -484,6 +486,7 @@ SYM_FUNC_START(_save_lsx_context) li.w a0, 0 # success jr ra SYM_FUNC_END(_save_lsx_context) +EXPORT_SYMBOL_GPL(_save_lsx_context) /* * a0: fpregs @@ -497,6 +500,7 @@ SYM_FUNC_START(_restore_lsx_context) li.w a0, 0 # success jr ra SYM_FUNC_END(_restore_lsx_context) +EXPORT_SYMBOL_GPL(_restore_lsx_context) /* * a0: fpregs @@ -510,6 +514,7 @@ SYM_FUNC_START(_save_lasx_context) li.w a0, 0 # success jr ra SYM_FUNC_END(_save_lasx_context) +EXPORT_SYMBOL_GPL(_save_lasx_context) /* * a0: fpregs @@ -523,6 +528,7 @@ SYM_FUNC_START(_restore_lasx_context) li.w a0, 0 # success jr ra SYM_FUNC_END(_restore_lasx_context) +EXPORT_SYMBOL_GPL(_restore_lasx_context) .L_fpu_fault: li.w a0, -EFAULT # failure diff --git a/arch/loongarch/kernel/lbt.S b/arch/loongarch/kernel/lbt.S index 001f061d226ab52818aaa79cca57e94c0b4d3f9d..71678912d24ce281c367f3e3e9295b7324140b22 100644 --- a/arch/loongarch/kernel/lbt.S +++ b/arch/loongarch/kernel/lbt.S @@ -90,6 +90,7 @@ SYM_FUNC_START(_save_lbt_context) li.w a0, 0 # success jr ra SYM_FUNC_END(_save_lbt_context) +EXPORT_SYMBOL_GPL(_save_lbt_context) /* * a0: scr @@ -110,6 +111,7 @@ SYM_FUNC_START(_restore_lbt_context) li.w a0, 0 # success jr ra SYM_FUNC_END(_restore_lbt_context) +EXPORT_SYMBOL_GPL(_restore_lbt_context) /* * a0: ftop @@ -120,6 +122,7 @@ SYM_FUNC_START(_save_ftop_context) li.w a0, 0 # success jr ra SYM_FUNC_END(_save_ftop_context) +EXPORT_SYMBOL_GPL(_save_ftop_context) /* * a0: ftop @@ -150,6 +153,7 @@ SYM_FUNC_START(_restore_ftop_context) li.w a0, 0 # success jr ra SYM_FUNC_END(_restore_ftop_context) +EXPORT_SYMBOL_GPL(_restore_ftop_context) .L_lbt_fault: li.w a0, -EFAULT # failure diff --git a/arch/loongarch/kernel/ptrace.c b/arch/loongarch/kernel/ptrace.c index 5e2402cfcab0a1370b2f21901bd46f02489ad477..d2058102179b5b54e47aea7666e0b6a792d997eb 100644 --- a/arch/loongarch/kernel/ptrace.c +++ b/arch/loongarch/kernel/ptrace.c @@ -72,9 +72,13 @@ void ptrace_disable(struct task_struct *child) /* regset get/set implementations */ -static int gpr_get(struct task_struct *target, - const struct user_regset *regset, - struct membuf to) +int gpr_get(struct task_struct *target, + const struct user_regset *regset, + struct membuf to); + +int gpr_get(struct task_struct *target, + const struct user_regset *regset, + struct membuf to) { int r; struct pt_regs *regs = task_pt_regs(target); @@ -87,10 +91,15 @@ static int gpr_get(struct task_struct *target, return r; } -static int gpr_set(struct task_struct *target, - const struct user_regset *regset, - unsigned int pos, unsigned int count, - const void *kbuf, const void __user *ubuf) +int gpr_set(struct task_struct *target, + const struct user_regset *regset, + unsigned int pos, unsigned int count, + const void *kbuf, const void __user *ubuf); + +int gpr_set(struct task_struct *target, + const struct user_regset *regset, + unsigned int pos, unsigned int count, + const void *kbuf, const void __user *ubuf) { int err; int a0_start = sizeof(u64) * GPR_NUM; @@ -950,8 +959,11 @@ const struct user_regset_view *task_user_regset_view(struct task_struct *task) return &user_loongarch64_view; } -static inline int read_user(struct task_struct *target, unsigned long addr, - unsigned long __user *data) +int read_user(struct task_struct *target, unsigned long addr, + unsigned long __user *data); + +int read_user(struct task_struct *target, unsigned long addr, + unsigned long __user *data) { unsigned long tmp = 0; @@ -975,8 +987,11 @@ static inline int read_user(struct task_struct *target, unsigned long addr, return put_user(tmp, data); } -static inline int write_user(struct task_struct *target, unsigned long addr, - unsigned long data) +int write_user(struct task_struct *target, unsigned long addr, + unsigned long data); + +int write_user(struct task_struct *target, unsigned long addr, + unsigned long data) { switch (addr) { case 0 ... 31: diff --git a/arch/loongarch/kernel/signal.c b/arch/loongarch/kernel/signal.c index 4a3686d133494921d64853e6c94b061dfe262bc0..e638a5394a080d341693623985f98084390bf102 100644 --- a/arch/loongarch/kernel/signal.c +++ b/arch/loongarch/kernel/signal.c @@ -50,27 +50,6 @@ #define lock_lbt_owner() ({ preempt_disable(); pagefault_disable(); }) #define unlock_lbt_owner() ({ pagefault_enable(); preempt_enable(); }) -/* Assembly functions to move context to/from the FPU */ -extern asmlinkage int -_save_fp_context(void __user *fpregs, void __user *fcc, void __user *csr); -extern asmlinkage int -_restore_fp_context(void __user *fpregs, void __user *fcc, void __user *csr); -extern asmlinkage int -_save_lsx_context(void __user *fpregs, void __user *fcc, void __user *fcsr); -extern asmlinkage int -_restore_lsx_context(void __user *fpregs, void __user *fcc, void __user *fcsr); -extern asmlinkage int -_save_lasx_context(void __user *fpregs, void __user *fcc, void __user *fcsr); -extern asmlinkage int -_restore_lasx_context(void __user *fpregs, void __user *fcc, void __user *fcsr); - -#ifdef CONFIG_CPU_HAS_LBT -extern asmlinkage int _save_lbt_context(void __user *regs, void __user *eflags); -extern asmlinkage int _restore_lbt_context(void __user *regs, void __user *eflags); -extern asmlinkage int _save_ftop_context(void __user *ftop); -extern asmlinkage int _restore_ftop_context(void __user *ftop); -#endif - struct rt_sigframe { struct siginfo rs_info; struct ucontext rs_uctx; @@ -956,8 +935,11 @@ SYSCALL_DEFINE0(rt_sigreturn) return 0; } -static int setup_rt_frame(void *sig_return, struct ksignal *ksig, - struct pt_regs *regs, sigset_t *set) +int setup_rt_frame(void *sig_return, struct ksignal *ksig, + struct pt_regs *regs, sigset_t *set); + +int setup_rt_frame(void *sig_return, struct ksignal *ksig, + struct pt_regs *regs, sigset_t *set) { int err = 0; struct extctx_layout extctx; diff --git a/arch/loongarch/pci/acpi.c b/arch/loongarch/pci/acpi.c index 5ba4d3a169b21b869bba40f08f15b686ea18bac1..38b2a45473e0aa40e5a77e2e853c1f9043a57350 100644 --- a/arch/loongarch/pci/acpi.c +++ b/arch/loongarch/pci/acpi.c @@ -346,6 +346,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) struct acpi_pci_root_ops *root_ops; int domain = root->segment; int busnum = root->secondary.start; + struct pci_host_bridge *host; info = kzalloc(sizeof(*info), GFP_KERNEL); if (!info) { @@ -386,8 +387,17 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) return NULL; } - pci_bus_size_bridges(bus); - pci_bus_assign_resources(bus); + /* If we must preserve the resource configuration, claim now */ + host = pci_find_host_bridge(bus); + if (host->preserve_config) + pci_bus_claim_resources(bus); + + /* + * Assign whatever was left unassigned. If we didn't claim above, + * this will reassign everything. + */ + pci_assign_unassigned_root_bus_resources(bus); + list_for_each_entry(child, &bus->children, node) pcie_bus_configure_settings(child); } diff --git a/include/linux/compiler.h b/include/linux/compiler.h index db140f106f3df532eae0563e53255234392c5377..c61c59e26e1bbe3aee850eb5de35f8b11da8dbfe 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -133,7 +133,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, #define annotate_unreachable() __annotate_unreachable(__COUNTER__) /* Annotate a C jump table to allow objtool to follow the code flow */ -#define __annotate_jump_table __section(".rodata..c_jump_table,\"a\",@progbits #") +#define __annotate_jump_table __section(".data.rel.ro.c_jump_table") #else /* !CONFIG_OBJTOOL */ #define annotate_reachable() diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 6e9dd6d6db37a2733de2ba584b00c19a1285256d..c88131a4b1d36e103cf600ba1f2801482b676ec1 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -2559,13 +2559,14 @@ static void mark_rodata(struct objtool_file *file) * * - .rodata: can contain GCC switch tables * - .rodata.: same, if -fdata-sections is being used - * - .rodata..c_jump_table: contains C annotated jump tables + * - .data.rel.ro.c_jump_table: contains C annotated jump tables * * .rodata.str1.* sections are ignored; they don't contain jump tables. */ for_each_sec(file, sec) { - if (!strncmp(sec->name, ".rodata", 7) && - !strstr(sec->name, ".str1.")) { + if ((!strncmp(sec->name, ".rodata", 7) && + !strstr(sec->name, ".str1.")) || + !strncmp(sec->name, ".data.rel.ro", 12)) { sec->rodata = true; found = true; } diff --git a/tools/objtool/include/objtool/special.h b/tools/objtool/include/objtool/special.h index 86d4af9c5aa9dc83cd543a140ab1979979a1d6fa..89ee12b1a13849ef0f3a3c6a28f26ce32f484819 100644 --- a/tools/objtool/include/objtool/special.h +++ b/tools/objtool/include/objtool/special.h @@ -10,7 +10,7 @@ #include #include -#define C_JUMP_TABLE_SECTION ".rodata..c_jump_table" +#define C_JUMP_TABLE_SECTION ".data.rel.ro.c_jump_table" struct special_alt { struct list_head list;