Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull LoongArch updates from Huacai Chen:

- Adjust the 'make install' operation

- Support SCHED_MC (Multi-core scheduler)

- Enable ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS

- Enable HAVE_ARCH_STACKLEAK

- Increase max supported CPUs up to 2048

- Introduce the numa_memblks conversion

- Add PWM controller nodes in dts

- Some bug fixes and other small changes

* tag 'loongarch-6.16' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson:
platform/loongarch: laptop: Unregister generic_sub_drivers on exit
platform/loongarch: laptop: Add backlight power control support
platform/loongarch: laptop: Get brightness setting from EC on probe
LoongArch: dts: Add PWM support to Loongson-2K2000
LoongArch: dts: Add PWM support to Loongson-2K1000
LoongArch: dts: Add PWM support to Loongson-2K0500
LoongArch: vDSO: Correctly use asm parameters in syscall wrappers
LoongArch: Fix panic caused by NULL-PMD in huge_pte_offset()
LoongArch: Preserve firmware configuration when desired
LoongArch: Avoid using $r0/$r1 as "mask" for csrxchg
LoongArch: Introduce the numa_memblks conversion
LoongArch: Increase max supported CPUs up to 2048
LoongArch: Enable HAVE_ARCH_STACKLEAK
LoongArch: Enable ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS
LoongArch: Add SCHED_MC (Multi-core scheduler) support
LoongArch: Add some annotations in archhelp
LoongArch: Using generic scripts/install.sh in `make install`
LoongArch: Add a default install.sh

