Skip to content

Commit 24fdd51

Browse files
committed
Merge tag 'loongarch-6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
Pull LoongArch updates from Huacai Chen: - Raise minimum clang version to 18.0.0 - Enable initial Rust support for LoongArch - Add built-in dtb support for LoongArch - Use generic interface to support crashkernel=X,[high,low] - Some bug fixes and other small changes - Update the default config file. * tag 'loongarch-6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson: (22 commits) MAINTAINERS: Add BPF JIT for LOONGARCH entry LoongArch: Update Loongson-3 default config file LoongArch: BPF: Prevent out-of-bounds memory access LoongArch: BPF: Support 64-bit pointers to kfuncs LoongArch: Fix definition of ftrace_regs_set_instruction_pointer() LoongArch: Use generic interface to support crashkernel=X,[high,low] LoongArch: Fix and simplify fcsr initialization on execve() LoongArch: Let cores_io_master cover the largest NR_CPUS LoongArch: Change SHMLBA from SZ_64K to PAGE_SIZE LoongArch: Add a missing call to efi_esrt_init() LoongArch: Parsing CPU-related information from DTS LoongArch: dts: DeviceTree for Loongson-2K2000 LoongArch: dts: DeviceTree for Loongson-2K1000 LoongArch: dts: DeviceTree for Loongson-2K0500 LoongArch: Allow device trees be built into the kernel dt-bindings: interrupt-controller: loongson,liointc: Fix dtbs_check warning for interrupt-names dt-bindings: interrupt-controller: loongson,liointc: Fix dtbs_check warning for reg-names dt-bindings: loongarch: Add Loongson SoC boards compatibles dt-bindings: loongarch: Add CPU bindings for LoongArch LoongArch: Enable initial Rust support ...
2 parents 9bc44c5 + 6e441fa commit 24fdd51

34 files changed

+1735
-102
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -888,9 +888,9 @@
888888
memory region [offset, offset + size] for that kernel
889889
image. If '@offset' is omitted, then a suitable offset
890890
is selected automatically.
891-
[KNL, X86-64, ARM64, RISCV] Select a region under 4G first, and
892-
fall back to reserve region above 4G when '@offset'
893-
hasn't been specified.
891+
[KNL, X86-64, ARM64, RISCV, LoongArch] Select a region
892+
under 4G first, and fall back to reserve region above
893+
4G when '@offset' hasn't been specified.
894894
See Documentation/admin-guide/kdump/kdump.rst for further details.
895895

896896
crashkernel=range1:size1[,range2:size2,...][@offset]
@@ -901,25 +901,27 @@
901901
Documentation/admin-guide/kdump/kdump.rst for an example.
902902

903903
crashkernel=size[KMG],high
904-
[KNL, X86-64, ARM64, RISCV] range could be above 4G.
904+
[KNL, X86-64, ARM64, RISCV, LoongArch] range could be
905+
above 4G.
905906
Allow kernel to allocate physical memory region from top,
906907
so could be above 4G if system have more than 4G ram
907908
installed. Otherwise memory region will be allocated
908909
below 4G, if available.
909910
It will be ignored if crashkernel=X is specified.
910911
crashkernel=size[KMG],low
911-
[KNL, X86-64, ARM64, RISCV] range under 4G. When crashkernel=X,high
912-
is passed, kernel could allocate physical memory region
913-
above 4G, that cause second kernel crash on system
914-
that require some amount of low memory, e.g. swiotlb
915-
requires at least 64M+32K low memory, also enough extra
916-
low memory is needed to make sure DMA buffers for 32-bit
917-
devices won't run out. Kernel would try to allocate
912+
[KNL, X86-64, ARM64, RISCV, LoongArch] range under 4G.
913+
When crashkernel=X,high is passed, kernel could allocate
914+
physical memory region above 4G, that cause second kernel
915+
crash on system that require some amount of low memory,
916+
e.g. swiotlb requires at least 64M+32K low memory, also
917+
enough extra low memory is needed to make sure DMA buffers
918+
for 32-bit devices won't run out. Kernel would try to allocate
918919
default size of memory below 4G automatically. The default
919920
size is platform dependent.
920921
--> x86: max(swiotlb_size_or_default() + 8MiB, 256MiB)
921922
--> arm64: 128MiB
922923
--> riscv: 128MiB
924+
--> loongarch: 128MiB
923925
This one lets the user specify own low range under 4G
924926
for second kernel instead.
925927
0: to disable low allocation.

Documentation/devicetree/bindings/interrupt-controller/loongson,liointc.yaml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,13 @@ maintainers:
1111

