Commit 12214540 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'loongarch-fixes-6.5-1' of...

Merge tag 'loongarch-fixes-6.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson

Pull LoongArch fixes from Huacai Chen:
 "Some bug fixes for build system, builtin cmdline handling, bpf and
  {copy, clear}_user, together with a trivial cleanup"

* tag 'loongarch-fixes-6.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson:
  LoongArch: Cleanup __builtin_constant_p() checking for cpu_has_*
  LoongArch: BPF: Fix check condition to call lu32id in move_imm()
  LoongArch: BPF: Enable bpf_probe_read{, str}() on LoongArch
  LoongArch: Fix return value underflow in exception path
  LoongArch: Fix CMDLINE_EXTEND and CMDLINE_BOOTLOADER handling
  LoongArch: Fix module relocation error with binutils 2.41
  LoongArch: Only fiddle with CHECKFLAGS if `need-compiler'
parents ffabf7c7 1e74ae32
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ config LOONGARCH
	select ARCH_HAS_CPU_FINALIZE_INIT
	select ARCH_HAS_FORTIFY_SOURCE
	select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
	select ARCH_HAS_PTE_SPECIAL
	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
	select ARCH_INLINE_READ_LOCK if !PREEMPTION
+3 −1
Original line number Diff line number Diff line
@@ -68,6 +68,8 @@ LDFLAGS_vmlinux += -static -n -nostdlib
ifdef CONFIG_AS_HAS_EXPLICIT_RELOCS
cflags-y			+= $(call cc-option,-mexplicit-relocs)
KBUILD_CFLAGS_KERNEL		+= $(call cc-option,-mdirect-extern-access)
KBUILD_AFLAGS_MODULE		+= $(call cc-option,-mno-relax) $(call cc-option,-Wa$(comma)-mno-relax)
KBUILD_CFLAGS_MODULE		+= $(call cc-option,-mno-relax) $(call cc-option,-Wa$(comma)-mno-relax)
else
cflags-y			+= $(call cc-option,-mno-explicit-relocs)
KBUILD_AFLAGS_KERNEL		+= -Wa,-mla-global-with-pcrel
@@ -111,7 +113,7 @@ KBUILD_CFLAGS += -isystem $(shell $(CC) -print-file-name=include)

KBUILD_LDFLAGS	+= -m $(ld-emul)

ifdef CONFIG_LOONGARCH
ifdef need-compiler
CHECKFLAGS += $(shell $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \
	grep -E -vw '__GNUC_(MINOR_|PATCHLEVEL_)?_' | \
	sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/\$$/&&/g')
+4 −11
Original line number Diff line number Diff line
@@ -218,14 +218,7 @@ static inline void restore_lsx(struct task_struct *t)

static inline void init_lsx_upper(void)
{
	/*
	 * Check cpu_has_lsx only if it's a constant. This will allow the
	 * compiler to optimise out code for CPUs without LSX without adding
	 * an extra redundant check for CPUs with LSX.
	 */
	if (__builtin_constant_p(cpu_has_lsx) && !cpu_has_lsx)
		return;

	if (cpu_has_lsx)
		_init_lsx_upper();
}

@@ -294,7 +287,7 @@ static inline void restore_lasx_upper(struct task_struct *t) {}

static inline int thread_lsx_context_live(void)
{
	if (__builtin_constant_p(cpu_has_lsx) && !cpu_has_lsx)
	if (!cpu_has_lsx)
		return 0;

	return test_thread_flag(TIF_LSX_CTX_LIVE);
@@ -302,7 +295,7 @@ static inline int thread_lsx_context_live(void)

static inline int thread_lasx_context_live(void)
{
	if (__builtin_constant_p(cpu_has_lasx) && !cpu_has_lasx)
	if (!cpu_has_lasx)
		return 0;

	return test_thread_flag(TIF_LASX_CTX_LIVE);
+16 −0
Original line number Diff line number Diff line
@@ -332,9 +332,25 @@ static void __init bootcmdline_init(char **cmdline_p)
			strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);

		strlcat(boot_command_line, init_command_line, COMMAND_LINE_SIZE);
		goto out;
	}
#endif

	/*
	 * Append built-in command line to the bootloader command line if
	 * CONFIG_CMDLINE_EXTEND is enabled.
	 */
	if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) && CONFIG_CMDLINE[0]) {
		strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
		strlcat(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
	}

	/*
	 * Use built-in command line if the bootloader command line is empty.
	 */
	if (IS_ENABLED(CONFIG_CMDLINE_BOOTLOADER) && !boot_command_line[0])
		strscpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);

out:
	*cmdline_p = boot_command_line;
}
+2 −1
Original line number Diff line number Diff line
@@ -108,6 +108,7 @@ SYM_FUNC_START(__clear_user_fast)
	addi.d	a3, a2, -8
	bgeu	a0, a3, .Llt8
15:	st.d	zero, a0, 0
	addi.d	a0, a0, 8

.Llt8:
16:	st.d	zero, a2, -8
@@ -188,7 +189,7 @@ SYM_FUNC_START(__clear_user_fast)
	_asm_extable 13b, .L_fixup_handle_0
	_asm_extable 14b, .L_fixup_handle_1
	_asm_extable 15b, .L_fixup_handle_0
	_asm_extable 16b, .L_fixup_handle_1
	_asm_extable 16b, .L_fixup_handle_0
	_asm_extable 17b, .L_fixup_handle_s0
	_asm_extable 18b, .L_fixup_handle_s0
	_asm_extable 19b, .L_fixup_handle_s0
Loading