Skip to content

Commit 1c241cb

Browse files
committed
Merge tag 'loongarch-6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
Pull LoongArch updates from Huacai Chen: - Always select HAVE_VIRT_CPU_ACCOUNTING_GEN - Enable UBSAN (Undefined Behavior Sanitizer) - Increase MAX_IO_PICS up to 8 - Increase ARCH_DMA_MINALIGN up to 16 - Fix and improve BPF JIT - Fix and improve vDSO implementation - Update the default config file - Some bug fixes and other small changes * tag 'loongarch-6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson: LoongArch: Update Loongson-3 default config file LoongArch: vDSO: Make use of the t8 register for vgetrandom-chacha LoongArch: vDSO: Remove --hash-style=sysv LoongArch: BPF: Don't override subprog's return value LoongArch: BPF: Use move_addr() for BPF_PSEUDO_FUNC LoongArch: BPF: Fix off-by-one error in build_prologue() LoongArch: Rework the arch_kgdb_breakpoint() implementation LoongArch: Fix device node refcount leak in fdt_cpu_clk_init() LoongArch: Increase ARCH_DMA_MINALIGN up to 16 LoongArch: Increase MAX_IO_PICS up to 8 LoongArch: Fix help text of CMDLINE_EXTEND in Kconfig LoongArch: Enable UBSAN (Undefined Behavior Sanitizer) LoongArch: Always select HAVE_VIRT_CPU_ACCOUNTING_GEN rust: Fix enabling Rust and building with GCC for LoongArch
2 parents 6cb0945 + 17ba839 commit 1c241cb

File tree

11 files changed

+44
-22
lines changed

11 files changed

+44
-22
lines changed

arch/loongarch/Kconfig

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ config LOONGARCH
3030
select ARCH_HAS_SET_MEMORY
3131
select ARCH_HAS_SET_DIRECT_MAP
3232
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
33+
select ARCH_HAS_UBSAN
3334
select ARCH_HAS_VDSO_ARCH_DATA
3435
select ARCH_INLINE_READ_LOCK if !PREEMPTION
3536
select ARCH_INLINE_READ_LOCK_BH if !PREEMPTION
@@ -177,7 +178,7 @@ config LOONGARCH
177178
select HAVE_STACKPROTECTOR
178179
select HAVE_SYSCALL_TRACEPOINTS
179180
select HAVE_TIF_NOHZ
180-
select HAVE_VIRT_CPU_ACCOUNTING_GEN if !SMP
181+
select HAVE_VIRT_CPU_ACCOUNTING_GEN
181182
select IRQ_FORCED_THREADING
182183
select IRQ_LOONGARCH_CPU
183184
select LOCK_MM_AND_FIND_VMA
@@ -387,8 +388,8 @@ config CMDLINE_BOOTLOADER
387388
config CMDLINE_EXTEND
388389
bool "Use built-in to extend bootloader kernel arguments"
389390
help
390-
The command-line arguments provided during boot will be
391-
appended to the built-in command line. This is useful in
391+
The built-in command line will be appended to the command-
392+
line arguments provided during boot. This is useful in
392393
cases where the provided arguments are insufficient and
393394
you don't want to or cannot modify them.
394395

arch/loongarch/configs/loongson3_defconfig

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ CONFIG_NUMA_BALANCING=y
2424
CONFIG_MEMCG=y
2525
CONFIG_BLK_CGROUP=y
2626
CONFIG_CFS_BANDWIDTH=y
27-
CONFIG_RT_GROUP_SCHED=y
2827
CONFIG_CGROUP_PIDS=y
2928
CONFIG_CGROUP_RDMA=y
29+
CONFIG_CGROUP_DMEM=y
3030
CONFIG_CGROUP_FREEZER=y
3131
CONFIG_CGROUP_HUGETLB=y
3232
CONFIG_CPUSETS=y
@@ -665,6 +665,10 @@ CONFIG_RTW88_8723DE=m
665665
CONFIG_RTW88_8723DU=m
666666
CONFIG_RTW88_8821CE=m
667667
CONFIG_RTW88_8821CU=m
668+
CONFIG_RTW88_8821AU=m
669+
CONFIG_RTW88_8812AU=m
670+
CONFIG_RTW88_8814AE=m
671+
CONFIG_RTW88_8814AU=m
668672
CONFIG_RTW89=m
669673
CONFIG_RTW89_8851BE=m
670674
CONFIG_RTW89_8852AE=m
@@ -748,6 +752,7 @@ CONFIG_MEDIA_PCI_SUPPORT=y
748752
CONFIG_VIDEO_BT848=m
749753
CONFIG_DVB_BT8XX=m
750754
CONFIG_DRM=y
755+
CONFIG_DRM_LOAD_EDID_FIRMWARE=y
751756
CONFIG_DRM_RADEON=m
752757
CONFIG_DRM_RADEON_USERPTR=y
753758
CONFIG_DRM_AMDGPU=m
@@ -761,6 +766,7 @@ CONFIG_DRM_LOONGSON=y
761766
CONFIG_FB=y
762767
CONFIG_FB_EFI=y
763768
CONFIG_FB_RADEON=y
769+
CONFIG_FIRMWARE_EDID=y
764770
CONFIG_LCD_CLASS_DEVICE=y
765771
CONFIG_LCD_PLATFORM=m
766772
# CONFIG_VGA_CONSOLE is not set
@@ -843,6 +849,9 @@ CONFIG_TYPEC_TCPCI=m
843849
CONFIG_TYPEC_UCSI=m
844850
CONFIG_UCSI_ACPI=m
845851
CONFIG_INFINIBAND=m
852+
CONFIG_EDAC=y
853+
# CONFIG_EDAC_LEGACY_SYSFS is not set
854+
CONFIG_EDAC_LOONGSON=y
846855
CONFIG_RTC_CLASS=y
847856
CONFIG_RTC_DRV_EFI=y
848857
CONFIG_RTC_DRV_LOONGSON=y

arch/loongarch/include/asm/cache.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#define L1_CACHE_SHIFT CONFIG_L1_CACHE_SHIFT
99
#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
1010

11+
#define ARCH_DMA_MINALIGN (16)
12+
1113
#define __read_mostly __section(".data..read_mostly")
1214

1315
#endif /* _ASM_CACHE_H */

arch/loongarch/include/asm/irq.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void spurious_interrupt(void);
5353
#define arch_trigger_cpumask_backtrace arch_trigger_cpumask_backtrace
5454
void arch_trigger_cpumask_backtrace(const struct cpumask *mask, int exclude_cpu);
5555

56-
#define MAX_IO_PICS 2
56+
#define MAX_IO_PICS 8
5757
#define NR_IRQS (64 + NR_VECTORS * (NR_CPUS + MAX_IO_PICS))
5858

5959
struct acpi_vector_group {

arch/loongarch/kernel/env.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ static int __init fdt_cpu_clk_init(void)
6868
return -ENODEV;
6969

7070
clk = of_clk_get(np, 0);
71+
of_node_put(np);
72+
7173
if (IS_ERR(clk))
7274
return -ENODEV;
7375

arch/loongarch/kernel/kgdb.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <linux/hw_breakpoint.h>
99
#include <linux/kdebug.h>
1010
#include <linux/kgdb.h>
11+
#include <linux/objtool.h>
1112
#include <linux/processor.h>
1213
#include <linux/ptrace.h>
1314
#include <linux/sched.h>
@@ -224,13 +225,13 @@ void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc)
224225
regs->csr_era = pc;
225226
}
226227

227-
void arch_kgdb_breakpoint(void)
228+
noinline void arch_kgdb_breakpoint(void)
228229
{
229230
__asm__ __volatile__ ( \
230231
".globl kgdb_breakinst\n\t" \
231-
"nop\n" \
232232
"kgdb_breakinst:\tbreak 2\n\t"); /* BRK_KDB = 2 */
233233
}
234+
STACK_FRAME_NON_STANDARD(arch_kgdb_breakpoint);
234235