+561 -218
+1 -1
Documentation/features/core/mseal_sys_mappings/arch-support.txt
··· 12 12 | arm64: | ok | 13 13 | csky: | N/A | 14 14 | hexagon: | N/A | 15 - | loongarch: | TODO | 15 + | loongarch: | ok | 16 16 | m68k: | N/A | 17 17 | microblaze: | N/A | 18 18 | mips: | TODO |
+1 -1
Documentation/userspace-api/mseal.rst
··· 144 144 architecture. 145 145 146 146 The following architectures currently support this feature: x86-64, arm64, 147 - and s390. 147 + loongarch and s390. 148 148 149 149 WARNING: This feature breaks programs which rely on relocating 150 150 or unmapping system mappings. Known broken software at the time
+15 -3
arch/loongarch/Kconfig
··· 69 69 select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 70 70 select ARCH_SUPPORTS_LTO_CLANG 71 71 select ARCH_SUPPORTS_LTO_CLANG_THIN 72 + select ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS 72 73 select ARCH_SUPPORTS_NUMA_BALANCING 73 74 select ARCH_SUPPORTS_RT 74 75 select ARCH_USE_BUILTIN_BSWAP ··· 124 123 select HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET 125 124 select HAVE_ARCH_SECCOMP 126 125 select HAVE_ARCH_SECCOMP_FILTER 126 + select HAVE_ARCH_STACKLEAK 127 127 select HAVE_ARCH_TRACEHOOK 128 128 select HAVE_ARCH_TRANSPARENT_HUGEPAGE 129 129 select HAVE_ARCH_USERFAULTFD_MINOR if USERFAULTFD ··· 189 187 select MODULES_USE_ELF_RELA if MODULES 190 188 select NEED_PER_CPU_EMBED_FIRST_CHUNK 191 189 select NEED_PER_CPU_PAGE_FIRST_CHUNK 190 + select NUMA_MEMBLKS if NUMA 192 191 select OF 193 192 select OF_EARLY_FLATTREE 194 193 select PCI ··· 459 456 Improves scheduler's performance when there are multiple 460 457 threads in one physical core. 461 458 459 + config SCHED_MC 460 + bool "Multi-core scheduler support" 461 + depends on SMP 462 + default y 463 + help 464 + Multi-core scheduler support improves the CPU scheduler's decision 465 + making when dealing with multi-core CPU chips at a cost of slightly 466 + increased overhead in some places. 467 + 462 468 config SMP 463 469 bool "Multi-Processing support" 464 470 help ··· 497 485 Say N if you want to disable CPU hotplug. 498 486 499 487 config NR_CPUS 500 - int "Maximum number of CPUs (2-256)" 501 - range 2 256 488 + int "Maximum number of CPUs (2-2048)" 489 + range 2 2048 490 + default "2048" 502 491 depends on SMP 503 - default "64" 504 492 help 505 493 This allows you to specify the maximum number of CPUs which this 506 494 kernel will support.
+7 -4
arch/loongarch/Makefile
··· 181 181 $(Q)$(MAKE) $(build)=$(boot) $(bootvars-y) $(boot)/$@ 182 182 183 183 install: 184 - $(Q)install -D -m 755 $(KBUILD_IMAGE) $(INSTALL_PATH)/$(image-name-y)-$(KERNELRELEASE) 185 - $(Q)install -D -m 644 .config $(INSTALL_PATH)/config-$(KERNELRELEASE) 186 - $(Q)install -D -m 644 System.map $(INSTALL_PATH)/System.map-$(KERNELRELEASE) 184 + $(call cmd,install) 187 185 188 186 define archhelp 189 - echo ' install - install kernel into $(INSTALL_PATH)' 187 + echo ' vmlinux.elf - Uncompressed ELF kernel image (arch/loongarch/boot/vmlinux.elf)' 188 + echo ' vmlinux.efi - Uncompressed EFI kernel image (arch/loongarch/boot/vmlinux.efi)' 189 + echo ' vmlinuz.efi - GZIP/ZSTD-compressed EFI kernel image (arch/loongarch/boot/vmlinuz.efi)' 190 + echo ' Default when CONFIG_EFI_ZBOOT=y' 191 + echo ' install - Install kernel using (your) ~/bin/$(INSTALLKERNEL) or' 192 + echo ' (distribution) /sbin/$(INSTALLKERNEL) or install.sh to $$(INSTALL_PATH)' 190 193 echo 191 194 endef
+160
arch/loongarch/boot/dts/loongson-2k0500.dtsi
··· 169 169 interrupts = <3>; 170 170 }; 171 171 172 + pwm@1ff5c000 { 173 + compatible = "loongson,ls2k0500-pwm", "loongson,ls7a-pwm"; 174 + reg = <0x0 0x1ff5c000 0x0 0x10>; 175 + interrupt-parent = <&liointc0>; 176 + interrupts = <24 IRQ_TYPE_LEVEL_HIGH>; 177 + clocks = <&clk LOONGSON2_APB_CLK>; 178 + #pwm-cells = <3>; 179 + status = "disabled"; 180 + }; 181 + 182 + pwm@1ff5c010 { 183 + compatible = "loongson,ls2k0500-pwm", "loongson,ls7a-pwm"; 184 + reg = <0x0 0x1ff5c010 0x0 0x10>; 185 + interrupt-parent = <&liointc0>; 186 + interrupts = <24 IRQ_TYPE_LEVEL_HIGH>; 187 + clocks = <&clk LOONGSON2_APB_CLK>; 188 + #pwm-cells = <3>; 189 + status = "disabled"; 190 + }; 191 + 192 + pwm@1ff5c020 { 193 + compatible = "loongson,ls2k0500-pwm", "loongson,ls7a-pwm"; 194 + reg = <0x0 0x1ff5c020 0x0 0x10>; 195 + interrupt-parent = <&liointc0>; 196 + interrupts = <24 IRQ_TYPE_LEVEL_HIGH>; 197 + clocks = <&clk LOONGSON2_APB_CLK>; 198 + #pwm-cells = <3>; 199 + status = "disabled"; 200 + }; 201 + 202 + pwm@1ff5c030 { 203 + compatible = "loongson,ls2k0500-pwm", "loongson,ls7a-pwm"; 204 + reg = <0x0 0x1ff5c030 0x0 0x10>; 205 + interrupt-parent = <&liointc0>; 206 + interrupts = <24 IRQ_TYPE_LEVEL_HIGH>; 207 + clocks = <&clk LOONGSON2_APB_CLK>; 208 + #pwm-cells = <3>; 209 + status = "disabled"; 210 + }; 211 + 212 + pwm@1ff5c040 { 213 + compatible = "loongson,ls2k0500-pwm", "loongson,ls7a-pwm"; 214 + reg = <0x0 0x1ff5c040 0x0 0x10>; 215 + interrupt-parent = <&liointc0>; 216 + interrupts = <25 IRQ_TYPE_LEVEL_HIGH>; 217 + clocks = <&clk LOONGSON2_APB_CLK>; 218 + #pwm-cells = <3>; 219 + status = "disabled"; 220 + }; 221 + 222 + pwm@1ff5c050 { 223 + compatible = "loongson,ls2k0500-pwm", "loongson,ls7a-pwm"; 224 + reg = <0x0 0x1ff5c050 0x0 0x10>; 225 + interrupt-parent = <&liointc0>; 226 + interrupts = <25 IRQ_TYPE_LEVEL_HIGH>; 227 + clocks = <&clk LOONGSON2_APB_CLK>; 228 + #pwm-cells = <3>; 229 + status = "disabled"; 230 + }; 231 + 232 + pwm@1ff5c060 { 233 + compatible = "loongson,ls2k0500-pwm", "loongson,ls7a-pwm"; 234 + reg = <0x0 0x1ff5c060 0x0 0x10>; 235 + interrupt-parent = <&liointc0>; 236 + interrupts = <25 IRQ_TYPE_LEVEL_HIGH>; 237 + clocks = <&clk LOONGSON2_APB_CLK>; 238 + #pwm-cells = <3>; 239 + status = "disabled"; 240 + }; 241 + 242 + pwm@1ff5c070 { 243 + compatible = "loongson,ls2k0500-pwm", "loongson,ls7a-pwm"; 244 + reg = <0x0 0x1ff5c070 0x0 0x10>; 245 + interrupt-parent = <&liointc0>; 246 + interrupts = <25 IRQ_TYPE_LEVEL_HIGH>; 247 + clocks = <&clk LOONGSON2_APB_CLK>; 248 + #pwm-cells = <3>; 249 + status = "disabled"; 250 + }; 251 + 252 + pwm@1ff5c080 { 253 + compatible = "loongson,ls2k0500-pwm", "loongson,ls7a-pwm"; 254 + reg = <0x0 0x1ff5c080 0x0 0x10>; 255 + interrupt-parent = <&liointc0>; 256 + interrupts = <26 IRQ_TYPE_LEVEL_HIGH>; 257 + clocks = <&clk LOONGSON2_APB_CLK>; 258 + #pwm-cells = <3>; 259 + status = "disabled"; 260 + }; 261 + 262 + pwm@1ff5c090 { 263 + compatible = "loongson,ls2k0500-pwm", "loongson,ls7a-pwm"; 264 + reg = <0x0 0x1ff5c090 0x0 0x10>; 265 + interrupt-parent = <&liointc0>; 266 + interrupts = <26 IRQ_TYPE_LEVEL_HIGH>; 267 + clocks = <&clk LOONGSON2_APB_CLK>; 268 + #pwm-cells = <3>; 269 + status = "disabled"; 270 + }; 271 + 272 + pwm@1ff5c0a0 { 273 + compatible = "loongson,ls2k0500-pwm", "loongson,ls7a-pwm"; 274 + reg = <0x0 0x1ff5c0a0 0x0 0x10>; 275 + interrupt-parent = <&liointc0>; 276 + interrupts = <26 IRQ_TYPE_LEVEL_HIGH>; 277 + clocks = <&clk LOONGSON2_APB_CLK>; 278 + #pwm-cells = <3>; 279 + status = "disabled"; 280 + }; 281 + 282 + pwm@1ff5c0b0 { 283 + compatible = "loongson,ls2k0500-pwm", "loongson,ls7a-pwm"; 284 + reg = <0x0 0x1ff5c0b0 0x0 0x10>; 285 + interrupt-parent = <&liointc0>; 286 + interrupts = <26 IRQ_TYPE_LEVEL_HIGH>; 287 + clocks = <&clk LOONGSON2_APB_CLK>; 288 + #pwm-cells = <3>; 289 + status = "disabled"; 290 + }; 291 + 292 + pwm@1ff5c0c0 { 293 + compatible = "loongson,ls2k0500-pwm", "loongson,ls7a-pwm"; 294 + reg = <0x0 0x1ff5c0c0 0x0 0x10>; 295 + interrupt-parent = <&liointc0>; 296 + interrupts = <27 IRQ_TYPE_LEVEL_HIGH>; 297 + clocks = <&clk LOONGSON2_APB_CLK>; 298 + #pwm-cells = <3>; 299 + status = "disabled"; 300 + }; 301 + 302 + pwm@1ff5c0d0 { 303 + compatible = "loongson,ls2k0500-pwm", "loongson,ls7a-pwm"; 304 + reg = <0x0 0x1ff5c0d0 0x0 0x10>; 305 + interrupt-parent = <&liointc0>; 306 + interrupts = <27 IRQ_TYPE_LEVEL_HIGH>; 307 + clocks = <&clk LOONGSON2_APB_CLK>; 308 + #pwm-cells = <3>; 309 + status = "disabled"; 310 + }; 311 + 312 + pwm@1ff5c0e0 { 313 + compatible = "loongson,ls2k0500-pwm", "loongson,ls7a-pwm"; 314 + reg = <0x0 0x1ff5c0e0 0x0 0x10>; 315 + interrupt-parent = <&liointc0>; 316 + interrupts = <27 IRQ_TYPE_LEVEL_HIGH>; 317 + clocks = <&clk LOONGSON2_APB_CLK>; 318 + #pwm-cells = <3>; 319 + status = "disabled"; 320 + }; 321 + 322 + pwm@1ff5c0f0 { 323 + compatible = "loongson,ls2k0500-pwm", "loongson,ls7a-pwm"; 324 + reg = <0x0 0x1ff5c0f0 0x0 0x10>; 325 + interrupt-parent = <&liointc0>; 326 + interrupts = <27 IRQ_TYPE_LEVEL_HIGH>; 327 + clocks = <&clk LOONGSON2_APB_CLK>; 328 + #pwm-cells = <3>; 329 + status = "disabled"; 330 + }; 331 + 172 332 gmac0: ethernet@1f020000 { 173 333 compatible = "snps,dwmac-3.70a"; 174 334 reg = <0x0 0x1f020000 0x0 0x10000>;
+24
arch/loongarch/boot/dts/loongson-2k1000-ref.dts
··· 5 5 6 6 /dts-v1/; 7 7 8 + #include "dt-bindings/thermal/thermal.h" 8 9 #include "loongson-2k1000.dtsi" 9 10 10 11 / { ··· 38 37 size = <0x0 0x2000000>; 39 38 linux,cma-default; 40 39 }; 40 + }; 41 + 42 + fan0: pwm-fan { 43 + compatible = "pwm-fan"; 44 + cooling-levels = <255 153 85 25>; 45 + pwms = <&pwm1 0 100000 0>; 46 + #cooling-cells = <2>; 41 47 }; 42 48 }; 43 49 ··· 98 90 99 91 #address-cells = <1>; 100 92 #size-cells = <0>; 93 + }; 94 + 95 + &pwm1 { 96 + status = "okay"; 97 + 98 + pinctrl-0 = <&pwm1_pins_default>; 99 + pinctrl-names = "default"; 100 + }; 101 + 102 + &cpu_thermal { 103 + cooling-maps { 104 + map0 { 105 + trip = <&cpu_alert>; 106 + cooling-device = <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; 107 + }; 108 + }; 101 109 }; 102 110 103 111 &ehci0 {
+41 -1
arch/loongarch/boot/dts/loongson-2k1000.dtsi
··· 68 68 }; 69 69 70 70 thermal-zones { 71 - cpu-thermal { 71 + cpu_thermal: cpu-thermal { 72 72 polling-delay-passive = <1000>; 73 73 polling-delay = <5000>; 74 74 thermal-sensors = <&tsensor 0>; ··· 319 319 reg = <0x0 0x1fe21800 0x0 0x8>; 320 320 interrupt-parent = <&liointc0>; 321 321 interrupts = <23 IRQ_TYPE_LEVEL_HIGH>; 322 + status = "disabled"; 323 + }; 324 + 325 + pwm@1fe22000 { 326 + compatible = "loongson,ls2k1000-pwm", "loongson,ls7a-pwm"; 327 + reg = <0x0 0x1fe22000 0x0 0x10>; 328 + interrupt-parent = <&liointc0>; 329 + interrupts = <24 IRQ_TYPE_LEVEL_HIGH>; 330 + clocks = <&clk LOONGSON2_APB_CLK>; 331 + #pwm-cells = <3>; 332 + status = "disabled"; 333 + }; 334 + 335 + pwm1: pwm@1fe22010 { 336 + compatible = "loongson,ls2k1000-pwm", "loongson,ls7a-pwm"; 337 + reg = <0x0 0x1fe22010 0x0 0x10>; 338 + interrupt-parent = <&liointc0>; 339 + interrupts = <25 IRQ_TYPE_LEVEL_HIGH>; 340 + clocks = <&clk LOONGSON2_APB_CLK>; 341 + #pwm-cells = <3>; 342 + status = "disabled"; 343 + }; 344 + 345 + pwm@1fe22020 { 346 + compatible = "loongson,ls2k1000-pwm", "loongson,ls7a-pwm"; 347 + reg = <0x0 0x1fe22020 0x0 0x10>; 348 + interrupt-parent = <&liointc0>; 349 + interrupts = <26 IRQ_TYPE_LEVEL_HIGH>; 350 + clocks = <&clk LOONGSON2_APB_CLK>; 351 + #pwm-cells = <3>; 352 + status = "disabled"; 353 + }; 354 + 355 + pwm@1fe22030 { 356 + compatible = "loongson,ls2k1000-pwm", "loongson,ls7a-pwm"; 357 + reg = <0x0 0x1fe22030 0x0 0x10>; 358 + interrupt-parent = <&liointc0>; 359 + interrupts = <27 IRQ_TYPE_LEVEL_HIGH>; 360 + clocks = <&clk LOONGSON2_APB_CLK>; 361 + #pwm-cells = <3>; 322 362 status = "disabled"; 323 363 }; 324 364
+60
arch/loongarch/boot/dts/loongson-2k2000.dtsi
··· 165 165 interrupt-parent = <&eiointc>; 166 166 }; 167 167 168 + pwm@100a0000 { 169 + compatible = "loongson,ls2k2000-pwm", "loongson,ls7a-pwm"; 170 + reg = <0x0 0x100a0000 0x0 0x10>; 171 + interrupt-parent = <&pic>; 172 + interrupts = <24 IRQ_TYPE_LEVEL_HIGH>; 173 + clocks = <&clk LOONGSON2_MISC_CLK>; 174 + #pwm-cells = <3>; 175 + status = "disabled"; 176 + }; 177 + 178 + pwm@100a0100 { 179 + compatible = "loongson,ls2k2000-pwm", "loongson,ls7a-pwm"; 180 + reg = <0x0 0x100a0100 0x0 0x10>; 181 + interrupt-parent = <&pic>; 182 + interrupts = <25 IRQ_TYPE_LEVEL_HIGH>; 183 + clocks = <&clk LOONGSON2_MISC_CLK>; 184 + #pwm-cells = <3>; 185 + status = "disabled"; 186 + }; 187 + 188 + pwm@100a0200 { 189 + compatible = "loongson,ls2k2000-pwm", "loongson,ls7a-pwm"; 190 + reg = <0x0 0x100a0200 0x0 0x10>; 191 + interrupt-parent = <&pic>; 192 + interrupts = <26 IRQ_TYPE_LEVEL_HIGH>; 193 + clocks = <&clk LOONGSON2_MISC_CLK>; 194 + #pwm-cells = <3>; 195 + status = "disabled"; 196 + }; 197 + 198 + pwm@100a0300 { 199 + compatible = "loongson,ls2k2000-pwm", "loongson,ls7a-pwm"; 200 + reg = <0x0 0x100a0300 0x0 0x10>; 201 + interrupt-parent = <&pic>; 202 + interrupts = <27 IRQ_TYPE_LEVEL_HIGH>; 203 + clocks = <&clk LOONGSON2_MISC_CLK>; 204 + #pwm-cells = <3>; 205 + status = "disabled"; 206 + }; 207 + 208 + pwm@100a0400 { 209 + compatible = "loongson,ls2k2000-pwm", "loongson,ls7a-pwm"; 210 + reg = <0x0 0x100a0400 0x0 0x10>; 211 + interrupt-parent = <&pic>; 212 + interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; 213 + clocks = <&clk LOONGSON2_MISC_CLK>; 214 + #pwm-cells = <3>; 215 + status = "disabled"; 216 + }; 217 + 218 + pwm@100a0500 { 219 + compatible = "loongson,ls2k2000-pwm", "loongson,ls7a-pwm"; 220 + reg = <0x0 0x100a0500 0x0 0x10>; 221 + interrupt-parent = <&pic>; 222 + interrupts = <39 IRQ_TYPE_LEVEL_HIGH>; 223 + clocks = <&clk LOONGSON2_MISC_CLK>; 224 + #pwm-cells = <3>; 225 + status = "disabled"; 226 + }; 227 + 168 228 rtc0: rtc@100d0100 { 169 229 compatible = "loongson,ls2k2000-rtc", "loongson,ls7a-rtc"; 170 230 reg = <0x0 0x100d0100 0x0 0x100>;
+56
arch/loongarch/boot/install.sh
··· 1 + #!/bin/sh 2 + # 3 + # This file is subject to the terms and conditions of the GNU General Public 4 + # License. See the file "COPYING" in the main directory of this archive 5 + # for more details. 6 + # 7 + # Copyright (C) 1995 by Linus Torvalds 8 + # 9 + # Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin 10 + # Adapted from code in arch/i386/boot/install.sh by Russell King 11 + # 12 + # "make install" script for the LoongArch Linux port 13 + # 14 + # Arguments: 15 + # $1 - kernel version 16 + # $2 - kernel image file 17 + # $3 - kernel map file 18 + # $4 - default install path (blank if root directory) 19 + 20 + set -e 21 + 22 + case "${2##*/}" in 23 + vmlinux.elf) 24 + echo "Installing uncompressed vmlinux.elf kernel" 25 + base=vmlinux 26 + ;; 27 + vmlinux.efi) 28 + echo "Installing uncompressed vmlinux.efi kernel" 29 + base=vmlinux 30 + ;; 31 + vmlinuz.efi) 32 + echo "Installing gzip/zstd compressed vmlinuz.efi kernel" 33 + base=vmlinuz 34 + ;; 35 + *) 36 + echo "Warning: Unexpected kernel type" 37 + exit 1 38 + ;; 39 + esac 40 + 41 + if [ -f $4/$base-$1 ]; then 42 + mv $4/$base-$1 $4/$base-$1.old 43 + fi 44 + cat $2 > $4/$base-$1 45 + 46 + # Install system map file 47 + if [ -f $4/System.map-$1 ]; then 48 + mv $4/System.map-$1 $4/System.map-$1.old 49 + fi 50 + cp $3 $4/System.map-$1 51 + 52 + # Install kernel config file 53 + if [ -f $4/config-$1 ]; then 54 + mv $4/config-$1 $4/config-$1.old 55 + fi 56 + cp .config $4/config-$1
+1 -1
arch/loongarch/include/asm/acpi.h
··· 33 33 return true; 34 34 } 35 35 36 - #define MAX_CORE_PIC 256 36 + #define MAX_CORE_PIC 2048 37 37 38 38 extern struct list_head acpi_wakeup_device_list; 39 39 extern struct acpi_madt_core_pic acpi_core_pic[MAX_CORE_PIC];
+1 -7
arch/loongarch/include/asm/entry-common.h
··· 2 2 #ifndef ARCH_LOONGARCH_ENTRY_COMMON_H 3 3 #define ARCH_LOONGARCH_ENTRY_COMMON_H 4 4 5 - #include <linux/sched.h> 6 - #include <linux/processor.h> 7 - 8 - static inline bool on_thread_stack(void) 9 - { 10 - return !(((unsigned long)(current->stack) ^ current_stack_pointer) & ~(THREAD_SIZE - 1)); 11 - } 5 + #include <asm/stacktrace.h> /* For on_thread_stack() */ 12 6 13 7 #endif
+12 -4
arch/loongarch/include/asm/irqflags.h
··· 14 14 static inline void arch_local_irq_enable(void) 15 15 { 16 16 u32 flags = CSR_CRMD_IE; 17 + register u32 mask asm("t0") = CSR_CRMD_IE; 18 + 17 19 __asm__ __volatile__( 18 20 "csrxchg %[val], %[mask], %[reg]\n\t" 19 21 : [val] "+r" (flags) 20 - : [mask] "r" (CSR_CRMD_IE), [reg] "i" (LOONGARCH_CSR_CRMD) 22 + : [mask] "r" (mask), [reg] "i" (LOONGARCH_CSR_CRMD) 21 23 : "memory"); 22 24 } 23 25 24 26 static inline void arch_local_irq_disable(void) 25 27 { 26 28 u32 flags = 0; 29 + register u32 mask asm("t0") = CSR_CRMD_IE; 30 + 27 31 __asm__ __volatile__( 28 32 "csrxchg %[val], %[mask], %[reg]\n\t" 29 33 : [val] "+r" (flags) 30 - : [mask] "r" (CSR_CRMD_IE), [reg] "i" (LOONGARCH_CSR_CRMD) 34 + : [mask] "r" (mask), [reg] "i" (LOONGARCH_CSR_CRMD) 31 35 : "memory"); 32 36 } 33 37 34 38 static inline unsigned long arch_local_irq_save(void) 35 39 { 36 40 u32 flags = 0; 41 + register u32 mask asm("t0") = CSR_CRMD_IE; 42 + 37 43 __asm__ __volatile__( 38 44 "csrxchg %[val], %[mask], %[reg]\n\t" 39 45 : [val] "+r" (flags) 40 - : [mask] "r" (CSR_CRMD_IE), [reg] "i" (LOONGARCH_CSR_CRMD) 46 + : [mask] "r" (mask), [reg] "i" (LOONGARCH_CSR_CRMD) 41 47 : "memory"); 42 48 return flags; 43 49 } 44 50 45 51 static inline void arch_local_irq_restore(unsigned long flags) 46 52 { 53 + register u32 mask asm("t0") = CSR_CRMD_IE; 54 + 47 55 __asm__ __volatile__( 48 56 "csrxchg %[val], %[mask], %[reg]\n\t" 49 57 : [val] "+r" (flags) 50 - : [mask] "r" (CSR_CRMD_IE), [reg] "i" (LOONGARCH_CSR_CRMD) 58 + : [mask] "r" (mask), [reg] "i" (LOONGARCH_CSR_CRMD) 51 59 : "memory"); 52 60 } 53 61
+2 -2
arch/loongarch/include/asm/loongarch.h
··· 411 411 412 412 /* Config CSR registers */ 413 413 #define LOONGARCH_CSR_CPUID 0x20 /* CPU core id */ 414 - #define CSR_CPUID_COREID_WIDTH 9 415 - #define CSR_CPUID_COREID _ULCAST_(0x1ff) 414 + #define CSR_CPUID_COREID_WIDTH 11 415 + #define CSR_CPUID_COREID _ULCAST_(0x7ff) 416 416 417 417 #define LOONGARCH_CSR_PRCFG1 0x21 /* Config1 */ 418 418 #define CSR_CONF1_VSMAX_SHIFT 12
-14
arch/loongarch/include/asm/numa.h
··· 22 22 extern s16 __cpuid_to_node[CONFIG_NR_CPUS]; 23 23 extern nodemask_t numa_nodes_parsed __initdata; 24 24 25 - struct numa_memblk { 26 - u64 start; 27 - u64 end; 28 - int nid; 29 - }; 30 - 31 - #define NR_NODE_MEMBLKS (MAX_NUMNODES*2) 32 - struct numa_meminfo { 33 - int nr_blks; 34 - struct numa_memblk blk[NR_NODE_MEMBLKS]; 35 - }; 36 - 37 - extern int __init numa_add_memblk(int nodeid, u64 start, u64 end); 38 - 39 25 extern void __init early_numa_add_cpu(int cpuid, s16 node); 40 26 extern void numa_add_cpu(unsigned int cpu); 41 27 extern void numa_remove_cpu(unsigned int cpu);
+1
arch/loongarch/include/asm/smp.h
··· 25 25 extern int num_processors; 26 26 extern int disabled_cpus; 27 27 extern cpumask_t cpu_sibling_map[]; 28 + extern cpumask_t cpu_llc_shared_map[]; 28 29 extern cpumask_t cpu_core_map[]; 29 30 extern cpumask_t cpu_foreign_map[]; 30 31
-5
arch/loongarch/include/asm/sparsemem.h
··· 21 21 #define VMEMMAP_SIZE 0 /* 1, For FLATMEM; 2, For SPARSEMEM without VMEMMAP. */ 22 22 #endif 23 23 24 - #ifdef CONFIG_MEMORY_HOTPLUG 25 - int memory_add_physaddr_to_nid(u64 addr); 26 - #define memory_add_physaddr_to_nid memory_add_physaddr_to_nid 27 - #endif 28 - 29 24 #define INIT_MEMBLOCK_RESERVED_REGIONS (INIT_MEMBLOCK_REGIONS + NR_CPUS) 30 25 31 26 #endif /* _LOONGARCH_SPARSEMEM_H */
+6
arch/loongarch/include/asm/stackframe.h
··· 57 57 jirl zero, \temp1, 0xc 58 58 .endm 59 59 60 + .macro STACKLEAK_ERASE 61 + #ifdef CONFIG_GCC_PLUGIN_STACKLEAK 62 + bl stackleak_erase_on_task_stack 63 + #endif 64 + .endm 65 + 60 66 .macro BACKUP_T0T1 61 67 csrwr t0, EXCEPTION_KS0 62 68 csrwr t1, EXCEPTION_KS1
+5
arch/loongarch/include/asm/stacktrace.h
··· 31 31 bool in_task_stack(unsigned long stack, struct task_struct *task, struct stack_info *info); 32 32 int get_stack_info(unsigned long stack, struct task_struct *task, struct stack_info *info); 33 33 34 + static __always_inline bool on_thread_stack(void) 35 + { 36 + return !(((unsigned long)(current->stack) ^ current_stack_pointer) & ~(THREAD_SIZE - 1)); 37 + } 38 + 34 39 #define STR_LONG_L __stringify(LONG_L) 35 40 #define STR_LONG_S __stringify(LONG_S) 36 41 #define STR_LONGSIZE __stringify(LONGSIZE)
+10 -5
arch/loongarch/include/asm/topology.h
··· 19 19 20 20 #define cpumask_of_pcibus(bus) (cpu_online_mask) 21 21 22 - extern unsigned char node_distances[MAX_NUMNODES][MAX_NUMNODES]; 23 - 24 - void numa_set_distance(int from, int to, int distance); 25 - 26 - #define node_distance(from, to) (node_distances[(from)][(to)]) 22 + int __node_distance(int from, int to); 23 + #define node_distance(from, to) __node_distance(from, to) 27 24 28 25 #else 29 26 #define pcibus_to_node(bus) 0 30 27 #endif 31 28 32 29 #ifdef CONFIG_SMP 30 + /* 31 + * Return cpus that shares the last level cache. 32 + */ 33 + static inline const struct cpumask *cpu_coregroup_mask(int cpu) 34 + { 35 + return &cpu_llc_shared_map[cpu]; 36 + } 37 + 33 38 #define topology_physical_package_id(cpu) (cpu_data[cpu].package) 34 39 #define topology_core_id(cpu) (cpu_data[cpu].core) 35 40 #define topology_core_cpumask(cpu) (&cpu_core_map[cpu])
+1 -1
arch/loongarch/include/asm/vdso/getrandom.h
··· 20 20 21 21 asm volatile( 22 22 " syscall 0\n" 23 - : "+r" (ret) 23 + : "=r" (ret) 24 24 : "r" (nr), "r" (buffer), "r" (len), "r" (flags) 25 25 : "$t0", "$t1", "$t2", "$t3", "$t4", "$t5", "$t6", "$t7", "$t8", 26 26 "memory");
+3 -3
arch/loongarch/include/asm/vdso/gettimeofday.h
··· 25 25 26 26 asm volatile( 27 27 " syscall 0\n" 28 - : "+r" (ret) 28 + : "=r" (ret) 29 29 : "r" (nr), "r" (tv), "r" (tz) 30 30 : "$t0", "$t1", "$t2", "$t3", "$t4", "$t5", "$t6", "$t7", 31 31 "$t8", "memory"); ··· 44 44 45 45 asm volatile( 46 46 " syscall 0\n" 47 - : "+r" (ret) 47 + : "=r" (ret) 48 48 : "r" (nr), "r" (clkid), "r" (ts) 49 49 : "$t0", "$t1", "$t2", "$t3", "$t4", "$t5", "$t6", "$t7", 50 50 "$t8", "memory"); ··· 63 63 64 64 asm volatile( 65 65 " syscall 0\n" 66 - : "+r" (ret) 66 + : "=r" (ret) 67 67 : "r" (nr), "r" (clkid), "r" (ts) 68 68 : "$t0", "$t1", "$t2", "$t3", "$t4", "$t5", "$t6", "$t7", 69 69 "$t8", "memory");
+35 -17
arch/loongarch/kernel/acpi.c
··· 244 244 245 245 #ifdef CONFIG_ACPI_NUMA 246 246 247 - static __init int setup_node(int pxm) 248 - { 249 - return acpi_map_pxm_to_node(pxm); 250 - } 251 - 252 - void __init numa_set_distance(int from, int to, int distance) 253 - { 254 - if ((u8)distance != distance || (from == to && distance != LOCAL_DISTANCE)) { 255 - pr_warn_once("Warning: invalid distance parameter, from=%d to=%d distance=%d\n", 256 - from, to, distance); 257 - return; 258 - } 259 - 260 - node_distances[from][to] = distance; 261 - } 262 - 263 247 /* Callback for Proximity Domain -> CPUID mapping */ 264 248 void __init 265 249 acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa) ··· 264 280 pxm |= (pa->proximity_domain_hi[1] << 16); 265 281 pxm |= (pa->proximity_domain_hi[2] << 24); 266 282 } 267 - node = setup_node(pxm); 283 + node = acpi_map_pxm_to_node(pxm); 284 + if (node < 0) { 285 + pr_err("SRAT: Too many proximity domains %x\n", pxm); 286 + bad_srat(); 287 + return; 288 + } 289 + 290 + if (pa->apic_id >= CONFIG_NR_CPUS) { 291 + pr_info("SRAT: PXM %u -> CPU 0x%02x -> Node %u skipped apicid that is too big\n", 292 + pxm, pa->apic_id, node); 293 + return; 294 + } 295 + 296 + early_numa_add_cpu(pa->apic_id, node); 297 + 298 + set_cpuid_to_node(pa->apic_id, node); 299 + node_set(node, numa_nodes_parsed); 300 + pr_info("SRAT: PXM %u -> CPU 0x%02x -> Node %u\n", pxm, pa->apic_id, node); 301 + } 302 + 303 + void __init 304 + acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa) 305 + { 306 + int pxm, node; 307 + 308 + if (srat_disabled()) 309 + return; 310 + if (pa->header.length < sizeof(struct acpi_srat_x2apic_cpu_affinity)) { 311 + bad_srat(); 312 + return; 313 + } 314 + if ((pa->flags & ACPI_SRAT_CPU_ENABLED) == 0) 315 + return; 316 + pxm = pa->proximity_domain; 317 + node = acpi_map_pxm_to_node(pxm); 268 318 if (node < 0) { 269 319 pr_err("SRAT: Too many proximity domains %x\n", pxm); 270 320 bad_srat();
+3
arch/loongarch/kernel/entry.S
··· 73 73 move a0, sp 74 74 bl do_syscall 75 75 76 + STACKLEAK_ERASE 76 77 RESTORE_ALL_AND_RET 77 78 SYM_CODE_END(handle_syscall) 78 79 _ASM_NOKPROBE(handle_syscall) ··· 82 81 UNWIND_HINT_REGS 83 82 move a1, sp 84 83 bl ret_from_fork 84 + STACKLEAK_ERASE 85 85 RESTORE_STATIC 86 86 RESTORE_SOME 87 87 RESTORE_SP_AND_RET ··· 94 92 move a2, s0 95 93 move a3, s1 96 94 bl ret_from_kernel_thread 95 + STACKLEAK_ERASE 97 96 RESTORE_STATIC 98 97 RESTORE_SOME 99 98 RESTORE_SP_AND_RET
+12 -96
arch/loongarch/kernel/numa.c
··· 11 11 #include <linux/mmzone.h> 12 12 #include <linux/export.h> 13 13 #include <linux/nodemask.h> 14 + #include <linux/numa_memblks.h> 14 15 #include <linux/swap.h> 15 16 #include <linux/memblock.h> 16 17 #include <linux/pfn.h> ··· 28 27 #include <asm/time.h> 29 28 30 29 int numa_off; 31 - unsigned char node_distances[MAX_NUMNODES][MAX_NUMNODES]; 32 - EXPORT_SYMBOL(node_distances); 33 - 34 - static struct numa_meminfo numa_meminfo; 35 30 cpumask_t cpus_on_node[MAX_NUMNODES]; 36 31 cpumask_t phys_cpus_on_node[MAX_NUMNODES]; 37 32 EXPORT_SYMBOL(cpus_on_node); ··· 39 42 [0 ... CONFIG_NR_CPUS - 1] = NUMA_NO_NODE 40 43 }; 41 44 EXPORT_SYMBOL(__cpuid_to_node); 42 - 43 - nodemask_t numa_nodes_parsed __initdata; 44 45 45 46 #ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA 46 47 unsigned long __per_cpu_offset[NR_CPUS] __read_mostly; ··· 140 145 cpumask_clear_cpu(cpu, &cpus_on_node[nid]); 141 146 } 142 147 143 - static int __init numa_add_memblk_to(int nid, u64 start, u64 end, 144 - struct numa_meminfo *mi) 145 - { 146 - /* ignore zero length blks */ 147 - if (start == end) 148 - return 0; 149 - 150 - /* whine about and ignore invalid blks */ 151 - if (start > end || nid < 0 || nid >= MAX_NUMNODES) { 152 - pr_warn("NUMA: Warning: invalid memblk node %d [mem %#010Lx-%#010Lx]\n", 153 - nid, start, end - 1); 154 - return 0; 155 - } 156 - 157 - if (mi->nr_blks >= NR_NODE_MEMBLKS) { 158 - pr_err("NUMA: too many memblk ranges\n"); 159 - return -EINVAL; 160 - } 161 - 162 - mi->blk[mi->nr_blks].start = PFN_ALIGN(start); 163 - mi->blk[mi->nr_blks].end = PFN_ALIGN(end - PAGE_SIZE + 1); 164 - mi->blk[mi->nr_blks].nid = nid; 165 - mi->nr_blks++; 166 - return 0; 167 - } 168 - 169 - /** 170 - * numa_add_memblk - Add one numa_memblk to numa_meminfo 171 - * @nid: NUMA node ID of the new memblk 172 - * @start: Start address of the new memblk 173 - * @end: End address of the new memblk 174 - * 175 - * Add a new memblk to the default numa_meminfo. 176 - * 177 - * RETURNS: 178 - * 0 on success, -errno on failure. 179 - */ 180 - int __init numa_add_memblk(int nid, u64 start, u64 end) 181 - { 182 - return numa_add_memblk_to(nid, start, end, &numa_meminfo); 183 - } 184 - 185 148 static void __init node_mem_init(unsigned int node) 186 149 { 187 150 unsigned long start_pfn, end_pfn; ··· 158 205 159 206 #ifdef CONFIG_ACPI_NUMA 160 207 161 - static void __init add_node_intersection(u32 node, u64 start, u64 size, u32 type) 162 - { 163 - static unsigned long num_physpages; 164 - 165 - num_physpages += (size >> PAGE_SHIFT); 166 - pr_info("Node%d: mem_type:%d, mem_start:0x%llx, mem_size:0x%llx Bytes\n", 167 - node, type, start, size); 168 - pr_info(" start_pfn:0x%llx, end_pfn:0x%llx, num_physpages:0x%lx\n", 169 - start >> PAGE_SHIFT, (start + size) >> PAGE_SHIFT, num_physpages); 170 - memblock_set_node(start, size, &memblock.memory, node); 171 - } 172 - 173 208 /* 174 209 * add_numamem_region 175 210 * ··· 169 228 */ 170 229 static void __init add_numamem_region(u64 start, u64 end, u32 type) 171 230 { 172 - u32 i; 173 - u64 ofs = start; 231 + u32 node = pa_to_nid(start); 232 + u64 size = end - start; 233 + static unsigned long num_physpages; 174 234 175 235 if (start >= end) { 176 236 pr_debug("Invalid region: %016llx-%016llx\n", start, end); 177 237 return; 178 238 } 179 239 180 - for (i = 0; i < numa_meminfo.nr_blks; i++) { 181 - struct numa_memblk *mb = &numa_meminfo.blk[i]; 182 - 183 - if (ofs > mb->end) 184 - continue; 185 - 186 - if (end > mb->end) { 187 - add_node_intersection(mb->nid, ofs, mb->end - ofs, type); 188 - ofs = mb->end; 189 - } else { 190 - add_node_intersection(mb->nid, ofs, end - ofs, type); 191 - break; 192 - } 193 - } 240 + num_physpages += (size >> PAGE_SHIFT); 241 + pr_info("Node%d: mem_type:%d, mem_start:0x%llx, mem_size:0x%llx Bytes\n", 242 + node, type, start, size); 243 + pr_info(" start_pfn:0x%llx, end_pfn:0x%llx, num_physpages:0x%lx\n", 244 + start >> PAGE_SHIFT, end >> PAGE_SHIFT, num_physpages); 245 + memblock_set_node(start, size, &memblock.memory, node); 194 246 } 195 247 196 248 static void __init init_node_memblock(void) ··· 225 291 } 226 292 } 227 293 228 - static void __init numa_default_distance(void) 229 - { 230 - int row, col; 231 - 232 - for (row = 0; row < MAX_NUMNODES; row++) 233 - for (col = 0; col < MAX_NUMNODES; col++) { 234 - if (col == row) 235 - node_distances[row][col] = LOCAL_DISTANCE; 236 - else 237 - /* We assume that one node per package here! 238 - * 239 - * A SLIT should be used for multiple nodes 240 - * per package to override default setting. 241 - */ 242 - node_distances[row][col] = REMOTE_DISTANCE; 243 - } 244 - } 245 - 246 294 /* 247 295 * fake_numa_init() - For Non-ACPI systems 248 296 * Return: 0 on success, -errno on failure. ··· 249 333 for (i = 0; i < NR_CPUS; i++) 250 334 set_cpuid_to_node(i, NUMA_NO_NODE); 251 335 252 - numa_default_distance(); 336 + numa_reset_distance(); 253 337 nodes_clear(numa_nodes_parsed); 254 338 nodes_clear(node_possible_map); 255 339 nodes_clear(node_online_map); 256 - memset(&numa_meminfo, 0, sizeof(numa_meminfo)); 340 + WARN_ON(memblock_clear_hotplug(0, PHYS_ADDR_MAX)); 257 341 258 342 /* Parse SRAT and SLIT if provided by firmware. */ 259 343 ret = acpi_disabled ? fake_numa_init() : acpi_numa_init();
+38
arch/loongarch/kernel/smp.c
··· 46 46 cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly; 47 47 EXPORT_SYMBOL(cpu_sibling_map); 48 48 49 + /* Representing the last level cache shared map of each logical CPU */ 50 + cpumask_t cpu_llc_shared_map[NR_CPUS] __read_mostly; 51 + EXPORT_SYMBOL(cpu_llc_shared_map); 52 + 49 53 /* Representing the core map of multi-core chips of each logical CPU */ 50 54 cpumask_t cpu_core_map[NR_CPUS] __read_mostly; 51 55 EXPORT_SYMBOL(cpu_core_map); ··· 66 62 67 63 /* representing cpus for which sibling maps can be computed */ 68 64 static cpumask_t cpu_sibling_setup_map; 65 + 66 + /* representing cpus for which llc shared maps can be computed */ 67 + static cpumask_t cpu_llc_shared_setup_map; 69 68 70 69 /* representing cpus for which core maps can be computed */ 71 70 static cpumask_t cpu_core_setup_map; ··· 107 100 cpumask_set_cpu(cpu, &cpu_core_map[i]); 108 101 } 109 102 } 103 + } 104 + 105 + static inline void set_cpu_llc_shared_map(int cpu) 106 + { 107 + int i; 108 + 109 + cpumask_set_cpu(cpu, &cpu_llc_shared_setup_map); 110 + 111 + for_each_cpu(i, &cpu_llc_shared_setup_map) { 112 + if (cpu_to_node(cpu) == cpu_to_node(i)) { 113 + cpumask_set_cpu(i, &cpu_llc_shared_map[cpu]); 114 + cpumask_set_cpu(cpu, &cpu_llc_shared_map[i]); 115 + } 116 + } 117 + } 118 + 119 + static inline void clear_cpu_llc_shared_map(int cpu) 120 + { 121 + int i; 122 + 123 + for_each_cpu(i, &cpu_llc_shared_setup_map) { 124 + if (cpu_to_node(cpu) == cpu_to_node(i)) { 125 + cpumask_clear_cpu(i, &cpu_llc_shared_map[cpu]); 126 + cpumask_clear_cpu(cpu, &cpu_llc_shared_map[i]); 127 + } 128 + } 129 + 130 + cpumask_clear_cpu(cpu, &cpu_llc_shared_setup_map); 110 131 } 111 132 112 133 static inline void set_cpu_sibling_map(int cpu) ··· 441 406 #endif 442 407 set_cpu_online(cpu, false); 443 408 clear_cpu_sibling_map(cpu); 409 + clear_cpu_llc_shared_map(cpu); 444 410 calculate_cpu_foreign_map(); 445 411 local_irq_save(flags); 446 412 irq_migrate_all_off_this_cpu(); ··· 608 572 current_thread_info()->cpu = 0; 609 573 loongson_prepare_cpus(max_cpus); 610 574 set_cpu_sibling_map(0); 575 + set_cpu_llc_shared_map(0); 611 576 set_cpu_core_map(0); 612 577 calculate_cpu_foreign_map(); 613 578 #ifndef CONFIG_HOTPLUG_CPU ··· 650 613 loongson_init_secondary(); 651 614 652 615 set_cpu_sibling_map(cpu); 616 + set_cpu_llc_shared_map(cpu); 653 617 set_cpu_core_map(cpu); 654 618 655 619 notify_cpu_starting(cpu);
+3 -1
arch/loongarch/kernel/vdso.c
··· 105 105 106 106 vdso_addr = data_addr + VVAR_SIZE; 107 107 vma = _install_special_mapping(mm, vdso_addr, info->size, 108 - VM_READ | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC, 108 + VM_READ | VM_EXEC | 109 + VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC | 110 + VM_SEALED_SYSMAP, 109 111 &info->code_mapping); 110 112 if (IS_ERR(vma)) { 111 113 ret = PTR_ERR(vma);
+2 -1
arch/loongarch/mm/hugetlbpage.c
··· 47 47 pmd = pmd_offset(pud, addr); 48 48 } 49 49 } 50 - return pmd_none(pmdp_get(pmd)) ? NULL : (pte_t *) pmd; 50 + 51 + return (!pmd || pmd_none(pmdp_get(pmd))) ? NULL : (pte_t *) pmd; 51 52 } 52 53 53 54 uint64_t pmd_to_entrylo(unsigned long pmd_val)
-8
arch/loongarch/mm/init.c
··· 106 106 page += vmem_altmap_offset(altmap); 107 107 __remove_pages(start_pfn, nr_pages, altmap); 108 108 } 109 - 110 - #ifdef CONFIG_NUMA 111 - int memory_add_physaddr_to_nid(u64 start) 112 - { 113 - return pa_to_nid(start); 114 - } 115 - EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid); 116 - #endif 117 109 #endif 118 110 119 111 #ifdef CONFIG_SPARSEMEM_VMEMMAP
+12 -2
arch/loongarch/pci/acpi.c
··· 194 194 { 195 195 struct pci_bus *bus; 196 196 struct pci_root_info *info; 197 + struct pci_host_bridge *host; 197 198 struct acpi_pci_root_ops *root_ops; 198 199 int domain = root->segment; 199 200 int busnum = root->secondary.start; ··· 238 237 return NULL; 239 238 } 240 239 241 - pci_bus_size_bridges(bus); 242 - pci_bus_assign_resources(bus); 240 + /* If we must preserve the resource configuration, claim now */ 241 + host = pci_find_host_bridge(bus); 242 + if (host->preserve_config) 243 + pci_bus_claim_resources(bus); 244 + 245 + /* 246 + * Assign whatever was left unassigned. If we didn't claim above, 247 + * this will reassign everything. 248 + */ 249 + pci_assign_unassigned_root_bus_resources(bus); 250 + 243 251 list_for_each_entry(child, &bus->children, node) 244 252 pcie_bus_configure_settings(child); 245 253 }
+1 -1
drivers/firmware/efi/libstub/Makefile
··· 31 31 $(DISABLE_STACKLEAK_PLUGIN) 32 32 cflags-$(CONFIG_RISCV) += -fpic -DNO_ALTERNATIVE -mno-relax \ 33 33 $(DISABLE_STACKLEAK_PLUGIN) 34 - cflags-$(CONFIG_LOONGARCH) += -fpie 34 + cflags-$(CONFIG_LOONGARCH) += -fpie $(DISABLE_STACKLEAK_PLUGIN) 35 35 36 36 cflags-$(CONFIG_EFI_PARAMS_FROM_FDT) += -I$(srctree)/scripts/dtc/libfdt 37 37
+47 -40
drivers/platform/loongarch/loongson-laptop.c
··· 56 56 static acpi_handle hotkey_handle; 57 57 static struct key_entry hotkey_keycode_map[GENERIC_HOTKEY_MAP_MAX]; 58 58 59 - int loongson_laptop_turn_on_backlight(void); 60 - int loongson_laptop_turn_off_backlight(void); 59 + static bool bl_powered; 61 60 static int loongson_laptop_backlight_update(struct backlight_device *bd); 62 61 63 62 /* 2. ACPI Helpers and device model */ ··· 353 354 return level; 354 355 } 355 356 357 + static int ec_backlight_set_power(bool state) 358 + { 359 + int status; 360 + union acpi_object arg0 = { ACPI_TYPE_INTEGER }; 361 + struct acpi_object_list args = { 1, &arg0 }; 362 + 363 + arg0.integer.value = state; 364 + status = acpi_evaluate_object(NULL, "\\BLSW", &args, NULL); 365 + if (ACPI_FAILURE(status)) { 366 + pr_info("Loongson lvds error: 0x%x\n", status); 367 + return -EIO; 368 + } 369 + 370 + return 0; 371 + } 372 + 356 373 static int loongson_laptop_backlight_update(struct backlight_device *bd) 357 374 { 358 - int lvl = ec_backlight_level(bd->props.brightness); 375 + bool target_powered = !backlight_is_blank(bd); 376 + int ret = 0, lvl = ec_backlight_level(bd->props.brightness); 359 377 360 378 if (lvl < 0) 361 379 return -EIO; 380 + 362 381 if (ec_set_brightness(lvl)) 363 382 return -EIO; 364 383 365 - return 0; 384 + if (target_powered != bl_powered) { 385 + ret = ec_backlight_set_power(target_powered); 386 + if (ret < 0) 387 + return ret; 388 + 389 + bl_powered = target_powered; 390 + } 391 + 392 + return ret; 366 393 } 367 394 368 395 static int loongson_laptop_get_brightness(struct backlight_device *bd) ··· 409 384 410 385 static int laptop_backlight_register(void) 411 386 { 412 - int status = 0; 387 + int status = 0, ret; 413 388 struct backlight_properties props; 414 389 415 390 memset(&props, 0, sizeof(props)); ··· 417 392 if (!acpi_evalf(hotkey_handle, &status, "ECLL", "d")) 418 393 return -EIO; 419 394 420 - props.brightness = 1; 395 + ret = ec_backlight_set_power(true); 396 + if (ret) 397 + return ret; 398 + 399 + bl_powered = true; 400 + 421 401 props.max_brightness = status; 402 + props.brightness = ec_get_brightness(); 403 + props.power = BACKLIGHT_POWER_ON; 422 404 props.type = BACKLIGHT_PLATFORM; 423 405 424 406 backlight_device_register("loongson_laptop", 425 407 NULL, NULL, &backlight_laptop_ops, &props); 426 408 427 - return 0; 428 - } 429 - 430 - int loongson_laptop_turn_on_backlight(void) 431 - { 432 - int status; 433 - union acpi_object arg0 = { ACPI_TYPE_INTEGER }; 434 - struct acpi_object_list args = { 1, &arg0 }; 435 - 436 - arg0.integer.value = 1; 437 - status = acpi_evaluate_object(NULL, "\\BLSW", &args, NULL); 438 - if (ACPI_FAILURE(status)) { 439 - pr_info("Loongson lvds error: 0x%x\n", status); 440 - return -ENODEV; 441 - } 442 - 443 - return 0; 444 - } 445 - 446 - int loongson_laptop_turn_off_backlight(void) 447 - { 448 - int status; 449 - union acpi_object arg0 = { ACPI_TYPE_INTEGER }; 450 - struct acpi_object_list args = { 1, &arg0 }; 451 - 452 - arg0.integer.value = 0; 453 - status = acpi_evaluate_object(NULL, "\\BLSW", &args, NULL); 454 - if (ACPI_FAILURE(status)) { 455 - pr_info("Loongson lvds error: 0x%x\n", status); 456 - return -ENODEV; 457 - } 458 409 459 410 return 0; 460 411 } ··· 612 611 613 612 static void __exit generic_acpi_laptop_exit(void) 614 613 { 614 + int i; 615 + 615 616 if (generic_inputdev) { 616 - if (input_device_registered) 617 - input_unregister_device(generic_inputdev); 618 - else 617 + if (!input_device_registered) { 619 618 input_free_device(generic_inputdev); 619 + } else { 620 + input_unregister_device(generic_inputdev); 621 + 622 + for (i = 0; i < ARRAY_SIZE(generic_sub_drivers); i++) 623 + generic_subdriver_exit(&generic_sub_drivers[i]); 624 + } 620 625 } 621 626 } 622 627
+1
mm/Kconfig
··· 1355 1355 config NUMA_EMU 1356 1356 bool "NUMA emulation" 1357 1357 depends on NUMA_MEMBLKS 1358 + depends on X86 || GENERIC_ARCH_NUMA 1358 1359 help 1359 1360 Enable NUMA emulation. A flat machine will be split 1360 1361 into virtual nodes when booted with "numa=fake=N", where N is the