Skip to content

Commit 112e7e2

Browse files
committed
Merge tag 'loongarch-6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
Pull LoongArch updates from Huacai Chen: - preliminary ClangBuiltLinux enablement - add support to clone a time namespace - add vector extensions support - add SMT (Simultaneous Multi-Threading) support - support dbar with different hints - introduce hardware page table walker - add jump-label implementation - add rethook and uprobes support - some bug fixes and other small changes * tag 'loongarch-6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson: (28 commits) LoongArch: Remove five DIE_* definitions in kdebug.h LoongArch: Add uprobes support LoongArch: Use larch_insn_gen_break() for kprobes LoongArch: Add larch_insn_gen_break() to generate break insns LoongArch: Check for AMO instructions in insns_not_supported() LoongArch: Move three functions from kprobes.c to inst.c LoongArch: Replace kretprobe with rethook LoongArch: Add jump-label implementation LoongArch: Select HAVE_DEBUG_KMEMLEAK to support kmemleak LoongArch: Export some arch-specific pm interfaces LoongArch: Introduce hardware page table walker LoongArch: Support dbar with different hints LoongArch: Add SMT (Simultaneous Multi-Threading) support LoongArch: Add vector extensions support LoongArch: Add support to clone a time namespace Makefile: Add loongarch target flag for Clang compilation LoongArch: Mark Clang LTO as working LoongArch: Include KBUILD_CPPFLAGS in CHECKFLAGS invocation LoongArch: vDSO: Use CLANG_FLAGS instead of filtering out '--target=' LoongArch: Tweak CFLAGS for Clang compatibility ...
2 parents e55e5df + 5ee35c7 commit 112e7e2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+2378
-368
lines changed

Documentation/features/core/jump-labels/arch-support.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
| csky: | ok |
1414
| hexagon: | TODO |
1515
| ia64: | TODO |
16-
| loongarch: | TODO |
16+
| loongarch: | ok |
1717
| m68k: | TODO |
1818
| microblaze: | TODO |
1919
| mips: | ok |

Documentation/features/debug/kmemleak/arch-support.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
| csky: | ok |
1414
| hexagon: | TODO |
1515
| ia64: | TODO |
16-
| loongarch: | TODO |
16+
| loongarch: | ok |
1717
| m68k: | TODO |
1818
| microblaze: | ok |
1919
| mips: | ok |

arch/loongarch/Kconfig

Lines changed: 64 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ config LOONGARCH
55
select ACPI
66
select ACPI_GENERIC_GSI if ACPI
77
select ACPI_MCFG if ACPI
8+
select ACPI_PPTT if ACPI
89
select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI
910
select ARCH_BINFMT_ELF_STATE
1011
select ARCH_ENABLE_MEMORY_HOTPLUG
@@ -49,6 +50,8 @@ config LOONGARCH
4950
select ARCH_SUPPORTS_ACPI
5051
select ARCH_SUPPORTS_ATOMIC_RMW
5152
select ARCH_SUPPORTS_HUGETLBFS
53+
select ARCH_SUPPORTS_LTO_CLANG
54+
select ARCH_SUPPORTS_LTO_CLANG_THIN
5255
select ARCH_SUPPORTS_NUMA_BALANCING
5356
select ARCH_USE_BUILTIN_BSWAP
5457
select ARCH_USE_CMPXCHG_LOCKREF
@@ -81,16 +84,20 @@ config LOONGARCH
8184
select GENERIC_SCHED_CLOCK
8285
select GENERIC_SMP_IDLE_THREAD
8386
select GENERIC_TIME_VSYSCALL
87+
select GENERIC_VDSO_TIME_NS
8488
select GPIOLIB
8589
select HAS_IOPORT
8690
select HAVE_ARCH_AUDITSYSCALL
91+
select HAVE_ARCH_JUMP_LABEL
92+
select HAVE_ARCH_JUMP_LABEL_RELATIVE
8793
select HAVE_ARCH_MMAP_RND_BITS if MMU
8894
select HAVE_ARCH_SECCOMP_FILTER
8995
select HAVE_ARCH_TRACEHOOK
9096
select HAVE_ARCH_TRANSPARENT_HUGEPAGE
9197
select HAVE_ASM_MODVERSIONS
9298
select HAVE_CONTEXT_TRACKING_USER
9399
select HAVE_C_RECORDMCOUNT
100+
select HAVE_DEBUG_KMEMLEAK
94101
select HAVE_DEBUG_STACKOVERFLOW
95102
select HAVE_DMA_CONTIGUOUS
96103
select HAVE_DYNAMIC_FTRACE
@@ -121,6 +128,7 @@ config LOONGARCH
121128
select HAVE_PERF_REGS
122129
select HAVE_PERF_USER_STACK_DUMP
123130
select HAVE_REGS_AND_STACK_ACCESS_API
131+
select HAVE_RETHOOK
124132
select HAVE_RSEQ
125133
select HAVE_SAMPLE_FTRACE_DIRECT
126134
select HAVE_SAMPLE_FTRACE_DIRECT_MULTI
@@ -163,14 +171,6 @@ config 32BIT
163171
config 64BIT
164172
def_bool y
165173

166-
config CPU_HAS_FPU
167-
bool
168-
default y
169-
170-
config CPU_HAS_PREFETCH
171-
bool
172-
default y
173-
174174
config GENERIC_BUG
175175
def_bool y
176176
depends on BUG
@@ -243,6 +243,15 @@ config SCHED_OMIT_FRAME_POINTER
243243
config AS_HAS_EXPLICIT_RELOCS
244244
def_bool $(as-instr,x:pcalau12i \$t0$(comma)%pc_hi20(x))
245245

246+
config AS_HAS_FCSR_CLASS
247+
def_bool $(as-instr,movfcsr2gr \$t0$(comma)\$fcsr0)
248+
249+
config AS_HAS_LSX_EXTENSION
250+
def_bool $(as-instr,vld \$vr0$(comma)\$a0$(comma)0)
251+
252+
config AS_HAS_LASX_EXTENSION
253+
def_bool $(as-instr,xvld \$xr0$(comma)\$a0$(comma)0)
254+
246255
menu "Kernel type and options"
247256

248257
source "kernel/Kconfig.hz"
@@ -374,6 +383,13 @@ config EFI_STUB
374383
This kernel feature allows the kernel to be loaded directly by
375384
EFI firmware without the use of a bootloader.
376385

386+
config SCHED_SMT
387+
bool "SMT scheduler support"
388+
default y
389+
help
390+
Improves scheduler's performance when there are multiple
391+
threads in one physical core.
392+
377393
config SMP
378394
bool "Multi-Processing support"
379395
help
@@ -483,6 +499,43 @@ config ARCH_STRICT_ALIGN
483499
to run kernel only on systems with h/w unaligned access support in
484500
order to optimise for performance.
485501

502+
config CPU_HAS_FPU
503+
bool
504+
default y
505+
506+
config CPU_HAS_LSX
507+
bool "Support for the Loongson SIMD Extension"
508+
depends on AS_HAS_LSX_EXTENSION
509+
help
510+
Loongson SIMD Extension (LSX) introduces 128 bit wide vector registers
511+
and a set of SIMD instructions to operate on them. When this option
512+
is enabled the kernel will support allocating & switching LSX
513+
vector register contexts. If you know that your kernel will only be
514+
running on CPUs which do not support LSX or that your userland will
515+
not be making use of it then you may wish to say N here to reduce
516+
the size & complexity of your kernel.
517+
518+
If unsure, say Y.
519+
520+
config CPU_HAS_LASX
521+
bool "Support for the Loongson Advanced SIMD Extension"
522+
depends on CPU_HAS_LSX
523+
depends on AS_HAS_LASX_EXTENSION
524+
help
525+
Loongson Advanced SIMD Extension (LASX) introduces 256 bit wide vector
526+
registers and a set of SIMD instructions to operate on them. When this
527+
option is enabled the kernel will support allocating & switching LASX
528+
vector register contexts. If you know that your kernel will only be
529+
running on CPUs which do not support LASX or that your userland will
530+
not be making use of it then you may wish to say N here to reduce
531+
the size & complexity of your kernel.
532+
533+
If unsure, say Y.
534+
535+
config CPU_HAS_PREFETCH
536+
bool
537+
default y
538+
486539
config KEXEC
487540
bool "Kexec system call"
488541
select KEXEC_CORE
@@ -592,6 +645,9 @@ config ARCH_MMAP_RND_BITS_MIN
592645
config ARCH_MMAP_RND_BITS_MAX
593646
default 18
594647

648+
config ARCH_SUPPORTS_UPROBES
649+
def_bool y
650+
595651
menu "Power management options"
596652

597653
config ARCH_SUSPEND_POSSIBLE

arch/loongarch/Makefile

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ ld-emul = $(64bit-emul)
4646
cflags-y += -mabi=lp64s
4747
endif
4848

