1. 24 1月, 2016 2 次提交
    • H
      MIPS: Fix some missing CONFIG_CPU_MIPSR6 #ifdefs · 4f33f6c5
      Huacai Chen 提交于
      Commit be0c37c9 (MIPS: Rearrange PTE bits into fixed positions.)
      defines fixed PTE bits for MIPS R2. Then, commit d7b63141
      (MIPS: pgtable-bits: Fix XPA damage to R6 definitions.) adds the MIPS
      R6 definitions in the same way as MIPS R2. But some R6 #ifdefs in the
      later commit are missing, so in this patch I fix that.
      Signed-off-by: NHuacai Chen <chenhc@lemote.com>
      Cc: Aurelien Jarno <aurelien@aurel32.net>
      Cc: Steven J. Hill <Steven.Hill@imgtec.com>
      Cc: Fuxin Zhang <zhangfx@lemote.com>
      Cc: Zhangjin Wu <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Cc: stable@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/12164/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      4f33f6c5
    • H
      MIPS: sync-r4k: reduce skew while synchronization · db0dbd57
      Huacai Chen 提交于
      While synchronization, count register will go backwards for the master.
      If synchronise_count_master() runs before synchronise_count_slave(),
      skew becomes even more. The skew is very harmful for CPU hotplug (CPU0
      do synchronization with CPU1, then CPU0 do synchronization with CPU2
      and CPU0's count goes backwards, so it will be out of sync with CPU1).
      
      After the commit cf9bfe55 (MIPS: Synchronize MIPS count one
      CPU at a time), we needn't evaluate count_reference at the beginning of
      synchronise_count_master() any more. Thus, we evaluate the initcount (It
      seems like count_reference is redundant) in the 2nd loop. Since we write
      the count register in the last loop, we don't need additional barriers
      (the existing memory barriers are enough).
      
      Moreover, I think we loop 3 times is enough to get a primed instruction
      cache, this can also get less skew than looping 5 times.
      
      Comments are also updated in this patch.
      Signed-off-by: NHuacai Chen <chenhc@lemote.com>
      Cc: Aurelien Jarno <aurelien@aurel32.net>
      Cc: Steven J. Hill <Steven.Hill@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Fuxin Zhang <zhangfx@lemote.com>
      Cc: Zhangjin Wu <wuzhangjin@gmail.com>
      Patchwork: https://patchwork.linux-mips.org/patch/12163/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      db0dbd57
  2. 22 1月, 2016 4 次提交
    • H
      MIPS: hpet: Choose a safe value for the ETIME check · 5610b125
      Huacai Chen 提交于
      This patch is borrowed from x86 hpet driver and explaind below:
      
      Due to the overly intelligent design of HPETs, we need to workaround
      the problem that the compare value which we write is already behind
      the actual counter value at the point where the value hits the real
      compare register. This happens for two reasons:
      
      1) We read out the counter, add the delta and write the result to the
         compare register. When a NMI hits between the read out and the write
         then the counter can be ahead of the event already.
      
      2) The write to the compare register is delayed by up to two HPET
         cycles in AMD chipsets.
      
      We can work around this by reading back the compare register to make
      sure that the written value has hit the hardware. But that is bad
      performance wise for the normal case where the event is far enough in
      the future.
      
      As we already know that the write can be delayed by up to two cycles
      we can avoid the read back of the compare register completely if we
      make the decision whether the delta has elapsed already or not based
      on the following calculation:
      
        cmp = event - actual_count;
      
      If cmp is less than 64 HPET clock cycles, then we decide that the event
      has happened already and return -ETIME. That covers the above #1 and #2
      problems which would cause a wait for HPET wraparound (~306 seconds).
      Signed-off-by: NHuacai Chen <chenhc@lemote.com>
      Cc: Aurelien Jarno <aurelien@aurel32.net>
      Cc: Steven J. Hill <Steven.Hill@imgtec.com>
      Cc: Fuxin Zhang <zhangfx@lemote.com>
      Cc: Zhangjin Wu <wuzhangjin@gmail.com>
      Cc: Huacai Chen <chenhc@lemote.com>
      Cc: linux-mips@linux-mips.org
      Cc: stable@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/12162/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      5610b125
    • H
      MIPS: Loongson-3: Fix SMP_ASK_C0COUNT IPI handler · 57548432
      Huacai Chen 提交于
      When Core-0 handle SMP_ASK_C0COUNT IPI, we should make other cores to
      see the result as soon as possible (especially when Store-Fill-Buffer
      is enabled). Otherwise, C0_Count syncronization makes no sense.
      
      BTW, array is more suitable than per-cpu variable for syncronization,
      and there is a corner case should be avoid: C0_Count of Core-0 can be
      really 0.
      Signed-off-by: NHuacai Chen <chenhc@lemote.com>
      Cc: Aurelien Jarno <aurelien@aurel32.net>
      Cc: Steven J. Hill <Steven.Hill@imgtec.com>
      Cc: Fuxin Zhang <zhangfx@lemote.com>
      Cc: Zhangjin Wu <wuzhangjin@gmail.com>
      Cc: Huacai Chen <chenhc@lemote.com>
      Cc: linux-mips@linux-mips.org
      Cc: <stable@vger.kernel.org>
      Patchwork: https://patchwork.linux-mips.org/patch/12160/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      57548432
    • H
      MIPS: Loongson-3: Improve -march option and move it to Platform · 5188129b
      Huacai Chen 提交于
      If GCC >= 4.9 and Binutils >=2.25, we use -march=loongson3a, otherwise
      we use -march=mips64r2, this can slightly improve performance. Besides,
      arch/mips/loongson64/Platform is a better location rather than arch/
      mips/Makefile.
      Signed-off-by: NHuacai Chen <chenhc@lemote.com>
      Cc: Aurelien Jarno <aurelien@aurel32.net>
      Cc: Steven J. Hill <Steven.Hill@imgtec.com>
      Cc: Fuxin Zhang <zhangfx@lemote.com>
      Cc: Zhangjin Wu <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/12161/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      5188129b
    • H
      MIPS: Cleanup the unused __arch_local_irq_restore() function · 6e526844
      Huacai Chen 提交于
      In history, __arch_local_irq_restore() is only used by SMTC. However,
      SMTC support has been removed since 3.16, this patch remove the unused
      function.
      Signed-off-by: NHuacai Chen <chenhc@lemote.com>
      Cc: Aurelien Jarno <aurelien@aurel32.net>
      Cc: Steven J. Hill <Steven.Hill@imgtec.com>
      Cc: Fuxin Zhang <zhangfx@lemote.com>
      Cc: Zhangjin Wu <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/12159/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      6e526844
  3. 20 1月, 2016 17 次提交
  4. 04 1月, 2016 8 次提交
  5. 30 12月, 2015 1 次提交
    • G
      MIPS: VDSO: Fix build error with binutils 2.24 and earlier · 398c7500
      Guenter Roeck 提交于
      Commit 2a037f31 ("MIPS: VDSO: Fix build error") tries to fix a build
      error seen with binutils 2.24 and earlier. However, the fix does not work,
      and again results in the already known build errors if the kernel is built
      with an earlier version of binutils.
      
      CC      arch/mips/vdso/gettimeofday.o
      /tmp/ccnOVbHT.s: Assembler messages:
      /tmp/ccnOVbHT.s:50: Error: can't resolve `_start' {*UND* section} - `L0 {.text section}
      /tmp/ccnOVbHT.s:374: Error: can't resolve `_start' {*UND* section} - `L0 {.text section}
      scripts/Makefile.build:258: recipe for target 'arch/mips/vdso/gettimeofday.o' failed
      make[2]: *** [arch/mips/vdso/gettimeofday.o] Error 1
      
      Fixes: 2a037f31 ("MIPS: VDSO: Fix build error")
      Cc: Qais Yousef <qais.yousef@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/11926/Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      398c7500
  6. 28 12月, 2015 1 次提交
  7. 22 12月, 2015 6 次提交
    • R
      MIPS: Fix build error due to unused variables. · ec7b9720
      Ralf Baechle 提交于
      c861519f ("MIPS: Fix delay loops which may
      be removed by GCC.") which made it upstream was an outdated version of the
      patch and is lacking some the removal of two variables that became unused
      thus resulting in further warnings and build breakage.  The commit
      from ae878615d7cee5d7346946cf1ae1b60e427013c2 was correct however.
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      ec7b9720
    • Q
      MIPS: VDSO: Fix build error · 2a037f31
      Qais Yousef 提交于
      Commit ebb5e78c ("MIPS: Initial implementation of a VDSO") introduced a
      build error.
      
      For MIPS VDSO to be compiled it requires binutils version 2.25 or above but
      the check in the Makefile had inverted logic causing it to be compiled in if
      binutils is below 2.25.
      
      This fixes the following compilation error:
      
      CC      arch/mips/vdso/gettimeofday.o
      /tmp/ccsExcUd.s: Assembler messages:
      /tmp/ccsExcUd.s:62: Error: can't resolve `_start' {*UND* section} - `L0' {.text section}
      /tmp/ccsExcUd.s:467: Error: can't resolve `_start' {*UND* section} - `L0' {.text section}
      make[2]: *** [arch/mips/vdso/gettimeofday.o] Error 1
      make[1]: *** [arch/mips/vdso] Error 2
      make: *** [arch/mips] Error 2
      
      [ralf@linux-mips: Fixed Sergei's complaint on the formatting of the
      cited commit and generally reformatted the log message.]
      Signed-off-by: NQais Yousef <qais.yousef@imgtec.com>
      Cc: alex@alex-smith.me.uk
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/11745/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      2a037f31
    • 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
    • J
      MIPS: uaccess: Take EVA into account in __copy_from_user() · 6f06a2c4
      James Hogan 提交于
      When EVA is in use, __copy_from_user() was unconditionally using the EVA
      instructions to read the user address space, however this can also be
      used for kernel access. If the address isn't a valid user address it
      will cause an address error or TLB exception, and if it is then user
      memory may be read instead of kernel memory.
      
      For example in the following stack trace from Linux v3.10 (changes since
      then will prevent this particular one still happening) kernel_sendmsg()
      set the user address limit to KERNEL_DS, and tcp_sendmsg() goes on to
      use __copy_from_user() with a kernel address in KSeg0.
      
      [<8002d434>] __copy_fromuser_common+0x10c/0x254
      [<805710e0>] tcp_sendmsg+0x5f4/0xf00
      [<804e8e3c>] sock_sendmsg+0x78/0xa0
      [<804e8f28>] kernel_sendmsg+0x24/0x38
      [<804ee0f8>] sock_no_sendpage+0x70/0x7c
      [<8017c820>] pipe_to_sendpage+0x80/0x98
      [<8017c6b0>] splice_from_pipe_feed+0xa8/0x198
      [<8017cc54>] __splice_from_pipe+0x4c/0x8c
      [<8017e844>] splice_from_pipe+0x58/0x78
      [<8017e884>] generic_splice_sendpage+0x20/0x2c
      [<8017d690>] do_splice_from+0xb4/0x110
      [<8017d710>] direct_splice_actor+0x24/0x30
      [<8017d394>] splice_direct_to_actor+0xd8/0x208
      [<8017d51c>] do_splice_direct+0x58/0x7c
      [<8014eaf4>] do_sendfile+0x1dc/0x39c
      [<8014f82c>] SyS_sendfile+0x90/0xf8
      
      Add the eva_kernel_access() check in __copy_from_user() like the one in
      copy_from_user().
      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/10843/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      6f06a2c4
    • J
      MIPS: uaccess: Fix strlen_user with EVA · 5dc62fdd
      James Hogan 提交于
      The strlen_user() function calls __strlen_kernel_asm in both branches of
      the eva_kernel_access() conditional. For EVA it should be calling
      __strlen_user_eva for user accesses, otherwise it will load from the
      kernel address space instead of the user address space, and the access
      checking will likely be ineffective at preventing it due to EVA's
      overlapping user and kernel address spaces.
      
      This was found after extending the test_user_copy module to cover user
      string access functions, which gave the following error with EVA:
      
      test_user_copy: illegal strlen_user passed
      
      Fortunately the use of strlen_user() has been all but eradicated from
      the mainline kernel, so only out of tree modules could be affected.
      
      Fixes: e3a9b07a ("MIPS: asm: uaccess: Add EVA support for str*_user operations")
      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
      Cc: <stable@vger.kernel.org> # 3.15.x-
      Patchwork: https://patchwork.linux-mips.org/patch/10842/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      5dc62fdd
  8. 13 12月, 2015 1 次提交