1. 23 1月, 2018 1 次提交
    • J
      MIPS: Add helpers for assembler macro instructions · fc62f53b
      James Hogan 提交于
      Implement a parse_r assembler macro in asm/mipsregs.h to parse a
      register in $n form, and a few C macros for defining assembler macro
      instructions. These can be used to more transparently support older
      binutils versions which don't support for example the msa, virt, xpa, or
      crc instructions.
      
      In particular they overcome the difficulty of turning a register name in
      $n form into an instruction encoding suitable for giving to .word /
      .hword, which is particularly problematic when needed from inline
      assembly where the compiler is responsible for register allocation.
      Traditionally this had required the use of $at and an extra MOV
      instruction, but for CRC instructions with multiple GP register operands
      that approach becomes more difficult.
      
      Three assembler macro creation helpers are added:
      
       - _ASM_MACRO_0(OP, ENC)
         This is to define an assembler macro for an instruction which has no
         operands, for example the VZ TLBGR instruction.
      
       - _ASM_MACRO_2R(OP, R1, R2, ENC)
         This is to define an assembler macro for an instruction which has 2
         register operands, for example the CFCMSA instruction.
      
       - _ASM_MACRO_3R(OP, R1, R2, R3, ENC)
         This is to define an assembler macro for an instruction which has 3
         register operands, for example the crc32 instructions.
      
       - _ASM_MACRO_2R_1S(OP, R1, R2, SEL3, ENC)
         This is to define an assembler macro for a Cop0 move instruction,
         with 2 register operands and an optional register select operand
         which defaults to 0, for example the VZ MFGC0 instruction.
      Suggested-by: NRalf Baechle <ralf@linux-mips.org>
      Signed-off-by: NJames Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Marcin Nowakowski <marcin.nowakowski@mips.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/17770/
      fc62f53b
  2. 19 1月, 2018 1 次提交
  3. 10 1月, 2018 2 次提交
    • J
      MIPS: mipsregs.h: Make read_c0_prid use const accessor · 6538953f
      James Hogan 提交于
      Make read_c0_prid() use the new constant accessor macros so that it can
      potentially be optimised or removed by the compiler. This is
      particularly important under virtualisation, where even with hardware
      assisted virtualisation (VZ), access to the PRid register may need to be
      emulated by the hypervisor.
      
      In particular this helps eliminate the read of the PRid register in the
      rather frequently called add_interrupt_randomness() (which calls into
      arch/mips/include/asm/timex.h) when the prid is unused but the read
      can't be removed due to the inline asm being marked __volatile__.
      Reported-by: NYann LeDu <Yann.LeDu@imgtec.com>
      Signed-off-by: NJames Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Maciej W. Rozycki <macro@mips.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/17923/
      6538953f
    • J
      MIPS: mipsregs.h: Add read const Cop0 macros · cd1e0737
      James Hogan 提交于
      Some Cop0 registers are constant and have no side effects when read.
      There is no need for the inline asm to read these to be marked
      __volatile__, and doing so prevents them from being removed by the
      compiler.
      
      Add a few new accessor macros to handle these registers more efficiently
      (especially for the sake of running in a guest where redundant access to
      the register may trap to the hypervisor):
        __read_const_32bit_c0_register()
        __read_const_64bit_c0_register()
        __read_const_ulong_c0_register()
      Signed-off-by: NJames Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Maciej W. Rozycki <macro@mips.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/17922/
      cd1e0737
  4. 30 11月, 2017 1 次提交
  5. 28 11月, 2017 1 次提交
    • M
      MIPS: Add custom serial.h with BASE_BAUD override for generic kernel · c8ec2041
      Matt Redfearn 提交于
      Add a custom serial.h header for MIPS, allowing platforms to override
      the asm-generic version if required.
      
      The generic platform uses this header to set BASE_BAUD to 0. The
      generic platform supports multiple boards, which may have different
      UART clocks. Also one of the boards supported is the Boston FPGA board,
      where the UART clock depends on the loaded FPGA bitfile. As such there
      is no way that the generic kernel can set a compile time default
      BASE_BAUD.
      
      Commit 31cb9a85 ("earlycon: initialise baud field of earlycon device
      structure") changed the behavior of of_setup_earlycon such that any baud
      rate set in the device tree is now set in the earlycon structure. The
      UART driver will then calculate a divisor based on BASE_BAUD and set it.
      With MIPS generic kernels this resulted in garbage output due to the
      incorrect uart clock rate being used to calculate a divisor. This
      commit, combined with "serial: 8250_early: Only set divisor if valid clk
      & baud" prevents the earlycon code setting a bad divisor and restores
      earlycon output.
      
      Fixes: 31cb9a85 ("earlycon: initialise baud field of earlycon device structure")
      Cc: stable <stable@vger.kernel.org> # 4.14
      Signed-off-by: NMatt Redfearn <matt.redfearn@mips.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c8ec2041
  6. 16 11月, 2017 1 次提交
  7. 15 11月, 2017 1 次提交
  8. 14 11月, 2017 1 次提交
  9. 11 11月, 2017 1 次提交
    • J
      MIPS: Fix odd fp register warnings with MIPS64r2 · c7fd89a6
      James Hogan 提交于
      Building 32-bit MIPS64r2 kernels produces warnings like the following
      on certain toolchains (such as GNU assembler 2.24.90, but not GNU
      assembler 2.28.51) since commit 22b8ba76 ("MIPS: Fix MIPS64 FP
      save/restore on 32-bit kernels"), due to the exposure of fpu_save_16odd
      from fpu_save_double and fpu_restore_16odd from fpu_restore_double:
      
      arch/mips/kernel/r4k_fpu.S:47: Warning: float register should be even, was 1
      ...
      arch/mips/kernel/r4k_fpu.S:59: Warning: float register should be even, was 1
      ...
      
      This appears to be because .set mips64r2 does not change the FPU ABI to
      64-bit when -march=mips64r2 (or e.g. -march=xlp) is provided on the
      command line on that toolchain, from the default FPU ABI of 32-bit due
      to the -mabi=32. This makes access to the odd FPU registers invalid.
      
      Fix by explicitly changing the FPU ABI with .set fp=64 directives in
      fpu_save_16odd and fpu_restore_16odd, and moving the undefine of fp up
      in asmmacro.h so fp doesn't turn into $30.
      
      Fixes: 22b8ba76 ("MIPS: Fix MIPS64 FP save/restore on 32-bit kernels")
      Signed-off-by: NJames Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Paul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: <stable@vger.kernel.org> # 4.0+: 22b8ba76: MIPS: Fix MIPS64 FP save/restore on 32-bit kernels
      Cc: <stable@vger.kernel.org> # 4.0+
      Patchwork: https://patchwork.linux-mips.org/patch/17656/
      c7fd89a6
  10. 09 11月, 2017 4 次提交
    • J
      MIPS/ptrace: Update syscall nr on register changes · de8cd0dc
      James Hogan 提交于
      Update the thread_info::syscall field when registers are modified via
      ptrace to change or cancel the system call being entered.
      
      This is important to allow seccomp and the syscall entry and exit trace
      events to observe the new syscall number changed by the normal ptrace
      hook or seccomp. That includes allowing seccomp's recheck of the system
      call number after SECCOMP_RET_TRACE to notice if the syscall is changed
      to a denied one, which happens in seccomp since commit ce6526e8
      ("seccomp: recheck the syscall after RET_TRACE") in v4.8.
      
      In the process of doing this, the logic to determine whether an indirect
      system call is in progress (i.e. the O32 ABI's syscall()) is abstracted
      into mips_syscall_is_indirect(), and a new mips_syscall_update_nr() is
      used to update the thread_info::syscall based on the register state.
      
      The following ptrace operations are updated:
       - PTRACE_SETREGS (ptrace_setregs()).
       - PTRACE_SETREGSET with NT_PRSTATUS (gpr32_set() and gpr64_set()).
       - PTRACE_POKEUSR with 2/v0 or 4/a0 for indirect syscall
         ([compat_]arch_ptrace()).
      
      Fixes: c2d9f177 ("MIPS: Fix syscall_get_nr for the syscall exit tracing.")
      Signed-off-by: NJames Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Lars Persson <larper@axis.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Will Drewry <wad@chromium.org>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16995/
      de8cd0dc
    • J
      MIPS: Fix MIPS64 FP save/restore on 32-bit kernels · 22b8ba76
      James Hogan 提交于
      32-bit kernels can be configured to support MIPS64, in which case
      neither CONFIG_64BIT or CONFIG_CPU_MIPS32_R* will be set. This causes
      the CP0_Status.FR checks at the point of floating point register save
      and restore to be compiled out, which results in odd FP registers not
      being saved or restored to the task or signal context even when
      CP0_Status.FR is set.
      
      Fix the ifdefs to use CONFIG_CPU_MIPSR2 and CONFIG_CPU_MIPSR6, which are
      enabled for the relevant revisions of either MIPS32 or MIPS64, along
      with some other CPUs such as Octeon (r2), Loongson1 (r2), XLP (r2),
      Loongson 3A R2.
      
      The suspect code originates from commit 597ce172 ("MIPS: Support for
      64-bit FP with O32 binaries") in v3.14, however the code in
      __enable_fpu() was consistent and refused to set FR=1, falling back to
      software FPU emulation. This was suboptimal but should be functionally
      correct.
      
      Commit fcc53b5f ("MIPS: fpu.h: Allow 64-bit FPU on a 64-bit MIPS R6
      CPU") in v4.2 (and stable tagged back to 4.0) later introduced the bug
      by updating __enable_fpu() to set FR=1 but failing to update the other
      similar ifdefs to enable FR=1 state handling.
      
      Fixes: fcc53b5f ("MIPS: fpu.h: Allow 64-bit FPU on a 64-bit MIPS R6 CPU")
      Signed-off-by: NJames Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Paul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: <stable@vger.kernel.org> # 4.0+
      Patchwork: https://patchwork.linux-mips.org/patch/16739/
      22b8ba76
    • F
      MIPS: page.h: Define virt_to_pfn() · 37d15948
      Florian Fainelli 提交于
      Define virt_to_pfn() based on the existing definition of virt_to_page()
      which already does a PFN_DOWN(vir_to_phys(kaddr)).
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Maciej W. Rozycki <macro@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/15409/Signed-off-by: NJames Hogan <jhogan@kernel.org>
      37d15948
    • M
      MIPS: Use SLL by 0 for 32-bit truncation in `__read_64bit_c0_split' · d3a0b968
      Maciej W. Rozycki 提交于
      Optimize `__read_64bit_c0_split' and reduce the instruction count by 1,
      observing that a DSLL/DSRA pair by 32, is equivalent to SLL by 0, which
      architecturally truncates the value requested to 32 bits on 64-bit MIPS
      hardware regardless of whether the input operand is or is not a properly
      sign-extended 32-bit value.
      Signed-off-by: NMaciej W. Rozycki <macro@imgtec.com>
      Reviewed-by: NJames Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/17399/Signed-off-by: NJames Hogan <jhogan@kernel.org>
      d3a0b968
  11. 08 11月, 2017 4 次提交
  12. 04 11月, 2017 1 次提交
    • P
      Update MIPS email addresses · fb615d61
      Paul Burton 提交于
      MIPS will soon not be a part of Imagination Technologies, and as such
      many @imgtec.com email addresses will no longer be valid. This patch
      updates the addresses for those who:
      
       - Have 10 or more patches in mainline authored using an @imgtec.com
         email address, or any patches dated within the past year.
      
       - Are still with Imagination but leaving as part of the MIPS business
         unit, as determined from an internal email address list.
      
       - Haven't already updated their email address (ie. JamesH) or expressed
         a desire to be excluded (ie. Maciej).
      
       - Acked v2 or earlier of this patch, which leaves Deng-Cheng, Matt &
         myself.
      
      New addresses are of the form firstname.lastname@mips.com, and all
      verified against an internal email address list.  An entry is added to
      .mailmap for each person such that get_maintainer.pl will report the new
      addresses rather than @imgtec.com addresses which will soon be dead.
      
      Instances of the affected addresses throughout the tree are then
      mechanically replaced with the new @mips.com address.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Cc: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
      Cc: Deng-Cheng Zhu <dengcheng.zhu@mips.com>
      Acked-by: NDengcheng Zhu <dengcheng.zhu@mips.com>
      Cc: Matt Redfearn <matt.redfearn@imgtec.com>
      Cc: Matt Redfearn <matt.redfearn@mips.com>
      Acked-by: NMatt Redfearn <matt.redfearn@mips.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Cc: trivial@kernel.org
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      fb615d61
  13. 02 11月, 2017 1 次提交
    • G
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman 提交于
      Many source files in the tree are missing licensing information, which
      makes it harder for compliance tools to determine the correct license.
      
      By default all files without license information are under the default
      license of the kernel, which is GPL version 2.
      
      Update the files which contain no license information with the 'GPL-2.0'
      SPDX license identifier.  The SPDX identifier is a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.
      
      How this work was done:
      
      Patches were generated and checked against linux-4.14-rc6 for a subset of
      the use cases:
       - file had no licensing information it it.
       - file was a */uapi/* one with no licensing information in it,
       - file was a */uapi/* one with existing licensing information,
      
      Further patches will be generated in subsequent months to fix up cases
      where non-standard license headers were used, and references to license
      had to be inferred by heuristics based on keywords.
      
      The analysis to determine which SPDX License Identifier to be applied to
      a file was done in a spreadsheet of side by side results from of the
      output of two independent scanners (ScanCode & Windriver) producing SPDX
      tag:value files created by Philippe Ombredanne.  Philippe prepared the
      base worksheet, and did an initial spot review of a few 1000 files.
      
      The 4.13 kernel was the starting point of the analysis with 60,537 files
      assessed.  Kate Stewart did a file by file comparison of the scanner
      results in the spreadsheet to determine which SPDX license identifier(s)
      to be applied to the file. She confirmed any determination that was not
      immediately clear with lawyers working with the Linux Foundation.
      
      Criteria used to select files for SPDX license identifier tagging was:
       - Files considered eligible had to be source code files.
       - Make and config files were included as candidates if they contained >5
         lines of source
       - File already had some variant of a license header in it (even if <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: NKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: NPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  14. 01 11月, 2017 3 次提交
    • P
      MIPS: Fix CM region target definitions · 6a6cba1d
      Paul Burton 提交于
      The default CM target field in the GCR_BASE register is encoded with 0
      meaning memory & 1 being reserved. However the definitions we use for
      those bits effectively get these two values backwards - likely because
      they were copied from the definitions for the CM regions where the
      target is encoded differently. This results in use setting up GCR_BASE
      with the reserved target value by default, rather than targeting memory
      as intended. Although we currently seem to get away with this it's not a
      great idea to rely upon.
      
      Fix this by changing our macros to match the documentated target values.
      
      The incorrect encoding became used as of commit 9f98f3dd ("MIPS: Add
      generic CM probe & access code") in the Linux v3.15 cycle, and was
      likely carried forwards from older but unused code introduced by
      commit 39b8d525 ("[MIPS] Add support for MIPS CMP platform.") in the
      v2.6.26 cycle.
      
      Fixes: 9f98f3dd ("MIPS: Add generic CM probe & access code")
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Reported-by: NMatt Redfearn <matt.redfearn@mips.com>
      Reviewed-by: NJames Hogan <jhogan@kernel.org>
      Cc: Matt Redfearn <matt.redfearn@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Cc: <stable@vger.kernel.org> # v3.15+
      Patchwork: https://patchwork.linux-mips.org/patch/17562/Signed-off-by: NJames Hogan <jhogan@kernel.org>
      6a6cba1d
    • M
      MIPS: Fix exception entry when CONFIG_EVA enabled · c496f3c0
      Matt Redfearn 提交于
      Commit 9fef6868 ("MIPS: Make SAVE_SOME more standard") made several
      changes to the order in which registers are saved in the SAVE_SOME
      macro, used by exception handlers to save the processor state. In
      particular, it removed the
      move   k1, sp
      in the delay slot of the branch testing if the processor is already in
      kernel mode. This is replaced later in the macro by a
      move   k0, sp
      When CONFIG_EVA is disabled, this instruction actually appears in the
      delay slot of the branch. However, when CONFIG_EVA is enabled, instead
      the RPS workaround of
      MFC0	k0, CP0_ENTRYHI
      appears in the delay slot. This results in k0 not containing the stack
      pointer, but some unrelated value, which is then saved to the kernel
      stack. On exit from the exception, this bogus value is restored to the
      stack pointer, resulting in an OOPS.
      
      Fix this by moving the save of SP in k0 explicitly in the delay slot of
      the branch, outside of the CONFIG_EVA section, restoring the expected
      instruction ordering when CONFIG_EVA is active.
      
      Fixes: 9fef6868 ("MIPS: Make SAVE_SOME more standard")
      Signed-off-by: NMatt Redfearn <matt.redfearn@mips.com>
      Reported-by: NVladimir Kondratiev <vladimir.kondratiev@intel.com>
      Reviewed-by: NCorey Minyard <cminyard@mvista.com>
      Reviewed-by: NJames Hogan <jhogan@kernel.org>
      Patchwork: https://patchwork.linux-mips.org/patch/17471/Signed-off-by: NJames Hogan <jhogan@kernel.org>
      c496f3c0
    • P
      Update MIPS email addresses · 48c834be
      Paul Burton 提交于
      MIPS will soon not be a part of Imagination Technologies, and as such
      many @imgtec.com email addresses will no longer be valid. This patch
      updates the addresses for those who:
      
       - Have 10 or more patches in mainline authored using an @imgtec.com
         email address, or any patches dated within the past year.
      
       - Are still with Imagination but leaving as part of the MIPS business
         unit, as determined from an internal email address list.
      
       - Haven't already updated their email address (ie. JamesH) or expressed
         a desire to be excluded (ie. Maciej).
      
       - Acked v2 or earlier of this patch, which leaves Deng-Cheng, Matt &
         myself.
      
      New addresses are of the form firstname.lastname@mips.com, and all
      verified against an internal email address list. An entry is added to
      .mailmap for each person such that get_maintainer.pl will report the new
      addresses rather than @imgtec.com addresses which will soon be dead.
      
      Instances of the affected addresses throughout the tree are then
      mechanically replaced with the new @mips.com address.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Cc: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
      Cc: Deng-Cheng Zhu <dengcheng.zhu@mips.com>
      Acked-by: NDengcheng Zhu <dengcheng.zhu@mips.com>
      Cc: Matt Redfearn <matt.redfearn@imgtec.com>
      Cc: Matt Redfearn <matt.redfearn@mips.com>
      Acked-by: NMatt Redfearn <matt.redfearn@mips.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Cc: trivial@kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/17540/Signed-off-by: NJames Hogan <jhogan@kernel.org>
      48c834be
  15. 25 10月, 2017 1 次提交
    • M
      locking/atomics: COCCINELLE/treewide: Convert trivial ACCESS_ONCE() patterns... · 6aa7de05
      Mark Rutland 提交于
      locking/atomics: COCCINELLE/treewide: Convert trivial ACCESS_ONCE() patterns to READ_ONCE()/WRITE_ONCE()
      
      Please do not apply this to mainline directly, instead please re-run the
      coccinelle script shown below and apply its output.
      
      For several reasons, it is desirable to use {READ,WRITE}_ONCE() in
      preference to ACCESS_ONCE(), and new code is expected to use one of the
      former. So far, there's been no reason to change most existing uses of
      ACCESS_ONCE(), as these aren't harmful, and changing them results in
      churn.
      
      However, for some features, the read/write distinction is critical to
      correct operation. To distinguish these cases, separate read/write
      accessors must be used. This patch migrates (most) remaining
      ACCESS_ONCE() instances to {READ,WRITE}_ONCE(), using the following
      coccinelle script:
      
      ----
      // Convert trivial ACCESS_ONCE() uses to equivalent READ_ONCE() and
      // WRITE_ONCE()
      
      // $ make coccicheck COCCI=/home/mark/once.cocci SPFLAGS="--include-headers" MODE=patch
      
      virtual patch
      
      @ depends on patch @
      expression E1, E2;
      @@
      
      - ACCESS_ONCE(E1) = E2
      + WRITE_ONCE(E1, E2)
      
      @ depends on patch @
      expression E;
      @@
      
      - ACCESS_ONCE(E)
      + READ_ONCE(E)
      ----
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: davem@davemloft.net
      Cc: linux-arch@vger.kernel.org
      Cc: mpe@ellerman.id.au
      Cc: shuah@kernel.org
      Cc: snitzer@redhat.com
      Cc: thor.thayer@linux.intel.com
      Cc: tj@kernel.org
      Cc: viro@zeniv.linux.org.uk
      Cc: will.deacon@arm.com
      Link: http://lkml.kernel.org/r/1508792849-3115-19-git-send-email-paulmck@linux.vnet.ibm.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      6aa7de05
  16. 19 10月, 2017 1 次提交
  17. 10 10月, 2017 2 次提交
  18. 09 10月, 2017 3 次提交
    • P
      MIPS: Fix cmpxchg on 32b signed ints for 64b kernel with !kernel_uses_llsc · 133d68e0
      Paul Burton 提交于
      Commit 8263db4d ("MIPS: cmpxchg: Implement __cmpxchg() as a
      function") refactored our implementation of __cmpxchg() to be a function
      rather than a macro, with the aim of making it easier to read & modify.
      Unfortunately the commit breaks use of cmpxchg() for signed 32 bit
      values when we have a 64 bit kernel with kernel_uses_llsc == false,
      because:
      
       - In cmpxchg_local() we cast the old value to the type the pointer
         points to, and then to an unsigned long. If the pointer points to a
         signed type smaller than 64 bits then the old value will be sign
         extended to 64 bits. That is, bits beyond the size of the pointed to
         type will be set to 1 if the old value is negative. In the case of a
         signed 32 bit integer with a negative value, bits 63:32 will all be
         set.
      
       - In __cmpxchg_asm() we load the value from memory, ie. dereference the
         pointer, and store the value as an unsigned integer (__ret) whose
         size matches the pointer. For a 32 bit cmpxchg() this means we store
         the value in a u32, because the pointer provided to __cmpxchg_asm()
         by __cmpxchg() is of type volatile u32 *.
      
       - __cmpxchg_asm() then checks whether the value in memory (__ret)
         matches the provided old value, by comparing the two values. This
         results in the u32 being promoted to a 64 bit unsigned long to match
         the old argument - however because both types are unsigned the value
         is zero extended, which does not match the sign extension performed
         on the old value in cmpxchg_local() earlier.
      
      This mismatch means that unfortunate cmpxchg() calls can incorrectly
      fail for 64 bit kernels with kernel_uses_llsc == false. This is the case
      on at least non-SMP Cavium Octeon kernels, which hardcode
      kernel_uses_llsc in their cpu-feature-overrides.h header. Using a
      v4.13-rc7 kernel configured using cavium_octeon_defconfig with SMP
      manually disabled, this presents itself as oddity when we reach
      userland - for example:
      
        can't run '/bin/mount': Text file busy
        can't run '/bin/mkdir': Text file busy
        can't run '/bin/mkdir': Text file busy
        can't run '/bin/mount': Text file busy
        can't run '/bin/hostname': Text file busy
        can't run '/etc/init.d/rcS': Text file busy
        can't run '/sbin/getty': Text file busy
        can't run '/sbin/getty': Text file busy
      
      It appears that some part of the init process, which is in this case
      buildroot's busybox init, is running successfully. It never manages to
      reach the login prompt though, and complains about /sbin/getty being
      busy repeatedly and indefinitely.
      
      Fix this by casting the old value provided to __cmpxchg_asm() to an
      appropriately sized unsigned integer, such that we consistently
      zero-extend avoiding the mismatch. The __cmpxchg_small() case for 8 & 16
      bit values is unaffected because __cmpxchg_small() already masks
      provided values appropriately.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Fixes: 8263db4d ("MIPS: cmpxchg: Implement __cmpxchg() as a function")
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/17226/
      Cc: linux-mips@linux-mips.org
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      133d68e0
    • C
      MIPS: Add nudges to writes for bit unlocks. · 34ae9c91
      Chad Reese 提交于
      Flushing the writes lets other CPUs waiting for the lock to get it sooner.
      Signed-off-by: NChad Reese <kreese@caviumnetworks.com>
      Signed-off-by: NDavid Daney <david.daney@cavium.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/17289/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      34ae9c91
    • T
      MIPS: make thread_saved_pc static · 508c5757
      Tobias Klauser 提交于
      The only user of thread_saved_pc() in non-arch-specific code was removed
      in commit 8243d559 ("sched/core: Remove pointless printout in
      sched_show_task()"), so it no longer needs to be globally defined for
      MIPS and can be made static.
      Signed-off-by: NTobias Klauser <tklauser@distanz.ch>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/17303/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      508c5757
  19. 21 9月, 2017 1 次提交
    • J
      MIPS: Fix input modify in __write_64bit_c0_split() · c22c8043
      James Hogan 提交于
      The inline asm in __write_64bit_c0_split() modifies the 64-bit input
      operand by shifting the high register left by 32, and constructing the
      full 64-bit value in the low register (even on a 32-bit kernel), so if
      that value is used again it could cause breakage as GCC would assume the
      registers haven't changed when they have.
      
      To quote the GCC extended asm documentation:
      > Warning: Do not modify the contents of input-only operands (except for
      > inputs tied to outputs). The compiler assumes that on exit from the
      > asm statement these operands contain the same values as they had
      > before executing the statement.
      
      Avoid modifying the input by using a temporary variable as an output
      which is modified instead of the input and not otherwise used. The asm
      is always __volatile__ so GCC shouldn't optimise it out. The low
      register of the temporary output is written before the high register of
      the input is read, so we have two constraint alternatives, one where
      both use the same registers (for when the input value isn't subsequently
      used), and one with an early clobber on the output in case the low
      output uses the same register as the high input. This allows the
      resulting assembly to remain mostly unchanged.
      
      A diff of a MIPS32r6 kernel reveals only three differences, two in
      relation to write_c0_r10k_diag() in cpu_probe() (register allocation
      rearranged slightly but otherwise identical), and one in relation to
      write_c0_cvmmemctl2() in kvm_vz_local_flush_guesttlb_all(), but the
      octeon CPU is only supported on 64-bit kernels where
      __write_64bit_c0_split() isn't used so that shouldn't matter in
      practice. So there currently doesn't appear to be anything broken by
      this bug.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/17315/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      c22c8043
  20. 20 9月, 2017 1 次提交
  21. 09 9月, 2017 1 次提交
    • M
      vga: optimise console scrolling · ac036f95
      Matthew Wilcox 提交于
      Where possible, call memset16(), memmove() or memcpy() instead of using
      open-coded loops.  I don't like the calling convention that uses a byte
      count instead of a count of u16s, but it's a little late to change that.
      Reduces code size of fbcon.o by almost 400 bytes on my laptop build.
      
      [akpm@linux-foundation.org: fix build]
      Link: http://lkml.kernel.org/r/20170720184539.31609-9-willy@infradead.orgSigned-off-by: NMatthew Wilcox <mawilcox@microsoft.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: David Miller <davem@davemloft.net>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
      Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Russell King <rmk+kernel@armlinux.org.uk>
      Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ac036f95
  22. 06 9月, 2017 4 次提交
  23. 05 9月, 2017 3 次提交