1. 03 4月, 2016 1 次提交
  2. 29 3月, 2016 2 次提交
    • P
      MIPS: Fix MSA ld unaligned failure cases · fa8ff601
      Paul Burton 提交于
      Copying the content of an MSA vector from user memory may involve TLB
      faults & mapping in pages. This will fail when preemption is disabled
      due to an inability to acquire mmap_sem from do_page_fault, which meant
      such vector loads to unmapped pages would always fail to be emulated.
      Fix this by disabling preemption later only around the updating of
      vector register state.
      
      This change does however introduce a race between performing the load
      into thread context & the thread being preempted, saving its current
      live context & clobbering the loaded value. This should be a rare
      occureence, so optimise for the fast path by simply repeating the load if
      we are preempted.
      
      Additionally if the copy failed then the failure path was taken with
      preemption left disabled, leading to the kernel typically encountering
      further issues around sleeping whilst atomic. The change to where
      preemption is disabled avoids this issue.
      
      Fixes: e4aa1f15 "MIPS: MSA unaligned memory access support"
      Reported-by: NJames Hogan <james.hogan@imgtec.com>
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Reviewed-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
      Cc: Maciej W. Rozycki <macro@linux-mips.org>
      Cc: James Cowgill <James.Cowgill@imgtec.com>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Cc: stable <stable@vger.kernel.org> # v4.3
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/12345/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      fa8ff601
    • Q
      MIPS: Fix broken malta qemu · 19fb5818
      Qais Yousef 提交于
      Malta defconfig compiles with GIC on. Hence when compiling for SMP it causes
      the new IPI code to be activated. But on qemu malta there's no GIC causing a
      BUG_ON(!ipidomain) to be hit in mips_smp_ipi_init().
      
      Since in that configuration one can only run a single core SMP (!), skip IPI
      initialisation if we detect that this is the case. It is a sensible
      behaviour to introduce and should keep such possible configuration to run
      rather than die hard unnecessarily.
      Signed-off-by: NQais Yousef <qsyousef@gmail.com>
      Reported-by: NGuenter Roeck <linux@roeck-us.net>
      Tested-by: NGuenter Roeck <linux@roeck-us.net>
      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/12892/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      19fb5818
  3. 26 3月, 2016 1 次提交
  4. 13 3月, 2016 1 次提交
    • J
      MIPS: smp.c: Fix uninitialised temp_foreign_map · d825c06b
      James Hogan 提交于
      When calculate_cpu_foreign_map() recalculates the cpu_foreign_map
      cpumask it uses the local variable temp_foreign_map without initialising
      it to zero. Since the calculation only ever sets bits in this cpumask
      any existing bits at that memory location will remain set and find their
      way into cpu_foreign_map too. This could potentially lead to cache
      operations suboptimally doing smp calls to multiple VPEs in the same
      core, even though the VPEs share primary caches.
      
      Therefore initialise temp_foreign_map using cpumask_clear() before use.
      
      Fixes: cccf34e9 ("MIPS: c-r4k: Fix cache flushing for MT cores")
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Paul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/12759/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      d825c06b
  5. 05 3月, 2016 1 次提交
  6. 02 3月, 2016 1 次提交
    • T
      arch/hotplug: Call into idle with a proper state · fc6d73d6
      Thomas Gleixner 提交于
      Let the non boot cpus call into idle with the corresponding hotplug state, so
      the hotplug core can handle the further bringup. That's a first step to
      convert the boot side of the hotplugged cpus to do all the synchronization
      with the other side through the state machine. For now it'll only start the
      hotplug thread and kick the full bringup of the cpu.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: linux-arch@vger.kernel.org
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Rafael Wysocki <rafael.j.wysocki@intel.com>
      Cc: "Srivatsa S. Bhat" <srivatsa@mit.edu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: Sebastian Siewior <bigeasy@linutronix.de>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Paul Turner <pjt@google.com>
      Link: http://lkml.kernel.org/r/20160226182341.614102639@linutronix.deSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      fc6d73d6
  7. 29 2月, 2016 1 次提交
  8. 25 2月, 2016 3 次提交
  9. 19 2月, 2016 1 次提交
  10. 11 2月, 2016 1 次提交
    • D
      mips: Differentiate between 32 and 64 bit ELF header · f4d3d504
      Daniel Wagner 提交于
      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: NDaniel Wagner <daniel.wagner@bmw-carit.de>
      Suggested-by: NMaciej W. Rozycki <macro@imgtec.com>
      Reviewed-by: NMaciej W. Rozycki <macro@imgtec.com>
      Reported-by: NFengguang 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: NRalf Baechle <ralf@linux-mips.org>
      f4d3d504
  11. 10 2月, 2016 1 次提交
    • P
      MIPS: Fix early CM probing · 3af5a67c
      Paul Burton 提交于
      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: NPaul Burton <paul.burton@imgtec.com>
      Reviewed-by: NAlexander 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: NRalf Baechle <ralf@linux-mips.org>
      3af5a67c
  12. 06 2月, 2016 1 次提交
  13. 02 2月, 2016 3 次提交
  14. 30 1月, 2016 1 次提交
    • T
      arch: Set IORESOURCE_SYSTEM_RAM flag for System RAM · 35d98e93
      Toshi Kani 提交于
      Set IORESOURCE_SYSTEM_RAM in flags of resource ranges with
      "System RAM", "Kernel code", "Kernel data", and "Kernel bss".
      
      Note that:
      
       - IORESOURCE_SYSRAM (i.e. modifier bit) is set in flags when
         IORESOURCE_MEM is already set. IORESOURCE_SYSTEM_RAM is defined
         as (IORESOURCE_MEM|IORESOURCE_SYSRAM).
      
       - Some archs do not set 'flags' for children nodes, such as
         "Kernel code".  This patch does not change 'flags' in this
         case.
      Signed-off-by: NToshi Kani <toshi.kani@hpe.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Luis R. Rodriguez <mcgrof@suse.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Toshi Kani <toshi.kani@hp.com>
      Cc: linux-arch@vger.kernel.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-mips@linux-mips.org
      Cc: linux-mm <linux-mm@kvack.org>
      Cc: linux-parisc@vger.kernel.org
      Cc: linux-s390@vger.kernel.org
      Cc: linux-sh@vger.kernel.org
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: sparclinux@vger.kernel.org
      Link: http://lkml.kernel.org/r/1453841853-11383-7-git-send-email-bp@alien8.deSigned-off-by: NIngo Molnar <mingo@kernel.org>
      35d98e93
  15. 24 1月, 2016 6 次提交
  16. 20 1月, 2016 7 次提交
    • M
      MIPS: Add IEEE Std 754 conformance mode selection · 503943e0
      Maciej W. Rozycki 提交于
      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: NMaciej 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: NRalf Baechle <ralf@linux-mips.org>
      503943e0
    • M
      MIPS: Determine the presence of IEEE Std 754-2008 features · 93adeaf6
      Maciej W. Rozycki 提交于
      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: NMaciej 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: NRalf Baechle <ralf@linux-mips.org>
      93adeaf6
    • M
      MIPS: ELF: Interpret the NAN2008 file header flag · 2b5e869e
      Maciej W. Rozycki 提交于
      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: NMaciej 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: NRalf Baechle <ralf@linux-mips.org>
      2b5e869e
    • M
      ELF: Also pass any interpreter's file header to `arch_check_elf' · eb4bc076
      Maciej W. Rozycki 提交于
      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: NMaciej W. Rozycki <macro@imgtec.com>
      Acked-by: NAndrew Morton <akpm@linux-foundation.org>
      Acked-by: NAl 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: NRalf Baechle <ralf@linux-mips.org>
      eb4bc076
    • M
      MIPS: math-emu: Add IEEE Std 754-2008 NaN encoding emulation · 90d53a91
      Maciej W. Rozycki 提交于
      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: NMaciej 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: NRalf Baechle <ralf@linux-mips.org>
      90d53a91
    • M
      MIPS: Define the legacy-NaN and 2008-NaN features · 9519ef37
      Maciej W. Rozycki 提交于
      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: NMaciej 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: NRalf Baechle <ralf@linux-mips.org>
      9519ef37
    • M
      MIPS: Use a union to access the ELF file header · 2ed02dd4
      Maciej W. Rozycki 提交于
      Rewrite `arch_elf_pt_proc' and `arch_check_elf' using a union to access
      the ELF file header.
      Signed-off-by: NMaciej 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: NRalf Baechle <ralf@linux-mips.org>
      2ed02dd4
  17. 22 12月, 2015 2 次提交
    • P
      MIPS: CPS: drop .set mips64r2 directives · f3575e23
      Paul Burton 提交于
      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: NPaul 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: NRalf Baechle <ralf@linux-mips.org>
      f3575e23
    • J
      MIPS: uaccess: Take EVA into account in [__]clear_user · d6a428fb
      James Hogan 提交于
      __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: NJames 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: NRalf Baechle <ralf@linux-mips.org>
      d6a428fb
  18. 05 12月, 2015 1 次提交
  19. 12 11月, 2015 2 次提交
  20. 11 11月, 2015 3 次提交
    • J
      MIPS: Make the kernel arguments from dtb available · 2024972e
      Jonas Gorski 提交于
      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: NJonas 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: NRalf Baechle <ralf@linux-mips.org>
      2024972e
    • A
      MIPS: Add LATENCYTOP support · e1e16115
      Aaro Koskinen 提交于
      Add LATENCYTOP support for MIPS. Tested on OCTEON.
      Signed-off-by: NAaro Koskinen <aaro.koskinen@nokia.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/11353/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      e1e16115
    • A
      MIPS: VDSO: Add implementations of gettimeofday() and clock_gettime() · a7f4df4e
      Alex Smith 提交于
      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: NAlex Smith <alex.smith@imgtec.com>
      Signed-off-by: NMarkos 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: NRalf Baechle <ralf@linux-mips.org>
      a7f4df4e