235236
/*
236237
* Calls linux_debug_hook before the kernel dies. If KGDB is enabled,

arch/loongarch/net/bpf_jit.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ static void build_prologue(struct jit_ctx *ctx)
142142
*/
143143
if (seen_tail_call(ctx) && seen_call(ctx))
144144
move_reg(ctx, TCC_SAVED, REG_TCC);
145+
else
146+
emit_insn(ctx, nop);
145147

146148
ctx->stack_size = stack_adjust;
147149
}
@@ -905,7 +907,10 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, bool ext
905907

906908
move_addr(ctx, t1, func_addr);
907909
emit_insn(ctx, jirl, LOONGARCH_GPR_RA, t1, 0);
908-
move_reg(ctx, regmap[BPF_REG_0], LOONGARCH_GPR_A0);
910+
911+
if (insn->src_reg != BPF_PSEUDO_CALL)
912+
move_reg(ctx, regmap[BPF_REG_0], LOONGARCH_GPR_A0);
913+
909914
break;
910915

911916
/* tail call */
@@ -930,7 +935,10 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, bool ext
930935
{
931936
const u64 imm64 = (u64)(insn + 1)->imm << 32 | (u32)insn->imm;
932937

933-
move_imm(ctx, dst, imm64, is32);
938+
if (bpf_pseudo_func(insn))
939+
move_addr(ctx, dst, imm64);
940+
else
941+
move_imm(ctx, dst, imm64, is32);
934942
return 1;
935943
}
936944

arch/loongarch/net/bpf_jit.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ struct jit_data {
2727
struct jit_ctx ctx;
2828
};
2929

30+
static inline void emit_nop(union loongarch_instruction *insn)
31+
{
32+
insn->word = INSN_NOP;
33+
}
34+
3035
#define emit_insn(ctx, func, ...) \
3136
do { \
3237
if (ctx->image != NULL) { \

arch/loongarch/vdso/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ endif
3636

3737
# VDSO linker flags.
3838
ldflags-y := -Bsymbolic --no-undefined -soname=linux-vdso.so.1 \
39-
$(filter -E%,$(KBUILD_CFLAGS)) -nostdlib -shared \
40-
--hash-style=sysv --build-id -T
39+
$(filter -E%,$(KBUILD_CFLAGS)) -nostdlib -shared --build-id -T
4140

4241
#
4342
# Shared build commands.

arch/loongarch/vdso/vgetrandom-chacha.S

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@ SYM_FUNC_START(__arch_chacha20_blocks_nostack)
5858
#define copy0 t5
5959
#define copy1 t6
6060
#define copy2 t7
61-
62-
/* Reuse i as copy3 */
63-
#define copy3 i
61+
#define copy3 t8
6462

6563
/* Packs to be used with OP_4REG */
6664
#define line0 state0, state1, state2, state3
@@ -99,6 +97,7 @@ SYM_FUNC_START(__arch_chacha20_blocks_nostack)
9997
li.w copy0, 0x61707865
10098
li.w copy1, 0x3320646e
10199
li.w copy2, 0x79622d32
100+
li.w copy3, 0x6b206574
102101

103102
ld.w cnt_lo, counter, 0
104103
ld.w cnt_hi, counter, 4
@@ -108,7 +107,7 @@ SYM_FUNC_START(__arch_chacha20_blocks_nostack)
108107
move state0, copy0
109108
move state1, copy1
110109
move state2, copy2
111-
li.w state3, 0x6b206574
110+
move state3, copy3
112111

113112
/* state[4,5,..,11] = key */
114113
ld.w state4, key, 0
@@ -167,12 +166,6 @@ SYM_FUNC_START(__arch_chacha20_blocks_nostack)
167166
addi.w i, i, -1
168167
bnez i, .Lpermute
169168

170-
/*
171-
* copy[3] = "expa", materialize it here because copy[3] shares the
172-
* same register with i which just became dead.
173-
*/
174-
li.w copy3, 0x6b206574
175-
176169
/* output[0,1,2,3] = copy[0,1,2,3] + state[0,1,2,3] */
177170
OP_4REG add.w line0, copy
178171
st.w state0, output, 0

0 commit comments

Comments
 (0)