1. 06 9月, 2017 8 次提交
    • M
      MIPS: Refactor handling of stack pointer in get_frame_info · 56dfb700
      Matt Redfearn 提交于
      Commit 34c2f668 ("MIPS: microMIPS: Add unaligned access support.")
      added handling of microMIPS instructions to manipulate the stack
      pointer. The code that was added violates code style rules with long
      lines caused by lots of nested conditionals.
      
      The added code interprets (inline) any known stack pointer manipulation
      instruction to find the stack frame size. Handling the microMIPS cases
      added quite a bit of complication to this function.
      
      Refactor is_sp_move_ins to perform the interpretation of the immediate
      as the instruction manipulating the stack pointer is found. This reduces
      the amount of indentation required in get_frame_info, and more closely
      matches the operation of is_ra_save_ins.
      Suggested-by: NMaciej W. Rozycki <macro@imgtec.com>
      Signed-off-by: NMatt Redfearn <matt.redfearn@imgtec.com>
      Cc: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Paul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/16958/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      56dfb700
    • M
      MIPS: Stacktrace: Fix microMIPS stack unwinding on big endian systems · 41885b02
      Matt Redfearn 提交于
      The stack unwinding code uses the mips_instuction union to decode the
      instructions it finds. That union uses the __BITFIELD_FIELD macro to
      reorder depending on endianness. The stack unwinding code always places
      16bit instructions in halfword 1 of the union. This makes the union
      accesses correct for little endian systems. Similarly, 32bit
      instructions are reordered such that they are correct for little endian
      systems. This handling leaves unwinding the stack on big endian systems
      broken, as the mips_instruction union will then look for the fields in
      the wrong halfword.
      
      To fix this, use a logical shift to place the 16bit instruction into the
      correct position in the word field of the union. Use the same shifting
      to order the 2 halfwords of 32bit instuctions. Then replace accesses to
      the halfword with accesses to the shifted word.
      In the case of the ADDIUS5 instruction, switch to using the
      mm16_r5_format union member to avoid the need for a 16bit shift.
      
      Fixes: 34c2f668 ("MIPS: microMIPS: Add unaligned access support.")
      Signed-off-by: NMatt Redfearn <matt.redfearn@imgtec.com>
      Reviewed-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Paul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/16956/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      41885b02
    • M
      MIPS: microMIPS: Fix decoding of swsp16 instruction · cea8cd49
      Matt Redfearn 提交于
      When the immediate encoded in the instruction is accessed, it is sign
      extended due to being a signed value being assigned to a signed integer.
      The ISA specifies that this operation is an unsigned operation.
      The sign extension leads us to incorrectly decode:
      
      801e9c8e:       cbf1            sw      ra,68(sp)
      
      As having an immediate of 1073741809.
      
      Since the instruction format does not specify signed/unsigned, and this
      is currently the only location to use this instuction format, change it
      to an unsigned immediate.
      
      Fixes: bb9bc468 ("MIPS: Calculate microMIPS ra properly when unwinding the stack")
      Suggested-by: NPaul Burton <paul.burton@imgtec.com>
      Signed-off-by: NMatt Redfearn <matt.redfearn@imgtec.com>
      Reviewed-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
      Cc: Miodrag Dinic <miodrag.dinic@imgtec.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: David Daney <david.daney@cavium.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/16957/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      cea8cd49
    • M
      MIPS: microMIPS: Fix decoding of addiusp instruction · a0ae2b08
      Matt Redfearn 提交于
      Commit 34c2f668 ("MIPS: microMIPS: Add unaligned access support.")
      added handling of microMIPS instructions to manipulate the stack
      pointer. Unfortunately the decoding of the addiusp instruction was
      incorrect, and performed a left shift by 2 bits to the raw immediate,
      rather than decoding the immediate and then performing the shift, as
      documented in the ISA.
      
      This led to incomplete stack traces, due to incorrect frame sizes being
      calculated. For example the instruction:
      801faee0 <do_sys_poll>:
      801faee0:       4e25            addiu   sp,sp,-952
      
      As decoded by objdump, would be interpreted by the existing code as
      having manipulated the stack pointer by +1096.
      
      Fix this by changing the order of decoding the immediate and applying
      the left shift. Also change to accessing the instuction through the
      union to avoid the endianness problem of accesing halfword[0], which
      will fail on big endian systems.
      
      Cope with the special behaviour of immediates 0x0, 0x1, 0x1fe and 0x1ff
      by XORing with 0x100 again if mod(immediate) < 4. This logic was tested
      with the following test code:
      
      int main(int argc, char **argv)
      {
      	unsigned int enc;
      	int imm;
      
      	for (enc = 0; enc < 512; ++enc) {
      		int tmp = enc << 2;
      		imm = -(signed short)(tmp | ((tmp & 0x100) ? 0xfe00 : 0));
      		unsigned short tmp = enc;
      		tmp = (tmp ^ 0x100) - 0x100;
      		if ((unsigned short)(tmp + 2) < 4)
      			tmp ^= 0x100;
      		imm = -(signed short)(tmp << 2);
      		printf("%#x\t%d\t->\t(%#x\t%d)\t%#x\t%d\n",
      		       enc, enc,
      		       (short)tmp, (short)tmp,
      		       imm, imm);
      	}
      	return EXIT_SUCCESS;
      }
      
      Which generates the table:
      
      input encoding	->	tmp (matching manual)	frame size
      -----------------------------------------------------------------------
      0	0	->	(0x100		256)	0xfffffc00	-1024
      0x1	1	->	(0x101		257)	0xfffffbfc	-1028
      0x2	2	->	(0x2		2)	0xfffffff8	-8
      0x3	3	->	(0x3		3)	0xfffffff4	-12
      ...
      0xfe	254	->	(0xfe		254)	0xfffffc08	-1016
      0xff	255	->	(0xff		255)	0xfffffc04	-1020
      0x100	256	->	(0xffffff00	-256)	0x400		1024
      0x101	257	->	(0xffffff01	-255)	0x3fc		1020
      ...
      0x1fc	508	->	(0xfffffffc	-4)	0x10		16
      0x1fd	509	->	(0xfffffffd	-3)	0xc		12
      0x1fe	510	->	(0xfffffefe	-258)	0x408		1032
      0x1ff	511	->	(0xfffffeff	-257)	0x404		1028
      
      Thanks to James Hogan for the test code & verifying the logic.
      
      Fixes: 34c2f668 ("MIPS: microMIPS: Add unaligned access support.")
      Suggested-by: NJames Hogan <james.hogan@imgtec.com>
      Signed-off-by: NMatt Redfearn <matt.redfearn@imgtec.com>
      Cc: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Paul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/16955/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      a0ae2b08
    • M
      MIPS: microMIPS: Fix detection of addiusp instruction · b332fec0
      Matt Redfearn 提交于
      The addiusp instruction uses the pool16d opcode, with bit 0 of the
      immediate set. The test for the addiusp opcode erroneously did a logical
      and of the immediate with mm_addiusp_func, which has value 1, so this
      test always passes when the immediate is non-zero.
      
      Fix the test by replacing the logical and with a bitwise and.
      
      Fixes: 34c2f668 ("MIPS: microMIPS: Add unaligned access support.")
      Signed-off-by: NMatt Redfearn <matt.redfearn@imgtec.com>
      Cc: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Paul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/16954/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      b332fec0
    • M
      MIPS: Handle non word sized instructions when examining frame · 11887ed1
      Matt Redfearn 提交于
      Commit 34c2f668 ("MIPS: microMIPS: Add unaligned access support.")
      added fairly broken support for handling 16bit microMIPS instructions in
      get_frame_info(). It adjusts the instruction pointer by 16bits in the
      case of a 16bit sp move instruction, but not any other 16bit
      instruction.
      
      Commit b6c7a324 ("MIPS: Fix get_frame_info() handling of microMIPS
      function size") goes some way to fixing get_frame_info() to iterate over
      microMIPS instuctions, but the instruction pointer is still manipulated
      using a postincrement, and is of union mips_instruction type. Since the
      union is sized to the largest member (a word), but microMIPS
      instructions are a mix of halfword and word sizes, the function does not
      always iterate correctly, ending up misaligned with the instruction
      stream and interpreting it incorrectly.
      
      Since the instruction modifying the stack pointer is usually the first
      in the function, that one is usually handled correctly. But the
      instruction which saves the return address to the sp is some variable
      number of instructions into the frame and is frequently missed due to
      not being on a word boundary, leading to incomplete walking of the
      stack.
      
      Fix this by incrementing the instruction pointer based on the size of
      the previously decoded instruction (& remove the hack introduced by
      commit 34c2f668 ("MIPS: microMIPS: Add unaligned access support.")
      which adjusts the instruction pointer in the case of a 16bit sp move
      instruction, but not any other).
      
      Fixes: 34c2f668 ("MIPS: microMIPS: Add unaligned access support.")
      Signed-off-by: NMatt Redfearn <matt.redfearn@imgtec.com>
      Cc: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Paul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/16953/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      11887ed1
    • C
      MIPS: Add DWARF unwinding to assembly · 866b6a89
      Corey Minyard 提交于
      This will allow kdump dumps to work correclty with MIPS and
      future DWARF unwinding of the stack to give accurate tracebacks.
      Signed-off-by: NCorey Minyard <cminyard@mvista.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/16990/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      866b6a89
    • C
      MIPS: Fix issues in backtraces · aee16625
      Corey Minyard 提交于
      I saw two problems when doing backtraces:
      
      The compiler was putting a "fast return" at the top of some
      functions, before it set up the frame.  The backtrace code
      would stop when it saw a jump instruction, so it would never
      get to the stack frame setup and would thus misinterpret it.
      To fix this, don't look for jump instructions until the
      frame setup has been seen.
      
      The assembly code here is:
      
      ffffffff80b885a0 <serial8250_handle_irq>:
      ffffffff80b885a0:       c8a00003        bbit0   a1,0x0,ffffffff80b885b0 <serial8250_handle_irq+0x10>
      ffffffff80b885a4:       0000102d        move    v0,zero
      ffffffff80b885a8:       03e00008        jr      ra
      ffffffff80b885ac:       00000000        nop
      ffffffff80b885b0:       67bdffd0        daddiu  sp,sp,-48
      ffffffff80b885b4:       ffb00008        sd      s0,8(sp)
      
      The second problem was the compiler was putting the last
      instruction of the frame save in the delay slot of the
      jump instruction.  If it saved the RA in there, the
      backtrace could would miss it and misinterpret the frame.
      To fix this, make sure to process the instruction after
      the first jump seen.
      
      The assembly code for this is:
      
      ffffffff80806fd0 <plat_irq_dispatch>:
      ffffffff80806fd0:       67bdffd0        daddiu  sp,sp,-48
      ffffffff80806fd4:       ffb30020        sd      s3,32(sp)
      ffffffff80806fd8:       24130018        li      s3,24
      ffffffff80806fdc:       ffb20018        sd      s2,24(sp)
      ffffffff80806fe0:       3c12811c        lui     s2,0x811c
      ffffffff80806fe4:       ffb10010        sd      s1,16(sp)
      ffffffff80806fe8:       3c11811c        lui     s1,0x811c
      ffffffff80806fec:       ffb00008        sd      s0,8(sp)
      ffffffff80806ff0:       3c10811c        lui     s0,0x811c
      ffffffff80806ff4:       08201c03        j       ffffffff8080700c <plat_irq_dispa
      tch+0x3c>
      ffffffff80806ff8:       ffbf0028        sd      ra,40(sp)
      Signed-off-by: NCorey Minyard <cminyard@mvista.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/16992/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      aee16625
  2. 05 9月, 2017 1 次提交
  3. 04 9月, 2017 4 次提交
  4. 30 8月, 2017 12 次提交
  5. 29 8月, 2017 15 次提交
    • J
      MIPS: Remove pt_regs adjustments in indirect syscall handler · 5af2ed36
      James Cowgill 提交于
      If a restartable syscall is called using the indirect o32 syscall
      handler - eg: syscall(__NR_waitid, ...), then it is possible for the
      incorrect arguments to be passed to the syscall after it has been
      restarted. This is because the syscall handler tries to shift all the
      registers down one place in pt_regs so that when the syscall is restarted,
      the "real" syscall is called instead. Unfortunately it only shifts the
      arguments passed in registers, not the arguments on the user stack. This
      causes the 4th argument to be duplicated when the syscall is restarted.
      
      Fix by removing all the pt_regs shifting so that the indirect syscall
      handler is called again when the syscall is restarted. The comment "some
      syscalls like execve get their arguments from struct pt_regs" is long
      out of date so this should now be safe.
      Signed-off-by: NJames Cowgill <James.Cowgill@imgtec.com>
      Reviewed-by: NJames Hogan <james.hogan@imgtec.com>
      Tested-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/15856/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      5af2ed36
    • J
      MIPS: seccomp: Fix indirect syscall args · 3d729dea
      James Hogan 提交于
      Since commit 669c4092 ("MIPS: Give __secure_computing() access to
      syscall arguments."), upon syscall entry when seccomp is enabled,
      syscall_trace_enter() passes a carefully prepared struct seccomp_data
      containing syscall arguments to __secure_computing(). Unfortunately it
      directly uses mips_get_syscall_arg() and fails to take into account the
      indirect O32 system calls (i.e. syscall(2)) which put the system call
      number in a0 and have the arguments shifted up by one entry.
      
      We can't just revert that commit as samples/bpf/tracex5 would break
      again, so use syscall_get_arguments() which already takes indirect
      syscalls into account instead of directly using mips_get_syscall_arg(),
      similar to what populate_seccomp_data() does.
      
      This also removes the redundant error checking of the
      mips_get_syscall_arg() return value (get_user() already zeroes the
      result if an argument from the stack can't be loaded).
      Reported-by: NJames Cowgill <James.Cowgill@imgtec.com>
      Fixes: 669c4092 ("MIPS: Give __secure_computing() access to syscall arguments.")
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      Cc: David Daney <david.daney@cavium.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Will Drewry <wad@chromium.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: netdev@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16994/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      3d729dea
    • P
      MIPS: CM: Use BIT/GENMASK for register fields, order & drop shifts · 93c5bba5
      Paul Burton 提交于
      There's no reason for us not to use BIT() & GENMASK() in asm/mips-cm.h
      when declaring macros corresponding to register fields. This patch
      modifies our definitions to do so.
      
      The *_SHF definitions are removed entirely - they duplicate information
      found in the masks, are infrequently used & can be replaced with use of
      __ffs() where needed.
      
      The *_MSK definitions then lose their _MSK suffix which is now somewhat
      redundant, and users are modified to match.
      
      The field definitions are moved to follow the appropriate register's
      accessor functions, which helps to keep the field definitions in order &
      to find the appropriate fields for a given register. Whilst here a
      comment is added describing each register & including its name, which is
      helpful both for linking the register back to hardware documentation &
      for grepping purposes.
      
      This also cleans up a couple of issues that became obvious as a result
      of making the changes described above:
      
        - We previously had definitions for GCR_Cx_RESET_EXT_BASE & a phony
          copy of that named GCR_RESET_EXT_BASE - a register which does not
          exist. The bad definitions were added by commit 497e803e ("MIPS:
          smp-cps: Ensure secondary cores start with EVA disabled") and made
          use of from boot_core(), which is now modified to use the
          GCR_Cx_RESET_EXT_BASE definitions.
      
        - We had a typo in CM_GCR_ERROR_CAUSE_ERRINGO_MSK - we now correctly
          define this as inFo rather than inGo.
      
      Now that we don't duplicate field information between _SHF & _MSK
      definitions, and keep the fields next to the register accessors, it will
      be much easier to spot & prevent any similar oddities being introduced
      in the future.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Acked-by: Thomas Gleixner <tglx@linutronix.de
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/17001/
      Patchwork: https://patchwork.linux-mips.org/patch/17216/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      93c5bba5
    • P
      MIPS: CM: Specify register size when generating accessors · b025d518
      Paul Burton 提交于
      Some CM registers are always 32 bits, or at least only use bits in the
      lower 32 bits of the register. For these registers it is wasteful for us
      to generate accessors which bother to check mips_cm_is64 & perform 64
      bit accesses.
      
      This patch modifies the accessor generation to take into account the
      size of the register, and for 32 bit registers we generate accessors
      which only ever perform 32 bit accesses. For 64 bit registers we either
      perform a 64 bit access or two 32 bit accesses, depending upon the value
      of mips_cm_is64. Doing this saves us ~1.5KiB of code in a generic 64r6el
      kernel, and perhaps more importantly simplifies various code paths.
      
      This removes the read64_gcr_* accessors, so mips_cm_error_report() is
      modified to stop using them & instead use the regular read_gcr_*
      accessors which will return 64 bit values from the 64 bit registers.
      
      The new accessor macros are placed in asm/mips-cps.h such that they can
      be shared by CPC & GIC code in later patches.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/17000/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      b025d518
    • P
      MIPS: CM: Rename mips_cm_base to mips_gcr_base · abe852ea
      Paul Burton 提交于
      We currently have a mips_cm_base variable which holds the base address
      of the Coherence Manager (CM) Global Configuration Registers (GCRs), and
      accessor functions which use the GCR in their names. This works fine,
      but gets in the way of sharing the code to generate the accessor
      functions with other blocks (ie. CPC & GIC) because that code would then
      need to separately handle the name of the base address variable & the
      name used in the accessor functions.
      
      In order to prepare for sharing the accessor generation code between CM,
      CPC & GIC code this patch renames mips_cm_base to mips_gcr_base such
      that the "gcr" portion is common to both the base address variable & the
      accessor function names.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16999/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      abe852ea
    • P
      MIPS: Declare various variables & functions static · b7fc2cc5
      Paul Burton 提交于
      We currently have various variables & functions which are only used
      within a single translation unit, but which we don't declare static.
      This causes various sparse warnings of the form:
      
        arch/mips/kernel/mips-r2-to-r6-emul.c:49:1: warning: symbol
          'mipsr2emustats' was not declared. Should it be static?
      
        arch/mips/kernel/unaligned.c:1381:11: warning: symbol 'reg16to32st'
          was not declared. Should it be static?
      
        arch/mips/mm/mmap.c:146:15: warning: symbol 'arch_mmap_rnd' was not
          declared. Should it be static?
      
      Fix these & others by declaring various affected variables & functions
      static, avoiding the sparse warnings & redundant symbols.
      
      [ralf@linux-mips.org: Add Marcin's build fix.]
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: trivial@kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/17176/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      b7fc2cc5
    • P
      MIPS: Remove plat_timer_setup() · 7d630e83
      Paul Burton 提交于
      The plat_timer_setup() function is entirely unused - nothing calls it,
      and no platforms provide it. Perhaps our dummy implementation was once
      useful as an aid in forward porting platforms, but its time has long
      since passed so let's remove the dead code.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: trivial@kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/17175/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      7d630e83
    • P
      MIPS: Include linux/cpu.h for arch_cpu_idle() · 91955e3e
      Paul Burton 提交于
      arch/mips/kernel/idle.c provides our implementation of the
      arch_cpu_idle() function, but doesn't include the linux/cpu.h header
      which declares it. This leads to a warning from sparse:
      
        arch/mips/kernel/idle.c:256:6: warning: symbol 'arch_cpu_idle' was not
          declared. Should it be static?
      
      Fix this by including linux/cpu.h to get the declaration of
      arch_cpu_idle().
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: trivial@kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/17169/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      91955e3e
    • R
      MIPS: signal: Remove unreachable code from force_fcr31_sig(). · b123718b
      Ralf Baechle 提交于
      Based on discussion with Linus remove the impossible to reach code
      rather than replacing it with a BUG().
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      Link: http://lkml.kernel.org/r/20170718140651.15973-4-ebiederm@xmission.com
      b123718b
    • P
      MIPS: Remove unused ST_OFF from r2300_switch.S · df4c87f5
      Paul Burton 提交于
      Commit 1a3d5957 ("MIPS: Tidy up FPU context switching") removed
      usage of ST_OFF, leaving it behind as dead code. Commit 828d1e4e
      ("MIPS: Remove dead define of ST_OFF") then removed the definition of
      ST_OFF from r4k_switch.S as a cleanup. However the unused definition of
      ST_OFF has been left behind in r2300_switch.S. Remove it.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16239/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      df4c87f5
    • P
      MIPS: Move r2300 FP code from r2300_switch.S to r2300_fpu.S · 423fb0d5
      Paul Burton 提交于
      Move _save_fp(), _restore_fp() & _init_fpu() out of r2300_switch.S &
      into r2300_fpu.S. This logically places all FP-related asm code into
      r2300_fpu.S & provides consistency with R4K after the preceding commit.
      
      Besides cleaning up this will be useful for later patches which disable
      FP support.
      
      [ralf@linux-mips.org: Fixed build issues reported by Arnd Bergmann
      <arnd@arndb.de>]
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16238/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      423fb0d5
    • P
      MIPS: Move r4k FP code from r4k_switch.S to r4k_fpu.S · a2aea699
      Paul Burton 提交于
      Move _save_fp(), _restore_fp(), _save_msa(), _restore_msa(),
      _init_msa_upper() & _init_fpu() out of r4k_switch.S & into r4k_fpu.S.
      This allows us to clean up the way in which Octeon includes the default
      r4k implementations of these FP functions despite replacing resume(),
      and makes CONFIG_R4K_FPU more straightforwardly represent all
      configurations that have an R4K-style FPU, including Octeon.
      
      Besides cleaning up this will be useful for later patches which disable
      FP support.
      
      [ralf@linux-mips.org: Fixed build issues reported by Arnd Bergmann
      <arnd@arndb.de>]
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16237/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      a2aea699
    • P
      MIPS: Remove unused R6000 support · 3b2db173
      Paul Burton 提交于
      The kernel contains a small amount of incomplete code aimed at
      supporting old R6000 CPUs. This is:
      
        - Unused, as no machine selects CONFIG_SYS_HAS_CPU_R6000.
      
        - Broken, since there are glaring errors such as r6000_fpu.S moving
          the FCSR register to t1, then ignoring it & instead saving t0 into
          struct sigcontext...
      
        - A maintenance headache, since it's code that nobody can test which
          nevertheless imposes constraints on code which it shares with other
          machines.
      
      Remove this incomplete & broken R6000 CPU support in order to clean up
      and in preparation for changes which will no longer need to consider
      dragging the pretense of R6000 support along with them.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16236/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      3b2db173
    • M
      MIPS: R6: Constify r2_decoder_tables · 114c3708
      Matt Redfearn 提交于
      The r2_decoder_tables are never modified. They are arrays of constant
      values and as such should be declared const.
      
      This change saves 256 bytes of kernel text, and 128 bytes of kernel data
      (384 bytes total) on a 32r6el_defconfig (with SMP disabled)
      Before:
         text	   data	    bss	    dec	    hex	filename
      5576221	1080804	 267040	6924065	 69a721	vmlinux
      After:
         text	   data	    bss	    dec	    hex	filename
      5575965	1080676	 267040	6923681	 69a5a1	vmlinux
      Signed-off-by: NMatt Redfearn <matt.redfearn@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/15289/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      114c3708
    • M
      MIPS: SMP: Constify smp ops · ff2c8252
      Matt Redfearn 提交于
      smp_ops providers do not modify their ops structures, so they should be
      made const for robustness. Since currently the MIPS kernel is not mapped
      with memory protection, this does not in itself provide any security
      benefit, but it still makes sense to make this change.
      
      There are also slight code size efficincies from the structure being
      made read-only, saving 128 bytes of kernel text on a
      pistachio_defconfig.
      Before:
         text	   data	    bss	    dec	    hex	filename
      7187239	1772752	 470224	9430215	 8fe4c7	vmlinux
      After:
         text	   data	    bss	    dec	    hex	filename
      7187111	1772752	 470224	9430087	 8fe447	vmlinux
      Signed-off-by: NMatt Redfearn <matt.redfearn@imgtec.com>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
      Cc: Bart Van Assche <bart.vanassche@sandisk.com>
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Huacai Chen <chenhc@lemote.com>
      Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
      Cc: Kevin Cernekee <cernekee@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Doug Ledford <dledford@redhat.com>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Joe Perches <joe@perches.com>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Paul Burton <paul.burton@imgtec.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Steven J. Hill <steven.hill@cavium.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/16784/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      ff2c8252