49-
cflags-y += -G0 -pipe -msoft-float
50-
LDFLAGS_vmlinux += -G0 -static -n -nostdlib
49+
cflags-y += -pipe -msoft-float
50+
LDFLAGS_vmlinux += -static -n -nostdlib
5151

5252
# When the assembler supports explicit relocation hint, we must use it.
5353
# GCC may have -mexplicit-relocs off by default if it was built with an old
@@ -56,13 +56,18 @@ LDFLAGS_vmlinux += -G0 -static -n -nostdlib
5656
# When the assembler does not supports explicit relocation hint, we can't use
5757
# it. Disable it if the compiler supports it.
5858
#
59-
# If you've seen "unknown reloc hint" message building the kernel and you are
60-
# now wondering why "-mexplicit-relocs" is not wrapped with cc-option: the
61-
# combination of a "new" assembler and "old" compiler is not supported. Either
62-
# upgrade the compiler or downgrade the assembler.
59+
# The combination of a "new" assembler and "old" GCC is not supported, given
60+
# the rarity of this combo and the extra complexity needed to make it work.
61+
# Either upgrade the compiler or downgrade the assembler; the build will error
62+
# out if it is the case (by probing for the model attribute; all supported
63+
# compilers in this case would have support).
64+
#
65+
# Also, -mdirect-extern-access is useful in case of building with explicit
66+
# relocs, for avoiding unnecessary GOT accesses. It is harmless to not have
67+
# support though.
6368
ifdef CONFIG_AS_HAS_EXPLICIT_RELOCS
64-
cflags-y += -mexplicit-relocs
65-
KBUILD_CFLAGS_KERNEL += -mdirect-extern-access
69+
cflags-y += $(call cc-option,-mexplicit-relocs)
70+
KBUILD_CFLAGS_KERNEL += $(call cc-option,-mdirect-extern-access)
6671
else
6772
cflags-y += $(call cc-option,-mno-explicit-relocs)
6873
KBUILD_AFLAGS_KERNEL += -Wa,-mla-global-with-pcrel
@@ -107,7 +112,7 @@ KBUILD_CFLAGS += -isystem $(shell $(CC) -print-file-name=include)
107112
KBUILD_LDFLAGS += -m $(ld-emul)
108113

109114
ifdef CONFIG_LOONGARCH
110-
CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \
115+
CHECKFLAGS += $(shell $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \
111116
grep -E -vw '__GNUC_(MINOR_|PATCHLEVEL_)?_' | \
112117
sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/\$$/&&/g')
113118
endif

arch/loongarch/include/asm/Kbuild

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ generic-y += mcs_spinlock.h
55
generic-y += parport.h
66
generic-y += early_ioremap.h
77
generic-y += qrwlock.h
8-
generic-y += qspinlock.h
98
generic-y += rwsem.h
109
generic-y += segment.h
1110
generic-y += user.h

arch/loongarch/include/asm/acpi.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@
88
#ifndef _ASM_LOONGARCH_ACPI_H
99
#define _ASM_LOONGARCH_ACPI_H
1010

11+
#include <asm/suspend.h>
12+
1113
#ifdef CONFIG_ACPI
1214
extern int acpi_strict;
1315
extern int acpi_disabled;
1416
extern int acpi_pci_disabled;
1517
extern int acpi_noirq;
18+
extern int pptt_enabled;
1619

1720
#define acpi_os_ioremap acpi_os_ioremap
1821
void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size);
@@ -30,19 +33,25 @@ static inline bool acpi_has_cpu_in_madt(void)
3033
}
3134

3235
extern struct list_head acpi_wakeup_device_list;
36+
extern struct acpi_madt_core_pic acpi_core_pic[NR_CPUS];
37+
38+
extern int __init parse_acpi_topology(void);
39+
40+
static inline u32 get_acpi_id_for_cpu(unsigned int cpu)
41+
{
42+
return acpi_core_pic[cpu_logical_map(cpu)].processor_id;
43+
}
3344

3445
#endif /* !CONFIG_ACPI */
3546

3647
#define ACPI_TABLE_UPGRADE_MAX_PHYS ARCH_LOW_ADDRESS_LIMIT
3748

3849
extern int loongarch_acpi_suspend(void);
3950
extern int (*acpi_suspend_lowlevel)(void);
40-
extern void loongarch_suspend_enter(void);
4151

4252
static inline unsigned long acpi_get_wakeup_address(void)
4353
{
4454
#ifdef CONFIG_SUSPEND
45-
extern void loongarch_wakeup_start(void);
4655
return (unsigned long)loongarch_wakeup_start;
4756
#endif
4857
return 0UL;

0 commit comments

Comments
 (0)