1. 28 2月, 2017 1 次提交
  2. 03 1月, 2017 2 次提交
    • P
      MIPS: Remove r2_emul_return from struct thread_info · e11124d8
      Paul Burton 提交于
      The r2_emul_return field in struct thread_info was used in order to take
      an alternate codepath when returning to userland, which (besides not
      implementing certain features) effectively used the eretnc instruction
      in place of eret. The difference is that eretnc doesn't clear LLBit, and
      therefore doesn't cause a linked load & store sequence to fail due to
      emulation like eret would.
      
      The reason eret would usually be used to clear LLBit is so that after
      context switching we ensure that a load performed by one task doesn't
      influence another task. However commit 7c151d3d ("MIPS: Make use of
      the ERETNC instruction on MIPS R6") which introduced the r2_emul_return
      field and conditional use of eretnc also for some reason began
      explicitly clearing LLBit during context switches - despite retaining
      the use of eret for everything but returns from the pre-r6 instruction
      emulation code.
      
      As LLBit is cleared upon context switches anyway, simplify this by using
      eretnc unconditionally for MIPSr6 kernels. This allows us to remove the
      4 byte r2_emul_return boolean from struct thread_info, simplify the
      return to user code in entry.S and avoid the overhead of tracking &
      checking state which we don't need.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/14408/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      e11124d8
    • P
      MIPS: traps: Ensure L1 & L2 ECC checking match for CM3 systems · 35e6de38
      Paul Burton 提交于
      On systems with CM3, we must ensure that the L1 & L2 ECC enables are set
      to the same value. This is presumed by the hardware & cache corruption
      can occur when it is not the case. Support enabling & disabling the L2
      ECC checking on CM3 systems where this is controlled via a GCR, and
      ensure that it matches the state of L1 ECC checking. Remove I6400 from
      the switch statement it will no longer hit, and which was incorrect
      since the L2 ECC enable bit isn't in the CP0 ErrCtl register.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/14413/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      35e6de38
  3. 25 12月, 2016 1 次提交
  4. 04 11月, 2016 5 次提交
  5. 07 10月, 2016 1 次提交
    • P
      MIPS: Print CM error reports upon bus errors · dabdc185
      Paul Burton 提交于
      If a bus error occurs on a system with a MIPS Coherence Manager (CM)
      then the CM may hold useful diagnostic information. Printing this out
      has so far been left up to boards, with the requirement that they
      register a board_be_handler function & call mips_cm_error_decode() from
      there.
      
      In order to avoid boards other than Malta needing to duplicate this
      code, call mips_cm_error_decode() automatically if the board registers
      no board_be_handler, and remove the Malta implementation of that.
      
      This patch results in no functional change, but removes a further piece
      of platform-specific code.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/14350/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      dabdc185
  6. 04 10月, 2016 4 次提交
    • M
      MIPS: traps: Ensure full EBase is written · 4b22c693
      Matt Redfearn 提交于
      On CPUs which support the EBase WG (write gate) flag, the most
      significant bits of the exception base can be changed. Firmware running
      on a VP(E) using MIPS rproc may change EBase to point into the user
      segment where the firmware is located such that it can service
      interrupts. When control is transferred back to the kernel the EBase
      must be switched back into the kernel segment, such that the kernel's
      exception vectors are used.
      
      Similarly when vectored interrupts (vint) or vectored external interrupt
      controllers (veic) are enabled an exception vector is allocated from
      bootmem, and written to the EBase register. Due to the WG flag being
      clear, only bits 29:12 will be written. Asside from the rproc case above
      this is normally fine (as it will usually be a low allocation within the
      KSeg0 range, however when Enhanced Virtual Addressing (EVA) is enabled
      the allocation may be outside of the traditional KSeg0/KSeg1 address
      range, resulting in the wrong EBase being written.
      
      Correct both cases (configure_exception_vector() for the boot CPU, and
      per_cpu_trap_init() for secondary CPUs) to write EBase with the WG flag
      first if supported.
      
      On the Malta EVA configuration, KSeg0 is mapped to physical address 0,
      and memory is allocated from the KUSeg segment which is mapped to
      physical address 0x80000000, which physically aliases the RAM at 0. This
      only worked due to the exception base address aliasing the same
      underlying RAM that was written to & cache flushed, and due to
      flush_icache_range() going beyond the call of duty and flushing from the
      L2 cache too (due to the differing physical addresses).
      Signed-off-by: NMatt Redfearn <matt.redfearn@imgtec.com>
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Leonid Yegoshin <leonid.yegoshin@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/14150/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      4b22c693
    • J
      MIPS: traps: Convert ebase to KSEG0 · c195e079
      James Hogan 提交于
      When allocating boot memory for the exception vector when vectored
      interrupts (vint) or vectored external interrupt controllers (veic) are
      enabled, try to ensure that the virtual address resides in KSeg0 (and
      WARN should that not be possible).
      
      This will be helpful on MIPS64 cores supporting the CP0_EBase Write Gate
      (WG) bit once we start using the WG bit to write the full ebase into
      CP0_EBase, as we ideally need to avoid hitting the architecturally
      poorly defined exception base for Cache Errors when CP0_EBase is in
      XKPhys.
      
      An exception is made for Enhanced Virtual Addressing (EVA) kernels which
      allow segments to be rearranged and to become uncached during cache
      error handling, making it valid for ebase to be elsewhere.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Matt Redfearn <matt.redfearn@imgtec.com>
      Cc: Leonid Yegoshin <leonid.yegoshin@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/14149/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      c195e079
    • J
      MIPS: traps: 64bit kernels should read CP0_EBase 64bit · 18022894
      James Hogan 提交于
      When reading the CP0_EBase register containing the WG (write gate) bit,
      the ebase variable should be set to the full value of the register, i.e.
      on a 64-bit kernel the full 64-bit width of the register via
      read_cp0_ebase_64(), and on a 32-bit kernel the full 32-bit width
      including bits 31:30 which may be writeable.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Signed-off-by: NMatt Redfearn <matt.redfearn@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/14148/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      18022894
    • P
      MIPS: Migrate exception table users off module.h and onto extable.h · 9f3b8081
      Paul Gortmaker 提交于
      These files were only including module.h for exception table
      related functions.  We've now separated that content out into its
      own file "extable.h" so now move over to that and avoid all the
      extra header content in module.h that we don't really need to compile
      these files.
      
      In the case of traps.c we can't dump the module.h include since it is
      also used to provide "print_modules".
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/13934/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      9f3b8081
  7. 21 7月, 2016 1 次提交
  8. 16 6月, 2016 2 次提交
    • J
      MIPS: KVM: Don't hardcode restored HWREna · b937ff62
      James Hogan 提交于
      KVM modifies CP0_HWREna during guest execution so it can trap and
      emulate RDHWR instructions, however it always restores the hardcoded
      value 0x2000000F. This assumes the presence of the UserLocal register,
      and the absence of any implementation dependent or future HW registers.
      
      Fix by exporting the value that traps.c write into CP0_HWREna, and
      loading from there instead of hard coding.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Acked-by: NRalf Baechle <ralf@linux-mips.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Radim Krčmář <rkrcmar@redhat.com>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      b937ff62
    • J
      MIPS: Clean up RDHWR handling · aff565aa
      James Hogan 提交于
      No preprocessor definitions are used in the handling of the registers
      accessible with the RDHWR instruction, nor the corresponding bits in the
      CP0 HWREna register.
      
      Add definitions for both the register numbers (MIPS_HWR_*) and HWREna
      bits (MIPS_HWRENA_*) in asm/mipsregs.h and make use of them in the
      initialisation of HWREna and emulation of the RDHWR instruction.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Acked-by: NRalf Baechle <ralf@linux-mips.org>
      Cc: David Daney <david.daney@cavium.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Radim Krčmář <rkrcmar@redhat.com>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      aff565aa
  9. 14 6月, 2016 1 次提交
    • J
      MIPS: KVM: Restore host EBase from ebase variable · 878edf01
      James Hogan 提交于
      The host kernel's exception vector base address is currently saved in
      the VCPU structure at creation time, and restored on a guest exit.
      However it doesn't change and can already be easily accessed from the
      'ebase' variable (arch/mips/kernel/traps.c), so drop the host_ebase
      member of kvm_vcpu_arch, export the 'ebase' variable to modules and load
      from there instead.
      
      This does result in a single extra instruction (lui) on the guest exit
      path, but simplifies the code a bit and removes the redundant storage of
      the host exception base address.
      
      Credit for the idea goes to Cavium's VZ KVM implementation.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Radim Krčmář <rkrcmar@redhat.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      878edf01
  10. 17 5月, 2016 1 次提交
    • M
      MIPS: MSA: Fix a link error on `_init_msa_upper' with older GCC · e49d3848
      Maciej W. Rozycki 提交于
      Fix a build regression from commit c9017757 ("MIPS: init upper 64b
      of vector registers when MSA is first used"):
      
      arch/mips/built-in.o: In function `enable_restore_fp_context':
      traps.c:(.text+0xbb90): undefined reference to `_init_msa_upper'
      traps.c:(.text+0xbb90): relocation truncated to fit: R_MIPS_26 against `_init_msa_upper'
      traps.c:(.text+0xbef0): undefined reference to `_init_msa_upper'
      traps.c:(.text+0xbef0): relocation truncated to fit: R_MIPS_26 against `_init_msa_upper'
      
      to !CONFIG_CPU_HAS_MSA configurations with older GCC versions, which are
      unable to figure out that calls to `_init_msa_upper' are indeed dead.
      Of the many ways to tackle this failure choose the approach we have
      already taken in `thread_msa_context_live'.
      
      [ralf@linux-mips.org: Drop patch segment to junk file.]
      Signed-off-by: NMaciej W. Rozycki <macro@imgtec.com>
      Cc: stable@vger.kernel.org # v3.16+
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/13271/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      e49d3848
  11. 13 5月, 2016 7 次提交
  12. 09 5月, 2016 1 次提交
    • J
      MIPS: Avoid using unwind_stack() with usermode · 81a76d71
      James Hogan 提交于
      When showing backtraces in response to traps, for example crashes and
      address errors (usually unaligned accesses) when they are set in debugfs
      to be reported, unwind_stack will be used if the PC was in the kernel
      text address range. However since EVA it is possible for user and kernel
      address ranges to overlap, and even without EVA userland can still
      trigger an address error by jumping to a KSeg0 address.
      
      Adjust the check to also ensure that it was running in kernel mode. I
      don't believe any harm can come of this problem, since unwind_stack() is
      sufficiently defensive, however it is only meant for unwinding kernel
      code, so to be correct it should use the raw backtracing instead.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Reviewed-by: NLeonid Yegoshin <Leonid.Yegoshin@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: <stable@vger.kernel.org> # 3.15+
      Patchwork: https://patchwork.linux-mips.org/patch/11701/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      (cherry picked from commit d2941a975ac745c607dfb590e92bb30bc352dad9)
      81a76d71
  13. 04 4月, 2016 1 次提交
  14. 03 4月, 2016 2 次提交
  15. 05 3月, 2016 1 次提交
  16. 02 2月, 2016 2 次提交
    • M
      MIPS: traps.c: Correct microMIPS RDHWR emulation · 7aa70471
      Maciej W. Rozycki 提交于
      Fix the code to fetch and decode the whole 32-bit instruction.  This
      only really matters with the `noulri' kernel parameter as all microMIPS
      processors are supposed to have all the hardware registers we support.
      Signed-off-by: NMaciej W. Rozycki <macro@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/12281/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      7aa70471
    • M
      MIPS: traps.c: Don't emulate RDHWR in the CpU #0 exception handler · 10f6d99f
      Maciej W. Rozycki 提交于
      In the regular MIPS instruction set RDHWR is encoded with the SPECIAL3
      (011111) major opcode.  Therefore it cannot trigger the CpU (Coprocessor
      Unusable) exception, and certainly not for coprocessor 0, as the opcode
      does not overlap with any of the older ISA reservations, i.e. LWC0
      (110000), SWC0 (111000), LDC0 (110100) or SDC0 (111100).  The closest
      match might be SDC3 (111111), possibly causing a CpU #3 exception,
      however our code does not handle it anyway.  A quick check with a MIPS I
      and a MIPS III processor:
      
      CPU0 revision is: 00000220 (R3000)
      CPU0 revision is: 00000440 (R4400SC)
      
      indeed indicates that the RI (Reserved Instruction) exception is
      triggered.  It's only LL and SC that require emulation in the CpU #0
      exception handler as they reuse the LWC0 and SWC0 opcodes respectively.
      
      In the microMIPS instruction set RDHWR is mandatory and triggering the
      RI exception is required on unimplemented or disabled register accesses.
      Therefore emulating the microMIPS instruction in the CpU #0 exception
      handler is not required either.
      Signed-off-by: NMaciej W. Rozycki <macro@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/12280/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      10f6d99f
  17. 24 1月, 2016 1 次提交
  18. 09 11月, 2015 1 次提交
  19. 26 10月, 2015 1 次提交
  20. 03 9月, 2015 3 次提交
  21. 26 8月, 2015 1 次提交