Skip to content
  1. Feb 29, 2016
  2. Feb 11, 2016
    • Daniel Wagner's avatar
      mips: Differentiate between 32 and 64 bit ELF header · f4d3d504
      Daniel Wagner authored
      
      
      Depending on the configuration either the 32 or 64 bit version of
      elf_check_arch() is defined. parse_crash_elf{32|64}_headers() does
      some basic verification of the ELF header via
      vmcore_elf{32|64}_check_arch() which happen to map to elf_check_arch().
      Since the implementation 32 and 64 bit version of elf_check_arch()
      differ, we use the wrong type:
      
         In file included from include/linux/elf.h:4:0,
                          from fs/proc/vmcore.c:13:
         fs/proc/vmcore.c: In function 'parse_crash_elf64_headers':
      >> arch/mips/include/asm/elf.h:228:23: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
           struct elfhdr *__h = (hdr);     \
                                ^
         include/linux/crash_dump.h:41:37: note: in expansion of macro 'elf_check_arch'
          #define vmcore_elf64_check_arch(x) (elf_check_arch(x) || vmcore_elf_check_arch_cross(x))
                                              ^
         fs/proc/vmcore.c:1015:4: note: in expansion of macro 'vmcore_elf64_check_arch'
            !vmcore_elf64_check_arch(&ehdr) ||
             ^
      
      Therefore, we rather define vmcore_elf{32|64}_check_arch() as a
      basic machine check and use it also in binfm_elf?32.c as well.
      
      Signed-off-by: default avatarDaniel Wagner <daniel.wagner@bmw-carit.de>
      Suggested-by: default avatarMaciej W. Rozycki <macro@imgtec.com>
      Reviewed-by: default avatarMaciej W. Rozycki <macro@imgtec.com>
      Reported-by: default avatarFengguang Wu <fengguang.wu@intel.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/12529/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      f4d3d504
  3. Feb 09, 2016
    • Paul Burton's avatar
      MIPS: Fix early CM probing · 3af5a67c
      Paul Burton authored
      
      
      Commit c014d164 ("MIPS: Add platform callback before initializing
      the L2 cache") added a platform_early_l2_init function in order to allow
      platforms to probe for the CM before L2 initialisation is performed, so
      that CM GCRs are available to mips_sc_probe.
      
      That commit actually fails to do anything useful, since it checks
      mips_cm_revision to determine whether it should call mips_cm_probe but
      the result of mips_cm_revision will always be 0 until mips_cm_probe has
      been called. Thus the "early" mips_cm_probe call never occurs.
      
      Fix this & drop the useless weak platform_early_l2_init function by
      simply calling mips_cm_probe from setup_arch. For platforms that don't
      select CONFIG_MIPS_CM this will be a no-op, and for those that do it
      removes the requirement for them to call mips_cm_probe manually
      (although doing so isn't harmful for now).
      
      Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
      Reviewed-by: default avatarAlexander Sverdlin <alexander.sverdlin@nokia.com>
      Cc: Andrzej Hajda <a.hajda@samsung.com>
      Cc: Aaro Koskinen <aaro.koskinen@nokia.com>
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Peter Hurley <peter@hurleysoftware.com>
      Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
      Cc: Jaedon Shin <jaedon.shin@gmail.com>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Jonas Gorski <jogo@openwrt.org>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/12475/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      3af5a67c
  4. Feb 05, 2016
  5. Feb 02, 2016
    • Maciej W. Rozycki's avatar
      MIPS: traps.c: Correct microMIPS RDHWR emulation · 7aa70471
      Maciej W. Rozycki authored
      
      
      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: default avatarMaciej W. Rozycki <macro@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/12281/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      7aa70471
    • Maciej W. Rozycki's avatar
      MIPS: traps.c: Don't emulate RDHWR in the CpU #0 exception handler · 10f6d99f
      Maciej W. Rozycki authored
      
      
      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: default avatarMaciej W. Rozycki <macro@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/12280/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      10f6d99f
  6. Feb 01, 2016
  7. Jan 24, 2016
  8. Jan 19, 2016
    • Maciej W. Rozycki's avatar
      MIPS: Add IEEE Std 754 conformance mode selection · 503943e0
      Maciej W. Rozycki authored
      
      
      Add an `ieee754=' kernel parameter to control IEEE Std 754 conformance
      mode.
      
      Use separate flags copied from the respective CPU feature flags, and
      adjusted according to the conformance mode selected, to make binaries
      requesting individual NaN encoding modes accepted or rejected as needed.
      Update the initial setting for FCSR and, in the full FPU emulation mode,
      its read-only mask accordingly.  Accept the mode selection requested for
      legacy processors as well.
      
      As with the EF_MIPS_NAN2008 ELF file header flag adjust both ABS2008 and
      NAN2008 bits at the same time, to match the choice made for hardware
      currently implemented.
      
      Signed-off-by: default avatarMaciej W. Rozycki <macro@imgtec.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Matthew Fortune <Matthew.Fortune@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/11481/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      503943e0
    • Maciej W. Rozycki's avatar
      MIPS: Determine the presence of IEEE Std 754-2008 features · 93adeaf6
      Maciej W. Rozycki authored
      
      
      Determine the presence of and the amount of control available over IEEE
      Std 754-2008 features.
      
      In the case of a hardware FPU being used examine the FIR register for
      the presence of the HAS2008 bit and then the FCSR register for the
      writability of the ABS2008 and NAN2008 bits and the hardwired state of
      each of these bits if read-only.  Update the initial FCSR contents used
      for threads and the FCSR writability mask accordingly.
      
      For full FPU emulation and MIPS32 or MIPS64 processors make the FCSR
      ABS2008 and NAN2008 bits writable.
      
      Signed-off-by: default avatarMaciej W. Rozycki <macro@imgtec.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Matthew Fortune <Matthew.Fortune@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/11480/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      93adeaf6
    • Maciej W. Rozycki's avatar
      MIPS: ELF: Interpret the NAN2008 file header flag · 2b5e869e
      Maciej W. Rozycki authored
      
      
      Handle the EF_MIPS_NAN2008 ELF file header flag and refuse execution
      where there is no support in the FPU for the NaN encoding mode requested
      by a binary invoked.  Ensure that the setting of the bit in the binary
      matches one in any intepreter used.  Set the thread's initial FCSR
      contents according to the value of the EF_MIPS_NAN2008.
      
      Set the values of the FCSR ABS2008 and NAN2008 bits both to the same
      value if possible, to take the approach taken with existing FPU hardware
      into account.  As of now all implementations have both bits hardwired to
      the same value, that is both are fixed at 0 or both are fixed at 1, even
      though the architecture allows for implementations where the amount of
      control implemented with each of these two individual bits is
      independent of each other.
      
      Signed-off-by: default avatarMaciej W. Rozycki <macro@imgtec.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Matthew Fortune <Matthew.Fortune@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/11479/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      2b5e869e
    • Maciej W. Rozycki's avatar
      ELF: Also pass any interpreter's file header to `arch_check_elf' · eb4bc076
      Maciej W. Rozycki authored
      
      
      Also pass any interpreter's file header to `arch_check_elf' so that any
      architecture handler can have a look at it if needed.
      
      Signed-off-by: default avatarMaciej W. Rozycki <macro@imgtec.com>
      Acked-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Acked-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Cc: Matthew Fortune <Matthew.Fortune@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/11478/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      eb4bc076
    • Maciej W. Rozycki's avatar
      MIPS: math-emu: Add IEEE Std 754-2008 NaN encoding emulation · 90d53a91
      Maciej W. Rozycki authored
      
      
      Implement IEEE Std 754-2008 NaN encoding wired to the state of the
      FCSR.NAN2008 bit.  Make the interpretation of the quiet bit in NaN data
      as follows:
      
      * in the legacy mode originally defined by the MIPS architecture the
        value of 1 denotes an sNaN whereas the value of 0 denotes a qNaN,
      
      * in the 2008 mode introduced with revision 5 of the MIPS architecture
        the value of 0 denotes an sNaN whereas the value of 1 denotes a qNaN,
        following the definition of the preferred NaN encoding introduced with
        IEEE Std 754-2008.
      
      In the 2008 mode, following the requirement of the said standard, quiet
      an sNaN where needed by setting the quiet bit to 1 and leaving all the
      NaN payload bits unchanged.
      
      Update format conversion operations according to the rules set by IEEE
      Std 754-2008 and the MIPS architecture.  Specifically:
      
      * propagate NaN payload bits through conversions between floating-point
        formats such that as much information as possible is preserved and
        specifically a conversion from a narrower format to a wider format and
        then back to the original format does not change a qNaN payload in any
        way,
      
      * conversions from a floating-point to an integer format where the
        source is a NaN, infinity or a value that would convert to an integer
        outside the range of the result format produce, under the default
        exception handling, the respective values defined by the MIPS
        architecture.
      
      In full FPU emulation set the FIR.HAS2008 bit to 1, however do not make
      any further FCSR bits writable.
      
      Signed-off-by: default avatarMaciej W. Rozycki <macro@imgtec.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Matthew Fortune <Matthew.Fortune@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/11477/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      90d53a91
    • Maciej W. Rozycki's avatar
      MIPS: Define the legacy-NaN and 2008-NaN features · 9519ef37
      Maciej W. Rozycki authored
      
      
      Allocate CPU option bits and define macros for the legacy-NaN and
      2008-NaN IEEE Std 754 MIPS architecture features.  Unconditionally mark
      the legacy-NaN feature as present across hardware and emulated
      floating-point configurations.
      
      Signed-off-by: default avatarMaciej W. Rozycki <macro@imgtec.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Matthew Fortune <Matthew.Fortune@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/11475/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      9519ef37
    • Maciej W. Rozycki's avatar
      MIPS: Use a union to access the ELF file header · 2ed02dd4
      Maciej W. Rozycki authored
      
      
      Rewrite `arch_elf_pt_proc' and `arch_check_elf' using a union to access
      the ELF file header.
      
      Signed-off-by: default avatarMaciej W. Rozycki <macro@imgtec.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Matthew Fortune <Matthew.Fortune@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/11474/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      2ed02dd4
  9. Dec 22, 2015
    • Paul Burton's avatar
      MIPS: CPS: drop .set mips64r2 directives · f3575e23
      Paul Burton authored
      
      
      Commit 977e043d ("MIPS: kernel: cps-vec: Replace mips32r2 ISA level
      with mips64r2") leads to .set mips64r2 directives being present in 32
      bit (ie. CONFIG_32BIT=y) kernels. This is incorrect & leads to MIPS64
      instructions being emitted by the assembler when expanding
      pseudo-instructions. For example the "move" instruction can legitimately
      be expanded to a "daddu". This causes problems when the kernel is run on
      a MIPS32 CPU, as CONFIG_32BIT kernels of course often are...
      
      Fix this by dropping the .set <ISA> directives entirely now that Kconfig
      should be ensuring that kernels including this code are built with a
      suitable -march= compiler flag.
      
      Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: <stable@vger.kernel.org> # 3.16+
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/10869/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      f3575e23
    • James Hogan's avatar
      MIPS: uaccess: Take EVA into account in [__]clear_user · d6a428fb
      James Hogan authored
      
      
      __clear_user() (and clear_user() which uses it), always access the user
      mode address space, which results in EVA store instructions when EVA is
      enabled even if the current user address limit is KERNEL_DS.
      
      Fix this by adding a new symbol __bzero_kernel for the normal kernel
      address space bzero in EVA mode, and call that from __clear_user() if
      eva_kernel_access().
      
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Cc: Paul Burton <paul.burton@imgtec.com>
      Cc: Leonid Yegoshin <leonid.yegoshin@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/10844/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      d6a428fb
  10. Dec 04, 2015
  11. Nov 12, 2015
  12. Nov 11, 2015
    • Jonas Gorski's avatar
      MIPS: Make the kernel arguments from dtb available · 2024972e
      Jonas Gorski authored
      
      
      Similar to how arm allows using selecting between bootloader arguments,
      dtb arguments and both, allow to select them on mips. But since we have
      less control over the place of the dtb do not modify it but instead use
      the boot_command_line for merging them.
      
      The default is "use bootloader arguments" to keep the current behaviour
      as default.
      
      Signed-off-by: default avatarJonas Gorski <jogo@openwrt.org>
      Cc: linux-mips@linux-mips.org
      Cc: Kevin Cernekee <cernekee@gmail.com>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: John Crispin <blogic@openwrt.org>
      Cc: Ganesan Ramalingam <ganesanr@broadcom.com>
      Cc: Jayachandran C <jchandra@broadcom.com>
      Cc: Andrew Bresticker <abrestic@chromium.org>
      Cc: James Hartley <james.hartley@imgtec.com>
      Patchwork: https://patchwork.linux-mips.org/patch/11284/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      2024972e
    • Aaro Koskinen's avatar
      MIPS: Add LATENCYTOP support · e1e16115
      Aaro Koskinen authored
      
      
      Add LATENCYTOP support for MIPS. Tested on OCTEON.
      
      Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@nokia.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/11353/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      e1e16115
    • Alex Smith's avatar
      MIPS: VDSO: Add implementations of gettimeofday() and clock_gettime() · a7f4df4e
      Alex Smith authored
      
      
      Add user-mode implementations of gettimeofday() and clock_gettime() to
      the VDSO. This is currently usable with 2 clocksources: the CP0 count
      register, which is accessible to user-mode via RDHWR on R2 and later
      cores, or the MIPS Global Interrupt Controller (GIC) timer, which
      provides a "user-mode visible" section containing a mirror of its
      counter registers. This section must be mapped into user memory, which
      is done below the VDSO data page.
      
      When a supported clocksource is not in use, the VDSO functions will
      return -ENOSYS, which causes libc to fall back on the standard syscall
      path.
      
      When support for neither of these clocksources is compiled into the
      kernel at all, the VDSO still provides clock_gettime(), as the coarse
      realtime/monotonic clocks can still be implemented. However,
      gettimeofday() is not provided in this case as nothing can be done
      without a suitable clocksource. This causes the symbol lookup to fail
      in libc and it will then always use the standard syscall path.
      
      This patch includes a workaround for a bug in QEMU which results in
      RDHWR on the CP0 count register always returning a constant (incorrect)
      value. A fix for this has been submitted, and the workaround can be
      removed after the fix has been in stable releases for a reasonable
      amount of time.
      
      A simple performance test which calls gettimeofday() 1000 times in a
      loop and calculates the average execution time gives the following
      results on a Malta + I6400 (running at 20MHz):
      
       - Syscall:    ~31000 ns
       - VDSO (GIC): ~15000 ns
       - VDSO (CP0): ~9500 ns
      
      [markos.chandras@imgtec.com:
      - Minor code re-arrangements in order for mappings to be made
      in the order they appear to the process' address space.
      - Move do_{monotonic, realtime} outside of the MIPS_CLOCK_VSYSCALL ifdef
      - Use gic_get_usm_range so we can do the GIC mapping in the
      arch/mips/kernel/vdso instead of the GIC irqchip driver]
      
      Signed-off-by: default avatarAlex Smith <alex.smith@imgtec.com>
      Signed-off-by: default avatarMarkos Chandras <markos.chandras@imgtec.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/11338/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      a7f4df4e
    • Alex Smith's avatar
      MIPS: Initial implementation of a VDSO · ebb5e78c
      Alex Smith authored
      
      
      Add an initial implementation of a proper (i.e. an ELF shared library)
      VDSO. With this commit it does not export any symbols, it only replaces
      the current signal return trampoline page. A later commit will add user
      implementations of gettimeofday()/clock_gettime().
      
      To support both new toolchains and old ones which don't generate ABI
      flags section, we define its content manually and then use a tool
      (genvdso) to patch up the section to have the correct name and type.
      genvdso also extracts symbol offsets ({,rt_}sigreturn) needed by the
      kernel, and generates a C file containing a "struct mips_vdso_image"
      containing both the VDSO data and these offsets. This C file is
      compiled into the kernel.
      
      On 64-bit kernels we require a different VDSO for each supported ABI,
      so we may build up to 3 different VDSOs. The VDSO to use is selected by
      the mips_abi structure.
      
      A kernel/user shared data page is created and mapped below the VDSO
      image. This is currently empty, but will be used by the user time
      function implementations which are added later.
      
      [markos.chandras@imgtec.com:
      - Add more comments
      - Move abi detection in genvdso.h since it's the get_symbol function
      that needs it.
      - Add an R6 specific way to calculate the base address of VDSO in order
      to avoid the branch instruction which affects performance.
      - Do not patch .gnu.attributes since it's not needed for dynamic linking.
      - Simplify Makefile a little bit.
      - checkpatch fixes
      - Restrict VDSO support for binutils < 2.25 for pre-R6
      - Include atomic64.h for O32 variant on MIPS64]
      
      Signed-off-by: default avatarAlex Smith <alex.smith@imgtec.com>
      Signed-off-by: default avatarMarkos Chandras <markos.chandras@imgtec.com>
      Cc: Matthew Fortune <matthew.fortune@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/11337/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      ebb5e78c
    • Paul Burton's avatar
      MIPS: Extend hardware table walking support to MIPS64 · cab25bc7
      Paul Burton authored
      
      
      Extend the existing support for Hardware Table Walking (HTW) to MIPS64
      systems by supporting PMDs & setting the pointer size bit in PWSize,
      then ceasing to blacklist HTW on MIPS64 systems.
      
      Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Steven J. Hill <Steven.Hill@imgtec.com>
      Cc: Joshua Kinard <kumba@gentoo.org>
      Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
      Cc: Maciej W. Rozycki <macro@linux-mips.org>
      Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Patchwork: https://patchwork.linux-mips.org/patch/11224/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      cab25bc7
    • Paul Burton's avatar
      MIPS: Always use r4k_wait_irqoff for MIPSr6 · 5b10a0e8
      Paul Burton authored
      
      
      Prior to release 6 of the MIPS architecture it has been implementation
      dependent whether masked interrupts cause a wait instruction to return,
      so the kernel has effectively had to maintain a whitelist of cores upon
      which it is safe to use the r4k_wait_irqoff cpu_wait implementation.
      With MIPSr6 this is no longer implementation dependent and
      r4k_wait_irqoff can always be used.
      
      Remove the existing I6400 case which will no longer ever be hit, and was
      incorrect anyway since I6400 & r6 in general doesn't have the WII bit.
      
      Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Patchwork: https://patchwork.linux-mips.org/patch/11210/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      5b10a0e8
    • Paul Burton's avatar
      MIPS: CM, CPC: Ensure core-other GCRs reflect the correct core · 78a54c4d
      Paul Burton authored
      
      
      Ensure the update to which core the core-other GCR regions reflect has
      taken place before any core-other GCRs are accessed by placing a memory
      barrier (sync instruction) between the write to the core-other registers
      and any such GCR accesses.
      
      Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Patchwork: https://patchwork.linux-mips.org/patch/11209/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      78a54c4d
    • Paul Burton's avatar
      MIPS: CM: make use of mips_cm_{lock,unlock}_other · 4ede3161
      Paul Burton authored
      
      
      Document that CPC core-other accesses must take place within the bounds
      of the CM lock, and begin using the CM lock functions where we access
      the GCRs of other cores. This is required because with CM3 the CPC began
      using GCR_CL_OTHER instead of CPC_CL_OTHER.
      
      Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Andrew Bresticker <abrestic@chromium.org>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: Niklas Cassel <niklas.cassel@axis.com>
      Cc: Ezequiel Garcia <ezequiel.garcia@imgtec.com>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Patchwork: https://patchwork.linux-mips.org/patch/11208/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      4ede3161
    • Paul Burton's avatar
      MIPS: CM: Introduce core-other locking functions · 23d5de8e
      Paul Burton authored
      
      
      Introduce mips_cm_lock_other & mips_cm_unlock_other, mirroring the
      existing CPC equivalents, in order to lock access from the current core
      to another via the core-other GCR region. This hasn't been required in
      the past but with CM3 the CPC starts using GCR_CL_OTHER rather than
      CPC_CL_OTHER and this will be required for safety.
      
      [ralf@linux-mips.org: Fix merge conflict.]
      
      Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Patchwork: https://patchwork.linux-mips.org/patch/11207/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      23d5de8e
    • Paul Burton's avatar
      MIPS: CPS: Warn if a core doesn't start · a8c20614
      Paul Burton authored
      
      
      When debugging core bringup it is useful to see the state of the CPC
      sequencer, so output that value if the core hasn't started within a
      reasonable amount of time (1 second). This avoids simply appearing to
      the user to hang if a secondary core fails to start.
      
      Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Andrew Bresticker <abrestic@chromium.org>
      Cc: linux-kernel@vger.kernel.org
      Cc: Niklas Cassel <niklas.cassel@axis.com>
      Cc: Ezequiel Garcia <ezequiel.garcia@imgtec.com>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Patchwork: https://patchwork.linux-mips.org/patch/11205/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      a8c20614
    • Paul Burton's avatar
      MIPS: CPS: Skip Config1 presence check · 192fbc20
      Paul Burton authored
      
      
      The Config1 register is architecturally defined as required, and is thus
      present in all systems which may make use of cps-vec.S. Skip the check
      for its presence via the Config.M bit.
      
      Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/11204/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      192fbc20
    • Paul Burton's avatar
      MIPS: CPS: Read CM GCR base from cop0 · 946db173
      Paul Burton authored
      
      
      Rather than patching the start of mips_cps_core_entry to provide the
      base address of the CM GCRs, simply read that base address from the cop0
      CMGCRBase register, converting from the physical address to an uncached
      virtual address.
      
      Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Andrew Bresticker <abrestic@chromium.org>
      Cc: linux-kernel@vger.kernel.org
      Cc: Niklas Cassel <niklas.cassel@axis.com>
      Cc: Ezequiel Garcia <ezequiel.garcia@imgtec.com>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Patchwork: https://patchwork.linux-mips.org/patch/11203/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      946db173
    • Paul Burton's avatar
      MIPS: CPS: Early debug using an ns16550-compatible UART · 609cf6f2
      Paul Burton authored
      
      
      Provide support for outputting early debug information, in the form of
      various register values should an exception occur, during the early
      bringup of secondary cores. This code requires an ns16550-compatible
      UART accessible from the secondary core, and is written in assembly due
      to the environment in which such early exceptions occur where way may
      not have a stack, be coherent or even have initialised caches.
      
      [ralf@linux-mips.org: Fix merge conflict.]
      
      Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Steven J. Hill <Steven.Hill@imgtec.com>
      Cc: Andrew Bresticker <abrestic@chromium.org>
      Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
      Cc: Maciej W. Rozycki <macro@linux-mips.org>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: linux-kernel@vger.kernel.org
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Patchwork: https://patchwork.linux-mips.org/patch/11202/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      609cf6f2
  13. Nov 10, 2015
    • David Daney's avatar
      MIPS: OCTEON: omit ELF NOTE segments · 3bfb7224
      David Daney authored
      
      
      OCTEON Pre-SDK-1.8.1 bootloaders can not handle PT_NOTE program headers,
      so do not emit them.
      
      Before the patch:
      
      $ readelf --program-headers octeon-vmlinux
      
      Elf file type is EXEC (Executable file)
      Entry point 0xffffffff815d09d0
      There are 2 program headers, starting at offset 64
      
      Program Headers:
        Type           Offset             VirtAddr           PhysAddr
                       FileSiz            MemSiz              Flags  Align
        LOAD           0x0000000000001000 0xffffffff81100000 0xffffffff81100000
                       0x0000000000b57f80 0x0000000001b86360  RWE    1000
        NOTE           0x00000000004e02e0 0xffffffff815df2e0 0xffffffff815df2e0
                       0x0000000000000024 0x0000000000000024  R      4
      
      After the patch:
      
      $ readelf --program-headers octeon-vmlinux
      
      Elf file type is EXEC (Executable file)
      Entry point 0xffffffff815d09d0
      There are 1 program headers, starting at offset 64
      
      Program Headers:
        Type           Offset             VirtAddr           PhysAddr
                       FileSiz            MemSiz              Flags  Align
        LOAD           0x0000000000001000 0xffffffff81100000 0xffffffff81100000
                       0x0000000000b57f80 0x0000000001b86360  RWE    1000
      
      The patch was tested on DSR-1000N router.
      
      Signed-off-by: default avatarDavid Daney <ddaney@caviumnetworks.com>
      Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
      Cc: Matthew Fortune <Matthew.Fortune@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/11403/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      3bfb7224
    • Aaro Koskinen's avatar
      MIPS: vmlinux: discard .MIPS.abiflags · 61379878
      Aaro Koskinen authored
      
      
      Discard .MIPS.abiflags from vmlinux. It's not needed and will cause
      issues e.g. with old OCTEON bootloaders that cannot tolerate
      additional program headers.
      
      Before the patch:
      
      $ readelf --program-headers octeon-vmlinux
      
      Elf file type is EXEC (Executable file)
      Entry point 0xffffffff815d09d0
      There are 3 program headers, starting at offset 64
      
      Program Headers:
        Type           Offset             VirtAddr           PhysAddr
                       FileSiz            MemSiz              Flags  Align
        ABIFLAGS       0x00000000005e77f0 0xffffffff816e67f0 0xffffffff816e67f0
                       0x0000000000000018 0x0000000000000018  R      8
        LOAD           0x0000000000001000 0xffffffff81100000 0xffffffff81100000
                       0x0000000000b57f80 0x0000000001b86360  RWE    1000
        NOTE           0x00000000004e02e0 0xffffffff815df2e0 0xffffffff815df2e0
                       0x0000000000000024 0x0000000000000024  R      4
      
      After the patch:
      
      $ readelf --program-headers octeon-vmlinux
      
      Elf file type is EXEC (Executable file)
      Entry point 0xffffffff815d09d0
      There are 2 program headers, starting at offset 64
      
      Program Headers:
        Type           Offset             VirtAddr           PhysAddr
                       FileSiz            MemSiz              Flags  Align
        LOAD           0x0000000000001000 0xffffffff81100000 0xffffffff81100000
                       0x0000000000b57f80 0x0000000001b86360  RWE    1000
        NOTE           0x00000000004e02e0 0xffffffff815df2e0 0xffffffff815df2e0
                       0x0000000000000024 0x0000000000000024  R      4
      
      Suggested-by: default avatarMatthew Fortune <matthew.fortune@imgtec.com>
      Suggested-by: default avatarRalf Baechle <ralf@linux-mips.org>
      Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
      Cc: linux-mips@linux-mips.org
      Cc: David Daney <ddaney.cavm@gmail.com>
      Patchwork: https://patchwork.linux-mips.org/patch/11402/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      61379878
Loading