History

Merge tag 'for-5.16/parisc-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux

Pull parisc updates from Helge Deller: "Lots of new features and fixes: - Added TOC (table of content) support, which is a debugging feature which is either initiated by pressing the TOC button or via command in the BMC. If pressed the Linux built-in KDB/KGDB will be called (Sven Schnelle) - Fix CONFIG_PREEMPT (Sven) - Fix unwinder on 64-bit kernels (Sven) - Various kgdb fixes (Sven) - Added KFENCE support (me) - Switch to ARCH_STACKWALK implementation (me) - Fix ptrace check on syscall return (me) - Fix kernel crash with fixmaps on PA1.x machines (me) - Move thread_info into task struct, aka CONFIG_THREAD_INFO_IN_TASK (me) - Updated defconfigs - Smaller cleanups, including Makefile cleanups (Masahiro Yamada), use kthread_run() macro (Cai Huoqing), use swap() macro (Yihao Han)" * tag 'for-5.16/parisc-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux: (36 commits) parisc: Fix set_fixmap() on PA1.x CPUs parisc: Use swap() to swap values in setup_bootmem() parisc: Update defconfigs parisc: decompressor: clean up Makefile parisc: decompressor: remove repeated depenency of misc.o parisc: Remove unused constants from asm-offsets.c parisc/ftrace: use static key to enable/disable function graph tracer parisc/ftrace: set function trace function parisc: Make use of the helper macro kthread_run() parisc: mark xchg functions notrace parisc: enhance warning regarding usage of O_NONBLOCK parisc: Drop ifdef __KERNEL__ from non-uapi kernel headers parisc: Use PRIV_USER and PRIV_KERNEL in ptrace.h parisc: Use PRIV_USER in syscall.S parisc/kgdb: add kgdb_roundup() to make kgdb work with idle polling parisc: Move thread_info into task struct parisc: add support for TOC (transfer of control) parisc/firmware: add functions to retrieve TOC data parisc: add PIM TOC data structures parisc: move virt_map macro to assembly.h ...

Linus Torvalds committed 5 years ago

Commit 552ebfe2 parents 46f8763 6e866a444 files · +622 −321Browse files

Unified · Split

44 files
  1. Documentation/features/core/thread-info-in-task/arch-support.txt +1 −1
  2. arch/parisc/Kconfig +20 −2
  3. arch/parisc/boot/compressed/Makefile +3 −6
  4. arch/parisc/configs/generic-32bit_defconfig +2 −7
  5. arch/parisc/configs/generic-64bit_defconfig +12 −9
  6. arch/parisc/include/asm/assembly.h +32 −0
  7. arch/parisc/include/asm/bitops.h +0 −10
  8. arch/parisc/include/asm/current.h +19 −0
  9. arch/parisc/include/asm/futex.h +0 −3
  10. arch/parisc/include/asm/ide.h +0 −4
  11. arch/parisc/include/asm/kfence.h +44 −0
  12. arch/parisc/include/asm/mckinley.h +0 −2
  13. arch/parisc/include/asm/pdc.h +2 −0
  14. arch/parisc/include/asm/processor.h +5 −6
  15. arch/parisc/include/asm/ptrace.h +3 −3
  16. arch/parisc/include/asm/runway.h +0 −2
  17. arch/parisc/include/asm/smp.h +17 −2
  18. arch/parisc/include/asm/thread_info.h +1 −11
  19. arch/parisc/include/asm/traps.h +1 −0
  20. arch/parisc/include/asm/unaligned.h +0 −2
  21. arch/parisc/include/uapi/asm/pdc.h +26 −2
  22. arch/parisc/kernel/Makefile +1 −0
  23. arch/parisc/kernel/asm-offsets.c +9 −25
  24. arch/parisc/kernel/cache.c +36 −51
  25. arch/parisc/kernel/entry.S +30 −60
  26. arch/parisc/kernel/firmware.c +32 −0
  27. arch/parisc/kernel/ftrace.c +11 −10
  28. arch/parisc/kernel/head.S +19 −21
  29. arch/parisc/kernel/irq.c +3 −3
  30. arch/parisc/kernel/pdt.c +1 −3
  31. arch/parisc/kernel/process.c +2 −2
  32. arch/parisc/kernel/smp.c +21 −4
  33. arch/parisc/kernel/stacktrace.c +13 −17
  34. arch/parisc/kernel/sys_parisc.c +6 −4
  35. arch/parisc/kernel/syscall.S +10 −16
  36. arch/parisc/kernel/toc.c +111 −0
  37. arch/parisc/kernel/toc_asm.S +88 −0
  38. arch/parisc/kernel/traps.c +6 −1
  39. arch/parisc/kernel/unwind.c +20 −14
  40. arch/parisc/lib/bitops.c +6 −6
  41. arch/parisc/mm/fault.c +1 −1
  42. arch/parisc/mm/fixmap.c +1 −4
  43. arch/parisc/mm/init.c +3 −7
  44. include/linux/sched/task_stack.h +4 −0
