Skip to content
  1. May 28, 2016
  2. May 17, 2016
  3. May 14, 2016
  4. May 13, 2016
    • 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
    • Paul Burton's avatar
      MIPS: Allow emulation for unaligned [LS]DXC1 instructions · e70ac023
      Paul Burton authored
      
      
      If an address error exception occurs for a LDXC1 or SDXC1 instruction,
      within the cop1x opcode space, allow it to be passed through to the FPU
      emulator rather than resulting in a SIGILL. This causes LDXC1 & SDXC1 to
      be handled in a manner consistent with the more common LDC1 & SDC1
      instructions.
      
      Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
      Tested-by: default avatarAurelien Jarno <aurelien@aurel32.net>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/13143/
      
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      e70ac023