1212
description: |
1313
This interrupt controller is found in the Loongson-3 family of chips and
14-
Loongson-2K1000 chip, as the primary package interrupt controller which
14+
Loongson-2K series chips, as the primary package interrupt controller which
1515
can route local I/O interrupt to interrupt lines of cores.
16+
Be aware of the following points.
17+
1.The Loongson-2K0500 is a single core CPU;
18+
2.The Loongson-2K0500/2K1000 has 64 device interrupt sources as inputs, so we
19+
need to define two nodes in dts{i} to describe the "0-31" and "32-61" interrupt
20+
sources respectively.
1621
1722
allOf:
1823
- $ref: /schemas/interrupt-controller.yaml#
@@ -33,6 +38,7 @@ properties:
3338
- const: main
3439
- const: isr0
3540
- const: isr1
41+
minItems: 2
3642

3743
interrupt-controller: true
3844

@@ -45,11 +51,9 @@ properties:
4551
interrupt-names:
4652
description: List of names for the parent interrupts.
4753
items:
48-
- const: int0
49-
- const: int1
50-
- const: int2
51-
- const: int3
54+
pattern: int[0-3]
5255
minItems: 1
56+
maxItems: 4
5357

5458
'#interrupt-cells':
5559
const: 2
@@ -69,6 +73,7 @@ required:
6973
- compatible
7074
- reg
7175
- interrupts
76+
- interrupt-names
7277
- interrupt-controller
7378
- '#interrupt-cells'
7479
- loongson,parent_int_map
@@ -86,7 +91,8 @@ if:
8691
then:
8792
properties:
8893
reg:
89-
minItems: 3
94+
minItems: 2
95+
maxItems: 3
9096

9197
required:
9298
- reg-names
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/loongarch/cpus.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: LoongArch CPUs
8+
9+
maintainers:
10+
- Binbin Zhou <zhoubinbin@loongson.cn>
11+
12+
description:
13+
This document describes the list of LoongArch CPU cores that support FDT,
14+
it describe the layout of CPUs in a system through the "cpus" node.
15+
16+
allOf:
17+
- $ref: /schemas/cpu.yaml#
18+
19+
properties:
20+
compatible:
21+
enum:
22+
- loongson,la264
23+
- loongson,la364
24+
25+
reg:
26+
maxItems: 1
27+
28+
clocks:
29+
maxItems: 1
30+
31+
required:
32+
- compatible
33+
- reg
34+
- clocks
35+
36+
unevaluatedProperties: false
37+
38+
examples:
39+
- |
40+
#include <dt-bindings/clock/loongson,ls2k-clk.h>
41+
42+
cpus {
43+
#size-cells = <0>;
44+
#address-cells = <1>;
45+
46+
cpu@0 {
47+
compatible = "loongson,la264";
48+
device_type = "cpu";
49+
reg = <0>;
50+
clocks = <&clk LOONGSON2_NODE_CLK>;
51+
};
52+
53+
cpu@1 {
54+
compatible = "loongson,la264";
55+
device_type = "cpu";
56+
reg = <1>;
57+
clocks = <&clk LOONGSON2_NODE_CLK>;
58+
};
59+
};
60+
61+
...
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/loongarch/loongson.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Loongson SoC-based boards
8+
9+
maintainers:
10+
- Binbin Zhou <zhoubinbin@loongson.cn>
11+
12+
properties:
13+
$nodename:
14+
const: '/'
15+
compatible:
16+
oneOf:
17+
- description: Loongson-2K0500 processor based boards
18+
items:
19+
- const: loongson,ls2k0500-ref
20+
- const: loongson,ls2k0500
21+
22+
- description: Loongson-2K1000 processor based boards
23+
items:
24+
- const: loongson,ls2k1000-ref
25+
- const: loongson,ls2k1000
26+
27+
- description: Loongson-2K2000 processor based boards
28+
items:
29+
- const: loongson,ls2k2000-ref
30+
- const: loongson,ls2k2000
31+
32+
additionalProperties: true
33+
34+
...

Documentation/rust/arch-support.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ which uses ``libclang``.
1212
Below is a general summary of architectures that currently work. Level of
1313
support corresponds to ``S`` values in the ``MAINTAINERS`` file.
1414

15-
============ ================ ==============================================
16-
Architecture Level of support Constraints
17-
============ ================ ==============================================
18-
``um`` Maintained ``x86_64`` only.
19-
``x86`` Maintained ``x86_64`` only.
20-
============ ================ ==============================================
15+
============= ================ ==============================================
16+
Architecture Level of support Constraints
17+
============= ================ ==============================================
18+
``loongarch`` Maintained -
19+
``um`` Maintained ``x86_64`` only.
20+
``x86`` Maintained ``x86_64`` only.
21+
============= ================ ==============================================
2122

MAINTAINERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3692,6 +3692,13 @@ L: bpf@vger.kernel.org
36923692
S: Supported
36933693
F: arch/arm64/net/
36943694

3695+
BPF JIT for LOONGARCH
3696+
M: Tiezhu Yang <yangtiezhu@loongson.cn>
3697+
R: Hengqi Chen <hengqi.chen@gmail.com>
3698+
L: bpf@vger.kernel.org
3699+
S: Maintained
3700+
F: arch/loongarch/net/
3701+
36953702
BPF JIT for MIPS (32-BIT AND 64-BIT)
36963703
M: Johan Almbladh <johan.almbladh@anyfinetworks.com>
36973704
M: Paul Burton <paulburton@kernel.org>

arch/loongarch/Kbuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ obj-y += net/
44
obj-y += vdso/
55

66
obj-$(CONFIG_KVM) += kvm/
7+
obj-$(CONFIG_BUILTIN_DTB) += boot/dts/
78

89
# for cleaning
910
subdir- += boot

arch/loongarch/Kconfig

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ config LOONGARCH
142142
select HAVE_REGS_AND_STACK_ACCESS_API
143143
select HAVE_RETHOOK
144144
select HAVE_RSEQ
145+
select HAVE_RUST
145146
select HAVE_SAMPLE_FTRACE_DIRECT
146147
select HAVE_SAMPLE_FTRACE_DIRECT_MULTI
147148
select HAVE_SETUP_PER_CPU_AREA if NUMA
@@ -376,6 +377,24 @@ config CMDLINE_FORCE
376377

377378
endchoice
378379

380+
config BUILTIN_DTB
381+
bool "Enable built-in dtb in kernel"
382+
depends on OF
383+
help
384+
Some existing systems do not provide a canonical device tree to
385+
the kernel at boot time. Let's provide a device tree table in the
386+
kernel, keyed by the dts filename, containing the relevant DTBs.
387+
388+
Built-in DTBs are generic enough and can be used as references.
389+
390+
config BUILTIN_DTB_NAME
391+
string "Source file for built-in dtb"
392+
depends on BUILTIN_DTB
393+
help
394+
Base name (without suffix, relative to arch/loongarch/boot/dts/)
395+
for the DTS file that will be used to produce the DTB linked into
396+
the kernel.
397+
379398
config DMI
380399
bool "Enable DMI scanning"
381400
select DMI_SCAN_MACHINE_NON_EFI_FALLBACK
@@ -577,6 +596,9 @@ config ARCH_SELECTS_CRASH_DUMP
577596
depends on CRASH_DUMP
578597
select RELOCATABLE
579598

599+
config ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
600+
def_bool CRASH_CORE
601+
580602
config RELOCATABLE
581603
bool "Relocatable kernel"
582604
help

arch/loongarch/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
boot := arch/loongarch/boot
77

88
KBUILD_DEFCONFIG := loongson3_defconfig
9+
KBUILD_DTBS := dtbs
910

1011
image-name-y := vmlinux
1112
image-name-$(CONFIG_EFI_ZBOOT) := vmlinuz
@@ -81,8 +82,11 @@ KBUILD_AFLAGS_MODULE += -Wa,-mla-global-with-abs
8182
KBUILD_CFLAGS_MODULE += -fplt -Wa,-mla-global-with-abs,-mla-local-with-abs
8283
endif
8384

85+
KBUILD_RUSTFLAGS_MODULE += -Crelocation-model=pic
86+
8487
ifeq ($(CONFIG_RELOCATABLE),y)
8588
KBUILD_CFLAGS_KERNEL += -fPIE
89+
KBUILD_RUSTFLAGS_KERNEL += -Crelocation-model=pie
8690
LDFLAGS_vmlinux += -static -pie --no-dynamic-linker -z notext $(call ld-option, --apply-dynamic-relocs)
8791
endif
8892

@@ -141,7 +145,7 @@ endif
141145

142146
vdso-install-y += arch/loongarch/vdso/vdso.so.dbg
143147

144-
all: $(notdir $(KBUILD_IMAGE))
148+
all: $(notdir $(KBUILD_IMAGE)) $(KBUILD_DTBS)
145149

146150
vmlinuz.efi: vmlinux.efi
147151

arch/loongarch/boot/dts/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# SPDX-License-Identifier: GPL-2.0-only
2-
dtstree := $(srctree)/$(src)
32

4-
dtb-y := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard $(dtstree)/*.dts))
3+
dtb-y = loongson-2k0500-ref.dtb loongson-2k1000-ref.dtb loongson-2k2000-ref.dtb
4+
5+
obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .dtb.o, $(CONFIG_BUILTIN_DTB_NAME))

0 commit comments

Comments
 (0)