History

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

Pull LoongArch updates from Huacai Chen: - Select some options in Kconfig - Give a chance to build with !CONFIG_SMP - Switch to use built-in rustc target - Add new supported device nodes to dts - Some bug fixes and other small changes - Update the default config file * tag 'loongarch-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson: LoongArch: Update Loongson-3 default config file LoongArch: dts: Add new supported device nodes to Loongson-2K2000 LoongArch: dts: Add new supported device nodes to Loongson-2K0500 LoongArch: dts: Remove "disabled" state of clock controller node LoongArch: rust: Switch to use built-in rustc target LoongArch: Fix callchain parse error with kernel tracepoint events again LoongArch: Give a chance to build with !CONFIG_SMP LoongArch: Select THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE LoongArch: Select ARCH_WANT_DEFAULT_BPF_JIT LoongArch: Select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 LoongArch: Select ARCH_HAS_FAST_MULTIPLIER

Linus Torvalds committed 2 years ago

Commit 4f05e822 parents f33fda2 9cc1df419 files · +243 −29Browse files

Unified · Split

19 files
  1. arch/loongarch/Kconfig +5 −1
  2. arch/loongarch/Makefile +1 −1
  3. arch/loongarch/boot/dts/loongson-2k0500.dtsi +83 −3
  4. arch/loongarch/boot/dts/loongson-2k1000-ref.dts +0 −4
  5. arch/loongarch/boot/dts/loongson-2k1000.dtsi +0 −1
  6. arch/loongarch/boot/dts/loongson-2k2000.dtsi +45 −4
  7. arch/loongarch/configs/loongson3_defconfig +24 −0
  8. arch/loongarch/include/asm/acpi.h +1 −0
  9. arch/loongarch/include/asm/asm-prototypes.h +6 −0
  10. arch/loongarch/include/asm/perf_event.h +1 −2
  11. arch/loongarch/include/asm/smp.h +6 −0
  12. arch/loongarch/kernel/machine_kexec.c +1 −1
  13. arch/loongarch/lib/Makefile +2 −0
  14. arch/loongarch/lib/tishift.S +56 −0
  15. arch/loongarch/mm/tlbex.S +6 −3
  16. arch/loongarch/power/suspend.c +3 −1
  17. rust/Makefile +1 −1
  18. scripts/Makefile +1 −1
  19. scripts/generate_rust_target.rs +1 −6
