1. 28 May, 2016 19 commits
  2. 17 May, 2016 7 commits
  3. 13 May, 2016 14 commits
    • Tony Wu's avatar
      MIPS: CM: Fix compilation error when !MIPS_CM · 0868971a
      Tony Wu authored
      Fix mips_cm_lock_other compilation error when MIPS_CM is not selected.
      This was introduced in commit 23d5de8e (MIPS: CM: Introduce core-other
      locking functions)
      Signed-off-by: default avatarTony Wu <tung7970@gmail.com>
      Cc: Paul Burton <paul.burton@imgtec.com>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/11698/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      0868971a
    • James Hogan's avatar
      MIPS: Fix genvdso error on rebuild · 2afb9745
      James Hogan authored
      The genvdso program modifies the debug and stripped versions of the
      VDSOs in place, and errors if the modification has already taken place.
      Unfortunately this means that a rebuild which tries to rerun genvdso to
      generate vdso*-image.c without also rebuilding vdso.so.dbg (for example
      if genvdso.c is modified) hits a build error like this:
      
      arch/mips/vdso/genvdso 'arch/mips/vdso/vdso.so.dbg' already contains a '.MIPS.abiflags' section
      
      This is fixed by reorganising the rules such that unmodified .so files
      have a .raw suffix, and these are copied in the same rule that runs
      genvdso on the copies.
      
      I.e. previously we had:
      
       cmd_vdsold:
        link objects -> vdso.so.dbg
      
       cmd_genvdso:
        strip vdso.so.dbg -> vdso.so
        run genvdso -> vdso-image.c
         and modify vdso.so.dbg and vdso.so in place
      
      Now we have:
      
       cmd_vdsold:
        link objects -> vdso.so.dbg.raw
      
       a new cmd_objcopy based strip rule (inspired by ARM):
        strip vdso.so.dbg.raw -> vdso.so.raw
      
       cmd_genvdso:
        copy vdso.so.dbg.raw -> vdso.so.dbg
        copy vdso.so.raw -> vdso.so
        run genvdso -> vdso-image.c
         and modify vdso.so.dbg and vdso.so in place
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/13250/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      2afb9745
    • Maarten ter Huurne's avatar
      USB: ohci-jz4740: Remove obsolete driver · b071c5d7
      Maarten ter Huurne authored
      The ohci-platform driver can control the clock, while usb-nop-xceiv
      as the PHY can control the vbus regulator. So this JZ4740-specific
      glue is not needed anymore.
      Signed-off-by: default avatarMaarten ter Huurne <maarten@treewalker.org>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Lars-Peter Clausen <lars@metafoo.de>
      Cc: Paul Cercueil <paul@crapouillou.net>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/13105/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      b071c5d7
    • Maarten ter Huurne's avatar
      MIPS: JZ4740: Probe OHCI platform device via DT · 9d1e7875
      Maarten ter Huurne authored
      The DT fragment will select the ohci-platform driver, since that can
      handle the JZ4740 OHCI just fine. While I don't have a JZ4740-based
      board with anything connected to the USB host controller, I did test
      the generic OHCI driver successfully on a JZ4770-based board.
      
      The device is disabled by default; boards that want to use it can
      override the "status" property. The mass-production Qi LB60 boards
      don't use the USB host controller.
      Signed-off-by: default avatarMaarten ter Huurne <maarten@treewalker.org>
      Cc: Lars-Peter Clausen <lars@metafoo.de>
      Cc: Paul Cercueil <paul@crapouillou.net>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/13104/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      9d1e7875
    • Maarten ter Huurne's avatar
      MIPS: JZ4740: Qi LB60: Remove support for AVT2 variant · 46d6ccdb
      Maarten ter Huurne authored
      AVT2 was a prototype board of which about 5 were made, none of which
      are in use anymore.
      Signed-off-by: default avatarMaarten ter Huurne <maarten@treewalker.org>
      Acked-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Cc: Paul Cercueil <paul@crapouillou.net>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/13103/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      46d6ccdb
    • James Hartley's avatar
      MIPS: pistachio: Determine SoC revision during boot · ae07ea85
      James Hartley authored
      Now that there are different revisions of the Pistachio SoC
      in circulation, add this information to the boot log to make
      it easier for users to determine which hardware they have.
      Signed-off-by: default avatarJames Hartley <james.hartley@imgtec.com>
      Signed-off-by: default avatarIonela Voinescu <ionela.voinescu@imgtec.com>
      Cc: Andrew Bresticker <abrestic@chromium.org>
      Cc: Jonas Gorski <jogo@openwrt.org>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/13130/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      ae07ea85
    • Florian Fainelli's avatar
      MIPS: BMIPS: Adjust mips-hpt-frequency for BCM7435 · 80fa40ac
      Florian Fainelli authored
      The CPU actually runs at 1405Mhz which gives us a 175625000 Hz MIPS timer
      frequency (CPU frequency / 8).
      
      Fixes: e4c7d009 ("MIPS: BMIPS: Add BCM7435 dtsi")
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Cc: linux-mips@linux-mips.org
      Cc: john@phrozen.org
      Cc: cernekee@gmail.com
      Cc: jaedon.shin@gmail.com
      Patchwork: https://patchwork.linux-mips.org/patch/13132/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      80fa40ac
    • Sashka Nochkin's avatar
      mips: mt7620: fallback to SDRAM when syscfg0 does not have a valid value for the memory type · 86ce9a34
      Sashka Nochkin authored
      Mediatek MT7620 SoC has syscfg0 bits where it sets the type of memory being used.
      However, sometimes those bits are not set properly (reading "11"). In this case, the SoC assumes SDRAM.
      The patch below reflects that.
      Signed-off-by: default avatarSashka Nochkin <linux-mips@durdom.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/13135/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      86ce9a34
    • Paul Burton's avatar
      MIPS: Prevent "restoration" of MSA context in non-MSA kernels · 6533af4d
      Paul Burton authored
      If a kernel doesn't support MSA context (ie. CONFIG_CPU_HAS_MSA=n) then
      it will only keep 64 bits per FP register in thread context, and the
      calls to set_fpr64 in restore_msa_extcontext will overrun the end of the
      FP register context into the FCSR & MSACSR values. GCC 6.x has become
      smart enough to detect this & complain like so:
      
          arch/mips/kernel/signal.c: In function 'protected_restore_fp_context':
          ./arch/mips/include/asm/processor.h:114:17: error: array subscript is above array bounds [-Werror=array-bounds]
            fpr->val##width[FPR_IDX(width, idx)] = val;   \
            ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
          ./arch/mips/include/asm/processor.h:118:1: note: in expansion of macro 'BUILD_FPR_ACCESS'
           BUILD_FPR_ACCESS(64)
      
      The only way to trigger this code to run would be for a program to set
      up an artificial extended MSA context structure following a sigframe &
      execute sigreturn. Whilst this doesn't allow a program to write to any
      state that it couldn't already, it makes little sense to allow this
      "restoration" of MSA context in a system that doesn't support MSA.
      
      Fix this by killing a program with SIGSYS if it tries something as crazy
      as "restoring" fake MSA context in this way, also fixing the build error
      & allowing for most of restore_msa_extcontext to be optimised out of
      kernels without support for MSA.
      Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
      Reported-by: default avatarMichal Toman <michal.toman@imgtec.com>
      Fixes: bf82cb30 ("MIPS: Save MSA extended context around signals")
      Tested-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Michal Toman <michal.toman@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: stable <stable@vger.kernel.org> # v4.3+
      Patchwork: https://patchwork.linux-mips.org/patch/13164/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      6533af4d
    • James Hogan's avatar
      MIPS: cevt-r4k: Dynamically calculate min_delta_ns · 1fa40555
      James Hogan authored
      Calculate the MIPS clockevent device's min_delta_ns dynamically based on
      the time it takes to perform the mips_next_event() sequence.
      
      Virtualisation in particular makes the current fixed min_delta of 0x300
      inappropriate under some circumstances, as the CP0_Count and CP0_Compare
      registers may be being emulated by the hypervisor, and the frequency may
      not correspond directly to the CPU frequency.
      
      We actually use twice the median of multiple 75th percentiles of
      multiple measurements of how long the mips_next_event() sequence takes,
      in order to fairly efficiently eliminate outliers due to unexpected
      hypervisor latency (which would need handling with retries when it
      occurs during normal operation anyway).
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/13176/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      1fa40555
    • James Hogan's avatar
      MIPS: malta-time: Take seconds into account · 24e1df66
      James Hogan authored
      When estimating the clock frequency based on the RTC, take seconds into
      account in case the Update In Progress (UIP) bit wasn't seen. This can
      happen in virtual machines (which may get pre-empted by the hypervisor
      at inopportune times) with QEMU emulating the RTC (and in fact not
      setting the UIP bit for very long), especially on slow hosts such as
      FPGA systems and hardware emulators. This results in several seconds
      actually having elapsed before seeing the UIP bit instead of just one
      second, and exaggerated timer frequencies.
      
      While updating the comments, they're also fixed to match the code in
      that the rising edge of the update flag is detected first, not the
      falling edge.
      
      The rising edge gives a more precise point to read the counters in a
      virtualised system than the falling edge, resulting in a more accurate
      frequency.
      
      It does however mean that we have to also wait for the falling edge
      before doing the read of the RTC seconds register, otherwise it seems to
      be possible in slow hardware emulation to stray into the interval when
      the RTC time is undefined during the update (at least 244uS after the
      rising edge of the update flag). This can result in both seconds values
      reading the same, and it wrapping to 60 seconds, vastly underestimating
      the frequency.
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/13174/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      24e1df66
    • James Hogan's avatar
      MIPS: malta-time: Start GIC count before syncing to RTC · aab4673b
      James Hogan authored
      The sampling of the GIC counter on Malta after observing a rising edge
      of the RTC update flag differs slightly between the first and second
      sample, with the first sample also calling gic_start_count(). The two
      samples should really be taken as similarly as possible to get the most
      accurate figure, so move the gic_start_count() call before detecting the
      rising edge.
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/13173/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      aab4673b
    • Paul Burton's avatar
      MIPS: Force CPUs to lose FP context during mode switches · 6b832257
      Paul Burton authored
      Commit 9791554b ("MIPS,prctl: add PR_[GS]ET_FP_MODE prctl options
      for MIPS") added support for the PR_SET_FP_MODE prctl, which allows a
      userland program to modify its FP mode at runtime. This is most notably
      required if dynamic linking leads to the FP mode requirement changing at
      runtime from that indicated in the initial executable's ELF header. In
      order to avoid overhead in the general FP context restore code, it aimed
      to have threads in the process become unable to enable the FPU during a
      mode switch & have the thread calling the prctl syscall wait for all
      other threads in the process to be context switched at least once. Once
      that happens we can know that no thread in the process whose mode will
      be switched has live FP context, and it's safe to perform the mode
      switch. However in the (rare) case of modeswitches occurring in
      multithreaded programs this can lead to indeterminate delays for the
      thread invoking the prctl syscall, and the code monitoring for those
      context switches was woefully inadequate for all but the simplest cases.
      
      Fix this by broadcasting an IPI if other CPUs may have live FP context
      for an affected thread, with a handler causing those CPUs to relinquish
      their FPU ownership. Threads will then be allowed to continue running
      but will stall on the wait_on_atomic_t in enable_restore_fp_context if
      they attempt to use FP again whilst the mode switch is still in
      progress. The end result is less fragile poking at scheduler context
      switch counts & a more expedient completion of the mode switch.
      Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
      Fixes: 9791554b ("MIPS,prctl: add PR_[GS]ET_FP_MODE prctl options for MIPS")
      Reviewed-by: default avatarMaciej W. Rozycki <macro@imgtec.com>
      Cc: Adam Buchbinder <adam.buchbinder@gmail.com>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: stable <stable@vger.kernel.org> # v4.0+
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/13145/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      6b832257
    • Paul Burton's avatar
      MIPS: Disable preemption during prctl(PR_SET_FP_MODE, ...) · bd239f1e
      Paul Burton authored
      Whilst a PR_SET_FP_MODE prctl is performed there are decisions made
      based upon whether the task is executing on the current CPU. This may
      change if we're preempted, so disable preemption to avoid such changes
      for the lifetime of the mode switch.
      Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
      Fixes: 9791554b ("MIPS,prctl: add PR_[GS]ET_FP_MODE prctl options for MIPS")
      Reviewed-by: default avatarMaciej W. Rozycki <macro@imgtec.com>
      Tested-by: default avatarAurelien Jarno <aurelien@aurel32.net>
      Cc: Adam Buchbinder <adam.buchbinder@gmail.com>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: stable <stable@vger.kernel.org> # v4.0+
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/13144/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      bd239f1e