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 ...
Unified · Split
| @@ -20,7 +20,7 @@ · 19 unmodified lines | ||
| 20 | 20 | | nds32: | ok | |
| 21 | 21 | | nios2: | TODO | |
| 22 | 22 | | openrisc: | TODO | |
| 23 | − | parisc: | TODO | | |
| 23 | + | parisc: | ok | | |
| 24 | 24 | | powerpc: | ok | |
| 25 | 25 | | riscv: | ok | |
| 26 | 26 | | s390: | ok | |
| @@ -13,6 +13,8 @@ config PARISC · 12 unmodified lines | ||
| 13 | 13 | select ARCH_NO_SG_CHAIN |
| 14 | 14 | select ARCH_SUPPORTS_HUGETLBFS if PA20 |
| 15 | 15 | select ARCH_SUPPORTS_MEMORY_FAILURE |
| 16 | + select ARCH_STACKWALK | |
| 17 | + select HAVE_RELIABLE_STACKTRACE | |
| 16 | 18 | select DMA_OPS |
| 17 | 19 | select RTC_CLASS |
| 18 | 20 | select RTC_DRV_GENERIC |
| @@ -46,6 +48,7 @@ config PARISC · 27 unmodified lines | ||
| 46 | 48 | select HAVE_ARCH_HASH |
| 47 | 49 | select HAVE_ARCH_JUMP_LABEL |
| 48 | 50 | select HAVE_ARCH_JUMP_LABEL_RELATIVE |
| 51 | + select HAVE_ARCH_KFENCE | |
| 49 | 52 | select HAVE_ARCH_SECCOMP_FILTER |
| 50 | 53 | select HAVE_ARCH_TRACEHOOK |
| 51 | 54 | select HAVE_REGS_AND_STACK_ACCESS_API |
| @@ -53,6 +56,7 @@ config PARISC · 1 unmodified line | ||
| 53 | 56 | select HAVE_UNSTABLE_SCHED_CLOCK if SMP |
| 54 | 57 | select LEGACY_TIMER_TICK |
| 55 | 58 | select CPU_NO_EFFICIENT_FFS |
| 59 | + select THREAD_INFO_IN_TASK | |
| 56 | 60 | select NEED_DMA_MAP_STATE |
| 57 | 61 | select NEED_SG_DMA_LENGTH |
| 58 | 62 | select HAVE_ARCH_KGDB |
| @@ -252,11 +256,11 @@ config PARISC_PAGE_SIZE_4KB · 193 unmodified lines | ||
| 252 | 256 | |
| 253 | 257 | config PARISC_PAGE_SIZE_16KB |
| 254 | 258 | bool "16KB" |
| 255 | − depends on PA8X00 && BROKEN | |
| 259 | + depends on PA8X00 && BROKEN && !KFENCE | |
| 256 | 260 | |
| 257 | 261 | config PARISC_PAGE_SIZE_64KB |
| 258 | 262 | bool "64KB" |
| 259 | − depends on PA8X00 && BROKEN | |
| 263 | + depends on PA8X00 && BROKEN && !KFENCE | |
| 260 | 264 | |
| 261 | 265 | endchoice |
| 262 | 266 | |
| @@ -288,6 +292,20 @@ config SMP · 25 unmodified lines | ||
| 288 | 292 | |
| 289 | 293 | If you don't know what to do here, say N. |
| 290 | 294 | |
| 295 | +config 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 | + | |
| 291 | 309 | config PARISC_CPU_TOPOLOGY |
| 292 | 310 | bool "Support cpu topology definition" |
| 293 | 311 | depends on SMP |
| @@ -9,9 +9,10 @@ KCOV_INSTRUMENT := n · 8 unmodified lines | ||
| 9 | 9 | GCOV_PROFILE := n |
| 10 | 10 | UBSAN_SANITIZE := n |
| 11 | 11 | |
| 12 | +OBJECTS := head.o real2.o firmware.o misc.o piggy.o | |
| 12 | 13 | targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 |
| 13 | 14 | targets += vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.lz4 |
| 14 | −targets += misc.o piggy.o sizes.h head.o real2.o firmware.o | |
| 15 | +targets += $(OBJECTS) sizes.h | |
| 15 | 16 | targets += real2.S firmware.c |
| 16 | 17 | |
| 17 | 18 | KBUILD_CFLAGS := -D__KERNEL__ -O2 -DBOOTLOADER |
| @@ -23,10 +24,8 @@ ifndef CONFIG_64BIT · 5 unmodified lines | ||
| 23 | 24 | KBUILD_CFLAGS += -mfast-indirect-calls |
| 24 | 25 | endif |
| 25 | 26 | |
| 26 | −OBJECTS += $(obj)/head.o $(obj)/real2.o $(obj)/firmware.o $(obj)/misc.o $(obj)/piggy.o | |
| 27 | − | |
| 28 | 27 | LDFLAGS_vmlinux := -X -e startup --as-needed -T |
| 29 | −$(obj)/vmlinux: $(obj)/vmlinux.lds $(OBJECTS) $(LIBGCC) FORCE | |
| 28 | +$(obj)/vmlinux: $(obj)/vmlinux.lds $(addprefix $(obj)/, $(OBJECTS)) $(LIBGCC) FORCE | |
| 30 | 29 | $(call if_changed,ld) |
| 31 | 30 | |
| 32 | 31 | sed-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 | 51 | $(obj)/real2.S: $(srctree)/arch/$(SRCARCH)/kernel/real2.S |
| 53 | 52 | $(call cmd,shipped) |
| 54 | 53 | |
| 55 | −$(obj)/misc.o: $(obj)/sizes.h | |
| 56 | − | |
| 57 | 54 | CPPFLAGS_vmlinux.lds += -I$(objtree)/$(obj) -DBOOTLOADER |
| 58 | 55 | $(obj)/vmlinux.lds: $(obj)/sizes.h |
| 59 | 56 | |
| @@ -22,7 +22,6 @@ CONFIG_PCI_LBA=y · 21 unmodified lines | ||
| 22 | 22 | CONFIG_MODULES=y |
| 23 | 23 | CONFIG_MODULE_UNLOAD=y |
| 24 | 24 | CONFIG_MODULE_FORCE_UNLOAD=y |
| 25 | −# CONFIG_BLK_DEV_BSG is not set | |
| 26 | 25 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
| 27 | 26 | CONFIG_BINFMT_MISC=m |
| 28 | 27 | CONFIG_NET=y |
| @@ -55,13 +54,14 @@ CONFIG_BLK_DEV_SD=y · 26 unmodified lines | ||
| 55 | 54 | CONFIG_CHR_DEV_ST=y |
| 56 | 55 | CONFIG_BLK_DEV_SR=y |
| 57 | 56 | CONFIG_CHR_DEV_SG=y |
| 57 | +# CONFIG_BLK_DEV_BSG is not set | |
| 58 | 58 | CONFIG_SCSI_LASI700=y |
| 59 | 59 | CONFIG_SCSI_SYM53C8XX_2=y |
| 60 | 60 | CONFIG_SCSI_ZALON=y |
| 61 | 61 | CONFIG_SCSI_DH=y |
| 62 | 62 | CONFIG_ATA=y |
| 63 | −CONFIG_ATA_GENERIC=y | |
| 64 | 63 | CONFIG_PATA_NS87415=y |
| 64 | +CONFIG_ATA_GENERIC=y | |
| 65 | 65 | CONFIG_MD=y |
| 66 | 66 | CONFIG_BLK_DEV_MD=m |
| 67 | 67 | CONFIG_MD_LINEAR=m |
| @@ -212,7 +212,6 @@ CONFIG_NFS_FS=m · 144 unmodified lines | ||
| 212 | 212 | CONFIG_NFSD=m |
| 213 | 213 | CONFIG_NFSD_V3=y |
| 214 | 214 | CONFIG_CIFS=m |
| 215 | −CONFIG_CIFS_WEAK_PW_HASH=y | |
| 216 | 215 | CONFIG_CIFS_XATTR=y |
| 217 | 216 | CONFIG_CIFS_POSIX=y |
| 218 | 217 | # CONFIG_CIFS_DEBUG is not set |
| @@ -221,16 +220,12 @@ CONFIG_CRYPTO_HMAC=y · 2 unmodified lines | ||
| 221 | 220 | CONFIG_CRYPTO_MD5=y |
| 222 | 221 | CONFIG_CRYPTO_MICHAEL_MIC=m |
| 223 | 222 | CONFIG_CRYPTO_SHA1=y |
| 224 | −CONFIG_CRYPTO_TGR192=m | |
| 225 | 223 | CONFIG_CRYPTO_WP512=m |
| 226 | −CONFIG_CRYPTO_ANUBIS=m | |
| 227 | 224 | CONFIG_CRYPTO_BLOWFISH=m |
| 228 | 225 | CONFIG_CRYPTO_CAST5=m |
| 229 | 226 | CONFIG_CRYPTO_CAST6=m |
| 230 | 227 | CONFIG_CRYPTO_DES=y |
| 231 | −CONFIG_CRYPTO_KHAZAD=m | |
| 232 | 228 | CONFIG_CRYPTO_SERPENT=m |
| 233 | −CONFIG_CRYPTO_TEA=m | |
| 234 | 229 | CONFIG_CRYPTO_TWOFISH=m |
| 235 | 230 | CONFIG_CRYPTO_DEFLATE=y |
| 236 | 231 | CONFIG_CRC_CCITT=m |
| @@ -8,9 +8,10 @@ CONFIG_TASKSTATS=y · 7 unmodified lines | ||
| 8 | 8 | CONFIG_TASK_DELAY_ACCT=y |
| 9 | 9 | CONFIG_TASK_XACCT=y |
| 10 | 10 | CONFIG_TASK_IO_ACCOUNTING=y |
| 11 | +CONFIG_IKCONFIG=y | |
| 12 | +CONFIG_IKCONFIG_PROC=y | |
| 11 | 13 | CONFIG_CGROUPS=y |
| 12 | 14 | CONFIG_MEMCG=y |
| 13 | −CONFIG_MEMCG_SWAP=y | |
| 14 | 15 | CONFIG_CGROUP_PIDS=y |
| 15 | 16 | CONFIG_CPUSETS=y |
| 16 | 17 | CONFIG_RELAY=y |
| @@ -124,14 +125,13 @@ CONFIG_QLCNIC=m · 107 unmodified lines | ||
| 124 | 125 | # CONFIG_NET_VENDOR_TI is not set |
| 125 | 126 | # CONFIG_NET_VENDOR_VIA is not set |
| 126 | 127 | # CONFIG_NET_VENDOR_WIZNET is not set |
| 127 | −CONFIG_MDIO_BITBANG=m | |
| 128 | 128 | CONFIG_PHYLIB=y |
| 129 | 129 | CONFIG_BROADCOM_PHY=m |
| 130 | 130 | CONFIG_CICADA_PHY=m |
| 131 | 131 | CONFIG_DAVICOM_PHY=m |
| 132 | 132 | CONFIG_ICPLUS_PHY=m |
| 133 | −CONFIG_LSI_ET1011C_PHY=m | |
| 134 | 133 | CONFIG_LXT_PHY=m |
| 134 | +CONFIG_LSI_ET1011C_PHY=m | |
| 135 | 135 | CONFIG_MARVELL_PHY=m |
| 136 | 136 | CONFIG_NATIONAL_PHY=m |
| 137 | 137 | CONFIG_QSEMI_PHY=m |
| @@ -139,6 +139,7 @@ CONFIG_REALTEK_PHY=m · 1 unmodified line | ||
| 139 | 139 | CONFIG_SMSC_PHY=m |
| 140 | 140 | CONFIG_STE10XP=m |
| 141 | 141 | CONFIG_VITESSE_PHY=m |
| 142 | +CONFIG_MDIO_BITBANG=m | |
| 142 | 143 | CONFIG_SLIP=m |
| 143 | 144 | # CONFIG_WLAN is not set |
| 144 | 145 | CONFIG_INPUT_EVDEV=y |
| @@ -150,7 +151,6 @@ CONFIG_SERIO_SERPORT=m · 5 unmodified lines | ||
| 150 | 151 | # CONFIG_HP_SDC is not set |
| 151 | 152 | CONFIG_SERIO_RAW=m |
| 152 | 153 | # CONFIG_LEGACY_PTYS is not set |
| 153 | −CONFIG_NOZOMI=m | |
| 154 | 154 | CONFIG_SERIAL_8250=y |
| 155 | 155 | # CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set |
| 156 | 156 | CONFIG_SERIAL_8250_CONSOLE=y |
| @@ -160,6 +160,7 @@ CONFIG_SERIAL_8250_EXTENDED=y · 3 unmodified lines | ||
| 160 | 160 | CONFIG_SERIAL_8250_MANY_PORTS=y |
| 161 | 161 | CONFIG_SERIAL_8250_SHARE_IRQ=y |
| 162 | 162 | CONFIG_SERIAL_JSM=m |
| 163 | +CONFIG_NOZOMI=m | |
| 163 | 164 | CONFIG_IPMI_HANDLER=y |
| 164 | 165 | CONFIG_IPMI_DEVICE_INTERFACE=y |
| 165 | 166 | CONFIG_IPMI_SI=y |
| @@ -188,9 +189,13 @@ CONFIG_AGP=y · 22 unmodified lines | ||
| 188 | 189 | CONFIG_AGP_PARISC=y |
| 189 | 190 | CONFIG_DRM=y |
| 190 | 191 | CONFIG_DRM_RADEON=y |
| 191 | −CONFIG_FIRMWARE_EDID=y | |
| 192 | −CONFIG_FB_MODE_HELPERS=y | |
| 193 | −CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y | |
| 192 | +CONFIG_FB=y | |
| 193 | +CONFIG_FB_MATROX=y | |
| 194 | +CONFIG_FB_MATROX_MYSTIQUE=y | |
| 195 | +CONFIG_FB_MATROX_G=y | |
| 196 | +CONFIG_FB_MATROX_I2C=y | |
| 197 | +CONFIG_FB_MATROX_MAVEN=y | |
| 198 | +CONFIG_FB_RADEON=y | |
| 194 | 199 | CONFIG_HIDRAW=y |
| 195 | 200 | CONFIG_HID_PID=y |
| 196 | 201 | CONFIG_USB_HIDDEV=y |
| @@ -202,7 +207,6 @@ CONFIG_UIO_SERCOS3=m · 5 unmodified lines | ||
| 202 | 207 | CONFIG_UIO_PCI_GENERIC=m |
| 203 | 208 | CONFIG_STAGING=y |
| 204 | 209 | CONFIG_QLGE=m |
| 205 | −CONFIG_HP100=m | |
| 206 | 210 | CONFIG_EXT2_FS=y |
| 207 | 211 | CONFIG_EXT2_FS_XATTR=y |
| 208 | 212 | CONFIG_EXT2_FS_SECURITY=y |
| @@ -245,7 +249,6 @@ CONFIG_CRYPTO_PCBC=m · 36 unmodified lines | ||
| 245 | 249 | CONFIG_CRYPTO_MD4=m |
| 246 | 250 | CONFIG_CRYPTO_MD5=y |
| 247 | 251 | CONFIG_CRYPTO_MICHAEL_MIC=m |
| 248 | −CONFIG_CRYPTO_ARC4=m | |
| 249 | 252 | CONFIG_CRYPTO_FCRYPT=m |
| 250 | 253 | CONFIG_CRYPTO_DEFLATE=m |
| 251 | 254 | # CONFIG_CRYPTO_HW is not set |
| @@ -42,6 +42,9 @@ · 41 unmodified lines | ||
| 42 | 42 | #define ASM_ULONG_INSN .word |
| 43 | 43 | #endif |
| 44 | 44 | |
| 45 | +/* Frame alignment for 32- and 64-bit */ | |
| 46 | +#define FRAME_ALIGN 64 | |
| 47 | + | |
| 45 | 48 | #define CALLEE_SAVE_FRAME_SIZE (CALLEE_REG_FRAME_SIZE + CALLEE_FLOAT_FRAME_SIZE) |
| 46 | 49 | |
| 47 | 50 | #ifdef CONFIG_PA20 |
| @@ -58,6 +61,10 @@ · 10 unmodified lines | ||
| 58 | 61 | #define PA_ASM_LEVEL 1.1 |
| 59 | 62 | #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 | 68 | #ifdef __ASSEMBLY__ |
| 62 | 69 | |
| 63 | 70 | #ifdef CONFIG_64BIT |
| @@ -71,6 +78,7 @@ · 7 unmodified lines | ||
| 71 | 78 | #include <asm/types.h> |
| 72 | 79 | |
| 73 | 80 | #include <asm/asmregs.h> |
| 81 | +#include <asm/psw.h> | |
| 74 | 82 | |
| 75 | 83 | sp = 30 |
| 76 | 84 | gp = 27 |
| @@ -497,6 +505,30 @@ · 420 unmodified lines | ||
| 497 | 505 | nop /* 7 */ |
| 498 | 506 | .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 | |
| 528 | +4: | |
| 529 | + .endm | |
| 530 | + | |
| 531 | + | |
| 500 | 532 | /* |
| 501 | 533 | * ASM_EXCEPTIONTABLE_ENTRY |
| 502 | 534 | * |
| @@ -104,8 +104,6 @@ static __inline__ int test_and_change_bit(int nr, volatile unsigned long * addr) · 103 unmodified lines | ||
| 104 | 104 | |
| 105 | 105 | #include <asm-generic/bitops/non-atomic.h> |
| 106 | 106 | |
| 107 | −#ifdef __KERNEL__ | |
| 108 | − | |
| 109 | 107 | /** |
| 110 | 108 | * __ffs - find first bit in word. returns 0 to "BITS_PER_LONG-1". |
| 111 | 109 | * @word: The word to search |
| @@ -205,16 +203,8 @@ static __inline__ int fls(unsigned int x) · 93 unmodified lines | ||
| 205 | 203 | #include <asm-generic/bitops/hweight.h> |
| 206 | 204 | #include <asm-generic/bitops/lock.h> |
| 207 | 205 | #include <asm-generic/bitops/sched.h> |
| 208 | − | |
| 209 | −#endif /* __KERNEL__ */ | |
| 210 | − | |
| 211 | 206 | #include <asm-generic/bitops/find.h> |
| 212 | − | |
| 213 | −#ifdef __KERNEL__ | |
| 214 | − | |
| 215 | 207 | #include <asm-generic/bitops/le.h> |
| 216 | 208 | #include <asm-generic/bitops/ext2-atomic-setbit.h> |
| 217 | 209 | |
| 218 | −#endif /* __KERNEL__ */ | |
| 219 | − | |
| 220 | 210 | #endif /* _PARISC_BITOPS_H */ |
| @@ -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__ | |
| 8 | +struct task_struct; | |
| 9 | + | |
| 10 | +static __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 */ | |
| @@ -2,8 +2,6 @@ · 1 unmodified line | ||
| 2 | 2 | #ifndef _ASM_PARISC_FUTEX_H |
| 3 | 3 | #define _ASM_PARISC_FUTEX_H |
| 4 | 4 | |
| 5 | −#ifdef __KERNEL__ | |
| 6 | − | |
| 7 | 5 | #include <linux/futex.h> |
| 8 | 6 | #include <linux/uaccess.h> |
| 9 | 7 | #include <asm/atomic.h> |
| @@ -119,5 +117,4 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, · 109 unmodified lines | ||
| 119 | 117 | return 0; |
| 120 | 118 | } |
| 121 | 119 | |
| 122 | −#endif /*__KERNEL__*/ | |
| 123 | 120 | #endif /*_ASM_PARISC_FUTEX_H*/ |
| @@ -12,8 +12,6 @@ · 11 unmodified lines | ||
| 12 | 12 | #ifndef __ASM_PARISC_IDE_H |
| 13 | 13 | #define __ASM_PARISC_IDE_H |
| 14 | 14 | |
| 15 | −#ifdef __KERNEL__ | |
| 16 | − | |
| 17 | 15 | /* Generic I/O and MEMIO string operations. */ |
| 18 | 16 | |
| 19 | 17 | #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 | 54 | #endif /* __ASM_PARISC_IDE_H */ |
| @@ -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 | + | |
| 16 | +static inline bool arch_kfence_init_pool(void) | |
| 17 | +{ | |
| 18 | + return true; | |
| 19 | +} | |
| 20 | + | |
| 21 | +/* Protect the given page and flush TLB. */ | |
| 22 | +static 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 */ | |
| @@ -1,10 +1,8 @@ | ||
| 1 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | 2 | #ifndef ASM_PARISC_MCKINLEY_H |
| 3 | 3 | #define ASM_PARISC_MCKINLEY_H |
| 4 | −#ifdef __KERNEL__ | |
| 5 | 4 | |
| 6 | 5 | /* declared in arch/parisc/kernel/setup.c */ |
| 7 | 6 | extern struct proc_dir_entry * proc_mckinley_root; |
| 8 | 7 | |
| 9 | −#endif /*__KERNEL__*/ | |
| 10 | 8 | #endif /*ASM_PARISC_MCKINLEY_H*/ |
| @@ -51,6 +51,8 @@ int pdc_spaceid_bits(unsigned long *space_bits); · 50 unmodified lines | ||
| 51 | 51 | int pdc_btlb_info(struct pdc_btlb_info *btlb); |
| 52 | 52 | int pdc_mem_map_hpa(struct pdc_memory_map *r_addr, struct pdc_module_path *mod_path); |
| 53 | 53 | #endif /* !CONFIG_PA20 */ |
| 54 | +int pdc_pim_toc11(struct pdc_toc_pim_11 *ret); | |
| 55 | +int pdc_pim_toc20(struct pdc_toc_pim_20 *ret); | |
| 54 | 56 | int pdc_lan_station_id(char *lan_addr, unsigned long net_hpa); |
| 55 | 57 | |
| 56 | 58 | int pdc_stable_read(unsigned long staddr, void *memaddr, unsigned long count); |
| @@ -12,6 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | #ifndef __ASSEMBLY__ |
| 13 | 13 | #include <linux/threads.h> |
| 14 | 14 | |
| 15 | +#include <asm/assembly.h> | |
| 15 | 16 | #include <asm/prefetch.h> |
| 16 | 17 | #include <asm/hardware.h> |
| 17 | 18 | #include <asm/pdc.h> |
| @@ -37,16 +38,12 @@ · 19 unmodified lines | ||
| 37 | 38 | #define DEFAULT_MAP_BASE DEFAULT_MAP_BASE32 |
| 38 | 39 | #endif |
| 39 | 40 | |
| 40 | −#ifdef __KERNEL__ | |
| 41 | − | |
| 42 | 41 | /* XXX: STACK_TOP actually should be STACK_BOTTOM for parisc. |
| 43 | 42 | * prumpf */ |
| 44 | 43 | |
| 45 | 44 | #define STACK_TOP TASK_SIZE |
| 46 | 45 | #define STACK_TOP_MAX DEFAULT_TASK_SIZE |
| 47 | 46 | |
| 48 | −#endif | |
| 49 | − | |
| 50 | 47 | #ifndef __ASSEMBLY__ |
| 51 | 48 | |
| 52 | 49 | unsigned 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 | 99 | #define CPU_HVERSION ((boot_cpu_data.hversion >> 4) & 0x0FFF) |
| 103 | 100 | |
| 104 | −#define ARCH_MIN_TASKALIGN 8 | |
| 105 | − | |
| 106 | 101 | struct thread_struct { |
| 107 | 102 | struct pt_regs regs; |
| 108 | 103 | unsigned long task_size; |
| @@ -294,6 +289,10 @@ extern int _parisc_requires_coherency; · 185 unmodified lines | ||
| 294 | 289 | |
| 295 | 290 | extern int running_on_qemu; |
| 296 | 291 | |
| 292 | +extern void toc_handler(void); | |
| 293 | +extern unsigned int toc_handler_size; | |
| 294 | +extern unsigned int toc_handler_csum; | |
| 295 | + | |
| 297 | 296 | #endif /* __ASSEMBLY__ */ |
| 298 | 297 | |
| 299 | 298 | #endif /* __ASM_PARISC_PROCESSOR_H */ |
| @@ -5,17 +5,17 @@ · 4 unmodified lines | ||
| 5 | 5 | #ifndef _PARISC_PTRACE_H |
| 6 | 6 | #define _PARISC_PTRACE_H |
| 7 | 7 | |
| 8 | +#include <asm/assembly.h> | |
| 8 | 9 | #include <uapi/asm/ptrace.h> |
| 9 | 10 | |
| 10 | − | |
| 11 | 11 | #define task_regs(task) ((struct pt_regs *) ((char *)(task) + TASK_REGS)) |
| 12 | 12 | |
| 13 | 13 | #define arch_has_single_step() 1 |
| 14 | 14 | #define arch_has_block_step() 1 |
| 15 | 15 | |
| 16 | 16 | /* XXX should we use iaoq[1] or iaoq[0] ? */ |
| 17 | −#define user_mode(regs) (((regs)->iaoq[0] & 3) ? 1 : 0) | |
| 18 | −#define user_space(regs) (((regs)->iasq[1] != 0) ? 1 : 0) | |
| 17 | +#define user_mode(regs) (((regs)->iaoq[0] & 3) != PRIV_KERNEL) | |
| 18 | +#define user_space(regs) ((regs)->iasq[1] != PRIV_KERNEL) | |
| 19 | 19 | #define instruction_pointer(regs) ((regs)->iaoq[0] & ~3) |
| 20 | 20 | #define user_stack_pointer(regs) ((regs)->gr[30]) |
| 21 | 21 | unsigned long profile_pc(struct pt_regs *); |
| @@ -1,7 +1,6 @@ | ||
| 1 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | 2 | #ifndef ASM_PARISC_RUNWAY_H |
| 3 | 3 | #define ASM_PARISC_RUNWAY_H |
| 4 | −#ifdef __KERNEL__ | |
| 5 | 4 | |
| 6 | 5 | /* declared in arch/parisc/kernel/setup.c */ |
| 7 | 6 | extern struct proc_dir_entry * proc_runway_root; |
| @@ -9,5 +8,4 @@ extern struct proc_dir_entry * proc_runway_root; · 1 unmodified line | ||
| 9 | 8 | #define RUNWAY_STATUS 0x10 |
| 10 | 9 | #define RUNWAY_DEBUG 0x40 |
| 11 | 10 | |
| 12 | −#endif /* __KERNEL__ */ | |
| 13 | 11 | #endif /* ASM_PARISC_RUNWAY_H */ |
| @@ -34,8 +34,23 @@ extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); · 33 unmodified lines | ||
| 34 | 34 | |
| 35 | 35 | #endif /* !ASSEMBLY */ |
| 36 | 36 | |
| 37 | −#define raw_smp_processor_id() (current_thread_info()->cpu) | |
| 38 | − | |
| 37 | +/* | |
| 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 | 54 | #else /* CONFIG_SMP */ |
| 40 | 55 | |
| 41 | 56 | static inline void smp_send_all_nop(void) { return; } |
| @@ -2,30 +2,21 @@ · 1 unmodified line | ||
| 2 | 2 | #ifndef _ASM_PARISC_THREAD_INFO_H |
| 3 | 3 | #define _ASM_PARISC_THREAD_INFO_H |
| 4 | 4 | |
| 5 | −#ifdef __KERNEL__ | |
| 6 | − | |
| 7 | 5 | #ifndef __ASSEMBLY__ |
| 8 | 6 | #include <asm/processor.h> |
| 9 | 7 | #include <asm/special_insns.h> |
| 10 | 8 | |
| 11 | 9 | struct thread_info { |
| 12 | − struct task_struct *task; /* main task structure */ | |
| 13 | 10 | unsigned long flags; /* thread_info flags (see TIF_*) */ |
| 14 | − __u32 cpu; /* current CPU */ | |
| 15 | 11 | int preempt_count; /* 0=premptable, <0=BUG; will also serve as bh-counter */ |
| 16 | 12 | }; |
| 17 | 13 | |
| 18 | 14 | #define INIT_THREAD_INFO(tsk) \ |
| 19 | 15 | { \ |
| 20 | − .task = &tsk, \ | |
| 21 | 16 | .flags = 0, \ |
| 22 | − .cpu = 0, \ | |
| 23 | 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 | 20 | #endif /* !__ASSEMBLY */ |
| 30 | 21 | |
| 31 | 22 | /* thread information allocation */ |
| @@ -57,6 +48,7 @@ struct thread_info { · 25 unmodified lines | ||
| 57 | 48 | #define TIF_BLOCKSTEP 10 /* branch stepping? */ |
| 58 | 49 | #define TIF_SECCOMP 11 /* secure computing */ |
| 59 | 50 | #define TIF_SYSCALL_TRACEPOINT 12 /* syscall tracepoint instrumentation */ |
| 51 | +#define TIF_NONBLOCK_WARNING 13 /* warned about wrong O_NONBLOCK usage */ | |
| 60 | 52 | |
| 61 | 53 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) |
| 62 | 54 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) |
| @@ -87,6 +79,4 @@ struct thread_info { · 24 unmodified lines | ||
| 87 | 79 | # define is_32bit_task() (1) |
| 88 | 80 | #endif |
| 89 | 81 | |
| 90 | −#endif /* __KERNEL__ */ | |
| 91 | − | |
| 92 | 82 | #endif /* _ASM_PARISC_THREAD_INFO_H */ |
| @@ -14,6 +14,7 @@ void parisc_terminate(char *msg, struct pt_regs *regs, · 13 unmodified lines | ||
| 14 | 14 | void die_if_kernel(char *str, struct pt_regs *regs, long err); |
| 15 | 15 | |
| 16 | 16 | /* mm/fault.c */ |
| 17 | +unsigned long parisc_acctyp(unsigned long code, unsigned int inst); | |
| 17 | 18 | const char *trap_name(unsigned long code); |
| 18 | 19 | void do_page_fault(struct pt_regs *regs, unsigned long code, |
| 19 | 20 | unsigned long address); |
| @@ -4,10 +4,8 @@ · 3 unmodified lines | ||
| 4 | 4 | |
| 5 | 5 | #include <asm-generic/unaligned.h> |
| 6 | 6 | |
| 7 | −#ifdef __KERNEL__ | |
| 8 | 7 | struct pt_regs; |
| 9 | 8 | void handle_unaligned(struct pt_regs *regs); |
| 10 | 9 | int check_unaligned(struct pt_regs *regs); |
| 11 | −#endif | |
| 12 | 10 | |
| 13 | 11 | #endif /* _ASM_PARISC_UNALIGNED_H */ |
| @@ -398,8 +398,10 @@ struct zeropage { · 397 unmodified lines | ||
| 398 | 398 | /* int (*vec_rendz)(void); */ |
| 399 | 399 | unsigned int vec_rendz; |
| 400 | 400 | int vec_pow_fail_flen; |
| 401 | − int vec_pad[10]; | |
| 402 | − | |
| 401 | + int vec_pad0[3]; | |
| 402 | + unsigned int vec_toc_hi; | |
| 403 | + int vec_pad1[6]; | |
| 404 | + | |
| 403 | 405 | /* [0x040] reserved processor dependent */ |
| 404 | 406 | int pad0[112]; |
| 405 | 407 | |
| @@ -689,6 +691,28 @@ struct pdc_hpmc_pim_20 { /* PDC_PIM */ · 283 unmodified lines | ||
| 689 | 691 | unsigned long long fr[32]; |
| 690 | 692 | }; |
| 691 | 693 | |
| 694 | +struct 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 | + | |
| 705 | +struct 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 | 716 | #endif /* !defined(__ASSEMBLY__) */ |
| 693 | 717 | |
| 694 | 718 | #endif /* _UAPI_PARISC_PDC_H */ |
| @@ -39,3 +39,4 @@ obj-$(CONFIG_KGDB) += kgdb.o · 38 unmodified lines | ||
| 39 | 39 | obj-$(CONFIG_KPROBES) += kprobes.o |
| 40 | 40 | obj-$(CONFIG_KEXEC_CORE) += kexec.o relocate_kernel.o |
| 41 | 41 | obj-$(CONFIG_KEXEC_FILE) += kexec_file.o |
| 42 | +obj-$(CONFIG_TOC) += toc.o toc_asm.o | |
| @@ -14,6 +14,8 @@ · 13 unmodified lines | ||
| 14 | 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 | 19 | #include <linux/types.h> |
| 18 | 20 | #include <linux/sched.h> |
| 19 | 21 | #include <linux/thread_info.h> |
| @@ -22,18 +24,12 @@ · 2 unmodified lines | ||
| 22 | 24 | #include <linux/kbuild.h> |
| 23 | 25 | #include <linux/pgtable.h> |
| 24 | 26 | |
| 27 | +#include <asm/assembly.h> | |
| 25 | 28 | #include <asm/ptrace.h> |
| 26 | 29 | #include <asm/processor.h> |
| 27 | 30 | #include <asm/pdc.h> |
| 28 | 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 | 33 | /* Add FRAME_SIZE to the size x and align it to y. All definitions |
| 38 | 34 | * that use align_frame will include space for a frame. |
| 39 | 35 | */ |
| @@ -41,13 +37,11 @@ · 1 unmodified line | ||
| 41 | 37 | |
| 42 | 38 | int main(void) |
| 43 | 39 | { |
| 44 | − DEFINE(TASK_THREAD_INFO, offsetof(struct task_struct, stack)); | |
| 45 | − DEFINE(TASK_FLAGS, offsetof(struct task_struct, flags)); | |
| 46 | − DEFINE(TASK_SIGPENDING, offsetof(struct task_struct, pending)); | |
| 47 | − DEFINE(TASK_PTRACE, offsetof(struct task_struct, ptrace)); | |
| 48 | − DEFINE(TASK_MM, offsetof(struct task_struct, mm)); | |
| 49 | − DEFINE(TASK_PERSONALITY, offsetof(struct task_struct, personality)); | |
| 50 | − DEFINE(TASK_PID, offsetof(struct task_struct, pid)); | |
| 40 | + DEFINE(TASK_TI_FLAGS, offsetof(struct task_struct, thread_info.flags)); | |
| 41 | + DEFINE(TASK_STACK, offsetof(struct task_struct, stack)); | |
| 42 | +#ifdef CONFIG_SMP | |
| 43 | + DEFINE(TASK_CPU, offsetof(struct task_struct, cpu)); | |
| 44 | +#endif | |
| 51 | 45 | BLANK(); |
| 52 | 46 | DEFINE(TASK_REGS, offsetof(struct task_struct, thread.regs)); |
| 53 | 47 | DEFINE(TASK_PT_PSW, offsetof(struct task_struct, thread.regs.gr[ 0])); |
| @@ -135,10 +129,6 @@ int main(void) · 81 unmodified lines | ||
| 135 | 129 | DEFINE(TASK_PT_ISR, offsetof(struct task_struct, thread.regs.isr)); |
| 136 | 130 | DEFINE(TASK_PT_IOR, offsetof(struct task_struct, thread.regs.ior)); |
| 137 | 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 | 132 | DEFINE(PT_PSW, offsetof(struct pt_regs, gr[ 0])); |
| 143 | 133 | DEFINE(PT_GR1, offsetof(struct pt_regs, gr[ 1])); |
| 144 | 134 | DEFINE(PT_GR2, offsetof(struct pt_regs, gr[ 2])); |
| @@ -223,17 +213,11 @@ int main(void) · 78 unmodified lines | ||
| 223 | 213 | DEFINE(PT_IIR, offsetof(struct pt_regs, iir)); |
| 224 | 214 | DEFINE(PT_ISR, offsetof(struct pt_regs, isr)); |
| 225 | 215 | DEFINE(PT_IOR, offsetof(struct pt_regs, ior)); |
| 226 | − DEFINE(PT_SIZE, sizeof(struct pt_regs)); | |
| 227 | 216 | /* PT_SZ_ALGN includes space for a stack frame. */ |
| 228 | 217 | DEFINE(PT_SZ_ALGN, align_frame(sizeof(struct pt_regs), FRAME_ALIGN)); |
| 229 | 218 | BLANK(); |
| 230 | − DEFINE(TI_TASK, offsetof(struct thread_info, task)); | |
| 231 | 219 | DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); |
| 232 | − DEFINE(TI_CPU, offsetof(struct thread_info, cpu)); | |
| 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)); | |
| 220 | + DEFINE(TI_PRE_COUNT, offsetof(struct task_struct, thread_info.preempt_count)); | |
| 237 | 221 | BLANK(); |
| 238 | 222 | DEFINE(ICACHE_BASE, offsetof(struct pdc_cache_info, ic_base)); |
| 239 | 223 | DEFINE(ICACHE_STRIDE, offsetof(struct pdc_cache_info, ic_stride)); |
| @@ -543,10 +543,33 @@ static inline pte_t *get_ptep(pgd_t *pgd, unsigned long addr) · 542 unmodified lines | ||
| 543 | 543 | return ptep; |
| 544 | 544 | } |
| 545 | 545 | |
| 546 | +static 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 | + | |
| 561 | +static 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 | + | |
| 546 | 570 | void flush_cache_mm(struct mm_struct *mm) |
| 547 | 571 | { |
| 548 | 572 | struct vm_area_struct *vma; |
| 549 | − pgd_t *pgd; | |
| 550 | 573 | |
| 551 | 574 | /* Flushing the whole cache on each cpu takes forever on |
| 552 | 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 | 581 | return; |
| 559 | 582 | } |
| 560 | 583 | |
| 584 | + preempt_disable(); | |
| 561 | 585 | if (mm->context == mfsp(3)) { |
| 562 | − for (vma = mm->mmap; vma; vma = vma->vm_next) { | |
| 563 | − flush_user_dcache_range_asm(vma->vm_start, vma->vm_end); | |
| 564 | − if (vma->vm_flags & VM_EXEC) | |
| 565 | − flush_user_icache_range_asm(vma->vm_start, vma->vm_end); | |
| 566 | − flush_tlb_range(vma, vma->vm_start, vma->vm_end); | |
| 567 | − } | |
| 586 | + for (vma = mm->mmap; vma; vma = vma->vm_next) | |
| 587 | + flush_user_cache_tlb(vma, vma->vm_start, vma->vm_end); | |
| 588 | + preempt_enable(); | |
| 568 | 589 | return; |
| 569 | 590 | } |
| 570 | 591 | |
| 571 | − pgd = mm->pgd; | |
| 572 | − for (vma = mm->mmap; vma; vma = vma->vm_next) { | |
| 573 | − unsigned long addr; | |
| 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 | + for (vma = mm->mmap; vma; vma = vma->vm_next) | |
| 593 | + flush_cache_pages(vma, mm, vma->vm_start, vma->vm_end); | |
| 594 | + preempt_enable(); | |
| 592 | 595 | } |
| 593 | 596 | |
| 594 | 597 | void flush_cache_range(struct vm_area_struct *vma, |
| 595 | 598 | unsigned long start, unsigned long end) |
| 596 | 599 | { |
| 597 | − pgd_t *pgd; | |
| 598 | − unsigned long addr; | |
| 599 | − | |
| 600 | 600 | if ((!IS_ENABLED(CONFIG_SMP) || !arch_irqs_disabled()) && |
| 601 | 601 | end - start >= parisc_cache_flush_threshold) { |
| 602 | 602 | if (vma->vm_mm->context) |
| @@ -605,30 +605,15 @@ void flush_cache_range(struct vm_area_struct *vma, · 2 unmodified lines | ||
| 605 | 605 | return; |
| 606 | 606 | } |
| 607 | 607 | |
| 608 | + preempt_disable(); | |
| 608 | 609 | if (vma->vm_mm->context == mfsp(3)) { |
| 609 | − flush_user_dcache_range_asm(start, end); | |
| 610 | − if (vma->vm_flags & VM_EXEC) | |
| 611 | − flush_user_icache_range_asm(start, end); | |
| 612 | − flush_tlb_range(vma, start, end); | |
| 610 | + flush_user_cache_tlb(vma, start, end); | |
| 611 | + preempt_enable(); | |
| 613 | 612 | return; |
| 614 | 613 | } |
| 615 | 614 | |
| 616 | − pgd = vma->vm_mm->pgd; | |
| 617 | − for (addr = vma->vm_start; addr < vma->vm_end; addr += PAGE_SIZE) { | |
| 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 | − } | |
| 615 | + flush_cache_pages(vma, vma->vm_mm, vma->vm_start, vma->vm_end); | |
| 616 | + preempt_enable(); | |
| 632 | 617 | } |
| 633 | 618 | |
| 634 | 619 | void |
| @@ -51,30 +51,6 @@ · 50 unmodified lines | ||
| 51 | 51 | extrd,u \spc,(64 - (SPACEID_SHIFT)),32,\prot |
| 52 | 52 | .endm |
| 53 | 53 | #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 | |
| 75 | −4: | |
| 76 | − .endm | |
| 77 | − | |
| 78 | 54 | /* |
| 79 | 55 | * The "get_stack" macros are responsible for determining the |
| 80 | 56 | * kernel stack value. |
| @@ -87,8 +63,8 @@ · 6 unmodified lines | ||
| 87 | 63 | * Need to set up a kernel stack, so call the |
| 88 | 64 | * get_stack_use_cr30 macro to set up a pointer |
| 89 | 65 | * to the pt_regs structure contained within the |
| 90 | − * task pointer pointed to by cr30. Set the stack | |
| 91 | − * pointer to point to the end of the task structure. | |
| 66 | + * task pointer pointed to by cr30. Load the stack | |
| 67 | + * pointer from the task structure. | |
| 92 | 68 | * |
| 93 | 69 | * Note that we use shadowed registers for temps until |
| 94 | 70 | * we can save %r26 and %r29. %r26 is used to preserve |
| @@ -100,8 +76,6 @@ · 5 unmodified lines | ||
| 100 | 76 | * or handle_interruption. %r29 is used to hold a pointer |
| 101 | 77 | * the register save area, and once again, it needs to |
| 102 | 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 | 81 | .macro get_stack_use_cr30 |
| @@ -110,12 +84,11 @@ · 2 unmodified lines | ||
| 110 | 84 | |
| 111 | 85 | copy %r30, %r17 |
| 112 | 86 | mfctl %cr30, %r1 |
| 113 | − ldo THREAD_SZ_ALGN(%r1), %r30 | |
| 114 | − mtsp %r0,%sr7 | |
| 87 | + tophys %r1,%r9 /* task_struct */ | |
| 88 | + LDREG TASK_STACK(%r9),%r30 | |
| 89 | + ldo PT_SZ_ALGN(%r30),%r30 | |
| 90 | + mtsp %r0,%sr7 /* clear sr7 after kernel stack was set! */ | |
| 115 | 91 | mtsp %r16,%sr3 |
| 116 | − tophys %r1,%r9 | |
| 117 | − LDREG TI_TASK(%r9), %r1 /* thread_info -> task_struct */ | |
| 118 | − tophys %r1,%r9 | |
| 119 | 92 | ldo TASK_REGS(%r9),%r9 |
| 120 | 93 | STREG %r17,PT_GR30(%r9) |
| 121 | 94 | STREG %r29,PT_GR29(%r9) |
| @@ -757,7 +730,7 @@ ENTRY(ret_from_kernel_thread) · 635 unmodified lines | ||
| 757 | 730 | BL schedule_tail, %r2 |
| 758 | 731 | nop |
| 759 | 732 | |
| 760 | − LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30), %r1 | |
| 733 | + mfctl %cr30,%r1 /* task_struct */ | |
| 761 | 734 | LDREG TASK_PT_GR25(%r1), %r26 |
| 762 | 735 | #ifdef CONFIG_64BIT |
| 763 | 736 | LDREG TASK_PT_GR27(%r1), %r27 |
| @@ -788,7 +761,6 @@ ENTRY_CFI(_switch_to) · 24 unmodified lines | ||
| 788 | 761 | |
| 789 | 762 | STREG %r30, TASK_PT_KSP(%r26) |
| 790 | 763 | LDREG TASK_PT_KSP(%r25), %r30 |
| 791 | − LDREG TASK_THREAD_INFO(%r25), %r25 | |
| 792 | 764 | bv %r0(%r2) |
| 793 | 765 | mtctl %r25,%cr30 |
| 794 | 766 | |
| @@ -819,17 +791,16 @@ ENDPROC_CFI(_switch_to) · 24 unmodified lines | ||
| 819 | 791 | .align PAGE_SIZE |
| 820 | 792 | |
| 821 | 793 | ENTRY_CFI(syscall_exit_rfi) |
| 822 | − mfctl %cr30,%r16 | |
| 823 | − LDREG TI_TASK(%r16), %r16 /* thread_info -> task_struct */ | |
| 794 | + mfctl %cr30,%r16 /* task_struct */ | |
| 824 | 795 | ldo TASK_REGS(%r16),%r16 |
| 825 | 796 | /* Force iaoq to userspace, as the user has had access to our current |
| 826 | 797 | * context via sigcontext. Also Filter the PSW for the same reason. |
| 827 | 798 | */ |
| 828 | 799 | LDREG PT_IAOQ0(%r16),%r19 |
| 829 | − depi 3,31,2,%r19 | |
| 800 | + depi PRIV_USER,31,2,%r19 | |
| 830 | 801 | STREG %r19,PT_IAOQ0(%r16) |
| 831 | 802 | LDREG PT_IAOQ1(%r16),%r19 |
| 832 | − depi 3,31,2,%r19 | |
| 803 | + depi PRIV_USER,31,2,%r19 | |
| 833 | 804 | STREG %r19,PT_IAOQ1(%r16) |
| 834 | 805 | LDREG PT_PSW(%r16),%r19 |
| 835 | 806 | load32 USER_PSW_MASK,%r1 |
| @@ -865,14 +836,14 @@ ENTRY_CFI(syscall_exit_rfi) · 29 unmodified lines | ||
| 865 | 836 | ENTRY(intr_return) |
| 866 | 837 | /* check for reschedule */ |
| 867 | 838 | 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 | 840 | bb,<,n %r19,31-TIF_NEED_RESCHED,intr_do_resched /* forward */ |
| 870 | 841 | |
| 871 | 842 | .import do_notify_resume,code |
| 872 | 843 | intr_check_sig: |
| 873 | 844 | /* As above */ |
| 874 | 845 | mfctl %cr30,%r1 |
| 875 | − LDREG TI_FLAGS(%r1),%r19 | |
| 846 | + LDREG TASK_TI_FLAGS(%r1),%r19 | |
| 876 | 847 | ldi (_TIF_USER_WORK_MASK & ~_TIF_NEED_RESCHED), %r20 |
| 877 | 848 | and,COND(<>) %r19, %r20, %r0 |
| 878 | 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 | 946 | /* current_thread_info()->preempt_count */ |
| 976 | 947 | mfctl %cr30, %r1 |
| 977 | − LDREG TI_PRE_COUNT(%r1), %r19 | |
| 978 | − cmpib,COND(<>) 0, %r19, intr_restore /* if preempt_count > 0 */ | |
| 948 | + ldw TI_PRE_COUNT(%r1), %r19 | |
| 949 | + cmpib,<> 0, %r19, intr_restore /* if preempt_count > 0 */ | |
| 979 | 950 | nop /* prev insn branched backwards */ |
| 980 | 951 | |
| 981 | 952 | /* check if we interrupted a critical path */ |
| @@ -1716,7 +1687,7 @@ dtlb_fault: · 734 unmodified lines | ||
| 1716 | 1687 | |
| 1717 | 1688 | .macro fork_like name |
| 1718 | 1689 | ENTRY_CFI(sys_\name\()_wrapper) |
| 1719 | − LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30), %r1 | |
| 1690 | + mfctl %cr30,%r1 | |
| 1720 | 1691 | ldo TASK_REGS(%r1),%r1 |
| 1721 | 1692 | reg_save %r1 |
| 1722 | 1693 | mfctl %cr27, %r28 |
| @@ -1736,7 +1707,7 @@ ENTRY(child_return) · 13 unmodified lines | ||
| 1736 | 1707 | BL schedule_tail, %r2 |
| 1737 | 1708 | nop |
| 1738 | 1709 | finish_child_return: |
| 1739 | − LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30), %r1 | |
| 1710 | + mfctl %cr30,%r1 | |
| 1740 | 1711 | ldo TASK_REGS(%r1),%r1 /* get pt regs */ |
| 1741 | 1712 | |
| 1742 | 1713 | LDREG PT_CR27(%r1), %r3 |
| @@ -1747,7 +1718,7 @@ finish_child_return: · 4 unmodified lines | ||
| 1747 | 1718 | END(child_return) |
| 1748 | 1719 | |
| 1749 | 1720 | ENTRY_CFI(sys_rt_sigreturn_wrapper) |
| 1750 | − LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r26 | |
| 1721 | + mfctl %cr30,%r26 | |
| 1751 | 1722 | ldo TASK_REGS(%r26),%r26 /* get pt regs */ |
| 1752 | 1723 | /* Don't save regs, we are going to restore them from sigcontext. */ |
| 1753 | 1724 | STREG %r2, -RP_OFFSET(%r30) |
| @@ -1764,7 +1735,7 @@ ENTRY_CFI(sys_rt_sigreturn_wrapper) · 10 unmodified lines | ||
| 1764 | 1735 | LDREG -RP_OFFSET(%r30), %r2 |
| 1765 | 1736 | |
| 1766 | 1737 | /* FIXME: I think we need to restore a few more things here. */ |
| 1767 | − LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 | |
| 1738 | + mfctl %cr30,%r1 | |
| 1768 | 1739 | ldo TASK_REGS(%r1),%r1 /* get pt regs */ |
| 1769 | 1740 | reg_restore %r1 |
| 1770 | 1741 | |
| @@ -1783,9 +1754,7 @@ ENTRY(syscall_exit) · 12 unmodified lines | ||
| 1783 | 1754 | */ |
| 1784 | 1755 | |
| 1785 | 1756 | /* save return value now */ |
| 1786 | − | |
| 1787 | 1757 | mfctl %cr30, %r1 |
| 1788 | − LDREG TI_TASK(%r1),%r1 | |
| 1789 | 1758 | STREG %r28,TASK_PT_GR28(%r1) |
| 1790 | 1759 | |
| 1791 | 1760 | /* Seems to me that dp could be wrong here, if the syscall involved |
| @@ -1796,13 +1765,14 @@ ENTRY(syscall_exit) · 4 unmodified lines | ||
| 1796 | 1765 | syscall_check_resched: |
| 1797 | 1766 | |
| 1798 | 1767 | /* check for reschedule */ |
| 1799 | − | |
| 1800 | − LDREG TI_FLAGS-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r19 /* long */ | |
| 1768 | + mfctl %cr30,%r19 | |
| 1769 | + LDREG TASK_TI_FLAGS(%r19),%r19 /* long */ | |
| 1801 | 1770 | bb,<,n %r19, 31-TIF_NEED_RESCHED, syscall_do_resched /* forward */ |
| 1802 | 1771 | |
| 1803 | 1772 | .import do_signal,code |
| 1804 | 1773 | syscall_check_sig: |
| 1805 | − LDREG TI_FLAGS-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r19 | |
| 1774 | + mfctl %cr30,%r19 | |
| 1775 | + LDREG TASK_TI_FLAGS(%r19),%r19 | |
| 1806 | 1776 | ldi (_TIF_USER_WORK_MASK & ~_TIF_NEED_RESCHED), %r26 |
| 1807 | 1777 | and,COND(<>) %r19, %r26, %r0 |
| 1808 | 1778 | b,n syscall_restore /* skip past if we've nothing to do */ |
| @@ -1813,7 +1783,7 @@ syscall_do_signal: · 4 unmodified lines | ||
| 1813 | 1783 | * consistent with all the relevant state of the process |
| 1814 | 1784 | * before the syscall. We need to verify this. |
| 1815 | 1785 | */ |
| 1816 | − LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 | |
| 1786 | + mfctl %cr30,%r1 | |
| 1817 | 1787 | ldo TASK_REGS(%r1), %r26 /* struct pt_regs *regs */ |
| 1818 | 1788 | reg_save %r26 |
| 1819 | 1789 | |
| @@ -1824,17 +1794,17 @@ syscall_do_signal: · 4 unmodified lines | ||
| 1824 | 1794 | BL do_notify_resume,%r2 |
| 1825 | 1795 | ldi 1, %r25 /* long in_syscall = 1 */ |
| 1826 | 1796 | |
| 1827 | − LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 | |
| 1797 | + mfctl %cr30,%r1 | |
| 1828 | 1798 | ldo TASK_REGS(%r1), %r20 /* reload pt_regs */ |
| 1829 | 1799 | reg_restore %r20 |
| 1830 | 1800 | |
| 1831 | 1801 | b,n syscall_check_sig |
| 1832 | 1802 | |
| 1833 | 1803 | syscall_restore: |
| 1834 | − LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 | |
| 1804 | + mfctl %cr30,%r1 | |
| 1835 | 1805 | |
| 1836 | 1806 | /* Are we being ptraced? */ |
| 1837 | − ldw TASK_FLAGS(%r1),%r19 | |
| 1807 | + LDREG TASK_TI_FLAGS(%r1),%r19 | |
| 1838 | 1808 | ldi _TIF_SYSCALL_TRACE_MASK,%r2 |
| 1839 | 1809 | and,COND(=) %r19,%r2,%r0 |
| 1840 | 1810 | b,n syscall_restore_rfi |
| @@ -1873,7 +1843,7 @@ syscall_restore: · 32 unmodified lines | ||
| 1873 | 1843 | mtsp %r1,%sr5 /* Restore sr5 */ |
| 1874 | 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 | 1848 | #ifdef CONFIG_64BIT |
| 1879 | 1849 | /* decide whether to reset the wide mode bit |
| @@ -1949,7 +1919,7 @@ syscall_restore_rfi: · 69 unmodified lines | ||
| 1949 | 1919 | STREG %r0,TASK_PT_SR2(%r1) |
| 1950 | 1920 | |
| 1951 | 1921 | 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 | 1923 | STREG %r2,TASK_PT_IAOQ0(%r1) |
| 1954 | 1924 | ldo 4(%r2),%r2 |
| 1955 | 1925 | STREG %r2,TASK_PT_IAOQ1(%r1) |
| @@ -1958,10 +1928,10 @@ syscall_restore_rfi: · 2 unmodified lines | ||
| 1958 | 1928 | |
| 1959 | 1929 | pt_regs_ok: |
| 1960 | 1930 | 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 | 1932 | STREG %r2,TASK_PT_IAOQ0(%r1) |
| 1963 | 1933 | LDREG TASK_PT_IAOQ1(%r1),%r2 |
| 1964 | − depi 3,31,2,%r2 | |
| 1934 | + depi PRIV_USER,31,2,%r2 | |
| 1965 | 1935 | STREG %r2,TASK_PT_IAOQ1(%r1) |
| 1966 | 1936 | b intr_restore |
| 1967 | 1937 | copy %r25,%r16 |
| @@ -1061,6 +1061,38 @@ int pdc_mem_pdt_read_entries(struct pdc_mem_read_pdt *pret, · 1060 unmodified lines | ||
| 1061 | 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 | + */ | |
| 1068 | +int 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 | + */ | |
| 1084 | +int 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 | 1097 | * pdc_tod_set - Set the Time-Of-Day clock. |
| 1066 | 1098 | * @sec: The number of seconds since epoch. |
| @@ -15,6 +15,7 @@ · 14 unmodified lines | ||
| 15 | 15 | #include <linux/uaccess.h> |
| 16 | 16 | #include <linux/kprobes.h> |
| 17 | 17 | #include <linux/ptrace.h> |
| 18 | +#include <linux/jump_label.h> | |
| 18 | 19 | |
| 19 | 20 | #include <asm/assembly.h> |
| 20 | 21 | #include <asm/sections.h> |
| @@ -24,6 +25,8 @@ · 3 unmodified lines | ||
| 24 | 25 | #define __hot __section(".text.hot") |
| 25 | 26 | |
| 26 | 27 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
| 28 | +static DEFINE_STATIC_KEY_FALSE(ftrace_graph_enable); | |
| 29 | + | |
| 27 | 30 | /* |
| 28 | 31 | * Hook the return address and push it in the stack of return addrs |
| 29 | 32 | * in current thread info. |
| @@ -48,25 +51,19 @@ static void __hot prepare_ftrace_return(unsigned long *parent, · 18 unmodified lines | ||
| 48 | 51 | } |
| 49 | 52 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ |
| 50 | 53 | |
| 54 | +static ftrace_func_t ftrace_func; | |
| 55 | + | |
| 51 | 56 | void notrace __hot ftrace_function_trampoline(unsigned long parent, |
| 52 | 57 | unsigned long self_addr, |
| 53 | 58 | unsigned long org_sp_gr3, |
| 54 | 59 | struct ftrace_regs *fregs) |
| 55 | 60 | { |
| 56 | −#ifndef CONFIG_DYNAMIC_FTRACE | |
| 57 | − extern ftrace_func_t ftrace_trace_function; | |
| 58 | −#endif | |
| 59 | 61 | extern struct ftrace_ops *function_trace_op; |
| 60 | 62 | |
| 61 | − if (function_trace_op->flags & FTRACE_OPS_FL_ENABLED && | |
| 62 | − ftrace_trace_function != ftrace_stub) | |
| 63 | − ftrace_trace_function(self_addr, parent, | |
| 64 | − function_trace_op, fregs); | |
| 63 | + ftrace_func(self_addr, parent, function_trace_op, fregs); | |
| 65 | 64 | |
| 66 | 65 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
| 67 | − if (dereference_function_descriptor(ftrace_graph_return) != | |
| 68 | − dereference_function_descriptor(ftrace_stub) || | |
| 69 | − ftrace_graph_entry != ftrace_graph_entry_stub) { | |
| 66 | + if (static_branch_unlikely(&ftrace_graph_enable)) { | |
| 70 | 67 | unsigned long *parent_rp; |
| 71 | 68 | |
| 72 | 69 | /* calculate pointer to %rp in stack */ |
| @@ -84,11 +81,13 @@ void notrace __hot ftrace_function_trampoline(unsigned long parent, · 11 unmodified lines | ||
| 84 | 81 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
| 85 | 82 | int ftrace_enable_ftrace_graph_caller(void) |
| 86 | 83 | { |
| 84 | + static_key_enable(&ftrace_graph_enable.key); | |
| 87 | 85 | return 0; |
| 88 | 86 | } |
| 89 | 87 | |
| 90 | 88 | int ftrace_disable_ftrace_graph_caller(void) |
| 91 | 89 | { |
| 90 | + static_key_enable(&ftrace_graph_enable.key); | |
| 92 | 91 | return 0; |
| 93 | 92 | } |
| 94 | 93 | #endif |
| @@ -99,8 +98,10 @@ int __init ftrace_dyn_arch_init(void) · 4 unmodified lines | ||
| 99 | 98 | { |
| 100 | 99 | return 0; |
| 101 | 100 | } |
| 101 | + | |
| 102 | 102 | int ftrace_update_ftrace_func(ftrace_func_t func) |
| 103 | 103 | { |
| 104 | + ftrace_func = func; | |
| 104 | 105 | return 0; |
| 105 | 106 | } |
| 106 | 107 | |
| @@ -35,7 +35,8 @@ END(boot_args) · 34 unmodified lines | ||
| 35 | 35 | __HEAD |
| 36 | 36 | |
| 37 | 37 | .align 4 |
| 38 | − .import init_thread_union,data | |
| 38 | + .import init_task,data | |
| 39 | + .import init_stack,data | |
| 39 | 40 | .import fault_vector_20,code /* IVA parisc 2.0 32 bit */ |
| 40 | 41 | #ifndef CONFIG_64BIT |
| 41 | 42 | .import fault_vector_11,code /* IVA parisc 1.1 32 bit */ |
| @@ -123,12 +124,12 @@ $pgt_fill_loop: · 81 unmodified lines | ||
| 123 | 124 | load32 start_parisc,%r11 |
| 124 | 125 | |
| 125 | 126 | /* And the initial task pointer */ |
| 126 | − load32 init_thread_union,%r6 | |
| 127 | + load32 init_task,%r6 | |
| 127 | 128 | mtctl %r6,%cr30 |
| 128 | 129 | |
| 129 | 130 | /* And the stack pointer too */ |
| 130 | − ldo THREAD_SZ_ALGN(%r6),%sp | |
| 131 | − | |
| 131 | + load32 init_stack,%sp | |
| 132 | + tophys_r1 %sp | |
| 132 | 133 | #if defined(CONFIG_64BIT) && defined(CONFIG_FUNCTION_TRACER) |
| 133 | 134 | .import _mcount,data |
| 134 | 135 | /* initialize mcount FPTR */ |
| @@ -186,12 +187,11 @@ common_stext: · 51 unmodified lines | ||
| 186 | 187 | #endif /*CONFIG_SMP*/ |
| 187 | 188 | |
| 188 | 189 | #ifdef CONFIG_64BIT |
| 189 | − tophys_r1 %sp | |
| 190 | + mfctl %cr30,%r6 /* PCX-W2 firmware bug */ | |
| 191 | + tophys_r1 %r6 | |
| 190 | 192 | |
| 191 | 193 | /* Save the rfi target address */ |
| 192 | − ldd TI_TASK-THREAD_SZ_ALGN(%sp), %r10 | |
| 193 | − tophys_r1 %r10 | |
| 194 | − std %r11, TASK_PT_GR11(%r10) | |
| 194 | + STREG %r11, TASK_PT_GR11(%r6) | |
| 195 | 195 | /* Switch to wide mode Superdome doesn't support narrow PDC |
| 196 | 196 | ** calls. |
| 197 | 197 | */ |
| @@ -206,7 +206,6 @@ common_stext: · 8 unmodified lines | ||
| 206 | 206 | ** Someday, palo might not do this for the Monarch either. |
| 207 | 207 | */ |
| 208 | 208 | 2: |
| 209 | − mfctl %cr30,%r6 /* PCX-W2 firmware bug */ | |
| 210 | 209 | |
| 211 | 210 | ldo PDC_PSW(%r0),%arg0 /* 21 */ |
| 212 | 211 | ldo PDC_PSW_SET_DEFAULTS(%r0),%arg1 /* 2 */ |
| @@ -216,13 +215,9 @@ common_stext: · 3 unmodified lines | ||
| 216 | 215 | copy %r0,%arg3 |
| 217 | 216 | |
| 218 | 217 | stext_pdc_ret: |
| 218 | + LDREG TASK_PT_GR11(%r6), %r11 | |
| 219 | + tovirt_r1 %r6 | |
| 219 | 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 | 221 | #endif |
| 227 | 222 | |
| 228 | 223 | /* PARANOID: clear user scratch/user space SR's */ |
| @@ -287,7 +282,9 @@ aligned_rfi: · 58 unmodified lines | ||
| 287 | 282 | |
| 288 | 283 | load32 KERNEL_PSW,%r10 |
| 289 | 284 | mtctl %r10,%ipsw |
| 290 | − | |
| 285 | + | |
| 286 | + tovirt_r1 %sp | |
| 287 | + | |
| 291 | 288 | /* Jump through hyperspace to Virt Mode */ |
| 292 | 289 | rfi |
| 293 | 290 | nop |
| @@ -343,12 +340,13 @@ smp_slave_stext: · 49 unmodified lines | ||
| 343 | 340 | #endif |
| 344 | 341 | |
| 345 | 342 | /* Initialize the SP - monarch sets up smp_init_current_idle_task */ |
| 346 | − load32 PA(smp_init_current_idle_task),%sp | |
| 347 | − LDREG 0(%sp),%sp /* load task address */ | |
| 343 | + load32 PA(smp_init_current_idle_task),%r6 | |
| 344 | + LDREG 0(%r6),%r6 | |
| 345 | + mtctl %r6,%cr30 | |
| 346 | + tophys_r1 %r6 | |
| 347 | + LDREG TASK_STACK(%r6),%sp | |
| 348 | 348 | tophys_r1 %sp |
| 349 | − LDREG TASK_THREAD_INFO(%sp),%sp | |
| 350 | − mtctl %sp,%cr30 /* store in cr30 */ | |
| 351 | − ldo THREAD_SZ_ALGN(%sp),%sp | |
| 349 | + ldo FRAME_SIZE(%sp),%sp | |
| 352 | 350 | |
| 353 | 351 | /* point CPU to kernel page tables */ |
| 354 | 352 | load32 PA(swapper_pg_dir),%r4 |
| @@ -15,6 +15,7 @@ · 14 unmodified lines | ||
| 15 | 15 | #include <linux/kernel_stat.h> |
| 16 | 16 | #include <linux/seq_file.h> |
| 17 | 17 | #include <linux/types.h> |
| 18 | +#include <linux/sched/task_stack.h> | |
| 18 | 19 | #include <asm/io.h> |
| 19 | 20 | |
| 20 | 21 | #include <asm/softirq_stack.h> |
| @@ -399,8 +400,7 @@ static inline void stack_overflow_check(struct pt_regs *regs) · 378 unmodified lines | ||
| 399 | 400 | #ifdef CONFIG_DEBUG_STACKOVERFLOW |
| 400 | 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) current_thread_info(); | |
| 403 | + unsigned long stack_start = (unsigned long) task_stack_page(current); | |
| 404 | 404 | unsigned long sp = regs->gr[30]; |
| 405 | 405 | unsigned long stack_usage; |
| 406 | 406 | unsigned int *last_usage; |
| @@ -476,7 +476,7 @@ static void execute_on_irq_stack(void *func, unsigned long param1) · 69 unmodified lines | ||
| 476 | 476 | union_ptr = &per_cpu(irq_stack_union, smp_processor_id()); |
| 477 | 477 | irq_stack = (unsigned long) &union_ptr->stack; |
| 478 | 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 | 481 | /* We may be called recursive. If we are already using the irq stack, |
| 482 | 482 | * just continue to use it. Use spinlocks to serialize |
| @@ -352,12 +352,10 @@ static int __init pdt_initcall(void) · 351 unmodified lines | ||
| 352 | 352 | if (pdt_type == PDT_NONE) |
| 353 | 353 | return -ENODEV; |
| 354 | 354 | |
| 355 | − kpdtd_task = kthread_create(pdt_mainloop, NULL, "kpdtd"); | |
| 355 | + kpdtd_task = kthread_run(pdt_mainloop, NULL, "kpdtd"); | |
| 356 | 356 | if (IS_ERR(kpdtd_task)) |
| 357 | 357 | return PTR_ERR(kpdtd_task); |
| 358 | 358 | |
| 359 | − wake_up_process(kpdtd_task); | |
| 360 | − | |
| 361 | 359 | return 0; |
| 362 | 360 | } |
| 363 | 361 | |
| @@ -205,7 +205,7 @@ copy_thread(unsigned long clone_flags, unsigned long usp, · 204 unmodified lines | ||
| 205 | 205 | /* Must exit via ret_from_kernel_thread in order |
| 206 | 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 | 209 | cregs->kpc = (unsigned long) &ret_from_kernel_thread; |
| 210 | 210 | /* |
| 211 | 211 | * 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 | 228 | if (likely(usp)) |
| 229 | 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 | 232 | cregs->kpc = (unsigned long) &child_return; |
| 233 | 233 | |
| 234 | 234 | /* Setup thread TLS area */ |
| @@ -29,6 +29,7 @@ · 28 unmodified lines | ||
| 29 | 29 | #include <linux/bitops.h> |
| 30 | 30 | #include <linux/ftrace.h> |
| 31 | 31 | #include <linux/cpu.h> |
| 32 | +#include <linux/kgdb.h> | |
| 32 | 33 | |
| 33 | 34 | #include <linux/atomic.h> |
| 34 | 35 | #include <asm/current.h> |
| @@ -69,7 +70,10 @@ enum ipi_message_type { · 34 unmodified lines | ||
| 69 | 70 | IPI_CALL_FUNC, |
| 70 | 71 | IPI_CPU_START, |
| 71 | 72 | IPI_CPU_STOP, |
| 72 | − IPI_CPU_TEST | |
| 73 | + 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 | 171 | case IPI_CPU_TEST: |
| 168 | 172 | smp_debug(100, KERN_DEBUG "CPU%d is alive!\n", this_cpu); |
| 169 | 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 | 180 | default: |
| 172 | 181 | printk(KERN_CRIT "Unknown IPI num on CPU%d: %lu\n", |
| 173 | 182 | this_cpu, which); |
| @@ -219,13 +228,21 @@ static inline void · 45 unmodified lines | ||
| 219 | 228 | send_IPI_allbutself(enum ipi_message_type op) |
| 220 | 229 | { |
| 221 | 230 | int i; |
| 222 | − | |
| 231 | + | |
| 232 | + preempt_disable(); | |
| 223 | 233 | for_each_online_cpu(i) { |
| 224 | 234 | if (i != smp_processor_id()) |
| 225 | 235 | send_IPI_single(i, op); |
| 226 | 236 | } |
| 237 | + preempt_enable(); | |
| 227 | 238 | } |
| 228 | 239 | |
| 240 | +#ifdef CONFIG_KGDB | |
| 241 | +void kgdb_roundup_cpus(void) | |
| 242 | +{ | |
| 243 | + send_IPI_allbutself(IPI_ENTER_KGDB); | |
| 244 | +} | |
| 245 | +#endif | |
| 229 | 246 | |
| 230 | 247 | inline void |
| 231 | 248 | smp_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 | 339 | const struct cpuinfo_parisc *p = &per_cpu(cpu_data, cpuid); |
| 323 | 340 | long timeout; |
| 324 | 341 | |
| 325 | − task_thread_info(idle)->cpu = cpuid; | |
| 342 | + idle->cpu = cpuid; | |
| 326 | 343 | |
| 327 | 344 | /* Let _start know what logical CPU we're booting |
| 328 | 345 | ** (offset into init_tasks[],cpu_data[]) |
| @@ -2,45 +2,41 @@ · 1 unmodified line | ||
| 2 | 2 | /* |
| 3 | 3 | * 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 | 6 | * based on arch/x86/kernel/stacktrace.c by Ingo Molnar <mingo@redhat.com> |
| 7 | 7 | * and parisc unwind functions by Randolph Chung <tausq@debian.org> |
| 8 | 8 | * |
| 9 | 9 | * TODO: Userspace stacktrace (CONFIG_USER_STACKTRACE_SUPPORT) |
| 10 | 10 | */ |
| 11 | −#include <linux/module.h> | |
| 12 | 11 | #include <linux/stacktrace.h> |
| 13 | 12 | |
| 14 | 13 | #include <asm/unwind.h> |
| 15 | 14 | |
| 16 | −static void dump_trace(struct task_struct *task, struct stack_trace *trace) | |
| 15 | +static void notrace walk_stackframe(struct task_struct *task, | |
| 16 | + struct pt_regs *regs, bool (*fn)(void *, unsigned long), void *cookie) | |
| 17 | 17 | { |
| 18 | 18 | struct unwind_frame_info info; |
| 19 | 19 | |
| 20 | 20 | unwind_frame_init_task(&info, task, NULL); |
| 21 | − | |
| 22 | − /* unwind stack and save entries in stack_trace struct */ | |
| 23 | − trace->nr_entries = 0; | |
| 24 | − while (trace->nr_entries < trace->max_entries) { | |
| 21 | + while (1) { | |
| 25 | 22 | if (unwind_once(&info) < 0 || info.ip == 0) |
| 26 | 23 | break; |
| 27 | 24 | |
| 28 | 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 | −/* | |
| 34 | − * Save stack-backtrace addresses into a stack_trace buffer. | |
| 35 | − */ | |
| 36 | −void save_stack_trace(struct stack_trace *trace) | |
| 31 | +void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie, | |
| 32 | + struct task_struct *task, struct pt_regs *regs) | |
| 37 | 33 | { |
| 38 | − dump_trace(current, trace); | |
| 34 | + walk_stackframe(task, regs, consume_entry, cookie); | |
| 39 | 35 | } |
| 40 | −EXPORT_SYMBOL_GPL(save_stack_trace); | |
| 41 | 36 | |
| 42 | −void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace) | |
| 37 | +int 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 | } |
| 46 | −EXPORT_SYMBOL_GPL(save_stack_trace_tsk); | |
| @@ -409,10 +409,12 @@ long parisc_personality(unsigned long personality) · 408 unmodified lines | ||
| 409 | 409 | |
| 410 | 410 | static int FIX_O_NONBLOCK(int flags) |
| 411 | 411 | { |
| 412 | − if (flags & O_NONBLOCK_MASK_OUT) { | |
| 413 | − struct task_struct *tsk = current; | |
| 414 | − pr_warn_once("%s(%d) uses a deprecated O_NONBLOCK value.\n", | |
| 415 | − tsk->comm, tsk->pid); | |
| 412 | + if ((flags & O_NONBLOCK_MASK_OUT) && | |
| 413 | + !test_thread_flag(TIF_NONBLOCK_WARNING)) { | |
| 414 | + set_thread_flag(TIF_NONBLOCK_WARNING); | |
| 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 | 419 | return flags & ~O_NONBLOCK_MASK_OUT; |
| 418 | 420 | } |
| @@ -78,7 +78,7 @@ ENTRY(linux_gateway_page) · 77 unmodified lines | ||
| 78 | 78 | |
| 79 | 79 | lws_entry: |
| 80 | 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 | 83 | /* Fill from 0xb8 to 0xe0 */ |
| 84 | 84 | .rept 10 |
| @@ -89,7 +89,7 @@ lws_entry: · 4 unmodified lines | ||
| 89 | 89 | mechanism to work. DO NOT MOVE THIS CODE EVER! */ |
| 90 | 90 | set_thread_pointer: |
| 91 | 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 | 93 | be 0(%sr7,%r31) /* return to user space */ |
| 94 | 94 | mtctl %r26, %cr27 /* move arg0 to the control register */ |
| 95 | 95 | |
| @@ -139,9 +139,9 @@ linux_gateway_entry: · 43 unmodified lines | ||
| 139 | 139 | xor %r1,%r30,%r30 /* ye olde xor trick */ |
| 140 | 140 | xor %r1,%r30,%r1 |
| 141 | 141 | 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 | 145 | /* N.B.: It is critical that we don't set sr7 to 0 until r30 |
| 146 | 146 | * contains a valid kernel stack pointer. It is also |
| 147 | 147 | * critical that we don't start using the kernel stack |
| @@ -152,7 +152,6 @@ linux_gateway_entry: · 4 unmodified lines | ||
| 152 | 152 | ssm PSW_SM_I, %r0 /* enable interrupts */ |
| 153 | 153 | STREGM %r1,FRAME_SIZE(%r30) /* save r1 (usp) here for now */ |
| 154 | 154 | mfctl %cr30,%r1 /* get task ptr in %r1 */ |
| 155 | − LDREG TI_TASK(%r1),%r1 | |
| 156 | 155 | |
| 157 | 156 | /* Save some registers for sigcontext and potential task |
| 158 | 157 | switch (see entry.S for the details of which ones are |
| @@ -207,7 +206,7 @@ linux_gateway_entry: · 48 unmodified lines | ||
| 207 | 206 | |
| 208 | 207 | /* Are we being ptraced? */ |
| 209 | 208 | mfctl %cr30, %r1 |
| 210 | − LDREG TI_FLAGS(%r1),%r1 | |
| 209 | + LDREG TASK_TI_FLAGS(%r1),%r1 | |
| 211 | 210 | ldi _TIF_SYSCALL_TRACE_MASK, %r19 |
| 212 | 211 | and,COND(=) %r1, %r19, %r0 |
| 213 | 212 | b,n .Ltracesys |
| @@ -272,8 +271,7 @@ tracesys: · 58 unmodified lines | ||
| 272 | 271 | * C bit set, a non-straced syscall entry results in C and D clear |
| 273 | 272 | * in the saved PSW. |
| 274 | 273 | */ |
| 275 | − ldo -THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 /* get task ptr */ | |
| 276 | − LDREG TI_TASK(%r1), %r1 | |
| 274 | + mfctl %cr30,%r1 /* get task ptr */ | |
| 277 | 275 | ssm 0,%r2 |
| 278 | 276 | STREG %r2,TASK_PT_PSW(%r1) /* Lower 8 bits only!! */ |
| 279 | 277 | mfsp %sr0,%r2 |
| @@ -327,8 +325,7 @@ tracesys_next: · 47 unmodified lines | ||
| 327 | 325 | */ |
| 328 | 326 | copy %ret0,%r20 |
| 329 | 327 | |
| 330 | − ldo -THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 /* get task ptr */ | |
| 331 | − LDREG TI_TASK(%r1), %r1 | |
| 328 | + mfctl %cr30,%r1 /* get task ptr */ | |
| 332 | 329 | LDREG TASK_PT_GR28(%r1), %r28 /* Restore return value */ |
| 333 | 330 | LDREG TASK_PT_GR26(%r1), %r26 /* Restore the users args */ |
| 334 | 331 | LDREG TASK_PT_GR25(%r1), %r25 |
| @@ -385,16 +382,14 @@ tracesys_next: · 50 unmodified lines | ||
| 385 | 382 | makes a direct call to syscall_trace. */ |
| 386 | 383 | |
| 387 | 384 | tracesys_exit: |
| 388 | − ldo -THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 /* get task ptr */ | |
| 389 | − LDREG TI_TASK(%r1), %r1 | |
| 385 | + mfctl %cr30,%r1 /* get task ptr */ | |
| 390 | 386 | #ifdef CONFIG_64BIT |
| 391 | 387 | ldo -16(%r30),%r29 /* Reference param save area */ |
| 392 | 388 | #endif |
| 393 | 389 | ldo TASK_REGS(%r1),%r26 |
| 394 | 390 | BL do_syscall_trace_exit,%r2 |
| 395 | 391 | STREG %r28,TASK_PT_GR28(%r1) /* save return value now */ |
| 396 | − ldo -THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 /* get task ptr */ | |
| 397 | − LDREG TI_TASK(%r1), %r1 | |
| 392 | + mfctl %cr30,%r1 /* get task ptr */ | |
| 398 | 393 | LDREG TASK_PT_GR28(%r1), %r28 /* Restore return val. */ |
| 399 | 394 | |
| 400 | 395 | ldil L%syscall_exit,%r1 |
| @@ -407,8 +402,7 @@ tracesys_exit: · 6 unmodified lines | ||
| 407 | 402 | ldo R%tracesys_sigexit(%r2),%r2 |
| 408 | 403 | |
| 409 | 404 | tracesys_sigexit: |
| 410 | − ldo -THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 /* get task ptr */ | |
| 411 | − LDREG TI_TASK(%r1), %r1 | |
| 405 | + mfctl %cr30,%r1 /* get task ptr */ | |
| 412 | 406 | #ifdef CONFIG_64BIT |
| 413 | 407 | ldo -16(%r30),%r29 /* Reference param save area */ |
| 414 | 408 | #endif |
| @@ -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 | + | |
| 13 | +unsigned int __aligned(16) toc_lock = 1; | |
| 14 | + | |
| 15 | +static 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 | + | |
| 38 | +static 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 | + | |
| 61 | +void 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 | + | |
| 93 | +static __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 | +} | |
| 111 | +early_initcall(setup_toc); | |
| @@ -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 | |
| 16 | +ENTRY_CFI(toc_handler) | |
| 17 | + /* | |
| 18 | + * synchronize CPUs and obtain offset | |
| 19 | + * for stack setup. | |
| 20 | + */ | |
| 21 | + load32 PA(toc_lock),%r1 | |
| 22 | +0: 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 | |
| 47 | +0: 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 | |
| 76 | +ENDPROC_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 | + */ | |
| 83 | +SYM_DATA(toc_handler_csum, .long 0) | |
| 84 | +SYM_DATA(toc_handler_size, .long . - toc_handler) | |
| 85 | + | |
| 86 | + __PAGE_ALIGNED_BSS | |
| 87 | + .align 64 | |
| 88 | +SYM_DATA(toc_stack, .block 16384*NR_CPUS) | |
| @@ -30,6 +30,7 @@ · 29 unmodified lines | ||
| 30 | 30 | #include <linux/ratelimit.h> |
| 31 | 31 | #include <linux/uaccess.h> |
| 32 | 32 | #include <linux/kdebug.h> |
| 33 | +#include <linux/kfence.h> | |
| 33 | 34 | |
| 34 | 35 | #include <asm/assembly.h> |
| 35 | 36 | #include <asm/io.h> |
| @@ -143,7 +144,7 @@ void show_regs(struct pt_regs *regs) · 107 unmodified lines | ||
| 143 | 144 | printk("%s IIR: %08lx ISR: " RFMT " IOR: " RFMT "\n", |
| 144 | 145 | level, regs->iir, regs->isr, regs->ior); |
| 145 | 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 | 148 | printk("%s ORIG_R28: " RFMT "\n", level, regs->orig_r28); |
| 148 | 149 | |
| 149 | 150 | if (user) { |
| @@ -787,6 +788,10 @@ void notrace handle_interruption(int code, struct pt_regs *regs) · 637 unmodified lines | ||
| 787 | 788 | /* Clean up and return if in exception table. */ |
| 788 | 789 | if (fixup_exception(regs)) |
| 789 | 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 | 795 | pdc_chassis_send_status(PDC_CHASSIS_DIRECT_PANIC); |
| 791 | 796 | parisc_terminate("Kernel Fault", regs, code, fault_address); |
| 792 | 797 | } |
| @@ -14,6 +14,7 @@ · 13 unmodified lines | ||
| 14 | 14 | #include <linux/sched.h> |
| 15 | 15 | #include <linux/slab.h> |
| 16 | 16 | #include <linux/sort.h> |
| 17 | +#include <linux/sched/task_stack.h> | |
| 17 | 18 | |
| 18 | 19 | #include <linux/uaccess.h> |
| 19 | 20 | #include <asm/assembly.h> |
| @@ -21,6 +22,8 @@ · 1 unmodified line | ||
| 21 | 22 | #include <asm/ptrace.h> |
| 22 | 23 | |
| 23 | 24 | #include <asm/unwind.h> |
| 25 | +#include <asm/switch_to.h> | |
| 26 | +#include <asm/sections.h> | |
| 24 | 27 | |
| 25 | 28 | /* #define DEBUG 1 */ |
| 26 | 29 | #ifdef DEBUG |
| @@ -203,6 +206,11 @@ int __init unwind_init(void) · 176 unmodified lines | ||
| 203 | 206 | return 0; |
| 204 | 207 | } |
| 205 | 208 | |
| 209 | +static bool pc_is_kernel_fn(unsigned long pc, void *fn) | |
| 210 | +{ | |
| 211 | + return (unsigned long)dereference_kernel_function_descriptor(fn) == pc; | |
| 212 | +} | |
| 213 | + | |
| 206 | 214 | static 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 | 229 | extern void * const _call_on_stack; |
| 222 | 230 | #endif /* CONFIG_IRQSTACKS */ |
| 223 | 231 | |
| 224 | − if (pc == (unsigned long) &handle_interruption) { | |
| 232 | + if (pc_is_kernel_fn(pc, handle_interruption)) { | |
| 225 | 233 | struct pt_regs *regs = (struct pt_regs *)(info->sp - frame_size - PT_SZ_ALGN); |
| 226 | 234 | dbg("Unwinding through handle_interruption()\n"); |
| 227 | 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 | 237 | return 1; |
| 230 | 238 | } |
| 231 | 239 | |
| 232 | − if (pc == (unsigned long) &ret_from_kernel_thread || | |
| 233 | − pc == (unsigned long) &syscall_exit) { | |
| 240 | + if (pc_is_kernel_fn(pc, ret_from_kernel_thread) || | |
| 241 | + pc_is_kernel_fn(pc, syscall_exit)) { | |
| 234 | 242 | info->prev_sp = info->prev_ip = 0; |
| 235 | 243 | return 1; |
| 236 | 244 | } |
| 237 | 245 | |
| 238 | − if (pc == (unsigned long) &intr_return) { | |
| 246 | + if (pc_is_kernel_fn(pc, intr_return)) { | |
| 239 | 247 | struct pt_regs *regs; |
| 240 | 248 | |
| 241 | 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 | 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 | 259 | info->prev_sp = info->sp - CALLEE_SAVE_FRAME_SIZE; |
| 251 | 260 | info->prev_ip = *(unsigned long *)(info->prev_sp - RP_OFFSET); |
| 252 | 261 | return 1; |
| 253 | 262 | } |
| 254 | 263 | |
| 255 | 264 | #ifdef CONFIG_IRQSTACKS |
| 256 | − if (pc == (unsigned long) &_call_on_stack) { | |
| 265 | + if (pc_is_kernel_fn(pc, _call_on_stack)) { | |
| 257 | 266 | info->prev_sp = *(unsigned long *)(info->sp - FRAME_SIZE - REG_SZ); |
| 258 | 267 | info->prev_ip = *(unsigned long *)(info->sp - FRAME_SIZE - RP_OFFSET); |
| 259 | 268 | return 1; |
| 260 | 269 | } |
| 261 | 270 | #endif |
| 262 | − | |
| 263 | 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 | 300 | info->prev_sp = sp - 64; |
| 293 | 301 | info->prev_ip = 0; |
| 294 | 302 | |
| 295 | − /* The stack is at the end inside the thread_union | |
| 296 | − * struct. If we reach data, we have reached the | |
| 297 | − * beginning of the stack and should stop unwinding. */ | |
| 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)) { | |
| 303 | + /* Check if stack is inside kernel stack area */ | |
| 304 | + if ((info->prev_sp - (unsigned long) task_stack_page(info->t)) | |
| 305 | + >= THREAD_SIZE) { | |
| 301 | 306 | info->prev_sp = 0; |
| 302 | 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 | 312 | break; |
| 307 | 313 | info->prev_ip = tmp; |
| 308 | 314 | sp = info->prev_sp; |
| @@ -18,7 +18,7 @@ arch_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned = { · 17 unmodified lines | ||
| 18 | 18 | #endif |
| 19 | 19 | |
| 20 | 20 | #ifdef CONFIG_64BIT |
| 21 | −unsigned long __xchg64(unsigned long x, volatile unsigned long *ptr) | |
| 21 | +unsigned long notrace __xchg64(unsigned long x, volatile unsigned long *ptr) | |
| 22 | 22 | { |
| 23 | 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 | 31 | #endif |
| 32 | 32 | |
| 33 | −unsigned long __xchg32(int x, volatile int *ptr) | |
| 33 | +unsigned long notrace __xchg32(int x, volatile int *ptr) | |
| 34 | 34 | { |
| 35 | 35 | unsigned long flags; |
| 36 | 36 | long temp; |
| @@ -43,7 +43,7 @@ unsigned long __xchg32(int x, volatile int *ptr) · 6 unmodified lines | ||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | |
| 46 | −unsigned long __xchg8(char x, volatile char *ptr) | |
| 46 | +unsigned long notrace __xchg8(char x, volatile char *ptr) | |
| 47 | 47 | { |
| 48 | 48 | unsigned long flags; |
| 49 | 49 | long temp; |
| @@ -56,7 +56,7 @@ unsigned long __xchg8(char x, volatile char *ptr) · 6 unmodified lines | ||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | |
| 59 | −u64 __cmpxchg_u64(volatile u64 *ptr, u64 old, u64 new) | |
| 59 | +u64 notrace __cmpxchg_u64(volatile u64 *ptr, u64 old, u64 new) | |
| 60 | 60 | { |
| 61 | 61 | unsigned long flags; |
| 62 | 62 | u64 prev; |
| @@ -68,7 +68,7 @@ u64 __cmpxchg_u64(volatile u64 *ptr, u64 old, u64 new) · 5 unmodified lines | ||
| 68 | 68 | return prev; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | −unsigned long __cmpxchg_u32(volatile unsigned int *ptr, unsigned int old, unsigned int new) | |
| 71 | +unsigned long notrace __cmpxchg_u32(volatile unsigned int *ptr, unsigned int old, unsigned int new) | |
| 72 | 72 | { |
| 73 | 73 | unsigned long flags; |
| 74 | 74 | unsigned int prev; |
| @@ -80,7 +80,7 @@ unsigned long __cmpxchg_u32(volatile unsigned int *ptr, unsigned int old, unsign · 5 unmodified lines | ||
| 80 | 80 | return (unsigned long)prev; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | −u8 __cmpxchg_u8(volatile u8 *ptr, u8 old, u8 new) | |
| 83 | +u8 notrace __cmpxchg_u8(volatile u8 *ptr, u8 old, u8 new) | |
| 84 | 84 | { |
| 85 | 85 | unsigned long flags; |
| 86 | 86 | u8 prev; |
| @@ -48,7 +48,7 @@ int show_unhandled_signals = 1; · 47 unmodified lines | ||
| 48 | 48 | * VM_WRITE if write operation |
| 49 | 49 | * VM_EXEC if execute operation |
| 50 | 50 | */ |
| 51 | −static unsigned long | |
| 51 | +unsigned long | |
| 52 | 52 | parisc_acctyp(unsigned long code, unsigned int inst) |
| 53 | 53 | { |
| 54 | 54 | if (code == 6 || code == 16) |
| @@ -20,12 +20,9 @@ void notrace set_fixmap(enum fixed_addresses idx, phys_addr_t phys) · 19 unmodified lines | ||
| 20 | 20 | pte_t *pte; |
| 21 | 21 | |
| 22 | 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 | 23 | pte = pte_alloc_kernel(pmd, vaddr); |
| 28 | 24 | |
| 25 | + pte = pte_offset_kernel(pmd, vaddr); | |
| 29 | 26 | set_pte_at(&init_mm, vaddr, pte, __mk_pte(phys, PAGE_KERNEL_RWX)); |
| 30 | 27 | flush_tlb_kernel_range(vaddr, vaddr + PAGE_SIZE); |
| 31 | 28 | } |
| @@ -127,16 +127,12 @@ static void __init setup_bootmem(void) · 126 unmodified lines | ||
| 127 | 127 | int j; |
| 128 | 128 | |
| 129 | 129 | for (j = i; j > 0; j--) { |
| 130 | − physmem_range_t tmp; | |
| 131 | − | |
| 132 | 130 | if (pmem_ranges[j-1].start_pfn < |
| 133 | 131 | pmem_ranges[j].start_pfn) { |
| 134 | 132 | |
| 135 | 133 | break; |
| 136 | 134 | } |
| 137 | − tmp = pmem_ranges[j-1]; | |
| 138 | − pmem_ranges[j-1] = pmem_ranges[j]; | |
| 139 | − pmem_ranges[j] = tmp; | |
| 135 | + swap(pmem_ranges[j-1], pmem_ranges[j]); | |
| 140 | 136 | } |
| 141 | 137 | } |
| 142 | 138 | |
| @@ -842,9 +838,9 @@ void flush_tlb_all(void) · 699 unmodified lines | ||
| 842 | 838 | { |
| 843 | 839 | int do_recycle; |
| 844 | 840 | |
| 845 | − __inc_irq_stat(irq_tlb_count); | |
| 846 | 841 | do_recycle = 0; |
| 847 | 842 | spin_lock(&sid_lock); |
| 843 | + __inc_irq_stat(irq_tlb_count); | |
| 848 | 844 | if (dirty_space_ids > RECYCLE_THRESHOLD) { |
| 849 | 845 | BUG_ON(recycle_inuse); /* FIXME: Use a semaphore/wait queue here */ |
| 850 | 846 | get_dirty_sids(&recycle_ndirty,recycle_dirty_array); |
| @@ -863,8 +859,8 @@ void flush_tlb_all(void) · 12 unmodified lines | ||
| 863 | 859 | #else |
| 864 | 860 | void flush_tlb_all(void) |
| 865 | 861 | { |
| 866 | − __inc_irq_stat(irq_tlb_count); | |
| 867 | 862 | spin_lock(&sid_lock); |
| 863 | + __inc_irq_stat(irq_tlb_count); | |
| 868 | 864 | flush_tlb_all_local(NULL); |
| 869 | 865 | recycle_sids(); |
| 870 | 866 | spin_unlock(&sid_lock); |
| @@ -25,7 +25,11 @@ static inline void *task_stack_page(const struct task_struct *task) · 24 unmodified lines | ||
| 25 | 25 | |
| 26 | 26 | static 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 | 31 | return task->stack; |
| 32 | +#endif | |
| 29 | 33 | } |
| 30 | 34 | |
| 31 | 35 | #elif !defined(__HAVE_THREAD_FUNCTIONS) |