Skip to content

Commit

Permalink
Merge branch 'parisc-4.17-2' of git://git.kernel.org/pub/scm/linux/ke…
Browse files Browse the repository at this point in the history
…rnel/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
  • Loading branch information
torvalds committed Apr 13, 2018
2 parents 80aa76b + 6769828 commit 681857e
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 157 deletions.
1 change: 1 addition & 0 deletions arch/parisc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ source "mm/Kconfig"
config COMPAT
def_bool y
depends on 64BIT
select COMPAT_BINFMT_ELF if BINFMT_ELF

config SYSVIPC_COMPAT
def_bool y
Expand Down
6 changes: 6 additions & 0 deletions arch/parisc/include/asm/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ struct compat_shmid64_ds {
compat_ulong_t __unused6;
};

/*
* The type of struct elf_prstatus.pr_reg in compatible core dumps.
*/
#define COMPAT_ELF_NGREG 80
typedef compat_ulong_t compat_elf_gregset_t[COMPAT_ELF_NGREG];

/*
* A pointer passed in from user mode. This should not
* be used for syscall parameters, just declare them
Expand Down
69 changes: 35 additions & 34 deletions arch/parisc/include/asm/elf.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* ELF register definitions..
*/

#include <asm/ptrace.h>
#include <linux/types.h>

#define EM_PARISC 15

Expand Down Expand Up @@ -169,16 +169,12 @@ typedef struct elf64_fdesc {
__u64 gp;
} Elf64_Fdesc;

#ifdef __KERNEL__

#ifdef CONFIG_64BIT
#define Elf_Fdesc Elf64_Fdesc
#else
#define Elf_Fdesc Elf32_Fdesc
#endif /*CONFIG_64BIT*/

#endif /*__KERNEL__*/

/* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr. */

#define PT_HP_TLS (PT_LOOS + 0x0)
Expand Down Expand Up @@ -212,45 +208,45 @@ typedef struct elf64_fdesc {
#define PF_HP_LAZYSWAP 0x04000000
#define PF_HP_SBP 0x08000000

/*
* This yields a string that ld.so will use to load implementation
* specific libraries for optimization. This is more specific in
* intent than poking at uname or /proc/cpuinfo.
*/

#define ELF_PLATFORM ("PARISC")

/*
* The following definitions are those for 32-bit ELF binaries on a 32-bit
* kernel and for 64-bit binaries on a 64-bit kernel. To run 32-bit binaries
* on a 64-bit kernel, arch/parisc/kernel/binfmt_elf32.c defines these
* macros appropriately and then #includes binfmt_elf.c, which then includes
* this file.
* on a 64-bit kernel, fs/compat_binfmt_elf.c defines ELF_CLASS and then
* #includes binfmt_elf.c, which then includes this file.
*/
#ifndef ELF_CLASS

/*
* This is used to ensure we don't load something for the wrong architecture.
*
* Note that this header file is used by default in fs/binfmt_elf.c. So
* the following macros are for the default case. However, for the 64
* bit kernel we also support 32 bit parisc binaries. To do that
* arch/parisc/kernel/binfmt_elf32.c defines its own set of these
* macros, and then it includes fs/binfmt_elf.c to provide an alternate
* elf binary handler for 32 bit binaries (on the 64 bit kernel).
*/
#ifdef CONFIG_64BIT
#define ELF_CLASS ELFCLASS64
#define ELF_CLASS ELFCLASS64
#else
#define ELF_CLASS ELFCLASS32
#endif

typedef unsigned long elf_greg_t;

/*
* This yields a string that ld.so will use to load implementation
* specific libraries for optimization. This is more specific in
* intent than poking at uname or /proc/cpuinfo.
*/

#define ELF_PLATFORM ("PARISC\0")

#define SET_PERSONALITY(ex) \
({ \
set_personality((current->personality & ~PER_MASK) | PER_LINUX); \
current->thread.map_base = DEFAULT_MAP_BASE; \
current->thread.task_size = DEFAULT_TASK_SIZE \
current->thread.task_size = DEFAULT_TASK_SIZE; \
})

#endif /* ! ELF_CLASS */

#define COMPAT_SET_PERSONALITY(ex) \
({ \
set_thread_flag(TIF_32BIT); \
current->thread.map_base = DEFAULT_MAP_BASE32; \
current->thread.task_size = DEFAULT_TASK_SIZE32; \
})

/*
* Fill in general registers in a core dump. This saves pretty
Expand All @@ -277,10 +273,12 @@ typedef unsigned long elf_greg_t;

#define ELF_CORE_COPY_REGS(dst, pt) \
memset(dst, 0, sizeof(dst)); /* don't leak any "random" bits */ \
memcpy(dst + 0, pt->gr, 32 * sizeof(elf_greg_t)); \
memcpy(dst + 32, pt->sr, 8 * sizeof(elf_greg_t)); \
memcpy(dst + 40, pt->iaoq, 2 * sizeof(elf_greg_t)); \
memcpy(dst + 42, pt->iasq, 2 * sizeof(elf_greg_t)); \
{ int i; \
for (i = 0; i < 32; i++) dst[i] = pt->gr[i]; \
for (i = 0; i < 8; i++) dst[32 + i] = pt->sr[i]; \
} \
dst[40] = pt->iaoq[0]; dst[41] = pt->iaoq[1]; \
dst[42] = pt->iasq[0]; dst[43] = pt->iasq[1]; \
dst[44] = pt->sar; dst[45] = pt->iir; \
dst[46] = pt->isr; dst[47] = pt->ior; \
dst[48] = mfctl(22); dst[49] = mfctl(0); \
Expand All @@ -292,7 +290,7 @@ typedef unsigned long elf_greg_t;
dst[60] = mfctl(12); dst[61] = mfctl(13); \
dst[62] = mfctl(10); dst[63] = mfctl(15);

#endif /* ! ELF_CLASS */
#define CORE_DUMP_USE_REGSET

#define ELF_NGREG 80 /* We only need 64 at present, but leave space
for expansion. */
Expand All @@ -310,7 +308,10 @@ extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
struct pt_regs; /* forward declaration... */


#define elf_check_arch(x) ((x)->e_machine == EM_PARISC && (x)->e_ident[EI_CLASS] == ELF_CLASS)
#define elf_check_arch(x) \
((x)->e_machine == EM_PARISC && (x)->e_ident[EI_CLASS] == ELF_CLASS)
#define compat_elf_check_arch(x) \
((x)->e_machine == EM_PARISC && (x)->e_ident[EI_CLASS] == ELFCLASS32)

/*
* These are used to set parameters in the core dumps.
Expand Down
7 changes: 0 additions & 7 deletions arch/parisc/include/uapi/asm/siginfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,4 @@

#include <asm-generic/siginfo.h>

/*
* SIGFPE si_codes
*/
#ifdef __KERNEL__
#define FPE_FIXME 0 /* Broken dup of SI_USER */
#endif /* __KERNEL__ */

#endif
98 changes: 0 additions & 98 deletions arch/parisc/kernel/binfmt_elf32.c

This file was deleted.

2 changes: 1 addition & 1 deletion arch/parisc/kernel/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ parisc_cache_init(void)
}
}

void disable_sr_hashing(void)
void __init disable_sr_hashing(void)
{
int srhash_type, retval;
unsigned long space_bits;
Expand Down
9 changes: 5 additions & 4 deletions arch/parisc/kernel/pacache.S
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@
#include <asm/cache.h>
#include <asm/ldcw.h>
#include <linux/linkage.h>
#include <linux/init.h>

.text
.align 128
.section .text.hot
.align 16

ENTRY_CFI(flush_tlb_all_local)
.proc
Expand Down Expand Up @@ -328,8 +329,6 @@ fdsync:
.procend
ENDPROC_CFI(flush_data_cache_local)

.align 16

/* Macros to serialize TLB purge operations on SMP. */

.macro tlb_lock la,flags,tmp
Expand Down Expand Up @@ -1216,6 +1215,8 @@ ENTRY_CFI(flush_kernel_icache_range_asm)
.procend
ENDPROC_CFI(flush_kernel_icache_range_asm)

__INIT

/* align should cover use of rfi in disable_sr_hashing_asm and
* srdis_done.
*/
Expand Down
13 changes: 5 additions & 8 deletions arch/parisc/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,6 @@ void machine_restart(char *cmd)

}

void machine_halt(void)
{
/*
** The LED/ChassisCodes are updated by the led_halt()
** function, called by the reboot notifier chain.
*/
}

void (*chassis_power_off)(void);

/*
Expand Down Expand Up @@ -158,6 +150,11 @@ void machine_power_off(void)
void (*pm_power_off)(void);
EXPORT_SYMBOL(pm_power_off);

void machine_halt(void)
{
machine_power_off();
}

void flush_thread(void)
{
/* Only needs to handle fpu stuff or perf monitors.
Expand Down
7 changes: 4 additions & 3 deletions arch/parisc/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,9 +627,10 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
on condition */
if(user_mode(regs)){
si.si_signo = SIGFPE;
/* Set to zero, and let the userspace app figure it out from
the insn pointed to by si_addr */
si.si_code = FPE_FIXME;
/* Let userspace app figure it out from the insn pointed
* to by si_addr.
*/
si.si_code = FPE_CONDTRAP;
si.si_addr = (void __user *) regs->iaoq[0];
force_sig_info(SIGFPE, &si, current);
return;
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/signal_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static inline void signal_compat_build_tests(void)
* new fields are handled in copy_siginfo_to_user32()!
*/
BUILD_BUG_ON(NSIGILL != 11);
BUILD_BUG_ON(NSIGFPE != 14);
BUILD_BUG_ON(NSIGFPE != 15);
BUILD_BUG_ON(NSIGSEGV != 7);
BUILD_BUG_ON(NSIGBUS != 5);
BUILD_BUG_ON(NSIGTRAP != 4);
Expand Down
3 changes: 2 additions & 1 deletion include/uapi/asm-generic/siginfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ typedef struct siginfo {
#define __FPE_INVASC 12 /* invalid ASCII digit */
#define __FPE_INVDEC 13 /* invalid decimal digit */
#define FPE_FLTUNK 14 /* undiagnosed floating-point exception */
#define NSIGFPE 14
#define FPE_CONDTRAP 15 /* trap on condition */
#define NSIGFPE 15

/*
* SIGSEGV si_codes
Expand Down

0 comments on commit 681857e

Please sign in to comment.