Documentation/features/core/thread-info-in-task/arch-support.txt+1−1
@@ -20,7 +20,7 @@ · 19 unmodified lines
20 | nds32: | ok |20 | nds32: | ok |
21 | nios2: | TODO |21 | nios2: | TODO |
22 | openrisc: | TODO |22 | openrisc: | TODO |
23 | parisc: | TODO |23 | parisc: | ok |
24 | powerpc: | ok |24 | powerpc: | ok |
25 | riscv: | ok |25 | riscv: | ok |
26 | s390: | ok |26 | s390: | ok |
arch/parisc/Kconfig+20−2
@@ -13,6 +13,8 @@ config PARISC · 12 unmodified lines
13 select ARCH_NO_SG_CHAIN13 select ARCH_NO_SG_CHAIN
14 select ARCH_SUPPORTS_HUGETLBFS if PA2014 select ARCH_SUPPORTS_HUGETLBFS if PA20
15 select ARCH_SUPPORTS_MEMORY_FAILURE15 select ARCH_SUPPORTS_MEMORY_FAILURE
16 select ARCH_STACKWALK
17 select HAVE_RELIABLE_STACKTRACE
16 select DMA_OPS18 select DMA_OPS
17 select RTC_CLASS19 select RTC_CLASS
18 select RTC_DRV_GENERIC20 select RTC_DRV_GENERIC
@@ -46,6 +48,7 @@ config PARISC · 27 unmodified lines
46 select HAVE_ARCH_HASH48 select HAVE_ARCH_HASH
47 select HAVE_ARCH_JUMP_LABEL49 select HAVE_ARCH_JUMP_LABEL
48 select HAVE_ARCH_JUMP_LABEL_RELATIVE50 select HAVE_ARCH_JUMP_LABEL_RELATIVE
51 select HAVE_ARCH_KFENCE
49 select HAVE_ARCH_SECCOMP_FILTER52 select HAVE_ARCH_SECCOMP_FILTER
50 select HAVE_ARCH_TRACEHOOK53 select HAVE_ARCH_TRACEHOOK
51 select HAVE_REGS_AND_STACK_ACCESS_API54 select HAVE_REGS_AND_STACK_ACCESS_API
@@ -53,6 +56,7 @@ config PARISC · 1 unmodified line
53 select HAVE_UNSTABLE_SCHED_CLOCK if SMP56 select HAVE_UNSTABLE_SCHED_CLOCK if SMP
54 select LEGACY_TIMER_TICK57 select LEGACY_TIMER_TICK
55 select CPU_NO_EFFICIENT_FFS58 select CPU_NO_EFFICIENT_FFS
59 select THREAD_INFO_IN_TASK
56 select NEED_DMA_MAP_STATE60 select NEED_DMA_MAP_STATE
57 select NEED_SG_DMA_LENGTH61 select NEED_SG_DMA_LENGTH
58 select HAVE_ARCH_KGDB62 select HAVE_ARCH_KGDB
@@ -252,11 +256,11 @@ config PARISC_PAGE_SIZE_4KB · 193 unmodified lines
252 256
253config PARISC_PAGE_SIZE_16KB257config PARISC_PAGE_SIZE_16KB
254 bool "16KB"258 bool "16KB"
255 depends on PA8X00 && BROKEN259 depends on PA8X00 && BROKEN && !KFENCE
256 260
257config PARISC_PAGE_SIZE_64KB261config PARISC_PAGE_SIZE_64KB
258 bool "64KB"262 bool "64KB"
259 depends on PA8X00 && BROKEN263 depends on PA8X00 && BROKEN && !KFENCE
260 264
261endchoice265endchoice
262 266
@@ -288,6 +292,20 @@ config SMP · 25 unmodified lines
288 292
289 If you don't know what to do here, say N.293 If you don't know what to do here, say N.
290 294
295config TOC
296 bool "Support TOC switch"
297 default y if 64BIT || !SMP
298 help
299 Most PA-RISC machines have either a switch at the back of the machine
300 or a command in BMC to trigger a TOC interrupt. If you say Y here a
301 handler will be installed which will either show a backtrace on all
302 CPUs, or enter a possible configured debugger like kgdb/kdb.
303
304 Note that with this option enabled, the kernel will use an additional 16KB
305 per possible CPU as a special stack for the TOC handler.
306
307 If you don't want to debug the Kernel, say N.
308
291config PARISC_CPU_TOPOLOGY309config PARISC_CPU_TOPOLOGY
292 bool "Support cpu topology definition"310 bool "Support cpu topology definition"
293 depends on SMP311 depends on SMP
arch/parisc/boot/compressed/Makefile+3−6
@@ -9,9 +9,10 @@ KCOV_INSTRUMENT := n · 8 unmodified lines
9GCOV_PROFILE := n9GCOV_PROFILE := n
10UBSAN_SANITIZE := n10UBSAN_SANITIZE := n
11 11
12OBJECTS := head.o real2.o firmware.o misc.o piggy.o
12targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz213targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2
13targets += vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.lz414targets += vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.lz4
14targets += misc.o piggy.o sizes.h head.o real2.o firmware.o15targets += $(OBJECTS) sizes.h
15targets += real2.S firmware.c16targets += real2.S firmware.c
16 17
17KBUILD_CFLAGS := -D__KERNEL__ -O2 -DBOOTLOADER18KBUILD_CFLAGS := -D__KERNEL__ -O2 -DBOOTLOADER
@@ -23,10 +24,8 @@ ifndef CONFIG_64BIT · 5 unmodified lines
23KBUILD_CFLAGS += -mfast-indirect-calls24KBUILD_CFLAGS += -mfast-indirect-calls
24endif25endif
25 26
26OBJECTS += $(obj)/head.o $(obj)/real2.o $(obj)/firmware.o $(obj)/misc.o $(obj)/piggy.o
27
28LDFLAGS_vmlinux := -X -e startup --as-needed -T27LDFLAGS_vmlinux := -X -e startup --as-needed -T
29$(obj)/vmlinux: $(obj)/vmlinux.lds $(OBJECTS) $(LIBGCC) FORCE28$(obj)/vmlinux: $(obj)/vmlinux.lds $(addprefix $(obj)/, $(OBJECTS)) $(LIBGCC) FORCE
30 $(call if_changed,ld)29 $(call if_changed,ld)
31 30
32sed-sizes := -e 's/^\([0-9a-fA-F]*\) . \(__bss_start\|_end\|parisc_kernel_start\)$$/\#define SZ\2 0x\1/p'31sed-sizes := -e 's/^\([0-9a-fA-F]*\) . \(__bss_start\|_end\|parisc_kernel_start\)$$/\#define SZ\2 0x\1/p'
@@ -52,8 +51,6 @@ $(obj)/real2.o: $(obj)/real2.S · 19 unmodified lines
52$(obj)/real2.S: $(srctree)/arch/$(SRCARCH)/kernel/real2.S51$(obj)/real2.S: $(srctree)/arch/$(SRCARCH)/kernel/real2.S
53 $(call cmd,shipped)52 $(call cmd,shipped)
54 53
55$(obj)/misc.o: $(obj)/sizes.h
56
57CPPFLAGS_vmlinux.lds += -I$(objtree)/$(obj) -DBOOTLOADER54CPPFLAGS_vmlinux.lds += -I$(objtree)/$(obj) -DBOOTLOADER
58$(obj)/vmlinux.lds: $(obj)/sizes.h55$(obj)/vmlinux.lds: $(obj)/sizes.h
59 56
arch/parisc/configs/generic-32bit_defconfig+2−7
@@ -22,7 +22,6 @@ CONFIG_PCI_LBA=y · 21 unmodified lines
22CONFIG_MODULES=y22CONFIG_MODULES=y
23CONFIG_MODULE_UNLOAD=y23CONFIG_MODULE_UNLOAD=y
24CONFIG_MODULE_FORCE_UNLOAD=y24CONFIG_MODULE_FORCE_UNLOAD=y
25# CONFIG_BLK_DEV_BSG is not set
26# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set25# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
27CONFIG_BINFMT_MISC=m26CONFIG_BINFMT_MISC=m
28CONFIG_NET=y27CONFIG_NET=y
@@ -55,13 +54,14 @@ CONFIG_BLK_DEV_SD=y · 26 unmodified lines
55CONFIG_CHR_DEV_ST=y54CONFIG_CHR_DEV_ST=y
56CONFIG_BLK_DEV_SR=y55CONFIG_BLK_DEV_SR=y
57CONFIG_CHR_DEV_SG=y56CONFIG_CHR_DEV_SG=y
57# CONFIG_BLK_DEV_BSG is not set
58CONFIG_SCSI_LASI700=y58CONFIG_SCSI_LASI700=y
59CONFIG_SCSI_SYM53C8XX_2=y59CONFIG_SCSI_SYM53C8XX_2=y
60CONFIG_SCSI_ZALON=y60CONFIG_SCSI_ZALON=y
61CONFIG_SCSI_DH=y61CONFIG_SCSI_DH=y
62CONFIG_ATA=y62CONFIG_ATA=y
63CONFIG_ATA_GENERIC=y
64CONFIG_PATA_NS87415=y63CONFIG_PATA_NS87415=y
64CONFIG_ATA_GENERIC=y
65CONFIG_MD=y65CONFIG_MD=y
66CONFIG_BLK_DEV_MD=m66CONFIG_BLK_DEV_MD=m
67CONFIG_MD_LINEAR=m67CONFIG_MD_LINEAR=m
@@ -212,7 +212,6 @@ CONFIG_NFS_FS=m · 144 unmodified lines
212CONFIG_NFSD=m212CONFIG_NFSD=m
213CONFIG_NFSD_V3=y213CONFIG_NFSD_V3=y
214CONFIG_CIFS=m214CONFIG_CIFS=m
215CONFIG_CIFS_WEAK_PW_HASH=y
216CONFIG_CIFS_XATTR=y215CONFIG_CIFS_XATTR=y
217CONFIG_CIFS_POSIX=y216CONFIG_CIFS_POSIX=y
218# CONFIG_CIFS_DEBUG is not set217# CONFIG_CIFS_DEBUG is not set
@@ -221,16 +220,12 @@ CONFIG_CRYPTO_HMAC=y · 2 unmodified lines
221CONFIG_CRYPTO_MD5=y220CONFIG_CRYPTO_MD5=y
222CONFIG_CRYPTO_MICHAEL_MIC=m221CONFIG_CRYPTO_MICHAEL_MIC=m
223CONFIG_CRYPTO_SHA1=y222CONFIG_CRYPTO_SHA1=y
224CONFIG_CRYPTO_TGR192=m
225CONFIG_CRYPTO_WP512=m223CONFIG_CRYPTO_WP512=m
226CONFIG_CRYPTO_ANUBIS=m
227CONFIG_CRYPTO_BLOWFISH=m224CONFIG_CRYPTO_BLOWFISH=m
228CONFIG_CRYPTO_CAST5=m225CONFIG_CRYPTO_CAST5=m
229CONFIG_CRYPTO_CAST6=m226CONFIG_CRYPTO_CAST6=m
230CONFIG_CRYPTO_DES=y227CONFIG_CRYPTO_DES=y
231CONFIG_CRYPTO_KHAZAD=m
232CONFIG_CRYPTO_SERPENT=m228CONFIG_CRYPTO_SERPENT=m
233CONFIG_CRYPTO_TEA=m
234CONFIG_CRYPTO_TWOFISH=m229CONFIG_CRYPTO_TWOFISH=m
235CONFIG_CRYPTO_DEFLATE=y230CONFIG_CRYPTO_DEFLATE=y
236CONFIG_CRC_CCITT=m231CONFIG_CRC_CCITT=m
arch/parisc/configs/generic-64bit_defconfig+12−9
@@ -8,9 +8,10 @@ CONFIG_TASKSTATS=y · 7 unmodified lines
8CONFIG_TASK_DELAY_ACCT=y8CONFIG_TASK_DELAY_ACCT=y
9CONFIG_TASK_XACCT=y9CONFIG_TASK_XACCT=y
10CONFIG_TASK_IO_ACCOUNTING=y10CONFIG_TASK_IO_ACCOUNTING=y
11CONFIG_IKCONFIG=y
12CONFIG_IKCONFIG_PROC=y
11CONFIG_CGROUPS=y13CONFIG_CGROUPS=y
12CONFIG_MEMCG=y14CONFIG_MEMCG=y
13CONFIG_MEMCG_SWAP=y
14CONFIG_CGROUP_PIDS=y15CONFIG_CGROUP_PIDS=y
15CONFIG_CPUSETS=y16CONFIG_CPUSETS=y
16CONFIG_RELAY=y17CONFIG_RELAY=y
@@ -124,14 +125,13 @@ CONFIG_QLCNIC=m · 107 unmodified lines
124# CONFIG_NET_VENDOR_TI is not set125# CONFIG_NET_VENDOR_TI is not set
125# CONFIG_NET_VENDOR_VIA is not set126# CONFIG_NET_VENDOR_VIA is not set
126# CONFIG_NET_VENDOR_WIZNET is not set127# CONFIG_NET_VENDOR_WIZNET is not set
127CONFIG_MDIO_BITBANG=m
128CONFIG_PHYLIB=y128CONFIG_PHYLIB=y
129CONFIG_BROADCOM_PHY=m129CONFIG_BROADCOM_PHY=m
130CONFIG_CICADA_PHY=m130CONFIG_CICADA_PHY=m
131CONFIG_DAVICOM_PHY=m131CONFIG_DAVICOM_PHY=m
132CONFIG_ICPLUS_PHY=m132CONFIG_ICPLUS_PHY=m
133CONFIG_LSI_ET1011C_PHY=m
134CONFIG_LXT_PHY=m133CONFIG_LXT_PHY=m
134CONFIG_LSI_ET1011C_PHY=m
135CONFIG_MARVELL_PHY=m135CONFIG_MARVELL_PHY=m
136CONFIG_NATIONAL_PHY=m136CONFIG_NATIONAL_PHY=m
137CONFIG_QSEMI_PHY=m137CONFIG_QSEMI_PHY=m
@@ -139,6 +139,7 @@ CONFIG_REALTEK_PHY=m · 1 unmodified line
139CONFIG_SMSC_PHY=m139CONFIG_SMSC_PHY=m
140CONFIG_STE10XP=m140CONFIG_STE10XP=m
141CONFIG_VITESSE_PHY=m141CONFIG_VITESSE_PHY=m
142CONFIG_MDIO_BITBANG=m
142CONFIG_SLIP=m143CONFIG_SLIP=m
143# CONFIG_WLAN is not set144# CONFIG_WLAN is not set
144CONFIG_INPUT_EVDEV=y145CONFIG_INPUT_EVDEV=y
@@ -150,7 +151,6 @@ CONFIG_SERIO_SERPORT=m · 5 unmodified lines
150# CONFIG_HP_SDC is not set151# CONFIG_HP_SDC is not set
151CONFIG_SERIO_RAW=m152CONFIG_SERIO_RAW=m
152# CONFIG_LEGACY_PTYS is not set153# CONFIG_LEGACY_PTYS is not set
153CONFIG_NOZOMI=m
154CONFIG_SERIAL_8250=y154CONFIG_SERIAL_8250=y
155# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set155# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set
156CONFIG_SERIAL_8250_CONSOLE=y156CONFIG_SERIAL_8250_CONSOLE=y
@@ -160,6 +160,7 @@ CONFIG_SERIAL_8250_EXTENDED=y · 3 unmodified lines
160CONFIG_SERIAL_8250_MANY_PORTS=y160CONFIG_SERIAL_8250_MANY_PORTS=y
161CONFIG_SERIAL_8250_SHARE_IRQ=y161CONFIG_SERIAL_8250_SHARE_IRQ=y
162CONFIG_SERIAL_JSM=m162CONFIG_SERIAL_JSM=m
163CONFIG_NOZOMI=m
163CONFIG_IPMI_HANDLER=y164CONFIG_IPMI_HANDLER=y
164CONFIG_IPMI_DEVICE_INTERFACE=y165CONFIG_IPMI_DEVICE_INTERFACE=y
165CONFIG_IPMI_SI=y166CONFIG_IPMI_SI=y
@@ -188,9 +189,13 @@ CONFIG_AGP=y · 22 unmodified lines
188CONFIG_AGP_PARISC=y189CONFIG_AGP_PARISC=y
189CONFIG_DRM=y190CONFIG_DRM=y
190CONFIG_DRM_RADEON=y191CONFIG_DRM_RADEON=y
191CONFIG_FIRMWARE_EDID=y192CONFIG_FB=y
192CONFIG_FB_MODE_HELPERS=y193CONFIG_FB_MATROX=y
193CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y194CONFIG_FB_MATROX_MYSTIQUE=y
195CONFIG_FB_MATROX_G=y
196CONFIG_FB_MATROX_I2C=y
197CONFIG_FB_MATROX_MAVEN=y
198CONFIG_FB_RADEON=y
194CONFIG_HIDRAW=y199CONFIG_HIDRAW=y
195CONFIG_HID_PID=y200CONFIG_HID_PID=y
196CONFIG_USB_HIDDEV=y201CONFIG_USB_HIDDEV=y
@@ -202,7 +207,6 @@ CONFIG_UIO_SERCOS3=m · 5 unmodified lines
202CONFIG_UIO_PCI_GENERIC=m207CONFIG_UIO_PCI_GENERIC=m
203CONFIG_STAGING=y208CONFIG_STAGING=y
204CONFIG_QLGE=m209CONFIG_QLGE=m
205CONFIG_HP100=m
206CONFIG_EXT2_FS=y210CONFIG_EXT2_FS=y
207CONFIG_EXT2_FS_XATTR=y211CONFIG_EXT2_FS_XATTR=y
208CONFIG_EXT2_FS_SECURITY=y212CONFIG_EXT2_FS_SECURITY=y
@@ -245,7 +249,6 @@ CONFIG_CRYPTO_PCBC=m · 36 unmodified lines
245CONFIG_CRYPTO_MD4=m249CONFIG_CRYPTO_MD4=m
246CONFIG_CRYPTO_MD5=y250CONFIG_CRYPTO_MD5=y
247CONFIG_CRYPTO_MICHAEL_MIC=m251CONFIG_CRYPTO_MICHAEL_MIC=m
248CONFIG_CRYPTO_ARC4=m
249CONFIG_CRYPTO_FCRYPT=m252CONFIG_CRYPTO_FCRYPT=m
250CONFIG_CRYPTO_DEFLATE=m253CONFIG_CRYPTO_DEFLATE=m
251# CONFIG_CRYPTO_HW is not set254# CONFIG_CRYPTO_HW is not set
arch/parisc/include/asm/assembly.h+32−0
@@ -42,6 +42,9 @@ · 41 unmodified lines
42#define ASM_ULONG_INSN .word42#define ASM_ULONG_INSN .word
43#endif43#endif
44 44
45/* Frame alignment for 32- and 64-bit */
46#define FRAME_ALIGN 64
47
45#define CALLEE_SAVE_FRAME_SIZE (CALLEE_REG_FRAME_SIZE + CALLEE_FLOAT_FRAME_SIZE)48#define CALLEE_SAVE_FRAME_SIZE (CALLEE_REG_FRAME_SIZE + CALLEE_FLOAT_FRAME_SIZE)
46 49
47#ifdef CONFIG_PA2050#ifdef CONFIG_PA20
@@ -58,6 +61,10 @@ · 10 unmodified lines
58#define PA_ASM_LEVEL 1.161#define PA_ASM_LEVEL 1.1
59#endif62#endif
60 63
64/* Privilege level field in the rightmost two bits of the IA queues */
65#define PRIV_USER 3
66#define PRIV_KERNEL 0
67
61#ifdef __ASSEMBLY__68#ifdef __ASSEMBLY__
62 69
63#ifdef CONFIG_64BIT70#ifdef CONFIG_64BIT
@@ -71,6 +78,7 @@ · 7 unmodified lines
71#include <asm/types.h>78#include <asm/types.h>
72 79
73#include <asm/asmregs.h>80#include <asm/asmregs.h>
81#include <asm/psw.h>
74 82
75 sp = 3083 sp = 30
76 gp = 2784 gp = 27
@@ -497,6 +505,30 @@ · 420 unmodified lines
497 nop /* 7 */505 nop /* 7 */
498 .endm506 .endm
499 507
508 /* Switch to virtual mapping, trashing only %r1 */
509 .macro virt_map
510 /* pcxt_ssm_bug */
511 rsm PSW_SM_I, %r0 /* barrier for "Relied upon Translation */
512 mtsp %r0, %sr4
513 mtsp %r0, %sr5
514 mtsp %r0, %sr6
515 tovirt_r1 %r29
516 load32 KERNEL_PSW, %r1
517
518 rsm PSW_SM_QUIET,%r0 /* second "heavy weight" ctl op */
519 mtctl %r0, %cr17 /* Clear IIASQ tail */
520 mtctl %r0, %cr17 /* Clear IIASQ head */
521 mtctl %r1, %ipsw
522 load32 4f, %r1
523 mtctl %r1, %cr18 /* Set IIAOQ tail */
524 ldo 4(%r1), %r1
525 mtctl %r1, %cr18 /* Set IIAOQ head */
526 rfir
527 nop
5284:
529 .endm
530
531
500 /*532 /*
501 * ASM_EXCEPTIONTABLE_ENTRY533 * ASM_EXCEPTIONTABLE_ENTRY
502 *534 *
arch/parisc/include/asm/bitops.h+0−10
@@ -104,8 +104,6 @@ static __inline__ int test_and_change_bit(int nr, volatile unsigned long * addr) · 103 unmodified lines
104 104
105#include <asm-generic/bitops/non-atomic.h>105#include <asm-generic/bitops/non-atomic.h>
106 106
107#ifdef __KERNEL__
108
109/**107/**
110 * __ffs - find first bit in word. returns 0 to "BITS_PER_LONG-1".108 * __ffs - find first bit in word. returns 0 to "BITS_PER_LONG-1".
111 * @word: The word to search109 * @word: The word to search
@@ -205,16 +203,8 @@ static __inline__ int fls(unsigned int x) · 93 unmodified lines
205#include <asm-generic/bitops/hweight.h>203#include <asm-generic/bitops/hweight.h>
206#include <asm-generic/bitops/lock.h>204#include <asm-generic/bitops/lock.h>
207#include <asm-generic/bitops/sched.h>205#include <asm-generic/bitops/sched.h>
208
209#endif /* __KERNEL__ */
210
211#include <asm-generic/bitops/find.h>206#include <asm-generic/bitops/find.h>
212
213#ifdef __KERNEL__
214
215#include <asm-generic/bitops/le.h>207#include <asm-generic/bitops/le.h>
216#include <asm-generic/bitops/ext2-atomic-setbit.h>208#include <asm-generic/bitops/ext2-atomic-setbit.h>
217 209
218#endif /* __KERNEL__ */
219
220#endif /* _PARISC_BITOPS_H */210#endif /* _PARISC_BITOPS_H */
arch/parisc/include/asm/current.h+19−0
@@ -0,0 +1,19 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_PARISC_CURRENT_H
3#define _ASM_PARISC_CURRENT_H
4
5#include <asm/special_insns.h>
6
7#ifndef __ASSEMBLY__
8struct task_struct;
9
10static __always_inline struct task_struct *get_current(void)
11{
12 return (struct task_struct *) mfctl(30);
13}
14
15#define current get_current()
16
17#endif /* __ASSEMBLY__ */
18
19#endif /* _ASM_PARISC_CURRENT_H */
arch/parisc/include/asm/futex.h+0−3
@@ -2,8 +2,6 @@ · 1 unmodified line
2#ifndef _ASM_PARISC_FUTEX_H2#ifndef _ASM_PARISC_FUTEX_H
3#define _ASM_PARISC_FUTEX_H3#define _ASM_PARISC_FUTEX_H
4 4
5#ifdef __KERNEL__
6
7#include <linux/futex.h>5#include <linux/futex.h>
8#include <linux/uaccess.h>6#include <linux/uaccess.h>
9#include <asm/atomic.h>7#include <asm/atomic.h>
@@ -119,5 +117,4 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, · 109 unmodified lines
119 return 0;117 return 0;
120}118}
121 119
122#endif /*__KERNEL__*/
123#endif /*_ASM_PARISC_FUTEX_H*/120#endif /*_ASM_PARISC_FUTEX_H*/
arch/parisc/include/asm/ide.h+0−4
@@ -12,8 +12,6 @@ · 11 unmodified lines
12#ifndef __ASM_PARISC_IDE_H12#ifndef __ASM_PARISC_IDE_H
13#define __ASM_PARISC_IDE_H13#define __ASM_PARISC_IDE_H
14 14
15#ifdef __KERNEL__
16
17/* Generic I/O and MEMIO string operations. */15/* Generic I/O and MEMIO string operations. */
18 16
19#define __ide_insw insw17#define __ide_insw insw
@@ -53,6 +51,4 @@ static __inline__ void __ide_mm_outsl(void __iomem *port, void *addr, u32 count) · 33 unmodified lines
53 }51 }
54}52}
55 53
56#endif /* __KERNEL__ */
57
58#endif /* __ASM_PARISC_IDE_H */54#endif /* __ASM_PARISC_IDE_H */
arch/parisc/include/asm/kfence.h+44−0
@@ -0,0 +1,44 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * PA-RISC KFENCE support.
4 *
5 * Copyright (C) 2021, Helge Deller <deller@gmx.de>
6 */
7
8#ifndef _ASM_PARISC_KFENCE_H
9#define _ASM_PARISC_KFENCE_H
10
11#include <linux/kfence.h>
12
13#include <asm/pgtable.h>
14#include <asm/tlbflush.h>
15
16static inline bool arch_kfence_init_pool(void)
17{
18 return true;
19}
20
21/* Protect the given page and flush TLB. */
22static inline bool kfence_protect_page(unsigned long addr, bool protect)
23{
24 pte_t *pte = virt_to_kpte(addr);
25
26 if (WARN_ON(!pte))
27 return false;
28
29 /*
30 * We need to avoid IPIs, as we may get KFENCE allocations or faults
31 * with interrupts disabled.
32 */
33
34 if (protect)
35 set_pte(pte, __pte(pte_val(*pte) & ~_PAGE_PRESENT));
36 else
37 set_pte(pte, __pte(pte_val(*pte) | _PAGE_PRESENT));
38
39 flush_tlb_kernel_range(addr, addr + PAGE_SIZE);
40
41 return true;
42}
43
44#endif /* _ASM_PARISC_KFENCE_H */
arch/parisc/include/asm/mckinley.h+0−2
@@ -1,10 +1,8 @@
1/* SPDX-License-Identifier: GPL-2.0 */1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef ASM_PARISC_MCKINLEY_H2#ifndef ASM_PARISC_MCKINLEY_H
3#define ASM_PARISC_MCKINLEY_H3#define ASM_PARISC_MCKINLEY_H
4#ifdef __KERNEL__
5 4
6/* declared in arch/parisc/kernel/setup.c */5/* declared in arch/parisc/kernel/setup.c */
7extern struct proc_dir_entry * proc_mckinley_root;6extern struct proc_dir_entry * proc_mckinley_root;
8 7
9#endif /*__KERNEL__*/
10#endif /*ASM_PARISC_MCKINLEY_H*/8#endif /*ASM_PARISC_MCKINLEY_H*/
arch/parisc/include/asm/pdc.h+2−0
@@ -51,6 +51,8 @@ int pdc_spaceid_bits(unsigned long *space_bits); · 50 unmodified lines
51int pdc_btlb_info(struct pdc_btlb_info *btlb);51int pdc_btlb_info(struct pdc_btlb_info *btlb);
52int pdc_mem_map_hpa(struct pdc_memory_map *r_addr, struct pdc_module_path *mod_path);52int pdc_mem_map_hpa(struct pdc_memory_map *r_addr, struct pdc_module_path *mod_path);
53#endif /* !CONFIG_PA20 */53#endif /* !CONFIG_PA20 */
54int pdc_pim_toc11(struct pdc_toc_pim_11 *ret);
55int pdc_pim_toc20(struct pdc_toc_pim_20 *ret);
54int pdc_lan_station_id(char *lan_addr, unsigned long net_hpa);56int pdc_lan_station_id(char *lan_addr, unsigned long net_hpa);
55 57
56int pdc_stable_read(unsigned long staddr, void *memaddr, unsigned long count);58int pdc_stable_read(unsigned long staddr, void *memaddr, unsigned long count);
arch/parisc/include/asm/processor.h+5−6
@@ -12,6 +12,7 @@ · 11 unmodified lines
12#ifndef __ASSEMBLY__12#ifndef __ASSEMBLY__
13#include <linux/threads.h>13#include <linux/threads.h>
14 14
15#include <asm/assembly.h>
15#include <asm/prefetch.h>16#include <asm/prefetch.h>
16#include <asm/hardware.h>17#include <asm/hardware.h>
17#include <asm/pdc.h>18#include <asm/pdc.h>
@@ -37,16 +38,12 @@ · 19 unmodified lines
37#define DEFAULT_MAP_BASE DEFAULT_MAP_BASE3238#define DEFAULT_MAP_BASE DEFAULT_MAP_BASE32
38#endif39#endif
39 40
40#ifdef __KERNEL__
41
42/* XXX: STACK_TOP actually should be STACK_BOTTOM for parisc.41/* XXX: STACK_TOP actually should be STACK_BOTTOM for parisc.
43 * prumpf */42 * prumpf */
44 43
45#define STACK_TOP TASK_SIZE44#define STACK_TOP TASK_SIZE
46#define STACK_TOP_MAX DEFAULT_TASK_SIZE45#define STACK_TOP_MAX DEFAULT_TASK_SIZE
47 46
48#endif
49
50#ifndef __ASSEMBLY__47#ifndef __ASSEMBLY__
51 48
52unsigned long calc_max_stack_size(unsigned long stack_max);49unsigned long calc_max_stack_size(unsigned long stack_max);
@@ -101,8 +98,6 @@ DECLARE_PER_CPU(struct cpuinfo_parisc, cpu_data); · 48 unmodified lines
101 98
102#define CPU_HVERSION ((boot_cpu_data.hversion >> 4) & 0x0FFF)99#define CPU_HVERSION ((boot_cpu_data.hversion >> 4) & 0x0FFF)
103 100
104#define ARCH_MIN_TASKALIGN 8
105
106struct thread_struct {101struct thread_struct {
107 struct pt_regs regs;102 struct pt_regs regs;
108 unsigned long task_size;103 unsigned long task_size;
@@ -294,6 +289,10 @@ extern int _parisc_requires_coherency; · 185 unmodified lines
294 289
295extern int running_on_qemu;290extern int running_on_qemu;
296 291
292extern void toc_handler(void);
293extern unsigned int toc_handler_size;
294extern unsigned int toc_handler_csum;
295
297#endif /* __ASSEMBLY__ */296#endif /* __ASSEMBLY__ */
298 297
299#endif /* __ASM_PARISC_PROCESSOR_H */298#endif /* __ASM_PARISC_PROCESSOR_H */
arch/parisc/include/asm/ptrace.h+3−3
@@ -5,17 +5,17 @@ · 4 unmodified lines
5#ifndef _PARISC_PTRACE_H5#ifndef _PARISC_PTRACE_H
6#define _PARISC_PTRACE_H6#define _PARISC_PTRACE_H
7 7
8#include <asm/assembly.h>
8#include <uapi/asm/ptrace.h>9#include <uapi/asm/ptrace.h>
9 10
10
11#define task_regs(task) ((struct pt_regs *) ((char *)(task) + TASK_REGS))11#define task_regs(task) ((struct pt_regs *) ((char *)(task) + TASK_REGS))
12 12
13#define arch_has_single_step() 113#define arch_has_single_step() 1
14#define arch_has_block_step() 114#define arch_has_block_step() 1
15 15
16/* XXX should we use iaoq[1] or iaoq[0] ? */16/* XXX should we use iaoq[1] or iaoq[0] ? */
17#define user_mode(regs) (((regs)->iaoq[0] & 3) ? 1 : 0)17#define user_mode(regs) (((regs)->iaoq[0] & 3) != PRIV_KERNEL)
18#define user_space(regs) (((regs)->iasq[1] != 0) ? 1 : 0)18#define user_space(regs) ((regs)->iasq[1] != PRIV_KERNEL)
19#define instruction_pointer(regs) ((regs)->iaoq[0] & ~3)19#define instruction_pointer(regs) ((regs)->iaoq[0] & ~3)
20#define user_stack_pointer(regs) ((regs)->gr[30])20#define user_stack_pointer(regs) ((regs)->gr[30])
21unsigned long profile_pc(struct pt_regs *);21unsigned long profile_pc(struct pt_regs *);
arch/parisc/include/asm/runway.h+0−2
@@ -1,7 +1,6 @@
1/* SPDX-License-Identifier: GPL-2.0 */1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef ASM_PARISC_RUNWAY_H2#ifndef ASM_PARISC_RUNWAY_H
3#define ASM_PARISC_RUNWAY_H3#define ASM_PARISC_RUNWAY_H
4#ifdef __KERNEL__
5 4
6/* declared in arch/parisc/kernel/setup.c */5/* declared in arch/parisc/kernel/setup.c */
7extern struct proc_dir_entry * proc_runway_root;6extern struct proc_dir_entry * proc_runway_root;
@@ -9,5 +8,4 @@ extern struct proc_dir_entry * proc_runway_root; · 1 unmodified line
9#define RUNWAY_STATUS 0x108#define RUNWAY_STATUS 0x10
10#define RUNWAY_DEBUG 0x409#define RUNWAY_DEBUG 0x40
11 10
12#endif /* __KERNEL__ */
13#endif /* ASM_PARISC_RUNWAY_H */11#endif /* ASM_PARISC_RUNWAY_H */
arch/parisc/include/asm/smp.h+17−2
@@ -34,8 +34,23 @@ extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); · 33 unmodified lines
34 34
35#endif /* !ASSEMBLY */35#endif /* !ASSEMBLY */
36 36
37#define raw_smp_processor_id() (current_thread_info()->cpu)37/*
38 38 * This is particularly ugly: it appears we can't actually get the definition
39 * of task_struct here, but we need access to the CPU this task is running on.
40 * Instead of using task_struct we're using TASK_CPU which is extracted from
41 * asm-offsets.h by kbuild to get the current processor ID.
42 *
43 * This also needs to be safeguarded when building asm-offsets.s because at
44 * that time TASK_CPU is not defined yet. It could have been guarded by
45 * TASK_CPU itself, but we want the build to fail if TASK_CPU is missing
46 * when building something else than asm-offsets.s
47 */
48#ifdef GENERATING_ASM_OFFSETS
49#define raw_smp_processor_id() (0)
50#else
51#include <asm/asm-offsets.h>
52#define raw_smp_processor_id() (*(unsigned int *)((void *)current + TASK_CPU))
53#endif
39#else /* CONFIG_SMP */54#else /* CONFIG_SMP */
40 55
41static inline void smp_send_all_nop(void) { return; }56static inline void smp_send_all_nop(void) { return; }
arch/parisc/include/asm/thread_info.h+1−11
@@ -2,30 +2,21 @@ · 1 unmodified line
2#ifndef _ASM_PARISC_THREAD_INFO_H2#ifndef _ASM_PARISC_THREAD_INFO_H
3#define _ASM_PARISC_THREAD_INFO_H3#define _ASM_PARISC_THREAD_INFO_H
4 4
5#ifdef __KERNEL__
6
7#ifndef __ASSEMBLY__5#ifndef __ASSEMBLY__
8#include <asm/processor.h>6#include <asm/processor.h>
9#include <asm/special_insns.h>7#include <asm/special_insns.h>
10 8
11struct thread_info {9struct thread_info {
12 struct task_struct *task; /* main task structure */
13 unsigned long flags; /* thread_info flags (see TIF_*) */10 unsigned long flags; /* thread_info flags (see TIF_*) */
14 __u32 cpu; /* current CPU */
15 int preempt_count; /* 0=premptable, <0=BUG; will also serve as bh-counter */11 int preempt_count; /* 0=premptable, <0=BUG; will also serve as bh-counter */
16};12};
17 13
18#define INIT_THREAD_INFO(tsk) \14#define INIT_THREAD_INFO(tsk) \
19{ \15{ \
20 .task = &tsk, \
21 .flags = 0, \16 .flags = 0, \
22 .cpu = 0, \
23 .preempt_count = INIT_PREEMPT_COUNT, \17 .preempt_count = INIT_PREEMPT_COUNT, \
24}18}
25 19
26/* how to get the thread information struct from C */
27#define current_thread_info() ((struct thread_info *)mfctl(30))
28
29#endif /* !__ASSEMBLY */20#endif /* !__ASSEMBLY */
30 21
31/* thread information allocation */22/* thread information allocation */
@@ -57,6 +48,7 @@ struct thread_info { · 25 unmodified lines
57#define TIF_BLOCKSTEP 10 /* branch stepping? */48#define TIF_BLOCKSTEP 10 /* branch stepping? */
58#define TIF_SECCOMP 11 /* secure computing */49#define TIF_SECCOMP 11 /* secure computing */
59#define TIF_SYSCALL_TRACEPOINT 12 /* syscall tracepoint instrumentation */50#define TIF_SYSCALL_TRACEPOINT 12 /* syscall tracepoint instrumentation */
51#define TIF_NONBLOCK_WARNING 13 /* warned about wrong O_NONBLOCK usage */
60 52
61#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)53#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
62#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)54#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
@@ -87,6 +79,4 @@ struct thread_info { · 24 unmodified lines
87# define is_32bit_task() (1)79# define is_32bit_task() (1)
88#endif80#endif
89 81
90#endif /* __KERNEL__ */
91
92#endif /* _ASM_PARISC_THREAD_INFO_H */82#endif /* _ASM_PARISC_THREAD_INFO_H */
arch/parisc/include/asm/traps.h+1−0
@@ -14,6 +14,7 @@ void parisc_terminate(char *msg, struct pt_regs *regs, · 13 unmodified lines
14void die_if_kernel(char *str, struct pt_regs *regs, long err);14void die_if_kernel(char *str, struct pt_regs *regs, long err);
15 15
16/* mm/fault.c */16/* mm/fault.c */
17unsigned long parisc_acctyp(unsigned long code, unsigned int inst);
17const char *trap_name(unsigned long code);18const char *trap_name(unsigned long code);
18void do_page_fault(struct pt_regs *regs, unsigned long code,19void do_page_fault(struct pt_regs *regs, unsigned long code,
19 unsigned long address);20 unsigned long address);
arch/parisc/include/asm/unaligned.h+0−2
@@ -4,10 +4,8 @@ · 3 unmodified lines
4 4
5#include <asm-generic/unaligned.h>5#include <asm-generic/unaligned.h>
6 6
7#ifdef __KERNEL__
8struct pt_regs;7struct pt_regs;
9void handle_unaligned(struct pt_regs *regs);8void handle_unaligned(struct pt_regs *regs);
10int check_unaligned(struct pt_regs *regs);9int check_unaligned(struct pt_regs *regs);
11#endif
12 10
13#endif /* _ASM_PARISC_UNALIGNED_H */11#endif /* _ASM_PARISC_UNALIGNED_H */
arch/parisc/include/uapi/asm/pdc.h+26−2
@@ -398,8 +398,10 @@ struct zeropage { · 397 unmodified lines
398 /* int (*vec_rendz)(void); */398 /* int (*vec_rendz)(void); */
399 unsigned int vec_rendz;399 unsigned int vec_rendz;
400 int vec_pow_fail_flen;400 int vec_pow_fail_flen;
401 int vec_pad[10]; 401 int vec_pad0[3];
402 402 unsigned int vec_toc_hi;
403 int vec_pad1[6];
404
403 /* [0x040] reserved processor dependent */405 /* [0x040] reserved processor dependent */
404 int pad0[112];406 int pad0[112];
405 407
@@ -689,6 +691,28 @@ struct pdc_hpmc_pim_20 { /* PDC_PIM */ · 283 unmodified lines
689 unsigned long long fr[32];691 unsigned long long fr[32];
690};692};
691 693
694struct pdc_toc_pim_11 {
695 unsigned int gr[32];
696 unsigned int cr[32];
697 unsigned int sr[8];
698 unsigned int iasq_back;
699 unsigned int iaoq_back;
700 unsigned int check_type;
701 unsigned int hversion;
702 unsigned int cpu_state;
703};
704
705struct pdc_toc_pim_20 {
706 unsigned long long gr[32];
707 unsigned long long cr[32];
708 unsigned long long sr[8];
709 unsigned long long iasq_back;
710 unsigned long long iaoq_back;
711 unsigned int check_type;
712 unsigned int hversion;
713 unsigned int cpu_state;
714};
715
692#endif /* !defined(__ASSEMBLY__) */716#endif /* !defined(__ASSEMBLY__) */
693 717
694#endif /* _UAPI_PARISC_PDC_H */718#endif /* _UAPI_PARISC_PDC_H */
arch/parisc/kernel/Makefile+1−0
@@ -39,3 +39,4 @@ obj-$(CONFIG_KGDB) += kgdb.o · 38 unmodified lines
39obj-$(CONFIG_KPROBES) += kprobes.o39obj-$(CONFIG_KPROBES) += kprobes.o
40obj-$(CONFIG_KEXEC_CORE) += kexec.o relocate_kernel.o40obj-$(CONFIG_KEXEC_CORE) += kexec.o relocate_kernel.o
41obj-$(CONFIG_KEXEC_FILE) += kexec_file.o41obj-$(CONFIG_KEXEC_FILE) += kexec_file.o
42obj-$(CONFIG_TOC) += toc.o toc_asm.o
arch/parisc/kernel/asm-offsets.c+9−25
@@ -14,6 +14,8 @@ · 13 unmodified lines
14 * Copyright (C) 2003 James Bottomley <jejb at parisc-linux.org>14 * Copyright (C) 2003 James Bottomley <jejb at parisc-linux.org>
15 */15 */
16 16
17#define GENERATING_ASM_OFFSETS /* asm/smp.h */
18
17#include <linux/types.h>19#include <linux/types.h>
18#include <linux/sched.h>20#include <linux/sched.h>
19#include <linux/thread_info.h>21#include <linux/thread_info.h>
@@ -22,18 +24,12 @@ · 2 unmodified lines
22#include <linux/kbuild.h>24#include <linux/kbuild.h>
23#include <linux/pgtable.h>25#include <linux/pgtable.h>
24 26
27#include <asm/assembly.h>
25#include <asm/ptrace.h>28#include <asm/ptrace.h>
26#include <asm/processor.h>29#include <asm/processor.h>
27#include <asm/pdc.h>30#include <asm/pdc.h>
28#include <linux/uaccess.h>31#include <linux/uaccess.h>
29 32
30#ifdef CONFIG_64BIT
31#define FRAME_SIZE 128
32#else
33#define FRAME_SIZE 64
34#endif
35#define FRAME_ALIGN 64
36
37/* Add FRAME_SIZE to the size x and align it to y. All definitions33/* Add FRAME_SIZE to the size x and align it to y. All definitions
38 * that use align_frame will include space for a frame.34 * that use align_frame will include space for a frame.
39 */35 */
@@ -41,13 +37,11 @@ · 1 unmodified line
41 37
42int main(void)38int main(void)
43{39{
44 DEFINE(TASK_THREAD_INFO, offsetof(struct task_struct, stack));40 DEFINE(TASK_TI_FLAGS, offsetof(struct task_struct, thread_info.flags));
45 DEFINE(TASK_FLAGS, offsetof(struct task_struct, flags));41 DEFINE(TASK_STACK, offsetof(struct task_struct, stack));
46 DEFINE(TASK_SIGPENDING, offsetof(struct task_struct, pending));42#ifdef CONFIG_SMP
47 DEFINE(TASK_PTRACE, offsetof(struct task_struct, ptrace));43 DEFINE(TASK_CPU, offsetof(struct task_struct, cpu));
48 DEFINE(TASK_MM, offsetof(struct task_struct, mm));44#endif
49 DEFINE(TASK_PERSONALITY, offsetof(struct task_struct, personality));
50 DEFINE(TASK_PID, offsetof(struct task_struct, pid));
51 BLANK();45 BLANK();
52 DEFINE(TASK_REGS, offsetof(struct task_struct, thread.regs));46 DEFINE(TASK_REGS, offsetof(struct task_struct, thread.regs));
53 DEFINE(TASK_PT_PSW, offsetof(struct task_struct, thread.regs.gr[ 0]));47 DEFINE(TASK_PT_PSW, offsetof(struct task_struct, thread.regs.gr[ 0]));
@@ -135,10 +129,6 @@ int main(void) · 81 unmodified lines
135 DEFINE(TASK_PT_ISR, offsetof(struct task_struct, thread.regs.isr));129 DEFINE(TASK_PT_ISR, offsetof(struct task_struct, thread.regs.isr));
136 DEFINE(TASK_PT_IOR, offsetof(struct task_struct, thread.regs.ior));130 DEFINE(TASK_PT_IOR, offsetof(struct task_struct, thread.regs.ior));
137 BLANK();131 BLANK();
138 DEFINE(TASK_SZ, sizeof(struct task_struct));
139 /* TASK_SZ_ALGN includes space for a stack frame. */
140 DEFINE(TASK_SZ_ALGN, align_frame(sizeof(struct task_struct), FRAME_ALIGN));
141 BLANK();
142 DEFINE(PT_PSW, offsetof(struct pt_regs, gr[ 0]));132 DEFINE(PT_PSW, offsetof(struct pt_regs, gr[ 0]));
143 DEFINE(PT_GR1, offsetof(struct pt_regs, gr[ 1]));133 DEFINE(PT_GR1, offsetof(struct pt_regs, gr[ 1]));
144 DEFINE(PT_GR2, offsetof(struct pt_regs, gr[ 2]));134 DEFINE(PT_GR2, offsetof(struct pt_regs, gr[ 2]));
@@ -223,17 +213,11 @@ int main(void) · 78 unmodified lines
223 DEFINE(PT_IIR, offsetof(struct pt_regs, iir));213 DEFINE(PT_IIR, offsetof(struct pt_regs, iir));
224 DEFINE(PT_ISR, offsetof(struct pt_regs, isr));214 DEFINE(PT_ISR, offsetof(struct pt_regs, isr));
225 DEFINE(PT_IOR, offsetof(struct pt_regs, ior));215 DEFINE(PT_IOR, offsetof(struct pt_regs, ior));
226 DEFINE(PT_SIZE, sizeof(struct pt_regs));
227 /* PT_SZ_ALGN includes space for a stack frame. */216 /* PT_SZ_ALGN includes space for a stack frame. */
228 DEFINE(PT_SZ_ALGN, align_frame(sizeof(struct pt_regs), FRAME_ALIGN));217 DEFINE(PT_SZ_ALGN, align_frame(sizeof(struct pt_regs), FRAME_ALIGN));
229 BLANK();218 BLANK();
230 DEFINE(TI_TASK, offsetof(struct thread_info, task));
231 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));219 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
232 DEFINE(TI_CPU, offsetof(struct thread_info, cpu));220 DEFINE(TI_PRE_COUNT, offsetof(struct task_struct, thread_info.preempt_count));
233 DEFINE(TI_PRE_COUNT, offsetof(struct thread_info, preempt_count));
234 DEFINE(THREAD_SZ, sizeof(struct thread_info));
235 /* THREAD_SZ_ALGN includes space for a stack frame. */
236 DEFINE(THREAD_SZ_ALGN, align_frame(sizeof(struct thread_info), FRAME_ALIGN));
237 BLANK();221 BLANK();
238 DEFINE(ICACHE_BASE, offsetof(struct pdc_cache_info, ic_base));222 DEFINE(ICACHE_BASE, offsetof(struct pdc_cache_info, ic_base));
239 DEFINE(ICACHE_STRIDE, offsetof(struct pdc_cache_info, ic_stride));223 DEFINE(ICACHE_STRIDE, offsetof(struct pdc_cache_info, ic_stride));
arch/parisc/kernel/cache.c+36−51
@@ -543,10 +543,33 @@ static inline pte_t *get_ptep(pgd_t *pgd, unsigned long addr) · 542 unmodified lines
543 return ptep;543 return ptep;
544}544}
545 545
546static void flush_cache_pages(struct vm_area_struct *vma, struct mm_struct *mm,
547 unsigned long start, unsigned long end)
548{
549 unsigned long addr, pfn;
550 pte_t *ptep;
551
552 for (addr = start; addr < end; addr += PAGE_SIZE) {
553 ptep = get_ptep(mm->pgd, addr);
554 if (ptep) {
555 pfn = pte_pfn(*ptep);
556 flush_cache_page(vma, addr, pfn);
557 }
558 }
559}
560
561static void flush_user_cache_tlb(struct vm_area_struct *vma,
562 unsigned long start, unsigned long end)
563{
564 flush_user_dcache_range_asm(start, end);
565 if (vma->vm_flags & VM_EXEC)
566 flush_user_icache_range_asm(start, end);
567 flush_tlb_range(vma, start, end);
568}
569
546void flush_cache_mm(struct mm_struct *mm)570void flush_cache_mm(struct mm_struct *mm)
547{571{
548 struct vm_area_struct *vma;572 struct vm_area_struct *vma;
549 pgd_t *pgd;
550 573
551 /* Flushing the whole cache on each cpu takes forever on574 /* Flushing the whole cache on each cpu takes forever on
552 rp3440, etc. So, avoid it if the mm isn't too big. */575 rp3440, etc. So, avoid it if the mm isn't too big. */
@@ -558,45 +581,22 @@ void flush_cache_mm(struct mm_struct *mm) · 5 unmodified lines
558 return;581 return;
559 }582 }
560 583
584 preempt_disable();
561 if (mm->context == mfsp(3)) {585 if (mm->context == mfsp(3)) {
562 for (vma = mm->mmap; vma; vma = vma->vm_next) {586 for (vma = mm->mmap; vma; vma = vma->vm_next)
563 flush_user_dcache_range_asm(vma->vm_start, vma->vm_end);587 flush_user_cache_tlb(vma, vma->vm_start, vma->vm_end);
564 if (vma->vm_flags & VM_EXEC)588 preempt_enable();
565 flush_user_icache_range_asm(vma->vm_start, vma->vm_end);
566 flush_tlb_range(vma, vma->vm_start, vma->vm_end);
567 }
568 return;589 return;
569 }590 }
570 591
571 pgd = mm->pgd;592 for (vma = mm->mmap; vma; vma = vma->vm_next)
572 for (vma = mm->mmap; vma; vma = vma->vm_next) {593 flush_cache_pages(vma, mm, vma->vm_start, vma->vm_end);
573 unsigned long addr;594 preempt_enable();
574
575 for (addr = vma->vm_start; addr < vma->vm_end;
576 addr += PAGE_SIZE) {
577 unsigned long pfn;
578 pte_t *ptep = get_ptep(pgd, addr);
579 if (!ptep)
580 continue;
581 pfn = pte_pfn(*ptep);
582 if (!pfn_valid(pfn))
583 continue;
584 if (unlikely(mm->context)) {
585 flush_tlb_page(vma, addr);
586 __flush_cache_page(vma, addr, PFN_PHYS(pfn));
587 } else {
588 __purge_cache_page(vma, addr, PFN_PHYS(pfn));
589 }
590 }
591 }
592}595}
593 596
594void flush_cache_range(struct vm_area_struct *vma,597void flush_cache_range(struct vm_area_struct *vma,
595 unsigned long start, unsigned long end)598 unsigned long start, unsigned long end)
596{599{
597 pgd_t *pgd;
598 unsigned long addr;
599
600 if ((!IS_ENABLED(CONFIG_SMP) || !arch_irqs_disabled()) &&600 if ((!IS_ENABLED(CONFIG_SMP) || !arch_irqs_disabled()) &&
601 end - start >= parisc_cache_flush_threshold) {601 end - start >= parisc_cache_flush_threshold) {
602 if (vma->vm_mm->context)602 if (vma->vm_mm->context)
@@ -605,30 +605,15 @@ void flush_cache_range(struct vm_area_struct *vma, · 2 unmodified lines
605 return;605 return;
606 }606 }
607 607
608 preempt_disable();
608 if (vma->vm_mm->context == mfsp(3)) {609 if (vma->vm_mm->context == mfsp(3)) {
609 flush_user_dcache_range_asm(start, end);610 flush_user_cache_tlb(vma, start, end);
610 if (vma->vm_flags & VM_EXEC)611 preempt_enable();
611 flush_user_icache_range_asm(start, end);
612 flush_tlb_range(vma, start, end);
613 return;612 return;
614 }613 }
615 614
616 pgd = vma->vm_mm->pgd;615 flush_cache_pages(vma, vma->vm_mm, vma->vm_start, vma->vm_end);
617 for (addr = vma->vm_start; addr < vma->vm_end; addr += PAGE_SIZE) {616 preempt_enable();
618 unsigned long pfn;
619 pte_t *ptep = get_ptep(pgd, addr);
620 if (!ptep)
621 continue;
622 pfn = pte_pfn(*ptep);
623 if (pfn_valid(pfn)) {
624 if (unlikely(vma->vm_mm->context)) {
625 flush_tlb_page(vma, addr);
626 __flush_cache_page(vma, addr, PFN_PHYS(pfn));
627 } else {
628 __purge_cache_page(vma, addr, PFN_PHYS(pfn));
629 }
630 }
631 }
632}617}
633 618
634void619void
arch/parisc/kernel/entry.S+30−60
@@ -51,30 +51,6 @@ · 50 unmodified lines
51 extrd,u \spc,(64 - (SPACEID_SHIFT)),32,\prot51 extrd,u \spc,(64 - (SPACEID_SHIFT)),32,\prot
52 .endm52 .endm
53#endif53#endif
54
55 /* Switch to virtual mapping, trashing only %r1 */
56 .macro virt_map
57 /* pcxt_ssm_bug */
58 rsm PSW_SM_I, %r0 /* barrier for "Relied upon Translation */
59 mtsp %r0, %sr4
60 mtsp %r0, %sr5
61 mtsp %r0, %sr6
62 tovirt_r1 %r29
63 load32 KERNEL_PSW, %r1
64
65 rsm PSW_SM_QUIET,%r0 /* second "heavy weight" ctl op */
66 mtctl %r0, %cr17 /* Clear IIASQ tail */
67 mtctl %r0, %cr17 /* Clear IIASQ head */
68 mtctl %r1, %ipsw
69 load32 4f, %r1
70 mtctl %r1, %cr18 /* Set IIAOQ tail */
71 ldo 4(%r1), %r1
72 mtctl %r1, %cr18 /* Set IIAOQ head */
73 rfir
74 nop
754:
76 .endm
77
78 /*54 /*
79 * The "get_stack" macros are responsible for determining the55 * The "get_stack" macros are responsible for determining the
80 * kernel stack value.56 * kernel stack value.
@@ -87,8 +63,8 @@ · 6 unmodified lines
87 * Need to set up a kernel stack, so call the63 * Need to set up a kernel stack, so call the
88 * get_stack_use_cr30 macro to set up a pointer64 * get_stack_use_cr30 macro to set up a pointer
89 * to the pt_regs structure contained within the65 * to the pt_regs structure contained within the
90 * task pointer pointed to by cr30. Set the stack66 * task pointer pointed to by cr30. Load the stack
91 * pointer to point to the end of the task structure.67 * pointer from the task structure.
92 *68 *
93 * Note that we use shadowed registers for temps until69 * Note that we use shadowed registers for temps until
94 * we can save %r26 and %r29. %r26 is used to preserve70 * we can save %r26 and %r29. %r26 is used to preserve
@@ -100,8 +76,6 @@ · 5 unmodified lines
100 * or handle_interruption. %r29 is used to hold a pointer76 * or handle_interruption. %r29 is used to hold a pointer
101 * the register save area, and once again, it needs to77 * the register save area, and once again, it needs to
102 * be a non-shadowed register so that it survives the rfir.78 * be a non-shadowed register so that it survives the rfir.
103 *
104 * N.B. TASK_SZ_ALGN and PT_SZ_ALGN include space for a stack frame.
105 */79 */
106 80
107 .macro get_stack_use_cr3081 .macro get_stack_use_cr30
@@ -110,12 +84,11 @@ · 2 unmodified lines
110 84
111 copy %r30, %r1785 copy %r30, %r17
112 mfctl %cr30, %r186 mfctl %cr30, %r1
113 ldo THREAD_SZ_ALGN(%r1), %r3087 tophys %r1,%r9 /* task_struct */
114 mtsp %r0,%sr788 LDREG TASK_STACK(%r9),%r30
89 ldo PT_SZ_ALGN(%r30),%r30
90 mtsp %r0,%sr7 /* clear sr7 after kernel stack was set! */
115 mtsp %r16,%sr391 mtsp %r16,%sr3
116 tophys %r1,%r9
117 LDREG TI_TASK(%r9), %r1 /* thread_info -> task_struct */
118 tophys %r1,%r9
119 ldo TASK_REGS(%r9),%r992 ldo TASK_REGS(%r9),%r9
120 STREG %r17,PT_GR30(%r9)93 STREG %r17,PT_GR30(%r9)
121 STREG %r29,PT_GR29(%r9)94 STREG %r29,PT_GR29(%r9)
@@ -757,7 +730,7 @@ ENTRY(ret_from_kernel_thread) · 635 unmodified lines
757 BL schedule_tail, %r2730 BL schedule_tail, %r2
758 nop731 nop
759 732
760 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30), %r1733 mfctl %cr30,%r1 /* task_struct */
761 LDREG TASK_PT_GR25(%r1), %r26734 LDREG TASK_PT_GR25(%r1), %r26
762#ifdef CONFIG_64BIT735#ifdef CONFIG_64BIT
763 LDREG TASK_PT_GR27(%r1), %r27736 LDREG TASK_PT_GR27(%r1), %r27
@@ -788,7 +761,6 @@ ENTRY_CFI(_switch_to) · 24 unmodified lines
788 761
789 STREG %r30, TASK_PT_KSP(%r26)762 STREG %r30, TASK_PT_KSP(%r26)
790 LDREG TASK_PT_KSP(%r25), %r30763 LDREG TASK_PT_KSP(%r25), %r30
791 LDREG TASK_THREAD_INFO(%r25), %r25
792 bv %r0(%r2)764 bv %r0(%r2)
793 mtctl %r25,%cr30765 mtctl %r25,%cr30
794 766
@@ -819,17 +791,16 @@ ENDPROC_CFI(_switch_to) · 24 unmodified lines
819 .align PAGE_SIZE791 .align PAGE_SIZE
820 792
821ENTRY_CFI(syscall_exit_rfi)793ENTRY_CFI(syscall_exit_rfi)
822 mfctl %cr30,%r16794 mfctl %cr30,%r16 /* task_struct */
823 LDREG TI_TASK(%r16), %r16 /* thread_info -> task_struct */
824 ldo TASK_REGS(%r16),%r16795 ldo TASK_REGS(%r16),%r16
825 /* Force iaoq to userspace, as the user has had access to our current796 /* Force iaoq to userspace, as the user has had access to our current
826 * context via sigcontext. Also Filter the PSW for the same reason.797 * context via sigcontext. Also Filter the PSW for the same reason.
827 */798 */
828 LDREG PT_IAOQ0(%r16),%r19799 LDREG PT_IAOQ0(%r16),%r19
829 depi 3,31,2,%r19800 depi PRIV_USER,31,2,%r19
830 STREG %r19,PT_IAOQ0(%r16)801 STREG %r19,PT_IAOQ0(%r16)
831 LDREG PT_IAOQ1(%r16),%r19802 LDREG PT_IAOQ1(%r16),%r19
832 depi 3,31,2,%r19803 depi PRIV_USER,31,2,%r19
833 STREG %r19,PT_IAOQ1(%r16)804 STREG %r19,PT_IAOQ1(%r16)
834 LDREG PT_PSW(%r16),%r19805 LDREG PT_PSW(%r16),%r19
835 load32 USER_PSW_MASK,%r1806 load32 USER_PSW_MASK,%r1
@@ -865,14 +836,14 @@ ENTRY_CFI(syscall_exit_rfi) · 29 unmodified lines
865ENTRY(intr_return)836ENTRY(intr_return)
866 /* check for reschedule */837 /* check for reschedule */
867 mfctl %cr30,%r1838 mfctl %cr30,%r1
868 LDREG TI_FLAGS(%r1),%r19 /* sched.h: TIF_NEED_RESCHED */839 LDREG TASK_TI_FLAGS(%r1),%r19 /* sched.h: TIF_NEED_RESCHED */
869 bb,<,n %r19,31-TIF_NEED_RESCHED,intr_do_resched /* forward */840 bb,<,n %r19,31-TIF_NEED_RESCHED,intr_do_resched /* forward */
870 841
871 .import do_notify_resume,code842 .import do_notify_resume,code
872intr_check_sig:843intr_check_sig:
873 /* As above */844 /* As above */
874 mfctl %cr30,%r1845 mfctl %cr30,%r1
875 LDREG TI_FLAGS(%r1),%r19846 LDREG TASK_TI_FLAGS(%r1),%r19
876 ldi (_TIF_USER_WORK_MASK & ~_TIF_NEED_RESCHED), %r20847 ldi (_TIF_USER_WORK_MASK & ~_TIF_NEED_RESCHED), %r20
877 and,COND(<>) %r19, %r20, %r0848 and,COND(<>) %r19, %r20, %r0
878 b,n intr_restore /* skip past if we've nothing to do */849 b,n intr_restore /* skip past if we've nothing to do */
@@ -974,8 +945,8 @@ intr_do_preempt: · 95 unmodified lines
974 945
975 /* current_thread_info()->preempt_count */946 /* current_thread_info()->preempt_count */
976 mfctl %cr30, %r1947 mfctl %cr30, %r1
977 LDREG TI_PRE_COUNT(%r1), %r19948 ldw TI_PRE_COUNT(%r1), %r19
978 cmpib,COND(<>) 0, %r19, intr_restore /* if preempt_count > 0 */949 cmpib,<> 0, %r19, intr_restore /* if preempt_count > 0 */
979 nop /* prev insn branched backwards */950 nop /* prev insn branched backwards */
980 951
981 /* check if we interrupted a critical path */952 /* check if we interrupted a critical path */
@@ -1716,7 +1687,7 @@ dtlb_fault: · 734 unmodified lines
1716 1687
1717 .macro fork_like name1688 .macro fork_like name
1718ENTRY_CFI(sys_\name\()_wrapper)1689ENTRY_CFI(sys_\name\()_wrapper)
1719 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30), %r11690 mfctl %cr30,%r1
1720 ldo TASK_REGS(%r1),%r11691 ldo TASK_REGS(%r1),%r1
1721 reg_save %r11692 reg_save %r1
1722 mfctl %cr27, %r281693 mfctl %cr27, %r28
@@ -1736,7 +1707,7 @@ ENTRY(child_return) · 13 unmodified lines
1736 BL schedule_tail, %r21707 BL schedule_tail, %r2
1737 nop1708 nop
1738finish_child_return:1709finish_child_return:
1739 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30), %r11710 mfctl %cr30,%r1
1740 ldo TASK_REGS(%r1),%r1 /* get pt regs */1711 ldo TASK_REGS(%r1),%r1 /* get pt regs */
1741 1712
1742 LDREG PT_CR27(%r1), %r31713 LDREG PT_CR27(%r1), %r3
@@ -1747,7 +1718,7 @@ finish_child_return: · 4 unmodified lines
1747END(child_return)1718END(child_return)
1748 1719
1749ENTRY_CFI(sys_rt_sigreturn_wrapper)1720ENTRY_CFI(sys_rt_sigreturn_wrapper)
1750 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r261721 mfctl %cr30,%r26
1751 ldo TASK_REGS(%r26),%r26 /* get pt regs */1722 ldo TASK_REGS(%r26),%r26 /* get pt regs */
1752 /* Don't save regs, we are going to restore them from sigcontext. */1723 /* Don't save regs, we are going to restore them from sigcontext. */
1753 STREG %r2, -RP_OFFSET(%r30)1724 STREG %r2, -RP_OFFSET(%r30)
@@ -1764,7 +1735,7 @@ ENTRY_CFI(sys_rt_sigreturn_wrapper) · 10 unmodified lines
1764 LDREG -RP_OFFSET(%r30), %r21735 LDREG -RP_OFFSET(%r30), %r2
1765 1736
1766 /* FIXME: I think we need to restore a few more things here. */1737 /* FIXME: I think we need to restore a few more things here. */
1767 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r11738 mfctl %cr30,%r1
1768 ldo TASK_REGS(%r1),%r1 /* get pt regs */1739 ldo TASK_REGS(%r1),%r1 /* get pt regs */
1769 reg_restore %r11740 reg_restore %r1
1770 1741
@@ -1783,9 +1754,7 @@ ENTRY(syscall_exit) · 12 unmodified lines
1783 */1754 */
1784 1755
1785 /* save return value now */1756 /* save return value now */
1786
1787 mfctl %cr30, %r11757 mfctl %cr30, %r1
1788 LDREG TI_TASK(%r1),%r1
1789 STREG %r28,TASK_PT_GR28(%r1)1758 STREG %r28,TASK_PT_GR28(%r1)
1790 1759
1791 /* Seems to me that dp could be wrong here, if the syscall involved1760 /* Seems to me that dp could be wrong here, if the syscall involved
@@ -1796,13 +1765,14 @@ ENTRY(syscall_exit) · 4 unmodified lines
1796syscall_check_resched:1765syscall_check_resched:
1797 1766
1798 /* check for reschedule */1767 /* check for reschedule */
1799 1768 mfctl %cr30,%r19
1800 LDREG TI_FLAGS-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r19 /* long */1769 LDREG TASK_TI_FLAGS(%r19),%r19 /* long */
1801 bb,<,n %r19, 31-TIF_NEED_RESCHED, syscall_do_resched /* forward */1770 bb,<,n %r19, 31-TIF_NEED_RESCHED, syscall_do_resched /* forward */
1802 1771
1803 .import do_signal,code1772 .import do_signal,code
1804syscall_check_sig:1773syscall_check_sig:
1805 LDREG TI_FLAGS-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r191774 mfctl %cr30,%r19
1775 LDREG TASK_TI_FLAGS(%r19),%r19
1806 ldi (_TIF_USER_WORK_MASK & ~_TIF_NEED_RESCHED), %r261776 ldi (_TIF_USER_WORK_MASK & ~_TIF_NEED_RESCHED), %r26
1807 and,COND(<>) %r19, %r26, %r01777 and,COND(<>) %r19, %r26, %r0
1808 b,n syscall_restore /* skip past if we've nothing to do */1778 b,n syscall_restore /* skip past if we've nothing to do */
@@ -1813,7 +1783,7 @@ syscall_do_signal: · 4 unmodified lines
1813 * consistent with all the relevant state of the process1783 * consistent with all the relevant state of the process
1814 * before the syscall. We need to verify this.1784 * before the syscall. We need to verify this.
1815 */1785 */
1816 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r11786 mfctl %cr30,%r1
1817 ldo TASK_REGS(%r1), %r26 /* struct pt_regs *regs */1787 ldo TASK_REGS(%r1), %r26 /* struct pt_regs *regs */
1818 reg_save %r261788 reg_save %r26
1819 1789
@@ -1824,17 +1794,17 @@ syscall_do_signal: · 4 unmodified lines
1824 BL do_notify_resume,%r21794 BL do_notify_resume,%r2
1825 ldi 1, %r25 /* long in_syscall = 1 */1795 ldi 1, %r25 /* long in_syscall = 1 */
1826 1796
1827 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r11797 mfctl %cr30,%r1
1828 ldo TASK_REGS(%r1), %r20 /* reload pt_regs */1798 ldo TASK_REGS(%r1), %r20 /* reload pt_regs */
1829 reg_restore %r201799 reg_restore %r20
1830 1800
1831 b,n syscall_check_sig1801 b,n syscall_check_sig
1832 1802
1833syscall_restore:1803syscall_restore:
1834 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r11804 mfctl %cr30,%r1
1835 1805
1836 /* Are we being ptraced? */1806 /* Are we being ptraced? */
1837 ldw TASK_FLAGS(%r1),%r191807 LDREG TASK_TI_FLAGS(%r1),%r19
1838 ldi _TIF_SYSCALL_TRACE_MASK,%r21808 ldi _TIF_SYSCALL_TRACE_MASK,%r2
1839 and,COND(=) %r19,%r2,%r01809 and,COND(=) %r19,%r2,%r0
1840 b,n syscall_restore_rfi1810 b,n syscall_restore_rfi
@@ -1873,7 +1843,7 @@ syscall_restore: · 32 unmodified lines
1873 mtsp %r1,%sr5 /* Restore sr5 */1843 mtsp %r1,%sr5 /* Restore sr5 */
1874 mtsp %r1,%sr6 /* Restore sr6 */1844 mtsp %r1,%sr6 /* Restore sr6 */
1875 1845
1876 depi 3,31,2,%r31 /* ensure return to user mode. */1846 depi PRIV_USER,31,2,%r31 /* ensure return to user mode. */
1877 1847
1878#ifdef CONFIG_64BIT1848#ifdef CONFIG_64BIT
1879 /* decide whether to reset the wide mode bit1849 /* decide whether to reset the wide mode bit
@@ -1949,7 +1919,7 @@ syscall_restore_rfi: · 69 unmodified lines
1949 STREG %r0,TASK_PT_SR2(%r1)1919 STREG %r0,TASK_PT_SR2(%r1)
1950 1920
1951 LDREG TASK_PT_GR31(%r1),%r21921 LDREG TASK_PT_GR31(%r1),%r2
1952 depi 3,31,2,%r2 /* ensure return to user mode. */1922 depi PRIV_USER,31,2,%r2 /* ensure return to user mode. */
1953 STREG %r2,TASK_PT_IAOQ0(%r1)1923 STREG %r2,TASK_PT_IAOQ0(%r1)
1954 ldo 4(%r2),%r21924 ldo 4(%r2),%r2
1955 STREG %r2,TASK_PT_IAOQ1(%r1)1925 STREG %r2,TASK_PT_IAOQ1(%r1)
@@ -1958,10 +1928,10 @@ syscall_restore_rfi: · 2 unmodified lines
1958 1928
1959pt_regs_ok:1929pt_regs_ok:
1960 LDREG TASK_PT_IAOQ0(%r1),%r21930 LDREG TASK_PT_IAOQ0(%r1),%r2
1961 depi 3,31,2,%r2 /* ensure return to user mode. */1931 depi PRIV_USER,31,2,%r2 /* ensure return to user mode. */
1962 STREG %r2,TASK_PT_IAOQ0(%r1)1932 STREG %r2,TASK_PT_IAOQ0(%r1)
1963 LDREG TASK_PT_IAOQ1(%r1),%r21933 LDREG TASK_PT_IAOQ1(%r1),%r2
1964 depi 3,31,2,%r21934 depi PRIV_USER,31,2,%r2
1965 STREG %r2,TASK_PT_IAOQ1(%r1)1935 STREG %r2,TASK_PT_IAOQ1(%r1)
1966 b intr_restore1936 b intr_restore
1967 copy %r25,%r161937 copy %r25,%r16
arch/parisc/kernel/firmware.c+32−0
@@ -1061,6 +1061,38 @@ int pdc_mem_pdt_read_entries(struct pdc_mem_read_pdt *pret, · 1060 unmodified lines
1061 return retval;1061 return retval;
1062}1062}
1063 1063
1064/**
1065 * pdc_pim_toc11 - Fetch TOC PIM 1.1 data from firmware.
1066 * @ret: pointer to return buffer
1067 */
1068int pdc_pim_toc11(struct pdc_toc_pim_11 *ret)
1069{
1070 int retval;
1071 unsigned long flags;
1072
1073 spin_lock_irqsave(&pdc_lock, flags);
1074 retval = mem_pdc_call(PDC_PIM, PDC_PIM_TOC, __pa(pdc_result),
1075 __pa(ret), sizeof(*ret));
1076 spin_unlock_irqrestore(&pdc_lock, flags);
1077 return retval;
1078}
1079
1080/**
1081 * pdc_pim_toc20 - Fetch TOC PIM 2.0 data from firmware.
1082 * @ret: pointer to return buffer
1083 */
1084int pdc_pim_toc20(struct pdc_toc_pim_20 *ret)
1085{
1086 int retval;
1087 unsigned long flags;
1088
1089 spin_lock_irqsave(&pdc_lock, flags);
1090 retval = mem_pdc_call(PDC_PIM, PDC_PIM_TOC, __pa(pdc_result),
1091 __pa(ret), sizeof(*ret));
1092 spin_unlock_irqrestore(&pdc_lock, flags);
1093 return retval;
1094}
1095
1064/**1096/**
1065 * pdc_tod_set - Set the Time-Of-Day clock.1097 * pdc_tod_set - Set the Time-Of-Day clock.
1066 * @sec: The number of seconds since epoch.1098 * @sec: The number of seconds since epoch.
arch/parisc/kernel/ftrace.c+11−10
@@ -15,6 +15,7 @@ · 14 unmodified lines
15#include <linux/uaccess.h>15#include <linux/uaccess.h>
16#include <linux/kprobes.h>16#include <linux/kprobes.h>
17#include <linux/ptrace.h>17#include <linux/ptrace.h>
18#include <linux/jump_label.h>
18 19
19#include <asm/assembly.h>20#include <asm/assembly.h>
20#include <asm/sections.h>21#include <asm/sections.h>
@@ -24,6 +25,8 @@ · 3 unmodified lines
24#define __hot __section(".text.hot")25#define __hot __section(".text.hot")
25 26
26#ifdef CONFIG_FUNCTION_GRAPH_TRACER27#ifdef CONFIG_FUNCTION_GRAPH_TRACER
28static DEFINE_STATIC_KEY_FALSE(ftrace_graph_enable);
29
27/*30/*
28 * Hook the return address and push it in the stack of return addrs31 * Hook the return address and push it in the stack of return addrs
29 * in current thread info.32 * in current thread info.
@@ -48,25 +51,19 @@ static void __hot prepare_ftrace_return(unsigned long *parent, · 18 unmodified lines
48}51}
49#endif /* CONFIG_FUNCTION_GRAPH_TRACER */52#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
50 53
54static ftrace_func_t ftrace_func;
55
51void notrace __hot ftrace_function_trampoline(unsigned long parent,56void notrace __hot ftrace_function_trampoline(unsigned long parent,
52 unsigned long self_addr,57 unsigned long self_addr,
53 unsigned long org_sp_gr3,58 unsigned long org_sp_gr3,
54 struct ftrace_regs *fregs)59 struct ftrace_regs *fregs)
55{60{
56#ifndef CONFIG_DYNAMIC_FTRACE
57 extern ftrace_func_t ftrace_trace_function;
58#endif
59 extern struct ftrace_ops *function_trace_op;61 extern struct ftrace_ops *function_trace_op;
60 62
61 if (function_trace_op->flags & FTRACE_OPS_FL_ENABLED &&63 ftrace_func(self_addr, parent, function_trace_op, fregs);
62 ftrace_trace_function != ftrace_stub)
63 ftrace_trace_function(self_addr, parent,
64 function_trace_op, fregs);
65 64
66#ifdef CONFIG_FUNCTION_GRAPH_TRACER65#ifdef CONFIG_FUNCTION_GRAPH_TRACER
67 if (dereference_function_descriptor(ftrace_graph_return) !=66 if (static_branch_unlikely(&ftrace_graph_enable)) {
68 dereference_function_descriptor(ftrace_stub) ||
69 ftrace_graph_entry != ftrace_graph_entry_stub) {
70 unsigned long *parent_rp;67 unsigned long *parent_rp;
71 68
72 /* calculate pointer to %rp in stack */69 /* calculate pointer to %rp in stack */
@@ -84,11 +81,13 @@ void notrace __hot ftrace_function_trampoline(unsigned long parent, · 11 unmodified lines
84#ifdef CONFIG_FUNCTION_GRAPH_TRACER81#ifdef CONFIG_FUNCTION_GRAPH_TRACER
85int ftrace_enable_ftrace_graph_caller(void)82int ftrace_enable_ftrace_graph_caller(void)
86{83{
84 static_key_enable(&ftrace_graph_enable.key);
87 return 0;85 return 0;
88}86}
89 87
90int ftrace_disable_ftrace_graph_caller(void)88int ftrace_disable_ftrace_graph_caller(void)
91{89{
90 static_key_enable(&ftrace_graph_enable.key);
92 return 0;91 return 0;
93}92}
94#endif93#endif
@@ -99,8 +98,10 @@ int __init ftrace_dyn_arch_init(void) · 4 unmodified lines
99{98{
100 return 0;99 return 0;
101}100}
101
102int ftrace_update_ftrace_func(ftrace_func_t func)102int ftrace_update_ftrace_func(ftrace_func_t func)
103{103{
104 ftrace_func = func;
104 return 0;105 return 0;
105}106}
106 107
arch/parisc/kernel/head.S+19−21
@@ -35,7 +35,8 @@ END(boot_args) · 34 unmodified lines
35 __HEAD35 __HEAD
36 36
37 .align 437 .align 4
38 .import init_thread_union,data38 .import init_task,data
39 .import init_stack,data
39 .import fault_vector_20,code /* IVA parisc 2.0 32 bit */40 .import fault_vector_20,code /* IVA parisc 2.0 32 bit */
40#ifndef CONFIG_64BIT41#ifndef CONFIG_64BIT
41 .import fault_vector_11,code /* IVA parisc 1.1 32 bit */42 .import fault_vector_11,code /* IVA parisc 1.1 32 bit */
@@ -123,12 +124,12 @@ $pgt_fill_loop: · 81 unmodified lines
123 load32 start_parisc,%r11124 load32 start_parisc,%r11
124 125
125 /* And the initial task pointer */126 /* And the initial task pointer */
126 load32 init_thread_union,%r6127 load32 init_task,%r6
127 mtctl %r6,%cr30128 mtctl %r6,%cr30
128 129
129 /* And the stack pointer too */130 /* And the stack pointer too */
130 ldo THREAD_SZ_ALGN(%r6),%sp131 load32 init_stack,%sp
131 132 tophys_r1 %sp
132#if defined(CONFIG_64BIT) && defined(CONFIG_FUNCTION_TRACER)133#if defined(CONFIG_64BIT) && defined(CONFIG_FUNCTION_TRACER)
133 .import _mcount,data134 .import _mcount,data
134 /* initialize mcount FPTR */135 /* initialize mcount FPTR */
@@ -186,12 +187,11 @@ common_stext: · 51 unmodified lines
186#endif /*CONFIG_SMP*/187#endif /*CONFIG_SMP*/
187 188
188#ifdef CONFIG_64BIT189#ifdef CONFIG_64BIT
189 tophys_r1 %sp190 mfctl %cr30,%r6 /* PCX-W2 firmware bug */
191 tophys_r1 %r6
190 192
191 /* Save the rfi target address */193 /* Save the rfi target address */
192 ldd TI_TASK-THREAD_SZ_ALGN(%sp), %r10194 STREG %r11, TASK_PT_GR11(%r6)
193 tophys_r1 %r10
194 std %r11, TASK_PT_GR11(%r10)
195 /* Switch to wide mode Superdome doesn't support narrow PDC195 /* Switch to wide mode Superdome doesn't support narrow PDC
196 ** calls.196 ** calls.
197 */197 */
@@ -206,7 +206,6 @@ common_stext: · 8 unmodified lines
206 ** Someday, palo might not do this for the Monarch either.206 ** Someday, palo might not do this for the Monarch either.
207 */207 */
2082:2082:
209 mfctl %cr30,%r6 /* PCX-W2 firmware bug */
210 209
211 ldo PDC_PSW(%r0),%arg0 /* 21 */210 ldo PDC_PSW(%r0),%arg0 /* 21 */
212 ldo PDC_PSW_SET_DEFAULTS(%r0),%arg1 /* 2 */211 ldo PDC_PSW_SET_DEFAULTS(%r0),%arg1 /* 2 */
@@ -216,13 +215,9 @@ common_stext: · 3 unmodified lines
216 copy %r0,%arg3215 copy %r0,%arg3
217 216
218stext_pdc_ret:217stext_pdc_ret:
218 LDREG TASK_PT_GR11(%r6), %r11
219 tovirt_r1 %r6
219 mtctl %r6,%cr30 /* restore task thread info */220 mtctl %r6,%cr30 /* restore task thread info */
220
221 /* restore rfi target address*/
222 ldd TI_TASK-THREAD_SZ_ALGN(%sp), %r10
223 tophys_r1 %r10
224 ldd TASK_PT_GR11(%r10), %r11
225 tovirt_r1 %sp
226#endif221#endif
227 222
228 /* PARANOID: clear user scratch/user space SR's */223 /* PARANOID: clear user scratch/user space SR's */
@@ -287,7 +282,9 @@ aligned_rfi: · 58 unmodified lines
287 282
288 load32 KERNEL_PSW,%r10283 load32 KERNEL_PSW,%r10
289 mtctl %r10,%ipsw284 mtctl %r10,%ipsw
290 285
286 tovirt_r1 %sp
287
291 /* Jump through hyperspace to Virt Mode */288 /* Jump through hyperspace to Virt Mode */
292 rfi289 rfi
293 nop290 nop
@@ -343,12 +340,13 @@ smp_slave_stext: · 49 unmodified lines
343#endif340#endif
344 341
345 /* Initialize the SP - monarch sets up smp_init_current_idle_task */342 /* Initialize the SP - monarch sets up smp_init_current_idle_task */
346 load32 PA(smp_init_current_idle_task),%sp343 load32 PA(smp_init_current_idle_task),%r6
347 LDREG 0(%sp),%sp /* load task address */344 LDREG 0(%r6),%r6
345 mtctl %r6,%cr30
346 tophys_r1 %r6
347 LDREG TASK_STACK(%r6),%sp
348 tophys_r1 %sp348 tophys_r1 %sp
349 LDREG TASK_THREAD_INFO(%sp),%sp349 ldo FRAME_SIZE(%sp),%sp
350 mtctl %sp,%cr30 /* store in cr30 */
351 ldo THREAD_SZ_ALGN(%sp),%sp
352 350
353 /* point CPU to kernel page tables */351 /* point CPU to kernel page tables */
354 load32 PA(swapper_pg_dir),%r4352 load32 PA(swapper_pg_dir),%r4
arch/parisc/kernel/irq.c+3−3
@@ -15,6 +15,7 @@ · 14 unmodified lines
15#include <linux/kernel_stat.h>15#include <linux/kernel_stat.h>
16#include <linux/seq_file.h>16#include <linux/seq_file.h>
17#include <linux/types.h>17#include <linux/types.h>
18#include <linux/sched/task_stack.h>
18#include <asm/io.h>19#include <asm/io.h>
19 20
20#include <asm/softirq_stack.h>21#include <asm/softirq_stack.h>
@@ -399,8 +400,7 @@ static inline void stack_overflow_check(struct pt_regs *regs) · 378 unmodified lines
399#ifdef CONFIG_DEBUG_STACKOVERFLOW400#ifdef CONFIG_DEBUG_STACKOVERFLOW
400 #define STACK_MARGIN (256*6)401 #define STACK_MARGIN (256*6)
401 402
402 /* Our stack starts directly behind the thread_info struct. */403 unsigned long stack_start = (unsigned long) task_stack_page(current);
403 unsigned long stack_start = (unsigned long) current_thread_info();
404 unsigned long sp = regs->gr[30];404 unsigned long sp = regs->gr[30];
405 unsigned long stack_usage;405 unsigned long stack_usage;
406 unsigned int *last_usage;406 unsigned int *last_usage;
@@ -476,7 +476,7 @@ static void execute_on_irq_stack(void *func, unsigned long param1) · 69 unmodified lines
476 union_ptr = &per_cpu(irq_stack_union, smp_processor_id());476 union_ptr = &per_cpu(irq_stack_union, smp_processor_id());
477 irq_stack = (unsigned long) &union_ptr->stack;477 irq_stack = (unsigned long) &union_ptr->stack;
478 irq_stack = ALIGN(irq_stack + sizeof(irq_stack_union.slock),478 irq_stack = ALIGN(irq_stack + sizeof(irq_stack_union.slock),
479 64); /* align for stack frame usage */479 FRAME_ALIGN); /* align for stack frame usage */
480 480
481 /* We may be called recursive. If we are already using the irq stack,481 /* We may be called recursive. If we are already using the irq stack,
482 * just continue to use it. Use spinlocks to serialize482 * just continue to use it. Use spinlocks to serialize
arch/parisc/kernel/pdt.c+1−3
@@ -352,12 +352,10 @@ static int __init pdt_initcall(void) · 351 unmodified lines
352 if (pdt_type == PDT_NONE)352 if (pdt_type == PDT_NONE)
353 return -ENODEV;353 return -ENODEV;
354 354
355 kpdtd_task = kthread_create(pdt_mainloop, NULL, "kpdtd");355 kpdtd_task = kthread_run(pdt_mainloop, NULL, "kpdtd");
356 if (IS_ERR(kpdtd_task))356 if (IS_ERR(kpdtd_task))
357 return PTR_ERR(kpdtd_task);357 return PTR_ERR(kpdtd_task);
358 358
359 wake_up_process(kpdtd_task);
360
361 return 0;359 return 0;
362}360}
363 361
arch/parisc/kernel/process.c+2−2
@@ -205,7 +205,7 @@ copy_thread(unsigned long clone_flags, unsigned long usp, · 204 unmodified lines
205 /* Must exit via ret_from_kernel_thread in order205 /* Must exit via ret_from_kernel_thread in order
206 * to call schedule_tail()206 * to call schedule_tail()
207 */207 */
208 cregs->ksp = (unsigned long)stack + THREAD_SZ_ALGN + FRAME_SIZE;208 cregs->ksp = (unsigned long) stack + FRAME_SIZE + PT_SZ_ALGN;
209 cregs->kpc = (unsigned long) &ret_from_kernel_thread;209 cregs->kpc = (unsigned long) &ret_from_kernel_thread;
210 /*210 /*
211 * Copy function and argument to be called from211 * Copy function and argument to be called from
@@ -228,7 +228,7 @@ copy_thread(unsigned long clone_flags, unsigned long usp, · 16 unmodified lines
228 if (likely(usp))228 if (likely(usp))
229 cregs->gr[30] = usp;229 cregs->gr[30] = usp;
230 }230 }
231 cregs->ksp = (unsigned long)stack + THREAD_SZ_ALGN + FRAME_SIZE;231 cregs->ksp = (unsigned long) stack + FRAME_SIZE;
232 cregs->kpc = (unsigned long) &child_return;232 cregs->kpc = (unsigned long) &child_return;
233 233
234 /* Setup thread TLS area */234 /* Setup thread TLS area */
arch/parisc/kernel/smp.c+21−4
@@ -29,6 +29,7 @@ · 28 unmodified lines
29#include <linux/bitops.h>29#include <linux/bitops.h>
30#include <linux/ftrace.h>30#include <linux/ftrace.h>
31#include <linux/cpu.h>31#include <linux/cpu.h>
32#include <linux/kgdb.h>
32 33
33#include <linux/atomic.h>34#include <linux/atomic.h>
34#include <asm/current.h>35#include <asm/current.h>
@@ -69,7 +70,10 @@ enum ipi_message_type { · 34 unmodified lines
69 IPI_CALL_FUNC,70 IPI_CALL_FUNC,
70 IPI_CPU_START,71 IPI_CPU_START,
71 IPI_CPU_STOP,72 IPI_CPU_STOP,
72 IPI_CPU_TEST73 IPI_CPU_TEST,
74#ifdef CONFIG_KGDB
75 IPI_ENTER_KGDB,
76#endif
73};77};
74 78
75 79
@@ -167,7 +171,12 @@ ipi_interrupt(int irq, void *dev_id) · 91 unmodified lines
167 case IPI_CPU_TEST:171 case IPI_CPU_TEST:
168 smp_debug(100, KERN_DEBUG "CPU%d is alive!\n", this_cpu);172 smp_debug(100, KERN_DEBUG "CPU%d is alive!\n", this_cpu);
169 break;173 break;
170 174#ifdef CONFIG_KGDB
175 case IPI_ENTER_KGDB:
176 smp_debug(100, KERN_DEBUG "CPU%d ENTER_KGDB\n", this_cpu);
177 kgdb_nmicallback(raw_smp_processor_id(), get_irq_regs());
178 break;
179#endif
171 default:180 default:
172 printk(KERN_CRIT "Unknown IPI num on CPU%d: %lu\n",181 printk(KERN_CRIT "Unknown IPI num on CPU%d: %lu\n",
173 this_cpu, which);182 this_cpu, which);
@@ -219,13 +228,21 @@ static inline void · 45 unmodified lines
219send_IPI_allbutself(enum ipi_message_type op)228send_IPI_allbutself(enum ipi_message_type op)
220{229{
221 int i;230 int i;
222 231
232 preempt_disable();
223 for_each_online_cpu(i) {233 for_each_online_cpu(i) {
224 if (i != smp_processor_id())234 if (i != smp_processor_id())
225 send_IPI_single(i, op);235 send_IPI_single(i, op);
226 }236 }
237 preempt_enable();
227}238}
228 239
240#ifdef CONFIG_KGDB
241void kgdb_roundup_cpus(void)
242{
243 send_IPI_allbutself(IPI_ENTER_KGDB);
244}
245#endif
229 246
230inline void 247inline void
231smp_send_stop(void) { send_IPI_allbutself(IPI_CPU_STOP); }248smp_send_stop(void) { send_IPI_allbutself(IPI_CPU_STOP); }
@@ -322,7 +339,7 @@ int smp_boot_one_cpu(int cpuid, struct task_struct *idle) · 90 unmodified lines
322 const struct cpuinfo_parisc *p = &per_cpu(cpu_data, cpuid);339 const struct cpuinfo_parisc *p = &per_cpu(cpu_data, cpuid);
323 long timeout;340 long timeout;
324 341
325 task_thread_info(idle)->cpu = cpuid;342 idle->cpu = cpuid;
326 343
327 /* Let _start know what logical CPU we're booting344 /* Let _start know what logical CPU we're booting
328 ** (offset into init_tasks[],cpu_data[])345 ** (offset into init_tasks[],cpu_data[])
arch/parisc/kernel/stacktrace.c+13−17
@@ -2,45 +2,41 @@ · 1 unmodified line
2/*2/*
3 * Stack trace management functions3 * Stack trace management functions
4 *4 *
5 * Copyright (C) 2009 Helge Deller <deller@gmx.de>5 * Copyright (C) 2009-2021 Helge Deller <deller@gmx.de>
6 * based on arch/x86/kernel/stacktrace.c by Ingo Molnar <mingo@redhat.com>6 * based on arch/x86/kernel/stacktrace.c by Ingo Molnar <mingo@redhat.com>
7 * and parisc unwind functions by Randolph Chung <tausq@debian.org>7 * and parisc unwind functions by Randolph Chung <tausq@debian.org>
8 *8 *
9 * TODO: Userspace stacktrace (CONFIG_USER_STACKTRACE_SUPPORT)9 * TODO: Userspace stacktrace (CONFIG_USER_STACKTRACE_SUPPORT)
10 */10 */
11#include <linux/module.h>
12#include <linux/stacktrace.h>11#include <linux/stacktrace.h>
13 12
14#include <asm/unwind.h>13#include <asm/unwind.h>
15 14
16static void dump_trace(struct task_struct *task, struct stack_trace *trace)15static void notrace walk_stackframe(struct task_struct *task,
16 struct pt_regs *regs, bool (*fn)(void *, unsigned long), void *cookie)
17{17{
18 struct unwind_frame_info info;18 struct unwind_frame_info info;
19 19
20 unwind_frame_init_task(&info, task, NULL);20 unwind_frame_init_task(&info, task, NULL);
21 21 while (1) {
22 /* unwind stack and save entries in stack_trace struct */
23 trace->nr_entries = 0;
24 while (trace->nr_entries < trace->max_entries) {
25 if (unwind_once(&info) < 0 || info.ip == 0)22 if (unwind_once(&info) < 0 || info.ip == 0)
26 break;23 break;
27 24
28 if (__kernel_text_address(info.ip))25 if (__kernel_text_address(info.ip))
29 trace->entries[trace->nr_entries++] = info.ip;26 if (!fn(cookie, info.ip))
27 break;
30 }28 }
31}29}
32 30
33/*31void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie,
34 * Save stack-backtrace addresses into a stack_trace buffer.32 struct task_struct *task, struct pt_regs *regs)
35 */
36void save_stack_trace(struct stack_trace *trace)
37{33{
38 dump_trace(current, trace);34 walk_stackframe(task, regs, consume_entry, cookie);
39}35}
40EXPORT_SYMBOL_GPL(save_stack_trace);
41 36
42void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)37int arch_stack_walk_reliable(stack_trace_consume_fn consume_entry, void *cookie,
38 struct task_struct *task)
43{39{
44 dump_trace(tsk, trace);40 walk_stackframe(task, NULL, consume_entry, cookie);
41 return 1;
45}42}
46EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
arch/parisc/kernel/sys_parisc.c+6−4
@@ -409,10 +409,12 @@ long parisc_personality(unsigned long personality) · 408 unmodified lines
409 409
410static int FIX_O_NONBLOCK(int flags)410static int FIX_O_NONBLOCK(int flags)
411{411{
412 if (flags & O_NONBLOCK_MASK_OUT) {412 if ((flags & O_NONBLOCK_MASK_OUT) &&
413 struct task_struct *tsk = current;413 !test_thread_flag(TIF_NONBLOCK_WARNING)) {
414 pr_warn_once("%s(%d) uses a deprecated O_NONBLOCK value.\n",414 set_thread_flag(TIF_NONBLOCK_WARNING);
415 tsk->comm, tsk->pid);415 pr_warn("%s(%d) uses a deprecated O_NONBLOCK value."
416 " Please recompile with newer glibc.\n",
417 current->comm, current->pid);
416 }418 }
417 return flags & ~O_NONBLOCK_MASK_OUT;419 return flags & ~O_NONBLOCK_MASK_OUT;
418}420}
arch/parisc/kernel/syscall.S+10−16
@@ -78,7 +78,7 @@ ENTRY(linux_gateway_page) · 77 unmodified lines
78 78
79lws_entry:79lws_entry:
80 gate lws_start, %r0 /* increase privilege */80 gate lws_start, %r0 /* increase privilege */
81 depi 3, 31, 2, %r31 /* Ensure we return into user mode. */81 depi PRIV_USER, 31, 2, %r31 /* Ensure we return into user mode. */
82 82
83 /* Fill from 0xb8 to 0xe0 */83 /* Fill from 0xb8 to 0xe0 */
84 .rept 1084 .rept 10
@@ -89,7 +89,7 @@ lws_entry: · 4 unmodified lines
89 mechanism to work. DO NOT MOVE THIS CODE EVER! */89 mechanism to work. DO NOT MOVE THIS CODE EVER! */
90set_thread_pointer:90set_thread_pointer:
91 gate .+8, %r0 /* increase privilege */91 gate .+8, %r0 /* increase privilege */
92 depi 3, 31, 2, %r31 /* Ensure we return into user mode. */92 depi PRIV_USER, 31, 2, %r31 /* Ensure we return into user mode. */
93 be 0(%sr7,%r31) /* return to user space */93 be 0(%sr7,%r31) /* return to user space */
94 mtctl %r26, %cr27 /* move arg0 to the control register */94 mtctl %r26, %cr27 /* move arg0 to the control register */
95 95
@@ -139,9 +139,9 @@ linux_gateway_entry: · 43 unmodified lines
139 xor %r1,%r30,%r30 /* ye olde xor trick */139 xor %r1,%r30,%r30 /* ye olde xor trick */
140 xor %r1,%r30,%r1140 xor %r1,%r30,%r1
141 xor %r1,%r30,%r30141 xor %r1,%r30,%r30
142
143 ldo THREAD_SZ_ALGN+FRAME_SIZE(%r30),%r30 /* set up kernel stack */
144 142
143 LDREG TASK_STACK(%r30),%r30 /* set up kernel stack */
144 ldo FRAME_SIZE(%r30),%r30
145 /* N.B.: It is critical that we don't set sr7 to 0 until r30145 /* N.B.: It is critical that we don't set sr7 to 0 until r30
146 * contains a valid kernel stack pointer. It is also146 * contains a valid kernel stack pointer. It is also
147 * critical that we don't start using the kernel stack147 * critical that we don't start using the kernel stack
@@ -152,7 +152,6 @@ linux_gateway_entry: · 4 unmodified lines
152 ssm PSW_SM_I, %r0 /* enable interrupts */152 ssm PSW_SM_I, %r0 /* enable interrupts */
153 STREGM %r1,FRAME_SIZE(%r30) /* save r1 (usp) here for now */153 STREGM %r1,FRAME_SIZE(%r30) /* save r1 (usp) here for now */
154 mfctl %cr30,%r1 /* get task ptr in %r1 */154 mfctl %cr30,%r1 /* get task ptr in %r1 */
155 LDREG TI_TASK(%r1),%r1
156 155
157 /* Save some registers for sigcontext and potential task156 /* Save some registers for sigcontext and potential task
158 switch (see entry.S for the details of which ones are157 switch (see entry.S for the details of which ones are
@@ -207,7 +206,7 @@ linux_gateway_entry: · 48 unmodified lines
207 206
208 /* Are we being ptraced? */207 /* Are we being ptraced? */
209 mfctl %cr30, %r1208 mfctl %cr30, %r1
210 LDREG TI_FLAGS(%r1),%r1209 LDREG TASK_TI_FLAGS(%r1),%r1
211 ldi _TIF_SYSCALL_TRACE_MASK, %r19210 ldi _TIF_SYSCALL_TRACE_MASK, %r19
212 and,COND(=) %r1, %r19, %r0211 and,COND(=) %r1, %r19, %r0
213 b,n .Ltracesys212 b,n .Ltracesys
@@ -272,8 +271,7 @@ tracesys: · 58 unmodified lines
272 * C bit set, a non-straced syscall entry results in C and D clear271 * C bit set, a non-straced syscall entry results in C and D clear
273 * in the saved PSW.272 * in the saved PSW.
274 */273 */
275 ldo -THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 /* get task ptr */274 mfctl %cr30,%r1 /* get task ptr */
276 LDREG TI_TASK(%r1), %r1
277 ssm 0,%r2275 ssm 0,%r2
278 STREG %r2,TASK_PT_PSW(%r1) /* Lower 8 bits only!! */276 STREG %r2,TASK_PT_PSW(%r1) /* Lower 8 bits only!! */
279 mfsp %sr0,%r2277 mfsp %sr0,%r2
@@ -327,8 +325,7 @@ tracesys_next: · 47 unmodified lines
327 */325 */
328 copy %ret0,%r20326 copy %ret0,%r20
329 327
330 ldo -THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 /* get task ptr */328 mfctl %cr30,%r1 /* get task ptr */
331 LDREG TI_TASK(%r1), %r1
332 LDREG TASK_PT_GR28(%r1), %r28 /* Restore return value */329 LDREG TASK_PT_GR28(%r1), %r28 /* Restore return value */
333 LDREG TASK_PT_GR26(%r1), %r26 /* Restore the users args */330 LDREG TASK_PT_GR26(%r1), %r26 /* Restore the users args */
334 LDREG TASK_PT_GR25(%r1), %r25331 LDREG TASK_PT_GR25(%r1), %r25
@@ -385,16 +382,14 @@ tracesys_next: · 50 unmodified lines
385 makes a direct call to syscall_trace. */382 makes a direct call to syscall_trace. */
386 383
387tracesys_exit:384tracesys_exit:
388 ldo -THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 /* get task ptr */385 mfctl %cr30,%r1 /* get task ptr */
389 LDREG TI_TASK(%r1), %r1
390#ifdef CONFIG_64BIT386#ifdef CONFIG_64BIT
391 ldo -16(%r30),%r29 /* Reference param save area */387 ldo -16(%r30),%r29 /* Reference param save area */
392#endif388#endif
393 ldo TASK_REGS(%r1),%r26389 ldo TASK_REGS(%r1),%r26
394 BL do_syscall_trace_exit,%r2390 BL do_syscall_trace_exit,%r2
395 STREG %r28,TASK_PT_GR28(%r1) /* save return value now */391 STREG %r28,TASK_PT_GR28(%r1) /* save return value now */
396 ldo -THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 /* get task ptr */392 mfctl %cr30,%r1 /* get task ptr */
397 LDREG TI_TASK(%r1), %r1
398 LDREG TASK_PT_GR28(%r1), %r28 /* Restore return val. */393 LDREG TASK_PT_GR28(%r1), %r28 /* Restore return val. */
399 394
400 ldil L%syscall_exit,%r1395 ldil L%syscall_exit,%r1
@@ -407,8 +402,7 @@ tracesys_exit: · 6 unmodified lines
407 ldo R%tracesys_sigexit(%r2),%r2402 ldo R%tracesys_sigexit(%r2),%r2
408 403
409tracesys_sigexit:404tracesys_sigexit:
410 ldo -THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 /* get task ptr */405 mfctl %cr30,%r1 /* get task ptr */
411 LDREG TI_TASK(%r1), %r1
412#ifdef CONFIG_64BIT406#ifdef CONFIG_64BIT
413 ldo -16(%r30),%r29 /* Reference param save area */407 ldo -16(%r30),%r29 /* Reference param save area */
414#endif408#endif
arch/parisc/kernel/toc.c+111−0
@@ -0,0 +1,111 @@
1// SPDX-License-Identifier: GPL-2.0
2
3#include <linux/kernel.h>
4#include <linux/kgdb.h>
5#include <linux/printk.h>
6#include <linux/sched/debug.h>
7#include <linux/delay.h>
8#include <linux/reboot.h>
9
10#include <asm/pdc.h>
11#include <asm/pdc_chassis.h>
12
13unsigned int __aligned(16) toc_lock = 1;
14
15static void toc20_to_pt_regs(struct pt_regs *regs, struct pdc_toc_pim_20 *toc)
16{
17 int i;
18
19 regs->gr[0] = (unsigned long)toc->cr[22];
20
21 for (i = 1; i < 32; i++)
22 regs->gr[i] = (unsigned long)toc->gr[i];
23
24 for (i = 0; i < 8; i++)
25 regs->sr[i] = (unsigned long)toc->sr[i];
26
27 regs->iasq[0] = (unsigned long)toc->cr[17];
28 regs->iasq[1] = (unsigned long)toc->iasq_back;
29 regs->iaoq[0] = (unsigned long)toc->cr[18];
30 regs->iaoq[1] = (unsigned long)toc->iaoq_back;
31
32 regs->sar = (unsigned long)toc->cr[11];
33 regs->iir = (unsigned long)toc->cr[19];
34 regs->isr = (unsigned long)toc->cr[20];
35 regs->ior = (unsigned long)toc->cr[21];
36}
37
38static void toc11_to_pt_regs(struct pt_regs *regs, struct pdc_toc_pim_11 *toc)
39{
40 int i;
41
42 regs->gr[0] = toc->cr[22];
43
44 for (i = 1; i < 32; i++)
45 regs->gr[i] = toc->gr[i];
46
47 for (i = 0; i < 8; i++)
48 regs->sr[i] = toc->sr[i];
49
50 regs->iasq[0] = toc->cr[17];
51 regs->iasq[1] = toc->iasq_back;
52 regs->iaoq[0] = toc->cr[18];
53 regs->iaoq[1] = toc->iaoq_back;
54
55 regs->sar = toc->cr[11];
56 regs->iir = toc->cr[19];
57 regs->isr = toc->cr[20];
58 regs->ior = toc->cr[21];
59}
60
61void notrace __noreturn __cold toc_intr(struct pt_regs *regs)
62{
63 struct pdc_toc_pim_20 pim_data20;
64 struct pdc_toc_pim_11 pim_data11;
65
66 nmi_enter();
67
68 if (boot_cpu_data.cpu_type >= pcxu) {
69 if (pdc_pim_toc20(&pim_data20))
70 panic("Failed to get PIM data");
71 toc20_to_pt_regs(regs, &pim_data20);
72 } else {
73 if (pdc_pim_toc11(&pim_data11))
74 panic("Failed to get PIM data");
75 toc11_to_pt_regs(regs, &pim_data11);
76 }
77
78#ifdef CONFIG_KGDB
79 if (atomic_read(&kgdb_active) != -1)
80 kgdb_nmicallback(raw_smp_processor_id(), regs);
81 kgdb_handle_exception(9, SIGTRAP, 0, regs);
82#endif
83 show_regs(regs);
84
85 /* give other CPUs time to show their backtrace */
86 mdelay(2000);
87 machine_restart("TOC");
88
89 /* should never reach this */
90 panic("TOC");
91}
92
93static __init int setup_toc(void)
94{
95 unsigned int csum = 0;
96 unsigned long toc_code = (unsigned long)dereference_function_descriptor(toc_handler);
97 int i;
98
99 PAGE0->vec_toc = __pa(toc_code) & 0xffffffff;
100#ifdef CONFIG_64BIT
101 PAGE0->vec_toc_hi = __pa(toc_code) >> 32;
102#endif
103 PAGE0->vec_toclen = toc_handler_size;
104
105 for (i = 0; i < toc_handler_size/4; i++)
106 csum += ((u32 *)toc_code)[i];
107 toc_handler_csum = -csum;
108 pr_info("TOC handler registered\n");
109 return 0;
110}
111early_initcall(setup_toc);
arch/parisc/kernel/toc_asm.S+88−0
@@ -0,0 +1,88 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2
3/* TOC (Transfer of Control) handler. */
4
5 .level 1.1
6
7#include <asm/assembly.h>
8#include <asm/psw.h>
9#include <linux/threads.h>
10#include <linux/linkage.h>
11
12 .text
13 .import toc_intr,code
14 .import toc_lock,data
15 .align 16
16ENTRY_CFI(toc_handler)
17 /*
18 * synchronize CPUs and obtain offset
19 * for stack setup.
20 */
21 load32 PA(toc_lock),%r1
220: ldcw,co 0(%r1),%r2
23 cmpib,= 0,%r2,0b
24 nop
25 addi 1,%r2,%r4
26 stw %r4,0(%r1)
27 addi -1,%r2,%r4
28
29 load32 PA(toc_stack),%sp
30 /*
31 * deposit CPU number into stack address,
32 * so every CPU will have its own stack.
33 */
34 SHLREG %r4,14,%r4
35 add %r4,%sp,%sp
36
37 /*
38 * setup pt_regs on stack and save the
39 * floating point registers. PIM_TOC doesn't
40 * save fp registers, so we're doing it here.
41 */
42 copy %sp,%arg0
43 ldo PT_SZ_ALGN(%sp), %sp
44
45 /* clear pt_regs */
46 copy %arg0,%r1
470: cmpb,<<,n %r1,%sp,0b
48 stw,ma %r0,4(%r1)
49
50 ldo PT_FR0(%arg0),%r25
51 save_fp %r25
52
53 /* go virtual */
54 load32 PA(swapper_pg_dir),%r4
55 mtctl %r4,%cr24
56 mtctl %r4,%cr25
57
58 /* Clear sr4-sr7 */
59 mtsp %r0, %sr4
60 mtsp %r0, %sr5
61 mtsp %r0, %sr6
62 mtsp %r0, %sr7
63
64 tovirt_r1 %sp
65 tovirt_r1 %arg0
66 virt_map
67
68 loadgp
69
70#ifdef CONFIG_64BIT
71 ldo -16(%sp),%r29
72#endif
73 load32 toc_intr,%r1
74 be 0(%sr7,%r1)
75 nop
76ENDPROC_CFI(toc_handler)
77
78 /*
79 * keep this checksum here, as it is part of the toc_handler
80 * spanned by toc_handler_size (all words in toc_handler are
81 * added in PDC and the sum must equal to zero.
82 */
83SYM_DATA(toc_handler_csum, .long 0)
84SYM_DATA(toc_handler_size, .long . - toc_handler)
85
86 __PAGE_ALIGNED_BSS
87 .align 64
88SYM_DATA(toc_stack, .block 16384*NR_CPUS)
arch/parisc/kernel/traps.c+6−1
@@ -30,6 +30,7 @@ · 29 unmodified lines
30#include <linux/ratelimit.h>30#include <linux/ratelimit.h>
31#include <linux/uaccess.h>31#include <linux/uaccess.h>
32#include <linux/kdebug.h>32#include <linux/kdebug.h>
33#include <linux/kfence.h>
33 34
34#include <asm/assembly.h>35#include <asm/assembly.h>
35#include <asm/io.h>36#include <asm/io.h>
@@ -143,7 +144,7 @@ void show_regs(struct pt_regs *regs) · 107 unmodified lines
143 printk("%s IIR: %08lx ISR: " RFMT " IOR: " RFMT "\n",144 printk("%s IIR: %08lx ISR: " RFMT " IOR: " RFMT "\n",
144 level, regs->iir, regs->isr, regs->ior);145 level, regs->iir, regs->isr, regs->ior);
145 printk("%s CPU: %8d CR30: " RFMT " CR31: " RFMT "\n",146 printk("%s CPU: %8d CR30: " RFMT " CR31: " RFMT "\n",
146 level, current_thread_info()->cpu, cr30, cr31);147 level, task_cpu(current), cr30, cr31);
147 printk("%s ORIG_R28: " RFMT "\n", level, regs->orig_r28);148 printk("%s ORIG_R28: " RFMT "\n", level, regs->orig_r28);
148 149
149 if (user) {150 if (user) {
@@ -787,6 +788,10 @@ void notrace handle_interruption(int code, struct pt_regs *regs) · 637 unmodified lines
787 /* Clean up and return if in exception table. */788 /* Clean up and return if in exception table. */
788 if (fixup_exception(regs))789 if (fixup_exception(regs))
789 return;790 return;
791 /* Clean up and return if handled by kfence. */
792 if (kfence_handle_page_fault(fault_address,
793 parisc_acctyp(code, regs->iir) == VM_WRITE, regs))
794 return;
790 pdc_chassis_send_status(PDC_CHASSIS_DIRECT_PANIC);795 pdc_chassis_send_status(PDC_CHASSIS_DIRECT_PANIC);
791 parisc_terminate("Kernel Fault", regs, code, fault_address);796 parisc_terminate("Kernel Fault", regs, code, fault_address);
792 }797 }
arch/parisc/kernel/unwind.c+20−14
@@ -14,6 +14,7 @@ · 13 unmodified lines
14#include <linux/sched.h>14#include <linux/sched.h>
15#include <linux/slab.h>15#include <linux/slab.h>
16#include <linux/sort.h>16#include <linux/sort.h>
17#include <linux/sched/task_stack.h>
17 18
18#include <linux/uaccess.h>19#include <linux/uaccess.h>
19#include <asm/assembly.h>20#include <asm/assembly.h>
@@ -21,6 +22,8 @@ · 1 unmodified line
21#include <asm/ptrace.h>22#include <asm/ptrace.h>
22 23
23#include <asm/unwind.h>24#include <asm/unwind.h>
25#include <asm/switch_to.h>
26#include <asm/sections.h>
24 27
25/* #define DEBUG 1 */28/* #define DEBUG 1 */
26#ifdef DEBUG29#ifdef DEBUG
@@ -203,6 +206,11 @@ int __init unwind_init(void) · 176 unmodified lines
203 return 0;206 return 0;
204}207}
205 208
209static bool pc_is_kernel_fn(unsigned long pc, void *fn)
210{
211 return (unsigned long)dereference_kernel_function_descriptor(fn) == pc;
212}
213
206static int unwind_special(struct unwind_frame_info *info, unsigned long pc, int frame_size)214static int unwind_special(struct unwind_frame_info *info, unsigned long pc, int frame_size)
207{215{
208 /*216 /*
@@ -221,7 +229,7 @@ static int unwind_special(struct unwind_frame_info *info, unsigned long pc, int · 12 unmodified lines
221 extern void * const _call_on_stack;229 extern void * const _call_on_stack;
222#endif /* CONFIG_IRQSTACKS */230#endif /* CONFIG_IRQSTACKS */
223 231
224 if (pc == (unsigned long) &handle_interruption) {232 if (pc_is_kernel_fn(pc, handle_interruption)) {
225 struct pt_regs *regs = (struct pt_regs *)(info->sp - frame_size - PT_SZ_ALGN);233 struct pt_regs *regs = (struct pt_regs *)(info->sp - frame_size - PT_SZ_ALGN);
226 dbg("Unwinding through handle_interruption()\n");234 dbg("Unwinding through handle_interruption()\n");
227 info->prev_sp = regs->gr[30];235 info->prev_sp = regs->gr[30];
@@ -229,13 +237,13 @@ static int unwind_special(struct unwind_frame_info *info, unsigned long pc, int · 1 unmodified line
229 return 1;237 return 1;
230 }238 }
231 239
232 if (pc == (unsigned long) &ret_from_kernel_thread ||240 if (pc_is_kernel_fn(pc, ret_from_kernel_thread) ||
233 pc == (unsigned long) &syscall_exit) {241 pc_is_kernel_fn(pc, syscall_exit)) {
234 info->prev_sp = info->prev_ip = 0;242 info->prev_sp = info->prev_ip = 0;
235 return 1;243 return 1;
236 }244 }
237 245
238 if (pc == (unsigned long) &intr_return) {246 if (pc_is_kernel_fn(pc, intr_return)) {
239 struct pt_regs *regs;247 struct pt_regs *regs;
240 248
241 dbg("Found intr_return()\n");249 dbg("Found intr_return()\n");
@@ -246,20 +254,20 @@ static int unwind_special(struct unwind_frame_info *info, unsigned long pc, int · 4 unmodified lines
246 return 1;254 return 1;
247 }255 }
248 256
249 if (pc == (unsigned long) &_switch_to_ret) {257 if (pc_is_kernel_fn(pc, _switch_to) ||
258 pc_is_kernel_fn(pc, _switch_to_ret)) {
250 info->prev_sp = info->sp - CALLEE_SAVE_FRAME_SIZE;259 info->prev_sp = info->sp - CALLEE_SAVE_FRAME_SIZE;
251 info->prev_ip = *(unsigned long *)(info->prev_sp - RP_OFFSET);260 info->prev_ip = *(unsigned long *)(info->prev_sp - RP_OFFSET);
252 return 1;261 return 1;
253 }262 }
254 263
255#ifdef CONFIG_IRQSTACKS264#ifdef CONFIG_IRQSTACKS
256 if (pc == (unsigned long) &_call_on_stack) {265 if (pc_is_kernel_fn(pc, _call_on_stack)) {
257 info->prev_sp = *(unsigned long *)(info->sp - FRAME_SIZE - REG_SZ);266 info->prev_sp = *(unsigned long *)(info->sp - FRAME_SIZE - REG_SZ);
258 info->prev_ip = *(unsigned long *)(info->sp - FRAME_SIZE - RP_OFFSET);267 info->prev_ip = *(unsigned long *)(info->sp - FRAME_SIZE - RP_OFFSET);
259 return 1;268 return 1;
260 }269 }
261#endif270#endif
262
263 return 0;271 return 0;
264}272}
265 273
@@ -292,17 +300,15 @@ static void unwind_frame_regs(struct unwind_frame_info *info) · 26 unmodified lines
292 info->prev_sp = sp - 64;300 info->prev_sp = sp - 64;
293 info->prev_ip = 0;301 info->prev_ip = 0;
294 302
295 /* The stack is at the end inside the thread_union303 /* Check if stack is inside kernel stack area */
296 * struct. If we reach data, we have reached the304 if ((info->prev_sp - (unsigned long) task_stack_page(info->t))
297 * beginning of the stack and should stop unwinding. */305 >= THREAD_SIZE) {
298 if (info->prev_sp >= (unsigned long) task_thread_info(info->t) &&
299 info->prev_sp < ((unsigned long) task_thread_info(info->t)
300 + THREAD_SZ_ALGN)) {
301 info->prev_sp = 0;306 info->prev_sp = 0;
302 break;307 break;
303 }308 }
304 309
305 if (get_user(tmp, (unsigned long *)(info->prev_sp - RP_OFFSET))) 310 if (copy_from_kernel_nofault(&tmp,
311 (void *)info->prev_sp - RP_OFFSET, sizeof(tmp)))
306 break;312 break;
307 info->prev_ip = tmp;313 info->prev_ip = tmp;
308 sp = info->prev_sp;314 sp = info->prev_sp;
arch/parisc/lib/bitops.c+6−6
@@ -18,7 +18,7 @@ arch_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned = { · 17 unmodified lines
18#endif18#endif
19 19
20#ifdef CONFIG_64BIT20#ifdef CONFIG_64BIT
21unsigned long __xchg64(unsigned long x, volatile unsigned long *ptr)21unsigned long notrace __xchg64(unsigned long x, volatile unsigned long *ptr)
22{22{
23 unsigned long temp, flags;23 unsigned long temp, flags;
24 24
@@ -30,7 +30,7 @@ unsigned long __xchg64(unsigned long x, volatile unsigned long *ptr) · 5 unmodified lines
30}30}
31#endif31#endif
32 32
33unsigned long __xchg32(int x, volatile int *ptr)33unsigned long notrace __xchg32(int x, volatile int *ptr)
34{34{
35 unsigned long flags;35 unsigned long flags;
36 long temp;36 long temp;
@@ -43,7 +43,7 @@ unsigned long __xchg32(int x, volatile int *ptr) · 6 unmodified lines
43}43}
44 44
45 45
46unsigned long __xchg8(char x, volatile char *ptr)46unsigned long notrace __xchg8(char x, volatile char *ptr)
47{47{
48 unsigned long flags;48 unsigned long flags;
49 long temp;49 long temp;
@@ -56,7 +56,7 @@ unsigned long __xchg8(char x, volatile char *ptr) · 6 unmodified lines
56}56}
57 57
58 58
59u64 __cmpxchg_u64(volatile u64 *ptr, u64 old, u64 new)59u64 notrace __cmpxchg_u64(volatile u64 *ptr, u64 old, u64 new)
60{60{
61 unsigned long flags;61 unsigned long flags;
62 u64 prev;62 u64 prev;
@@ -68,7 +68,7 @@ u64 __cmpxchg_u64(volatile u64 *ptr, u64 old, u64 new) · 5 unmodified lines
68 return prev;68 return prev;
69}69}
70 70
71unsigned long __cmpxchg_u32(volatile unsigned int *ptr, unsigned int old, unsigned int new)71unsigned long notrace __cmpxchg_u32(volatile unsigned int *ptr, unsigned int old, unsigned int new)
72{72{
73 unsigned long flags;73 unsigned long flags;
74 unsigned int prev;74 unsigned int prev;
@@ -80,7 +80,7 @@ unsigned long __cmpxchg_u32(volatile unsigned int *ptr, unsigned int old, unsign · 5 unmodified lines
80 return (unsigned long)prev;80 return (unsigned long)prev;
81}81}
82 82
83u8 __cmpxchg_u8(volatile u8 *ptr, u8 old, u8 new)83u8 notrace __cmpxchg_u8(volatile u8 *ptr, u8 old, u8 new)
84{84{
85 unsigned long flags;85 unsigned long flags;
86 u8 prev;86 u8 prev;
arch/parisc/mm/fault.c+1−1
@@ -48,7 +48,7 @@ int show_unhandled_signals = 1; · 47 unmodified lines
48 * VM_WRITE if write operation48 * VM_WRITE if write operation
49 * VM_EXEC if execute operation49 * VM_EXEC if execute operation
50 */50 */
51static unsigned long51unsigned long
52parisc_acctyp(unsigned long code, unsigned int inst)52parisc_acctyp(unsigned long code, unsigned int inst)
53{53{
54 if (code == 6 || code == 16)54 if (code == 6 || code == 16)
arch/parisc/mm/fixmap.c+1−4
@@ -20,12 +20,9 @@ void notrace set_fixmap(enum fixed_addresses idx, phys_addr_t phys) · 19 unmodified lines
20 pte_t *pte;20 pte_t *pte;
21 21
22 if (pmd_none(*pmd))22 if (pmd_none(*pmd))
23 pmd = pmd_alloc(NULL, pud, vaddr);
24
25 pte = pte_offset_kernel(pmd, vaddr);
26 if (pte_none(*pte))
27 pte = pte_alloc_kernel(pmd, vaddr);23 pte = pte_alloc_kernel(pmd, vaddr);
28 24
25 pte = pte_offset_kernel(pmd, vaddr);
29 set_pte_at(&init_mm, vaddr, pte, __mk_pte(phys, PAGE_KERNEL_RWX));26 set_pte_at(&init_mm, vaddr, pte, __mk_pte(phys, PAGE_KERNEL_RWX));
30 flush_tlb_kernel_range(vaddr, vaddr + PAGE_SIZE);27 flush_tlb_kernel_range(vaddr, vaddr + PAGE_SIZE);
31}28}
arch/parisc/mm/init.c+3−7
@@ -127,16 +127,12 @@ static void __init setup_bootmem(void) · 126 unmodified lines
127 int j;127 int j;
128 128
129 for (j = i; j > 0; j--) {129 for (j = i; j > 0; j--) {
130 physmem_range_t tmp;
131
132 if (pmem_ranges[j-1].start_pfn <130 if (pmem_ranges[j-1].start_pfn <
133 pmem_ranges[j].start_pfn) {131 pmem_ranges[j].start_pfn) {
134 132
135 break;133 break;
136 }134 }
137 tmp = pmem_ranges[j-1];135 swap(pmem_ranges[j-1], pmem_ranges[j]);
138 pmem_ranges[j-1] = pmem_ranges[j];
139 pmem_ranges[j] = tmp;
140 }136 }
141 }137 }
142 138
@@ -842,9 +838,9 @@ void flush_tlb_all(void) · 699 unmodified lines
842{838{
843 int do_recycle;839 int do_recycle;
844 840
845 __inc_irq_stat(irq_tlb_count);
846 do_recycle = 0;841 do_recycle = 0;
847 spin_lock(&sid_lock);842 spin_lock(&sid_lock);
843 __inc_irq_stat(irq_tlb_count);
848 if (dirty_space_ids > RECYCLE_THRESHOLD) {844 if (dirty_space_ids > RECYCLE_THRESHOLD) {
849 BUG_ON(recycle_inuse); /* FIXME: Use a semaphore/wait queue here */845 BUG_ON(recycle_inuse); /* FIXME: Use a semaphore/wait queue here */
850 get_dirty_sids(&recycle_ndirty,recycle_dirty_array);846 get_dirty_sids(&recycle_ndirty,recycle_dirty_array);
@@ -863,8 +859,8 @@ void flush_tlb_all(void) · 12 unmodified lines
863#else859#else
864void flush_tlb_all(void)860void flush_tlb_all(void)
865{861{
866 __inc_irq_stat(irq_tlb_count);
867 spin_lock(&sid_lock);862 spin_lock(&sid_lock);
863 __inc_irq_stat(irq_tlb_count);
868 flush_tlb_all_local(NULL);864 flush_tlb_all_local(NULL);
869 recycle_sids();865 recycle_sids();
870 spin_unlock(&sid_lock);866 spin_unlock(&sid_lock);
include/linux/sched/task_stack.h+4−0
@@ -25,7 +25,11 @@ static inline void *task_stack_page(const struct task_struct *task) · 24 unmodified lines
25 25
26static inline unsigned long *end_of_stack(const struct task_struct *task)26static inline unsigned long *end_of_stack(const struct task_struct *task)
27{27{
28#ifdef CONFIG_STACK_GROWSUP
29 return (unsigned long *)((unsigned long)task->stack + THREAD_SIZE) - 1;
30#else
28 return task->stack;31 return task->stack;
32#endif
29}33}
30 34
31#elif !defined(__HAVE_THREAD_FUNCTIONS)35#elif !defined(__HAVE_THREAD_FUNCTIONS)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t