1. 11 11月, 2015 10 次提交
    • A
      MIPS: Initial implementation of a VDSO · ebb5e78c
      Alex Smith 提交于
      Add an initial implementation of a proper (i.e. an ELF shared library)
      VDSO. With this commit it does not export any symbols, it only replaces
      the current signal return trampoline page. A later commit will add user
      implementations of gettimeofday()/clock_gettime().
      
      To support both new toolchains and old ones which don't generate ABI
      flags section, we define its content manually and then use a tool
      (genvdso) to patch up the section to have the correct name and type.
      genvdso also extracts symbol offsets ({,rt_}sigreturn) needed by the
      kernel, and generates a C file containing a "struct mips_vdso_image"
      containing both the VDSO data and these offsets. This C file is
      compiled into the kernel.
      
      On 64-bit kernels we require a different VDSO for each supported ABI,
      so we may build up to 3 different VDSOs. The VDSO to use is selected by
      the mips_abi structure.
      
      A kernel/user shared data page is created and mapped below the VDSO
      image. This is currently empty, but will be used by the user time
      function implementations which are added later.
      
      [markos.chandras@imgtec.com:
      - Add more comments
      - Move abi detection in genvdso.h since it's the get_symbol function
      that needs it.
      - Add an R6 specific way to calculate the base address of VDSO in order
      to avoid the branch instruction which affects performance.
      - Do not patch .gnu.attributes since it's not needed for dynamic linking.
      - Simplify Makefile a little bit.
      - checkpatch fixes
      - Restrict VDSO support for binutils < 2.25 for pre-R6
      - Include atomic64.h for O32 variant on MIPS64]
      Signed-off-by: NAlex Smith <alex.smith@imgtec.com>
      Signed-off-by: NMarkos Chandras <markos.chandras@imgtec.com>
      Cc: Matthew Fortune <matthew.fortune@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/11337/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      ebb5e78c
    • P
      MIPS: Extend hardware table walking support to MIPS64 · cab25bc7
      Paul Burton 提交于
      Extend the existing support for Hardware Table Walking (HTW) to MIPS64
      systems by supporting PMDs & setting the pointer size bit in PWSize,
      then ceasing to blacklist HTW on MIPS64 systems.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Steven J. Hill <Steven.Hill@imgtec.com>
      Cc: Joshua Kinard <kumba@gentoo.org>
      Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
      Cc: Maciej W. Rozycki <macro@linux-mips.org>
      Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Patchwork: https://patchwork.linux-mips.org/patch/11224/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      cab25bc7
    • P
      MIPS: Always use r4k_wait_irqoff for MIPSr6 · 5b10a0e8
      Paul Burton 提交于
      Prior to release 6 of the MIPS architecture it has been implementation
      dependent whether masked interrupts cause a wait instruction to return,
      so the kernel has effectively had to maintain a whitelist of cores upon
      which it is safe to use the r4k_wait_irqoff cpu_wait implementation.
      With MIPSr6 this is no longer implementation dependent and
      r4k_wait_irqoff can always be used.
      
      Remove the existing I6400 case which will no longer ever be hit, and was
      incorrect anyway since I6400 & r6 in general doesn't have the WII bit.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Patchwork: https://patchwork.linux-mips.org/patch/11210/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      5b10a0e8
    • P
      MIPS: CM, CPC: Ensure core-other GCRs reflect the correct core · 78a54c4d
      Paul Burton 提交于
      Ensure the update to which core the core-other GCR regions reflect has
      taken place before any core-other GCRs are accessed by placing a memory
      barrier (sync instruction) between the write to the core-other registers
      and any such GCR accesses.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Patchwork: https://patchwork.linux-mips.org/patch/11209/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      78a54c4d
    • P
      MIPS: CM: make use of mips_cm_{lock,unlock}_other · 4ede3161
      Paul Burton 提交于
      Document that CPC core-other accesses must take place within the bounds
      of the CM lock, and begin using the CM lock functions where we access
      the GCRs of other cores. This is required because with CM3 the CPC began
      using GCR_CL_OTHER instead of CPC_CL_OTHER.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Andrew Bresticker <abrestic@chromium.org>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: Niklas Cassel <niklas.cassel@axis.com>
      Cc: Ezequiel Garcia <ezequiel.garcia@imgtec.com>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Patchwork: https://patchwork.linux-mips.org/patch/11208/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      4ede3161
    • P
      MIPS: CM: Introduce core-other locking functions · 23d5de8e
      Paul Burton 提交于
      Introduce mips_cm_lock_other & mips_cm_unlock_other, mirroring the
      existing CPC equivalents, in order to lock access from the current core
      to another via the core-other GCR region. This hasn't been required in
      the past but with CM3 the CPC starts using GCR_CL_OTHER rather than
      CPC_CL_OTHER and this will be required for safety.
      
      [ralf@linux-mips.org: Fix merge conflict.]
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Patchwork: https://patchwork.linux-mips.org/patch/11207/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      23d5de8e
    • P
      MIPS: CPS: Warn if a core doesn't start · a8c20614
      Paul Burton 提交于
      When debugging core bringup it is useful to see the state of the CPC
      sequencer, so output that value if the core hasn't started within a
      reasonable amount of time (1 second). This avoids simply appearing to
      the user to hang if a secondary core fails to start.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Andrew Bresticker <abrestic@chromium.org>
      Cc: linux-kernel@vger.kernel.org
      Cc: Niklas Cassel <niklas.cassel@axis.com>
      Cc: Ezequiel Garcia <ezequiel.garcia@imgtec.com>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Patchwork: https://patchwork.linux-mips.org/patch/11205/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      a8c20614
    • P
      MIPS: CPS: Skip Config1 presence check · 192fbc20
      Paul Burton 提交于
      The Config1 register is architecturally defined as required, and is thus
      present in all systems which may make use of cps-vec.S. Skip the check
      for its presence via the Config.M bit.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/11204/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      192fbc20
    • P
      MIPS: CPS: Read CM GCR base from cop0 · 946db173
      Paul Burton 提交于
      Rather than patching the start of mips_cps_core_entry to provide the
      base address of the CM GCRs, simply read that base address from the cop0
      CMGCRBase register, converting from the physical address to an uncached
      virtual address.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Andrew Bresticker <abrestic@chromium.org>
      Cc: linux-kernel@vger.kernel.org
      Cc: Niklas Cassel <niklas.cassel@axis.com>
      Cc: Ezequiel Garcia <ezequiel.garcia@imgtec.com>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Patchwork: https://patchwork.linux-mips.org/patch/11203/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      946db173
    • P
      MIPS: CPS: Early debug using an ns16550-compatible UART · 609cf6f2
      Paul Burton 提交于
      Provide support for outputting early debug information, in the form of
      various register values should an exception occur, during the early
      bringup of secondary cores. This code requires an ns16550-compatible
      UART accessible from the secondary core, and is written in assembly due
      to the environment in which such early exceptions occur where way may
      not have a stack, be coherent or even have initialised caches.
      
      [ralf@linux-mips.org: Fix merge conflict.]
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Steven J. Hill <Steven.Hill@imgtec.com>
      Cc: Andrew Bresticker <abrestic@chromium.org>
      Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
      Cc: Maciej W. Rozycki <macro@linux-mips.org>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: linux-kernel@vger.kernel.org
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Patchwork: https://patchwork.linux-mips.org/patch/11202/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      609cf6f2
  2. 26 10月, 2015 7 次提交
  3. 04 10月, 2015 1 次提交
  4. 03 10月, 2015 2 次提交
    • P
      MIPS: Fix R2300 FP context switch handling · 085c2f25
      Paul Burton 提交于
      Commit 1a3d5957 ("MIPS: Tidy up FPU context switching") removed FP
      context saving from the asm-written resume function in favour of reusing
      existing code to perform the same task. However it only removed the FP
      context saving code from the r4k_switch.S implementation of resume.
      Remove it from the r2300_switch.S implementation too in order to prevent
      attempting to save the FP context twice, which would likely lead to an
      exception from the second save because the FPU had already been disabled
      by the first save.
      
      This patch has only been build tested, using rbtx49xx_defconfig.
      
      Fixes: 1a3d5957 ("MIPS: Tidy up FPU context switching")
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Maciej W. Rozycki <macro@linux-mips.org>
      Cc: linux-kernel@vger.kernel.org
      Cc: Manuel Lauss <manuel.lauss@gmail.com>
      Patchwork: https://patchwork.linux-mips.org/patch/11167/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      085c2f25
    • P
      MIPS: Fix octeon FP context switch handling · 0fa24340
      Paul Burton 提交于
      Commit 1a3d5957 ("MIPS: Tidy up FPU context switching") removed FP
      context saving from the asm-written resume function in favour of reusing
      existing code to perform the same task. However it only removed the FP
      context saving code from the r4k_switch.S implementation of resume.
      Octeon uses its own implementation in octeon_switch.S, so remove FP
      context saving there too in order to prevent attempting to save context
      twice. That formerly led to an exception from the second save as follows
      because the FPU had already been disabled by the first save:
      
          do_cpu invoked from kernel context![#1]:
          CPU: 0 PID: 2 Comm: kthreadd Not tainted 4.3.0-rc2-dirty #2
          task: 800000041f84a008 ti: 800000041f864000 task.ti: 800000041f864000
          $ 0   : 0000000000000000 0000000010008ce1 0000000000100000 ffffffffbfffffff
          $ 4   : 800000041f84a008 800000041f84ac08 800000041f84c000 0000000000000004
          $ 8   : 0000000000000001 0000000000000000 0000000000000000 0000000000000001
          $12   : 0000000010008ce3 0000000000119c60 0000000000000036 800000041f864000
          $16   : 800000041f84ac08 800000000792ce80 800000041f84a008 ffffffff81758b00
          $20   : 0000000000000000 ffffffff8175ae50 0000000000000000 ffffffff8176c740
          $24   : 0000000000000006 ffffffff81170300
          $28   : 800000041f864000 800000041f867d90 0000000000000000 ffffffff815f3fa0
          Hi    : 0000000000fa8257
          Lo    : ffffffffe15cfc00
          epc   : ffffffff8112821c resume+0x9c/0x200
          ra    : ffffffff815f3fa0 __schedule+0x3f0/0x7d8
          Status: 10008ce2        KX SX UX KERNEL EXL
          Cause : 1080002c (ExcCode 0b)
          PrId  : 000d0601 (Cavium Octeon+)
          Modules linked in:
          Process kthreadd (pid: 2, threadinfo=800000041f864000, task=800000041f84a008, tls=0000000000000000)
          Stack : ffffffff81604218 ffffffff815f7e08 800000041f84a008 ffffffff811681b0
                    800000041f84a008 ffffffff817e9878 0000000000000000 ffffffff81770000
                    ffffffff81768340 ffffffff81161398 0000000000000001 0000000000000000
                    0000000000000000 ffffffff815f4424 0000000000000000 ffffffff81161d68
                    ffffffff81161be8 0000000000000000 0000000000000000 0000000000000000
                    0000000000000000 0000000000000000 0000000000000000 ffffffff8111e16c
                    0000000000000000 0000000000000000 0000000000000000 0000000000000000
                    0000000000000000 0000000000000000 0000000000000000 0000000000000000
                    0000000000000000 0000000000000000 0000000000000000 0000000000000000
                    0000000000000000 0000000000000000 0000000000000000 0000000000000000
                    ...
          Call Trace:
          [<ffffffff8112821c>] resume+0x9c/0x200
          [<ffffffff815f3fa0>] __schedule+0x3f0/0x7d8
          [<ffffffff815f4424>] schedule+0x34/0x98
          [<ffffffff81161d68>] kthreadd+0x180/0x198
          [<ffffffff8111e16c>] ret_from_kernel_thread+0x14/0x1c
      
      Tested using cavium_octeon_defconfig on an EdgeRouter Lite.
      
      Fixes: 1a3d5957 ("MIPS: Tidy up FPU context switching")
      Reported-by: NAaro Koskinen <aaro.koskinen@nokia.com>
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Aleksey Makarov <aleksey.makarov@auriga.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: Chandrakala Chavva <cchavva@caviumnetworks.com>
      Cc: David Daney <david.daney@cavium.com>
      Cc: Leonid Rosenboim <lrosenboim@caviumnetworks.com>
      Patchwork: https://patchwork.linux-mips.org/patch/11166/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      0fa24340
  5. 01 10月, 2015 3 次提交
  6. 30 9月, 2015 1 次提交
  7. 27 9月, 2015 1 次提交
    • P
      MIPS: Initialise MAARs on secondary CPUs · e060f6ed
      Paul Burton 提交于
      MAARs should be initialised on each CPU (or rather, core) in the system
      in order to achieve consistent behaviour & performance. Previously they
      have only been initialised on the boot CPU which leads to performance
      problems if tasks are later scheduled on a secondary CPU, particularly
      if those tasks make use of unaligned vector accesses where some CPUs
      don't handle any cases in hardware for non-speculative memory regions.
      Fix this by recording the MAAR configuration from the boot CPU and
      applying it to secondary CPUs as part of their bringup.
      Reported-by: NDoug Gilmore <doug.gilmore@imgtec.com>
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Steven J. Hill <Steven.Hill@imgtec.com>
      Cc: Andrew Bresticker <abrestic@chromium.org>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: David Hildenbrand <dahi@linux.vnet.ibm.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Cc: Hemmo Nieminen <hemmo.nieminen@iki.fi>
      Cc: Alex Smith <alex.smith@imgtec.com>
      Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
      Patchwork: https://patchwork.linux-mips.org/patch/11239/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      e060f6ed
  8. 23 9月, 2015 2 次提交
  9. 22 9月, 2015 1 次提交
  10. 03 9月, 2015 12 次提交
    • P
      MIPS: Tidy up FPU context switching · 1a3d5957
      Paul Burton 提交于
      Rather than saving the scalar FP or vector context in the assembly
      resume function, reuse the existing C code we have in fpu.h to do
      exactly that. This reduces duplication, results in a much easier to read
      resume function & should allow the compiler to optimise out more MSA
      code due to is_msa_enabled()/cpu_has_msa being known-zero at compile
      time for kernels without MSA support.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
      Cc: Maciej W. Rozycki <macro@linux-mips.org>
      Cc: linux-kernel@vger.kernel.org
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Cc: Manuel Lauss <manuel.lauss@gmail.com>
      Patchwork: https://patchwork.linux-mips.org/patch/10830/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      1a3d5957
    • R
      MIPS: Add uprobes support. · 40e084a5
      Ralf Baechle 提交于
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      40e084a5
    • R
      MIPS: Set trap_no field in thread_struct on exception. · e3b28831
      Ralf Baechle 提交于
      This reverts commit 7281cd22 and adds
      actual functionality to use the field.
      e3b28831
    • P
      MIPS: Advertise MSA support via HWCAP when present · 3cc9fa7f
      Paul Burton 提交于
      If MSA is supported by both the hardware & the kernel then advertise
      that support to userland via the AT_HWCAP aux vector.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Matthew Fortune <matthew.fortune@imgtec.com>
      Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
      Cc: Maciej W. Rozycki <macro@linux-mips.org>
      Cc: linux-kernel@vger.kernel.org
      Cc: Huacai Chen <chenhc@lemote.com>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Patchwork: https://patchwork.linux-mips.org/patch/10799/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      3cc9fa7f
    • P
      MIPS: Advertise MIPSr6 via HWCAP when appropriate · 4c063034
      Paul Burton 提交于
      When running on a CPU implementing the release 6 of the MIPS32 or MIPS64
      ISA, advertise that to userland via the appropriate HWCAP bit.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Matthew Fortune <matthew.fortune@imgtec.com>
      Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
      Cc: Maciej W. Rozycki <macro@linux-mips.org>
      Cc: linux-kernel@vger.kernel.org
      Cc: Huacai Chen <chenhc@lemote.com>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Patchwork: https://patchwork.linux-mips.org/patch/10798/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      4c063034
    • P
      MIPS: AT_HWCAP aux vector infrastructure · e14f1db7
      Paul Burton 提交于
      In order for userland to determine whether various features are safe to
      use, it will need to know both that the hardware supports those features
      and that the kernel is recent enough & configured appropriately to
      support them. For example under the O32 modeless FP proposal the dynamic
      linker & ifunc resolvers will need this information.  The kernel is the
      only thing in a position to know availability accurately, so the kernel
      needs to provide the information to userland. This patch introduces the
      infrastructure to provide the AT_HWCAP aux vector to userland in order
      to provide that information. It also defines the 2 currently specified
      flags, which indicate MIPSr6 & MSA support.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Matthew Fortune <matthew.fortune@imgtec.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Huacai Chen <chenhc@lemote.com>
      Cc: Maciej W. Rozycki <macro@linux-mips.org>
      Cc: Alex Smith <alex@alex-smith.me.uk>
      Cc: linux-kernel@vger.kernel.org
      Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Patchwork: https://patchwork.linux-mips.org/patch/10797/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      e14f1db7
    • P
      MIPS: Save MSA extended context around signals · bf82cb30
      Paul Burton 提交于
      It is desirable for signal handlers to be allowed to make use of MSA,
      particularly if auto vectorisation is used when compiling a program.
      The MSA context must therefore be saved & restored before & after
      invoking the signal handler. Make use of the extended context structs
      defined in the preceding patch to save MSA context after the sigframe
      when appropriate.
      
      [ralf@linux-mips.org: Fixed conflicts.]
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Matthew Fortune <matthew.fortune@imgtec.com>
      Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: Richard Weinberger <richard@nod.at>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Cc: Manuel Lauss <manuel.lauss@gmail.com>
      Cc: Maciej W. Rozycki <macro@codesourcery.com>
      Patchwork: https://patchwork.linux-mips.org/patch/10796/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      bf82cb30
    • P
      MIPS: Add definitions for extended context · f1fe2d21
      Paul Burton 提交于
      The context introduced by MSA needs to be saved around signals. However,
      we can't increase the size of struct sigcontext because that will change
      the offset of the signal mask in struct sigframe or struct ucontext.
      This patch instead places the new context immediately after the struct
      sigframe for traditional signals, or similarly after struct ucontext for
      RT signals. The layout of struct sigframe & struct ucontext is identical
      from their sigcontext fields onwards, so the offset from the sigcontext
      to the extended context will always be the same regardless of the type
      of signal.
      
      Userland will be able to search through the extended context by using
      the magic values to detect which types of context are present. Any
      unrecognised context can be skipped over using the size field of struct
      extcontext. Once the magic value END_EXTCONTEXT_MAGIC is seen it is
      known that there are no further extended context structures to examine.
      
      This approach is somewhat similar to that taken by ARM to save VFP &
      other context at the end of struct ucontext.
      
      Userland can determine whether extended context is present by checking
      for the USED_EXTCONTEXT bit in the sc_used_math field of struct
      sigcontext. Whilst this could potentially change the historic semantics
      of sc_used_math if further extended context which does not imply FP
      context were to be introduced in the future, I have been unable to find
      any userland code making use of sc_used_math at all. Using one of the
      fields described as unused in struct sigcontext was considered, but the
      kernel does not already write to those fields so there would be no
      guarantee of the field being clear on older kernels. Other alternatives
      would be to have userland check the kernel version, or to have a HWCAP
      bit indicating presence of extended context. However there is a desire
      to have the context & information required to decode it be self
      contained such that, for example, debuggers could decode the saved
      context easily.
      
      [ralf@linux-mips.org: Fixed conflict.]
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Matthew Fortune <matthew.fortune@imgtec.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
      Cc: Alex Smith <alex@alex-smith.me.uk>
      Cc: linux-kernel@vger.kernel.org
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Cc: Daniel Borkmann <dborkman@redhat.com>
      Cc: Maciej W. Rozycki <macro@codesourcery.com>
      Patchwork: https://patchwork.linux-mips.org/patch/10795/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      f1fe2d21
    • P
      MIPS: Indicate FP mode in sigcontext sc_used_math · 0d071fa3
      Paul Burton 提交于
      The sc_used_math field of struct sigcontext & its variants has
      traditionally been used as a boolean value indicating only whether or
      not floating point context is saved within the sigcontext. With various
      supported FP modes & the ability to switch between them this information
      will no longer be enough to decode the meaning of the data stored in the
      sc_fpregs fields of struct sigcontext.
      
      To make that possible 3 bits are defined within sc_used_math:
      
        - Bit 0 (USED_FP) represents whether FP was used, essentially
          providing the boolean flag which sc_used_math as a whole provided
          previously.
      
        - Bit 1 (USED_FR1) provides the value of the Status.FR bit at the time
          the FP context was saved.
      
        - Bit 2 (USED_HYBRID_FPRS) indicates whether the FP context was saved
          under the hybrid FPR scheme. Essentially, when set the odd singles
          are located in bits 63:32 of the preceding even indexed sc_fpregs
          element.
      
      Any userland that tests whether the sc_used_math field is zero or
      non-zero will continue to function as expected. Having said that, I
      could not find any userland which uses the sc_used_math field at all.
      
      [ralf@linux-mips.org: Fixed rejects.]
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Matthew Fortune <matthew.fortune@imgtec.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: linux-kernel@vger.kernel.org
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Maciej W. Rozycki <macro@codesourcery.com>
      Patchwork: https://patchwork.linux-mips.org/patch/10794/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      0d071fa3
    • P
      MIPS: Remove unused {get,put}_sigset functions · 6a24432c
      Paul Burton 提交于
      These functions are never called & thus dead code. Remove them.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Matthew Fortune <matthew.fortune@imgtec.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: linux-kernel@vger.kernel.org
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Patchwork: https://patchwork.linux-mips.org/patch/10793/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      6a24432c
    • P
      MIPS: Use common FP sigcontext code for O32 compat · d02a40af
      Paul Burton 提交于
      Make use of the common FP sigcontext code for O32 binaries running on
      MIPS64 kernels now that it is taking appropriate offsets into struct
      sigcontext(32) from struct mips_abi.
      
      [ralf@linux-mips.org: Fixed reject.]
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Matthew Fortune <matthew.fortune@imgtec.com>
      Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: linux-kernel@vger.kernel.org
      Cc: Richard Weinberger <richard@nod.at>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Cc: Manuel Lauss <manuel.lauss@gmail.com>
      Cc: Maciej W. Rozycki <macro@codesourcery.com>
      Patchwork: https://patchwork.linux-mips.org/patch/10792/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      d02a40af
    • P
      MIPS: Skip odd double FP registers when copying FP32 sigcontext · 6f0aba63
      Paul Burton 提交于
      When a task uses 32 bit floating point, the odd indexed 32b register
      values are stored in bits 63:32 of the preceding even indexed 64b
      FP register field in saved context. Thus there is no point in
      preserving the odd indexed 64b register fields since they hold no
      valid context. This patch will cause them to be skipped, as is
      already done in arch/mips/kernel/signal32.c.
      
      [ralf@linux-mips.org: Fixed reject.]
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Matthew Fortune <matthew.fortune@imgtec.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: linux-kernel@vger.kernel.org
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Maciej W. Rozycki <macro@codesourcery.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Patchwork: https://patchwork.linux-mips.org/patch/10791/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      6f0aba63