arch/loongarch/Kconfig+5−1
@@ -16,6 +16,7 @@ config LOONGARCH · 15 unmodified lines
1616 select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI
1717 select ARCH_HAS_CPU_FINALIZE_INIT
1818 select ARCH_HAS_CURRENT_STACK_POINTER
19+ select ARCH_HAS_FAST_MULTIPLIER
1920 select ARCH_HAS_FORTIFY_SOURCE
2021 select ARCH_HAS_KCOV
2122 select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
@@ -56,6 +57,7 @@ config LOONGARCH · 34 unmodified lines
5657 select ARCH_SUPPORTS_ACPI
5758 select ARCH_SUPPORTS_ATOMIC_RMW
5859 select ARCH_SUPPORTS_HUGETLBFS
60+ select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
5961 select ARCH_SUPPORTS_LTO_CLANG
6062 select ARCH_SUPPORTS_LTO_CLANG_THIN
6163 select ARCH_SUPPORTS_NUMA_BALANCING
@@ -63,10 +65,12 @@ config LOONGARCH · 1 unmodified line
6365 select ARCH_USE_CMPXCHG_LOCKREF
6466 select ARCH_USE_QUEUED_RWLOCKS
6567 select ARCH_USE_QUEUED_SPINLOCKS
68+ select ARCH_WANT_DEFAULT_BPF_JIT
6669 select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
6770 select ARCH_WANT_LD_ORPHAN_WARN
6871 select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
6972 select ARCH_WANTS_NO_INSTR
73+ select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE
7074 select BUILDTIME_TABLE_SORT
7175 select COMMON_CLK
7276 select CPU_PM
@@ -174,7 +178,6 @@ config LOONGARCH · 101 unmodified lines
174178 select PCI_QUIRKS
175179 select PERF_USE_VMALLOC
176180 select RTC_LIB
177− select SMP
178181 select SPARSE_IRQ
179182 select SYSCTL_ARCH_UNALIGN_ALLOW
180183 select SYSCTL_ARCH_UNALIGN_NO_WARN
@@ -420,6 +423,7 @@ config EFI_STUB · 239 unmodified lines
420423
421424 config SCHED_SMT
422425 bool "SMT scheduler support"
426+ depends on SMP
423427 default y
424428 help
425429 Improves scheduler's performance when there are multiple
arch/loongarch/Makefile+1−1
@@ -101,7 +101,7 @@ ifdef CONFIG_OBJTOOL · 100 unmodified lines
101101 KBUILD_CFLAGS += -fno-jump-tables
102102 endif
103103
104−KBUILD_RUSTFLAGS += --target=$(objtree)/scripts/target.json
104+KBUILD_RUSTFLAGS += --target=loongarch64-unknown-none-softfloat
105105 KBUILD_RUSTFLAGS_MODULE += -Crelocation-model=pic
106106
107107 ifeq ($(CONFIG_RELOCATABLE),y)
arch/loongarch/boot/dts/loongson-2k0500.dtsi+83−3
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 /dts-v1/;
77
88 #include <dt-bindings/interrupt-controller/irq.h>
9+#include <dt-bindings/clock/loongson,ls2k-clk.h>
910
1011 / {
1112 #address-cells = <2>;
@@ -19,14 +20,15 @@ · 7 unmodified lines
1920 compatible = "loongson,la264";
2021 device_type = "cpu";
2122 reg = <0x0>;
22− clocks = <&cpu_clk>;
23+ clocks = <&clk LOONGSON2_NODE_CLK>;
2324 };
2425 };
2526
26− cpu_clk: cpu-clk {
27+ ref_100m: clock-ref-100m {
2728 compatible = "fixed-clock";
2829 #clock-cells = <0>;
29− clock-frequency = <500000000>;
30+ clock-frequency = <100000000>;
31+ clock-output-names = "ref_100m";
3032 };
3133
3234 cpuintc: interrupt-controller {
@@ -35,6 +37,28 @@ · 2 unmodified lines
3537 interrupt-controller;
3638 };
3739
40+ thermal-zones {
41+ cpu-thermal {
42+ polling-delay-passive = <1000>;
43+ polling-delay = <5000>;
44+ thermal-sensors = <&tsensor 0>;
45+
46+ trips {
47+ cpu-alert {
48+ temperature = <33000>;
49+ hysteresis = <2000>;
50+ type = "active";
51+ };
52+
53+ cpu-crit {
54+ temperature = <85000>;
55+ hysteresis = <5000>;
56+ type = "critical";
57+ };
58+ };
59+ };
60+ };
61+
3862 bus@10000000 {
3963 compatible = "simple-bus";
4064 ranges = <0x0 0x10000000 0x0 0x10000000 0x0 0x10000000>,
@@ -52,6 +76,54 @@ · 11 unmodified lines
5276 ranges = <1 0x0 0x0 0x16400000 0x4000>;
5377 };
5478
79+ clk: clock-controller@1fe10400 {
80+ compatible = "loongson,ls2k0500-clk";
81+ reg = <0x0 0x1fe10400 0x0 0x2c>;
82+ #clock-cells = <1>;
83+ clocks = <&ref_100m>;
84+ clock-names = "ref_100m";
85+ };
86+
87+ dma-controller@1fe10c00 {
88+ compatible = "loongson,ls2k0500-apbdma", "loongson,ls2k1000-apbdma";
89+ reg = <0 0x1fe10c00 0 0x8>;
90+ interrupt-parent = <&eiointc>;
91+ interrupts = <67>;
92+ clocks = <&clk LOONGSON2_APB_CLK>;
93+ #dma-cells = <1>;
94+ status = "disabled";
95+ };
96+
97+ dma-controller@1fe10c10 {
98+ compatible = "loongson,ls2k0500-apbdma", "loongson,ls2k1000-apbdma";
99+ reg = <0 0x1fe10c10 0 0x8>;
100+ interrupt-parent = <&eiointc>;
101+ interrupts = <68>;
102+ clocks = <&clk LOONGSON2_APB_CLK>;
103+ #dma-cells = <1>;
104+ status = "disabled";
105+ };
106+
107+ dma-controller@1fe10c20 {
108+ compatible = "loongson,ls2k0500-apbdma", "loongson,ls2k1000-apbdma";
109+ reg = <0 0x1fe10c20 0 0x8>;
110+ interrupt-parent = <&eiointc>;
111+ interrupts = <69>;
112+ clocks = <&clk LOONGSON2_APB_CLK>;
113+ #dma-cells = <1>;
114+ status = "disabled";
115+ };
116+
117+ dma-controller@1fe10c30 {
118+ compatible = "loongson,ls2k0500-apbdma", "loongson,ls2k1000-apbdma";
119+ reg = <0 0x1fe10c30 0 0x8>;
120+ interrupt-parent = <&eiointc>;
121+ interrupts = <70>;
122+ clocks = <&clk LOONGSON2_APB_CLK>;
123+ #dma-cells = <1>;
124+ status = "disabled";
125+ };
126+
55127 liointc0: interrupt-controller@1fe11400 {
56128 compatible = "loongson,liointc-2.0";
57129 reg = <0x0 0x1fe11400 0x0 0x40>,
@@ -139,6 +211,14 @@ · 81 unmodified lines
139211 status = "disabled";
140212 };
141213
214+ tsensor: thermal-sensor@1fe11500 {
215+ compatible = "loongson,ls2k0500-thermal", "loongson,ls2k1000-thermal";
216+ reg = <0x0 0x1fe11500 0x0 0x30>;
217+ interrupt-parent = <&liointc0>;
218+ interrupts = <7 IRQ_TYPE_LEVEL_HIGH>;
219+ #thermal-sensor-cells = <1>;
220+ };
221+
142222 uart0: serial@1ff40800 {
143223 compatible = "ns16550a";
144224 reg = <0x0 0x1ff40800 0x0 0x10>;
arch/loongarch/boot/dts/loongson-2k1000-ref.dts+0−4
@@ -113,10 +113,6 @@ · 112 unmodified lines
113113 status = "okay";
114114 };
115115
116−&clk {
117− status = "okay";
118−};
119−
120116 &rtc0 {
121117 status = "okay";
122118 };
arch/loongarch/boot/dts/loongson-2k1000.dtsi+0−1
@@ -159,7 +159,6 @@ · 158 unmodified lines
159159 #clock-cells = <1>;
160160 clocks = <&ref_100m>;
161161 clock-names = "ref_100m";
162− status = "disabled";
163162 };
164163
165164 gpio0: gpio@1fe00500 {
arch/loongarch/boot/dts/loongson-2k2000.dtsi+45−4
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 /dts-v1/;
77
88 #include <dt-bindings/interrupt-controller/irq.h>
9+#include <dt-bindings/clock/loongson,ls2k-clk.h>
910
1011 / {
1112 #address-cells = <2>;
@@ -19,21 +20,22 @@ · 7 unmodified lines
1920 compatible = "loongson,la364";
2021 device_type = "cpu";
2122 reg = <0x0>;
22− clocks = <&cpu_clk>;
23+ clocks = <&clk LOONGSON2_NODE_CLK>;
2324 };
2425
2526 cpu1: cpu@2 {
2627 compatible = "loongson,la364";
2728 device_type = "cpu";
2829 reg = <0x1>;
29− clocks = <&cpu_clk>;
30+ clocks = <&clk LOONGSON2_NODE_CLK>;
3031 };
3132 };
3233
33− cpu_clk: cpu-clk {
34+ ref_100m: clock-ref-100m {
3435 compatible = "fixed-clock";
3536 #clock-cells = <0>;
36− clock-frequency = <1400000000>;
37+ clock-frequency = <100000000>;
38+ clock-output-names = "ref_100m";
3739 };
3840
3941 cpuintc: interrupt-controller {
@@ -42,6 +44,28 @@ · 2 unmodified lines
4244 interrupt-controller;
4345 };
4446
47+ thermal-zones {
48+ cpu-thermal {
49+ polling-delay-passive = <1000>;
50+ polling-delay = <5000>;
51+ thermal-sensors = <&tsensor 0>;
52+
53+ trips {
54+ cpu-alert {
55+ temperature = <40000>;
56+ hysteresis = <2000>;
57+ type = "active";
58+ };
59+
60+ cpu-crit {
61+ temperature = <85000>;
62+ hysteresis = <5000>;
63+ type = "critical";
64+ };
65+ };
66+ };
67+ };
68+
4569 bus@10000000 {
4670 compatible = "simple-bus";
4771 ranges = <0x0 0x10000000 0x0 0x10000000 0x0 0x10000000>,
@@ -58,6 +82,14 @@ · 10 unmodified lines
5882 ranges = <1 0x0 0x0 0x18400000 0x4000>;
5983 };
6084
85+ clk: clock-controller@10010480 {
86+ compatible = "loongson,ls2k2000-clk";
87+ reg = <0x0 0x10010480 0x0 0x100>;
88+ #clock-cells = <1>;
89+ clocks = <&ref_100m>;
90+ clock-names = "ref_100m";
91+ };
92+
6193 pmc: power-management@100d0000 {
6294 compatible = "loongson,ls2k2000-pmc", "loongson,ls2k0500-pmc", "syscon";
6395 reg = <0x0 0x100d0000 0x0 0x58>;
@@ -80,6 +112,15 @@ · 16 unmodified lines
80112 };
81113 };
82114
115+ tsensor: thermal-sensor@1fe01460 {
116+ compatible = "loongson,ls2k2000-thermal";
117+ reg = <0x0 0x1fe01460 0x0 0x30>,
118+ <0x0 0x1fe0019c 0x0 0x4>;
119+ interrupt-parent = <&liointc>;
120+ interrupts = <7 IRQ_TYPE_LEVEL_HIGH>;
121+ #thermal-sensor-cells = <1>;
122+ };
123+
83124 liointc: interrupt-controller@1fe01400 {
84125 compatible = "loongson,liointc-1.0";
85126 reg = <0x0 0x1fe01400 0x0 0x64>;
arch/loongarch/configs/loongson3_defconfig+24−0
@@ -14,6 +14,10 @@ CONFIG_TASKSTATS=y · 13 unmodified lines
1414 CONFIG_TASK_DELAY_ACCT=y
1515 CONFIG_TASK_XACCT=y
1616 CONFIG_TASK_IO_ACCOUNTING=y
17+CONFIG_PSI=y
18+CONFIG_IKCONFIG=y
19+CONFIG_IKCONFIG_PROC=y
20+CONFIG_IKHEADERS=y
1721 CONFIG_LOG_BUF_SHIFT=18
1822 CONFIG_NUMA_BALANCING=y
1923 CONFIG_MEMCG=y
@@ -129,13 +133,22 @@ CONFIG_IP_MROUTE=y · 109 unmodified lines
129133 CONFIG_IP_MROUTE_MULTIPLE_TABLES=y
130134 CONFIG_IP_PIMSM_V1=y
131135 CONFIG_IP_PIMSM_V2=y
136+CONFIG_INET_AH=m
132137 CONFIG_INET_ESP=m
138+CONFIG_INET_ESP_OFFLOAD=m
139+CONFIG_INET_ESPINTCP=y
140+CONFIG_INET_IPCOMP=m
133141 CONFIG_INET_UDP_DIAG=y
134142 CONFIG_TCP_CONG_ADVANCED=y
135143 CONFIG_TCP_CONG_BBR=m
136144 CONFIG_IPV6_ROUTER_PREF=y
137145 CONFIG_IPV6_ROUTE_INFO=y
146+CONFIG_INET6_AH=m
138147 CONFIG_INET6_ESP=m
148+CONFIG_INET6_ESP_OFFLOAD=m
149+CONFIG_INET6_ESPINTCP=y
150+CONFIG_INET6_IPCOMP=m
151+CONFIG_IPV6_MULTIPLE_TABLES=y
139152 CONFIG_IPV6_MROUTE=y
140153 CONFIG_MPTCP=y
141154 CONFIG_NETWORK_PHY_TIMESTAMPING=y
@@ -151,6 +164,8 @@ CONFIG_NF_CONNTRACK_PPTP=m · 9 unmodified lines
151164 CONFIG_NF_CONNTRACK_TFTP=m
152165 CONFIG_NF_CT_NETLINK=m
153166 CONFIG_NF_TABLES=m
167+CONFIG_NF_TABLES_INET=y
168+CONFIG_NFT_CT=m
154169 CONFIG_NFT_CONNLIMIT=m
155170 CONFIG_NFT_LOG=m
156171 CONFIG_NFT_LIMIT=m
@@ -163,6 +178,7 @@ CONFIG_NFT_QUOTA=m · 6 unmodified lines
163178 CONFIG_NFT_REJECT=m
164179 CONFIG_NFT_COMPAT=m
165180 CONFIG_NFT_HASH=m
181+CONFIG_NFT_FIB_INET=m
166182 CONFIG_NFT_SOCKET=m
167183 CONFIG_NFT_OSF=m
168184 CONFIG_NFT_TPROXY=m
@@ -259,6 +275,7 @@ CONFIG_IP_NF_ARPTABLES=m · 90 unmodified lines
259275 CONFIG_IP_NF_ARPFILTER=m
260276 CONFIG_IP_NF_ARP_MANGLE=m
261277 CONFIG_NF_TABLES_IPV6=y
278+CONFIG_NFT_FIB_IPV6=m
262279 CONFIG_IP6_NF_IPTABLES=y
263280 CONFIG_IP6_NF_MATCH_AH=m
264281 CONFIG_IP6_NF_MATCH_EUI64=m
@@ -279,6 +296,7 @@ CONFIG_IP6_NF_NAT=m · 14 unmodified lines
279296 CONFIG_IP6_NF_TARGET_MASQUERADE=m
280297 CONFIG_IP6_NF_TARGET_NPT=m
281298 CONFIG_NF_TABLES_BRIDGE=m
299+CONFIG_NF_CONNTRACK_BRIDGE=m
282300 CONFIG_BRIDGE_NF_EBTABLES=m
283301 CONFIG_BRIDGE_EBT_BROUTE=m
284302 CONFIG_BRIDGE_EBT_T_FILTER=m
@@ -549,6 +567,7 @@ CONFIG_NGBE=y · 264 unmodified lines
549567 CONFIG_TXGBE=y
550568 # CONFIG_NET_VENDOR_WIZNET is not set
551569 # CONFIG_NET_VENDOR_XILINX is not set
570+CONFIG_MOTORCOMM_PHY=y
552571 CONFIG_PPP=m
553572 CONFIG_PPP_BSDCOMP=m
554573 CONFIG_PPP_DEFLATE=m
@@ -810,6 +829,7 @@ CONFIG_NTB_SWITCHTEC=m · 255 unmodified lines
810829 CONFIG_NTB_PERF=m
811830 CONFIG_NTB_TRANSPORT=m
812831 CONFIG_PWM=y
832+CONFIG_GENERIC_PHY=y
813833 CONFIG_USB4=y
814834 CONFIG_EXT2_FS=y
815835 CONFIG_EXT2_FS_XATTR=y
@@ -875,10 +895,13 @@ CONFIG_UBIFS_FS=m · 59 unmodified lines
875895 CONFIG_UBIFS_FS_ADVANCED_COMPR=y
876896 CONFIG_CRAMFS=m
877897 CONFIG_SQUASHFS=y
898+CONFIG_SQUASHFS_FILE_DIRECT=y
899+CONFIG_SQUASHFS_CHOICE_DECOMP_BY_MOUNT=y
878900 CONFIG_SQUASHFS_XATTR=y
879901 CONFIG_SQUASHFS_LZ4=y
880902 CONFIG_SQUASHFS_LZO=y
881903 CONFIG_SQUASHFS_XZ=y
904+CONFIG_SQUASHFS_ZSTD=y
882905 CONFIG_MINIX_FS=m
883906 CONFIG_ROMFS_FS=m
884907 CONFIG_PSTORE=m
@@ -960,3 +983,4 @@ CONFIG_DEBUG_FS=y · 75 unmodified lines
960983 CONFIG_SCHEDSTATS=y
961984 # CONFIG_DEBUG_PREEMPT is not set
962985 # CONFIG_FTRACE is not set
986+CONFIG_UNWINDER_ORC=y
arch/loongarch/include/asm/acpi.h+1−0
@@ -8,6 +8,7 @@ · 7 unmodified lines
88 #ifndef _ASM_LOONGARCH_ACPI_H
99 #define _ASM_LOONGARCH_ACPI_H
1010
11+#include <asm/smp.h>
1112 #include <asm/suspend.h>
1213
1314 #ifdef CONFIG_ACPI
arch/loongarch/include/asm/asm-prototypes.h+6−0
@@ -6,3 +6,9 @@ · 5 unmodified lines
66 #include <asm/page.h>
77 #include <asm/ftrace.h>
88 #include <asm-generic/asm-prototypes.h>
9+
10+#ifdef CONFIG_ARCH_SUPPORTS_INT128
11+__int128_t __ashlti3(__int128_t a, int b);
12+__int128_t __ashrti3(__int128_t a, int b);
13+__int128_t __lshrti3(__int128_t a, int b);
14+#endif
arch/loongarch/include/asm/perf_event.h+1−2
@@ -13,8 +13,7 @@ · 12 unmodified lines
1313
1414 #define perf_arch_fetch_caller_regs(regs, __ip) { \
1515 (regs)->csr_era = (__ip); \
16− (regs)->regs[3] = current_stack_pointer; \
17− (regs)->regs[22] = (unsigned long) __builtin_frame_address(0); \
16+ (regs)->regs[3] = (unsigned long) __builtin_frame_address(0); \
1817 }
1918
2019 #endif /* __LOONGARCH_PERF_EVENT_H__ */
arch/loongarch/include/asm/smp.h+6−0
@@ -6,6 +6,8 @@ · 5 unmodified lines
66 #ifndef __ASM_SMP_H
77 #define __ASM_SMP_H
88
9+#ifdef CONFIG_SMP
10+
911 #include <linux/atomic.h>
1012 #include <linux/bitops.h>
1113 #include <linux/linkage.h>
@@ -109,4 +111,8 @@ static inline void __cpu_die(unsigned int cpu) · 97 unmodified lines
109111 }
110112 #endif
111113
114+#else /* !CONFIG_SMP */
115+#define cpu_logical_map(cpu) 0
116+#endif /* CONFIG_SMP */
117+
112118 #endif /* __ASM_SMP_H */
arch/loongarch/kernel/machine_kexec.c+1−1
@@ -225,6 +225,7 @@ void crash_smp_send_stop(void) · 224 unmodified lines
225225
226226 void machine_shutdown(void)
227227 {
228+#ifdef CONFIG_SMP
228229 int cpu;
229230
230231 /* All CPUs go to reboot_code_buffer */
@@ -232,7 +233,6 @@ void machine_shutdown(void) · 1 unmodified line
232233 if (!cpu_online(cpu))
233234 cpu_device_up(get_cpu_device(cpu));
234235
235−#ifdef CONFIG_SMP
236236 smp_call_function(kexec_shutdown_secondary, NULL, 0);
237237 #endif
238238 }
arch/loongarch/lib/Makefile+2−0
@@ -6,6 +6,8 @@ · 5 unmodified lines
66 lib-y += delay.o memset.o memcpy.o memmove.o \
77 clear_user.o copy_user.o csum.o dump_tlb.o unaligned.o
88
9+obj-$(CONFIG_ARCH_SUPPORTS_INT128) += tishift.o
10+
911 obj-$(CONFIG_CPU_HAS_LSX) += xor_simd.o xor_simd_glue.o
1012
1113 obj-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o
arch/loongarch/lib/tishift.S+56−0
@@ -0,0 +1,56 @@
1+/* SPDX-License-Identifier: GPL-2.0-only */
2+
3+#include <asm/asmmacro.h>
4+#include <linux/export.h>
5+#include <linux/linkage.h>
6+
7+SYM_FUNC_START(__ashlti3)
8+ srli.d t2, a0, 1
9+ nor t3, zero, a2
10+ sll.d t1, a1, a2
11+ srl.d t2, t2, t3
12+ andi t0, a2, 64
13+ sll.d a0, a0, a2
14+ or t1, t2, t1
15+ maskeqz a1, a0, t0
16+ masknez a0, a0, t0
17+ masknez t0, t1, t0
18+ or a1, t0, a1
19+ jr ra
20+SYM_FUNC_END(__ashlti3)
21+EXPORT_SYMBOL(__ashlti3)
22+
23+SYM_FUNC_START(__ashrti3)
24+ nor t3, zero, a2
25+ slli.d t2, a1, 1
26+ srl.d t1, a0, a2
27+ sll.d t2, t2, t3
28+ andi t0, a2, 64
29+ or t1, t2, t1
30+ sra.d a2, a1, a2
31+ srai.d a1, a1, 63
32+ maskeqz a0, a2, t0
33+ maskeqz a1, a1, t0
34+ masknez a2, a2, t0
35+ masknez t0, t1, t0
36+ or a1, a1, a2
37+ or a0, t0, a0
38+ jr ra
39+SYM_FUNC_END(__ashrti3)
40+EXPORT_SYMBOL(__ashrti3)
41+
42+SYM_FUNC_START(__lshrti3)
43+ slli.d t2, a1, 1
44+ nor t3, zero, a2
45+ srl.d t1, a0, a2
46+ sll.d t2, t2, t3
47+ andi t0, a2, 64
48+ srl.d a1, a1, a2
49+ or t1, t2, t1
50+ maskeqz a0, a1, t0
51+ masknez a1, a1, t0
52+ masknez t0, t1, t0
53+ or a0, t0, a0
54+ jr ra
55+SYM_FUNC_END(__lshrti3)
56+EXPORT_SYMBOL(__lshrti3)
arch/loongarch/mm/tlbex.S+6−3
@@ -125,6 +125,8 @@ vmalloc_load: · 124 unmodified lines
125125 tlb_huge_update_load:
126126 #ifdef CONFIG_SMP
127127 ll.d ra, t1, 0
128+#else
129+ rotri.d ra, ra, 64 - (_PAGE_HUGE_SHIFT + 1)
128130 #endif
129131 andi t0, ra, _PAGE_PRESENT
130132 beqz t0, nopage_tlb_load
@@ -135,7 +137,6 @@ tlb_huge_update_load: · 4 unmodified lines
135137 beqz t0, tlb_huge_update_load
136138 ori t0, ra, _PAGE_VALID
137139 #else
138− rotri.d ra, ra, 64 - (_PAGE_HUGE_SHIFT + 1)
139140 ori t0, ra, _PAGE_VALID
140141 st.d t0, t1, 0
141142 #endif
@@ -281,6 +282,8 @@ vmalloc_store: · 139 unmodified lines
281282 tlb_huge_update_store:
282283 #ifdef CONFIG_SMP
283284 ll.d ra, t1, 0
285+#else
286+ rotri.d ra, ra, 64 - (_PAGE_HUGE_SHIFT + 1)
284287 #endif
285288 andi t0, ra, _PAGE_PRESENT | _PAGE_WRITE
286289 xori t0, t0, _PAGE_PRESENT | _PAGE_WRITE
@@ -292,7 +295,6 @@ tlb_huge_update_store: · 5 unmodified lines
292295 beqz t0, tlb_huge_update_store
293296 ori t0, ra, (_PAGE_VALID | _PAGE_DIRTY | _PAGE_MODIFIED)
294297 #else
295− rotri.d ra, ra, 64 - (_PAGE_HUGE_SHIFT + 1)
296298 ori t0, ra, (_PAGE_VALID | _PAGE_DIRTY | _PAGE_MODIFIED)
297299 st.d t0, t1, 0
298300 #endif
@@ -438,6 +440,8 @@ vmalloc_modify: · 139 unmodified lines
438440 tlb_huge_update_modify:
439441 #ifdef CONFIG_SMP
440442 ll.d ra, t1, 0
443+#else
444+ rotri.d ra, ra, 64 - (_PAGE_HUGE_SHIFT + 1)
441445 #endif
442446 andi t0, ra, _PAGE_WRITE
443447 beqz t0, nopage_tlb_modify
@@ -448,7 +452,6 @@ tlb_huge_update_modify: · 4 unmodified lines
448452 beqz t0, tlb_huge_update_modify
449453 ori t0, ra, (_PAGE_VALID | _PAGE_DIRTY | _PAGE_MODIFIED)
450454 #else
451− rotri.d ra, ra, 64 - (_PAGE_HUGE_SHIFT + 1)
452455 ori t0, ra, (_PAGE_VALID | _PAGE_DIRTY | _PAGE_MODIFIED)
453456 st.d t0, t1, 0
454457 #endif
arch/loongarch/power/suspend.c+3−1
@@ -24,6 +24,7 @@ struct saved_registers { · 23 unmodified lines
2424 u64 kpgd;
2525 u32 pwctl0;
2626 u32 pwctl1;
27+ u64 pcpu_base;
2728 };
2829 static struct saved_registers saved_regs;
2930
@@ -36,6 +37,7 @@ void loongarch_common_suspend(void) · 6 unmodified lines
3637 saved_regs.pwctl1 = csr_read32(LOONGARCH_CSR_PWCTL1);
3738 saved_regs.ecfg = csr_read32(LOONGARCH_CSR_ECFG);
3839 saved_regs.euen = csr_read32(LOONGARCH_CSR_EUEN);
40+ saved_regs.pcpu_base = csr_read64(PERCPU_BASE_KS);
3941
4042 loongarch_suspend_addr = loongson_sysconf.suspend_addr;
4143 }
@@ -44,7 +46,6 @@ void loongarch_common_resume(void) · 2 unmodified lines
4446 {
4547 sync_counter();
4648 local_flush_tlb_all();
47− csr_write64(per_cpu_offset(0), PERCPU_BASE_KS);
4849 csr_write64(eentry, LOONGARCH_CSR_EENTRY);
4950 csr_write64(eentry, LOONGARCH_CSR_MERRENTRY);
5051 csr_write64(tlbrentry, LOONGARCH_CSR_TLBRENTRY);
@@ -55,6 +56,7 @@ void loongarch_common_resume(void) · 4 unmodified lines
5556 csr_write32(saved_regs.pwctl1, LOONGARCH_CSR_PWCTL1);
5657 csr_write32(saved_regs.ecfg, LOONGARCH_CSR_ECFG);
5758 csr_write32(saved_regs.euen, LOONGARCH_CSR_EUEN);
59+ csr_write64(saved_regs.pcpu_base, PERCPU_BASE_KS);
5860 }
5961
6062 int loongarch_acpi_suspend(void)
rust/Makefile+1−1
@@ -426,7 +426,7 @@ $(obj)/core.o: private rustc_objcopy = $(foreach sym,$(redirect-intrinsics),--re · 425 unmodified lines
426426 $(obj)/core.o: private rustc_target_flags = $(core-cfgs)
427427 $(obj)/core.o: $(RUST_LIB_SRC)/core/src/lib.rs FORCE
428428 +$(call if_changed_dep,rustc_library)
429−ifneq ($(or $(CONFIG_X86_64),$(CONFIG_LOONGARCH)),)
429+ifdef CONFIG_X86_64
430430 $(obj)/core.o: scripts/target.json
431431 endif
432432
scripts/Makefile+1−1
@@ -12,7 +12,7 @@ hostprogs-always-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert · 11 unmodified lines
1212 hostprogs-always-$(CONFIG_RUST_KERNEL_DOCTESTS) += rustdoc_test_builder
1313 hostprogs-always-$(CONFIG_RUST_KERNEL_DOCTESTS) += rustdoc_test_gen
1414
15−ifneq ($(or $(CONFIG_X86_64),$(CONFIG_LOONGARCH)),)
15+ifdef CONFIG_X86_64
1616 always-$(CONFIG_RUST) += target.json
1717 filechk_rust_target = $< < include/config/auto.conf
1818
scripts/generate_rust_target.rs+1−6
@@ -164,12 +164,7 @@ fn main() { · 163 unmodified lines
164164 ts.push("llvm-target", "x86_64-linux-gnu");
165165 ts.push("target-pointer-width", "64");
166166 } else if cfg.has("LOONGARCH") {
167− ts.push("arch", "loongarch64");
168− ts.push("data-layout", "e-m:e-p:64:64-i64:64-i128:128-n64-S128");
169− ts.push("features", "-f,-d");
170− ts.push("llvm-target", "loongarch64-linux-gnusf");
171− ts.push("llvm-abiname", "lp64s");
172− ts.push("target-pointer-width", "64");
167+ panic!("loongarch uses the builtin rustc loongarch64-unknown-none-softfloat target");
173168 } else {
174169 panic!("Unsupported architecture");
175170 }