Commit 554e6e9f authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus

Pull MIPS fixes from Ralf Baechle:
 "MIPS fixes across the field.  The only area that's standing out is the
  exception handling which received it's dose of breakage as part of the
  microMIPS patchset"

* 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus:
  MIPS: ralink: add missing SZ_1M multiplier
  MIPS: Compat: Fix cputime_to_timeval() arguments in compat binfmt_elf.
  MIPS: OCTEON: Improve _machine_halt implementation.
  MIPS: rtlx: Fix implicit declaration of function set_vi_handler()
  MIPS: Trap exception handling fixes
  MIPS: Quit exposing Kconfig symbols in uapi headers.
  MIPS: Remove duplicate definition of check_for_high_segbits.
parents 17d8dfcd cdfce539
...@@ -428,13 +428,16 @@ static void octeon_restart(char *command) ...@@ -428,13 +428,16 @@ static void octeon_restart(char *command)
*/ */
static void octeon_kill_core(void *arg) static void octeon_kill_core(void *arg)
{ {
mb(); if (octeon_is_simulation())
if (octeon_is_simulation()) {
/* The simulator needs the watchdog to stop for dead cores */
cvmx_write_csr(CVMX_CIU_WDOGX(cvmx_get_core_num()), 0);
/* A break instruction causes the simulator stop a core */ /* A break instruction causes the simulator stop a core */
asm volatile ("sync\nbreak"); asm volatile ("break" ::: "memory");
}
local_irq_disable();
/* Disable watchdog on this core. */
cvmx_write_csr(CVMX_CIU_WDOGX(cvmx_get_core_num()), 0);
/* Spin in a low power mode. */
while (true)
asm volatile ("wait" ::: "memory");
} }
......
...@@ -16,6 +16,38 @@ ...@@ -16,6 +16,38 @@
#include <asm/isadep.h> #include <asm/isadep.h>
#include <uapi/asm/ptrace.h> #include <uapi/asm/ptrace.h>
/*
* This struct defines the way the registers are stored on the stack during a
* system call/exception. As usual the registers k0/k1 aren't being saved.
*/
struct pt_regs {
#ifdef CONFIG_32BIT
/* Pad bytes for argument save space on the stack. */
unsigned long pad0[6];
#endif
/* Saved main processor registers. */
unsigned long regs[32];
/* Saved special registers. */
unsigned long cp0_status;
unsigned long hi;
unsigned long lo;
#ifdef CONFIG_CPU_HAS_SMARTMIPS
unsigned long acx;
#endif
unsigned long cp0_badvaddr;
unsigned long cp0_cause;
unsigned long cp0_epc;
#ifdef CONFIG_MIPS_MT_SMTC
unsigned long cp0_tcstatus;
#endif /* CONFIG_MIPS_MT_SMTC */
#ifdef CONFIG_CPU_CAVIUM_OCTEON
unsigned long long mpl[3]; /* MTM{0,1,2} */
unsigned long long mtp[3]; /* MTP{0,1,2} */
#endif
} __aligned(8);
struct task_struct; struct task_struct;
extern int ptrace_getregs(struct task_struct *child, __s64 __user *data); extern int ptrace_getregs(struct task_struct *child, __s64 __user *data);
......
...@@ -22,16 +22,12 @@ ...@@ -22,16 +22,12 @@
#define DSP_CONTROL 77 #define DSP_CONTROL 77
#define ACX 78 #define ACX 78
#ifndef __KERNEL__
/* /*
* This struct defines the way the registers are stored on the stack during a * This struct defines the way the registers are stored on the stack during a
* system call/exception. As usual the registers k0/k1 aren't being saved. * system call/exception. As usual the registers k0/k1 aren't being saved.
*/ */
struct pt_regs { struct pt_regs {
#ifdef CONFIG_32BIT
/* Pad bytes for argument save space on the stack. */
unsigned long pad0[6];
#endif
/* Saved main processor registers. */ /* Saved main processor registers. */
unsigned long regs[32]; unsigned long regs[32];
...@@ -39,20 +35,11 @@ struct pt_regs { ...@@ -39,20 +35,11 @@ struct pt_regs {
unsigned long cp0_status; unsigned long cp0_status;
unsigned long hi; unsigned long hi;
unsigned long lo; unsigned long lo;
#ifdef CONFIG_CPU_HAS_SMARTMIPS
unsigned long acx;
#endif
unsigned long cp0_badvaddr; unsigned long cp0_badvaddr;
unsigned long cp0_cause; unsigned long cp0_cause;
unsigned long cp0_epc; unsigned long cp0_epc;
#ifdef CONFIG_MIPS_MT_SMTC
unsigned long cp0_tcstatus;
#endif /* CONFIG_MIPS_MT_SMTC */
#ifdef CONFIG_CPU_CAVIUM_OCTEON
unsigned long long mpl[3]; /* MTM{0,1,2} */
unsigned long long mtp[3]; /* MTP{0,1,2} */
#endif
} __attribute__ ((aligned (8))); } __attribute__ ((aligned (8)));
#endif /* __KERNEL__ */
/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
#define PTRACE_GETREGS 12 #define PTRACE_GETREGS 12
......
...@@ -119,4 +119,15 @@ MODULE_AUTHOR("Ralf Baechle (ralf@linux-mips.org)"); ...@@ -119,4 +119,15 @@ MODULE_AUTHOR("Ralf Baechle (ralf@linux-mips.org)");
#undef TASK_SIZE #undef TASK_SIZE
#define TASK_SIZE TASK_SIZE32 #define TASK_SIZE TASK_SIZE32
#undef cputime_to_timeval
#define cputime_to_timeval cputime_to_compat_timeval
static __inline__ void
cputime_to_compat_timeval(const cputime_t cputime, struct compat_timeval *value)
{
unsigned long jiffies = cputime_to_jiffies(cputime);
value->tv_usec = (jiffies % HZ) * (1000000L / HZ);
value->tv_sec = jiffies / HZ;
}
#include "../../../fs/binfmt_elf.c" #include "../../../fs/binfmt_elf.c"
...@@ -162,4 +162,15 @@ MODULE_AUTHOR("Ralf Baechle (ralf@linux-mips.org)"); ...@@ -162,4 +162,15 @@ MODULE_AUTHOR("Ralf Baechle (ralf@linux-mips.org)");
#undef TASK_SIZE #undef TASK_SIZE
#define TASK_SIZE TASK_SIZE32 #define TASK_SIZE TASK_SIZE32
#undef cputime_to_timeval
#define cputime_to_timeval cputime_to_compat_timeval
static __inline__ void
cputime_to_compat_timeval(const cputime_t cputime, struct compat_timeval *value)
{
unsigned long jiffies = cputime_to_jiffies(cputime);
value->tv_usec = (jiffies % HZ) * (1000000L / HZ);
value->tv_sec = jiffies / HZ;
}
#include "../../../fs/binfmt_elf.c" #include "../../../fs/binfmt_elf.c"
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/vpe.h> #include <asm/vpe.h>
#include <asm/rtlx.h> #include <asm/rtlx.h>
#include <asm/setup.h>
static struct rtlx_info *rtlx; static struct rtlx_info *rtlx;
static int major; static int major;
......
...@@ -897,22 +897,24 @@ asmlinkage void do_bp(struct pt_regs *regs) ...@@ -897,22 +897,24 @@ asmlinkage void do_bp(struct pt_regs *regs)
asmlinkage void do_tr(struct pt_regs *regs) asmlinkage void do_tr(struct pt_regs *regs)
{ {
unsigned int opcode, tcode = 0; u32 opcode, tcode = 0;
u16 instr[2]; u16 instr[2];
unsigned long epc = exception_epc(regs); unsigned long epc = msk_isa16_mode(exception_epc(regs));
if ((__get_user(instr[0], (u16 __user *)msk_isa16_mode(epc))) || if (get_isa16_mode(regs->cp0_epc)) {
(__get_user(instr[1], (u16 __user *)msk_isa16_mode(epc + 2)))) if (__get_user(instr[0], (u16 __user *)(epc + 0)) ||
__get_user(instr[1], (u16 __user *)(epc + 2)))
goto out_sigsegv; goto out_sigsegv;
opcode = (instr[0] << 16) | instr[1]; opcode = (instr[0] << 16) | instr[1];
/* Immediate versions don't provide a code. */ /* Immediate versions don't provide a code. */
if (!(opcode & OPCODE)) { if (!(opcode & OPCODE))
if (get_isa16_mode(regs->cp0_epc)) tcode = (opcode >> 12) & ((1 << 4) - 1);
/* microMIPS */ } else {
tcode = (opcode >> 12) & 0x1f; if (__get_user(opcode, (u32 __user *)epc))
else goto out_sigsegv;
tcode = ((opcode >> 6) & ((1 << 10) - 1)); /* Immediate versions don't provide a code. */
if (!(opcode & OPCODE))
tcode = (opcode >> 6) & ((1 << 10) - 1);
} }
do_trap_or_bp(regs, tcode, "Trap"); do_trap_or_bp(regs, tcode, "Trap");
......
...@@ -301,10 +301,6 @@ static u32 tlb_handler[128] __cpuinitdata; ...@@ -301,10 +301,6 @@ static u32 tlb_handler[128] __cpuinitdata;
static struct uasm_label labels[128] __cpuinitdata; static struct uasm_label labels[128] __cpuinitdata;
static struct uasm_reloc relocs[128] __cpuinitdata; static struct uasm_reloc relocs[128] __cpuinitdata;
#ifdef CONFIG_64BIT
static int check_for_high_segbits __cpuinitdata;
#endif
static int check_for_high_segbits __cpuinitdata; static int check_for_high_segbits __cpuinitdata;
static unsigned int kscratch_used_mask __cpuinitdata; static unsigned int kscratch_used_mask __cpuinitdata;
......
...@@ -88,7 +88,7 @@ void __init plat_mem_setup(void) ...@@ -88,7 +88,7 @@ void __init plat_mem_setup(void)
__dt_setup_arch(&__dtb_start); __dt_setup_arch(&__dtb_start);
if (soc_info.mem_size) if (soc_info.mem_size)
add_memory_region(soc_info.mem_base, soc_info.mem_size, add_memory_region(soc_info.mem_base, soc_info.mem_size * SZ_1M,
BOOT_MEM_RAM); BOOT_MEM_RAM);
else else
detect_memory_region(soc_info.mem_base, detect_memory_region(soc_info.mem_base,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment