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

Merge branch 'parisc-4.17-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux

Pull parisc updates from Helge Deller:

- fix panic when halting system via "shutdown -h now"

- drop own coding in favour of generic CONFIG_COMPAT_BINFMT_ELF
implementation

- add FPE_CONDTRAP constant: last outstanding parisc-specific cleanup
for Eric Biedermans siginfo patches

- move some functions to .init and some to .text.hot linker sections

* 'parisc-4.17-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
parisc: Prevent panic at system halt
parisc: Switch to generic COMPAT_BINFMT_ELF
parisc: Move cache flush functions into .text.hot section
parisc/signal: Add FPE_CONDTRAP for conditional trap handling

+60 -157
+1
arch/parisc/Kconfig
··· 338 338 config COMPAT 339 339 def_bool y 340 340 depends on 64BIT 341 + select COMPAT_BINFMT_ELF if BINFMT_ELF 341 342 342 343 config SYSVIPC_COMPAT 343 344 def_bool y
+6
arch/parisc/include/asm/compat.h
··· 193 193 }; 194 194 195 195 /* 196 + * The type of struct elf_prstatus.pr_reg in compatible core dumps. 197 + */ 198 + #define COMPAT_ELF_NGREG 80 199 + typedef compat_ulong_t compat_elf_gregset_t[COMPAT_ELF_NGREG]; 200 + 201 + /* 196 202 * A pointer passed in from user mode. This should not 197 203 * be used for syscall parameters, just declare them 198 204 * as pointers because the syscall entry code will have
+35 -34
arch/parisc/include/asm/elf.h
··· 6 6 * ELF register definitions.. 7 7 */ 8 8 9 - #include <asm/ptrace.h> 9 + #include <linux/types.h> 10 10 11 11 #define EM_PARISC 15 12 12 ··· 169 169 __u64 gp; 170 170 } Elf64_Fdesc; 171 171 172 - #ifdef __KERNEL__ 173 - 174 172 #ifdef CONFIG_64BIT 175 173 #define Elf_Fdesc Elf64_Fdesc 176 174 #else 177 175 #define Elf_Fdesc Elf32_Fdesc 178 176 #endif /*CONFIG_64BIT*/ 179 - 180 - #endif /*__KERNEL__*/ 181 177 182 178 /* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr. */ 183 179 ··· 209 213 #define PF_HP_SBP 0x08000000 210 214 211 215 /* 216 + * This yields a string that ld.so will use to load implementation 217 + * specific libraries for optimization. This is more specific in 218 + * intent than poking at uname or /proc/cpuinfo. 219 + */ 220 + 221 + #define ELF_PLATFORM ("PARISC") 222 + 223 + /* 212 224 * The following definitions are those for 32-bit ELF binaries on a 32-bit 213 225 * kernel and for 64-bit binaries on a 64-bit kernel. To run 32-bit binaries 214 - * on a 64-bit kernel, arch/parisc/kernel/binfmt_elf32.c defines these 215 - * macros appropriately and then #includes binfmt_elf.c, which then includes 216 - * this file. 226 + * on a 64-bit kernel, fs/compat_binfmt_elf.c defines ELF_CLASS and then 227 + * #includes binfmt_elf.c, which then includes this file. 217 228 */ 218 229 #ifndef ELF_CLASS 219 230 220 - /* 221 - * This is used to ensure we don't load something for the wrong architecture. 222 - * 223 - * Note that this header file is used by default in fs/binfmt_elf.c. So 224 - * the following macros are for the default case. However, for the 64 225 - * bit kernel we also support 32 bit parisc binaries. To do that 226 - * arch/parisc/kernel/binfmt_elf32.c defines its own set of these 227 - * macros, and then it includes fs/binfmt_elf.c to provide an alternate 228 - * elf binary handler for 32 bit binaries (on the 64 bit kernel). 229 - */ 230 231 #ifdef CONFIG_64BIT 231 - #define ELF_CLASS ELFCLASS64 232 + #define ELF_CLASS ELFCLASS64 232 233 #else 233 234 #define ELF_CLASS ELFCLASS32 234 235 #endif 235 236 236 237 typedef unsigned long elf_greg_t; 237 238 238 - /* 239 - * This yields a string that ld.so will use to load implementation 240 - * specific libraries for optimization. This is more specific in 241 - * intent than poking at uname or /proc/cpuinfo. 242 - */ 243 - 244 - #define ELF_PLATFORM ("PARISC\0") 245 - 246 239 #define SET_PERSONALITY(ex) \ 240 + ({ \ 247 241 set_personality((current->personality & ~PER_MASK) | PER_LINUX); \ 248 242 current->thread.map_base = DEFAULT_MAP_BASE; \ 249 - current->thread.task_size = DEFAULT_TASK_SIZE \ 243 + current->thread.task_size = DEFAULT_TASK_SIZE; \ 244 + }) 245 + 246 + #endif /* ! ELF_CLASS */ 247 + 248 + #define COMPAT_SET_PERSONALITY(ex) \ 249 + ({ \ 250 + set_thread_flag(TIF_32BIT); \ 251 + current->thread.map_base = DEFAULT_MAP_BASE32; \ 252 + current->thread.task_size = DEFAULT_TASK_SIZE32; \ 253 + }) 250 254 251 255 /* 252 256 * Fill in general registers in a core dump. This saves pretty ··· 273 277 274 278 #define ELF_CORE_COPY_REGS(dst, pt) \ 275 279 memset(dst, 0, sizeof(dst)); /* don't leak any "random" bits */ \ 276 - memcpy(dst + 0, pt->gr, 32 * sizeof(elf_greg_t)); \ 277 - memcpy(dst + 32, pt->sr, 8 * sizeof(elf_greg_t)); \ 278 - memcpy(dst + 40, pt->iaoq, 2 * sizeof(elf_greg_t)); \ 279 - memcpy(dst + 42, pt->iasq, 2 * sizeof(elf_greg_t)); \ 280 + { int i; \ 281 + for (i = 0; i < 32; i++) dst[i] = pt->gr[i]; \ 282 + for (i = 0; i < 8; i++) dst[32 + i] = pt->sr[i]; \ 283 + } \ 284 + dst[40] = pt->iaoq[0]; dst[41] = pt->iaoq[1]; \ 285 + dst[42] = pt->iasq[0]; dst[43] = pt->iasq[1]; \ 280 286 dst[44] = pt->sar; dst[45] = pt->iir; \ 281 287 dst[46] = pt->isr; dst[47] = pt->ior; \ 282 288 dst[48] = mfctl(22); dst[49] = mfctl(0); \ ··· 290 292 dst[60] = mfctl(12); dst[61] = mfctl(13); \ 291 293 dst[62] = mfctl(10); dst[63] = mfctl(15); 292 294 293 - #endif /* ! ELF_CLASS */ 295 + #define CORE_DUMP_USE_REGSET 294 296 295 297 #define ELF_NGREG 80 /* We only need 64 at present, but leave space 296 298 for expansion. */ ··· 308 310 struct pt_regs; /* forward declaration... */ 309 311 310 312 311 - #define elf_check_arch(x) ((x)->e_machine == EM_PARISC && (x)->e_ident[EI_CLASS] == ELF_CLASS) 313 + #define elf_check_arch(x) \ 314 + ((x)->e_machine == EM_PARISC && (x)->e_ident[EI_CLASS] == ELF_CLASS) 315 + #define compat_elf_check_arch(x) \ 316 + ((x)->e_machine == EM_PARISC && (x)->e_ident[EI_CLASS] == ELFCLASS32) 312 317 313 318 /* 314 319 * These are used to set parameters in the core dumps.
-7
arch/parisc/include/uapi/asm/siginfo.h
··· 8 8 9 9 #include <asm-generic/siginfo.h> 10 10 11 - /* 12 - * SIGFPE si_codes 13 - */ 14 - #ifdef __KERNEL__ 15 - #define FPE_FIXME 0 /* Broken dup of SI_USER */ 16 - #endif /* __KERNEL__ */ 17 - 18 11 #endif
-98
arch/parisc/kernel/binfmt_elf32.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * Support for 32-bit Linux/Parisc ELF binaries on 64 bit kernels 4 - * 5 - * Copyright (C) 2000 John Marvin 6 - * Copyright (C) 2000 Hewlett Packard Co. 7 - * 8 - * Heavily inspired from various other efforts to do the same thing 9 - * (ia64,sparc64/mips64) 10 - */ 11 - 12 - /* Make sure include/asm-parisc/elf.h does the right thing */ 13 - 14 - #define ELF_CLASS ELFCLASS32 15 - 16 - #define ELF_CORE_COPY_REGS(dst, pt) \ 17 - memset(dst, 0, sizeof(dst)); /* don't leak any "random" bits */ \ 18 - { int i; \ 19 - for (i = 0; i < 32; i++) dst[i] = (elf_greg_t) pt->gr[i]; \ 20 - for (i = 0; i < 8; i++) dst[32 + i] = (elf_greg_t) pt->sr[i]; \ 21 - } \ 22 - dst[40] = (elf_greg_t) pt->iaoq[0]; dst[41] = (elf_greg_t) pt->iaoq[1]; \ 23 - dst[42] = (elf_greg_t) pt->iasq[0]; dst[43] = (elf_greg_t) pt->iasq[1]; \ 24 - dst[44] = (elf_greg_t) pt->sar; dst[45] = (elf_greg_t) pt->iir; \ 25 - dst[46] = (elf_greg_t) pt->isr; dst[47] = (elf_greg_t) pt->ior; \ 26 - dst[48] = (elf_greg_t) mfctl(22); dst[49] = (elf_greg_t) mfctl(0); \ 27 - dst[50] = (elf_greg_t) mfctl(24); dst[51] = (elf_greg_t) mfctl(25); \ 28 - dst[52] = (elf_greg_t) mfctl(26); dst[53] = (elf_greg_t) mfctl(27); \ 29 - dst[54] = (elf_greg_t) mfctl(28); dst[55] = (elf_greg_t) mfctl(29); \ 30 - dst[56] = (elf_greg_t) mfctl(30); dst[57] = (elf_greg_t) mfctl(31); \ 31 - dst[58] = (elf_greg_t) mfctl( 8); dst[59] = (elf_greg_t) mfctl( 9); \ 32 - dst[60] = (elf_greg_t) mfctl(12); dst[61] = (elf_greg_t) mfctl(13); \ 33 - dst[62] = (elf_greg_t) mfctl(10); dst[63] = (elf_greg_t) mfctl(15); 34 - 35 - 36 - typedef unsigned int elf_greg_t; 37 - 38 - #include <linux/spinlock.h> 39 - #include <asm/processor.h> 40 - #include <linux/module.h> 41 - #include <linux/elfcore.h> 42 - #include <linux/compat.h> /* struct compat_timeval */ 43 - 44 - #define elf_prstatus elf_prstatus32 45 - struct elf_prstatus32 46 - { 47 - struct elf_siginfo pr_info; /* Info associated with signal */ 48 - short pr_cursig; /* Current signal */ 49 - unsigned int pr_sigpend; /* Set of pending signals */ 50 - unsigned int pr_sighold; /* Set of held signals */ 51 - pid_t pr_pid; 52 - pid_t pr_ppid; 53 - pid_t pr_pgrp; 54 - pid_t pr_sid; 55 - struct compat_timeval pr_utime; /* User time */ 56 - struct compat_timeval pr_stime; /* System time */ 57 - struct compat_timeval pr_cutime; /* Cumulative user time */ 58 - struct compat_timeval pr_cstime; /* Cumulative system time */ 59 - elf_gregset_t pr_reg; /* GP registers */ 60 - int pr_fpvalid; /* True if math co-processor being used. */ 61 - }; 62 - 63 - #define elf_prpsinfo elf_prpsinfo32 64 - struct elf_prpsinfo32 65 - { 66 - char pr_state; /* numeric process state */ 67 - char pr_sname; /* char for pr_state */ 68 - char pr_zomb; /* zombie */ 69 - char pr_nice; /* nice val */ 70 - unsigned int pr_flag; /* flags */ 71 - u16 pr_uid; 72 - u16 pr_gid; 73 - pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid; 74 - /* Lots missing */ 75 - char pr_fname[16]; /* filename of executable */ 76 - char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */ 77 - }; 78 - 79 - #define init_elf_binfmt init_elf32_binfmt 80 - 81 - #define ELF_PLATFORM ("PARISC32\0") 82 - 83 - /* 84 - * We should probably use this macro to set a flag somewhere to indicate 85 - * this is a 32 on 64 process. We could use PER_LINUX_32BIT, or we 86 - * could set a processor dependent flag in the thread_struct. 87 - */ 88 - 89 - #undef SET_PERSONALITY 90 - #define SET_PERSONALITY(ex) \ 91 - set_thread_flag(TIF_32BIT); \ 92 - current->thread.map_base = DEFAULT_MAP_BASE32; \ 93 - current->thread.task_size = DEFAULT_TASK_SIZE32 \ 94 - 95 - #undef ns_to_timeval 96 - #define ns_to_timeval ns_to_compat_timeval 97 - 98 - #include "../../../fs/binfmt_elf.c"
+1 -1
arch/parisc/kernel/cache.c
··· 254 254 } 255 255 } 256 256 257 - void disable_sr_hashing(void) 257 + void __init disable_sr_hashing(void) 258 258 { 259 259 int srhash_type, retval; 260 260 unsigned long space_bits;
+5 -4
arch/parisc/kernel/pacache.S
··· 38 38 #include <asm/cache.h> 39 39 #include <asm/ldcw.h> 40 40 #include <linux/linkage.h> 41 + #include <linux/init.h> 41 42 42 - .text 43 - .align 128 43 + .section .text.hot 44 + .align 16 44 45 45 46 ENTRY_CFI(flush_tlb_all_local) 46 47 .proc ··· 328 327 329 328 .procend 330 329 ENDPROC_CFI(flush_data_cache_local) 331 - 332 - .align 16 333 330 334 331 /* Macros to serialize TLB purge operations on SMP. */ 335 332 ··· 1214 1215 .exit 1215 1216 .procend 1216 1217 ENDPROC_CFI(flush_kernel_icache_range_asm) 1218 + 1219 + __INIT 1217 1220 1218 1221 /* align should cover use of rfi in disable_sr_hashing_asm and 1219 1222 * srdis_done.
+5 -8
arch/parisc/kernel/process.c
··· 112 112 113 113 } 114 114 115 - void machine_halt(void) 116 - { 117 - /* 118 - ** The LED/ChassisCodes are updated by the led_halt() 119 - ** function, called by the reboot notifier chain. 120 - */ 121 - } 122 - 123 115 void (*chassis_power_off)(void); 124 116 125 117 /* ··· 149 157 150 158 void (*pm_power_off)(void); 151 159 EXPORT_SYMBOL(pm_power_off); 160 + 161 + void machine_halt(void) 162 + { 163 + machine_power_off(); 164 + } 152 165 153 166 void flush_thread(void) 154 167 {
+4 -3
arch/parisc/kernel/traps.c
··· 627 627 on condition */ 628 628 if(user_mode(regs)){ 629 629 si.si_signo = SIGFPE; 630 - /* Set to zero, and let the userspace app figure it out from 631 - the insn pointed to by si_addr */ 632 - si.si_code = FPE_FIXME; 630 + /* Let userspace app figure it out from the insn pointed 631 + * to by si_addr. 632 + */ 633 + si.si_code = FPE_CONDTRAP; 633 634 si.si_addr = (void __user *) regs->iaoq[0]; 634 635 force_sig_info(SIGFPE, &si, current); 635 636 return;
+1 -1
arch/x86/kernel/signal_compat.c
··· 26 26 * new fields are handled in copy_siginfo_to_user32()! 27 27 */ 28 28 BUILD_BUG_ON(NSIGILL != 11); 29 - BUILD_BUG_ON(NSIGFPE != 14); 29 + BUILD_BUG_ON(NSIGFPE != 15); 30 30 BUILD_BUG_ON(NSIGSEGV != 7); 31 31 BUILD_BUG_ON(NSIGBUS != 5); 32 32 BUILD_BUG_ON(NSIGTRAP != 4);
+2 -1
include/uapi/asm-generic/siginfo.h
··· 211 211 #define __FPE_INVASC 12 /* invalid ASCII digit */ 212 212 #define __FPE_INVDEC 13 /* invalid decimal digit */ 213 213 #define FPE_FLTUNK 14 /* undiagnosed floating-point exception */ 214 - #define NSIGFPE 14 214 + #define FPE_CONDTRAP 15 /* trap on condition */ 215 + #define NSIGFPE 15 215 216 216 217 /* 217 218 * SIGSEGV si_codes