1. 27 8月, 2015 1 次提交
    • R
      ARM: entry: provide uaccess assembly macro hooks · 2190fed6
      Russell King 提交于
      Provide hooks into the kernel entry and exit paths to permit control
      of userspace visibility to the kernel.  The intended use is:
      
      - on entry to kernel from user, uaccess_disable will be called to
        disable userspace visibility
      - on exit from kernel to user, uaccess_enable will be called to
        enable userspace visibility
      - on entry from a kernel exception, uaccess_save_and_disable will be
        called to save the current userspace visibility setting, and disable
        access
      - on exit from a kernel exception, uaccess_restore will be called to
        restore the userspace visibility as it was before the exception
        occurred.
      
      These hooks allows us to keep userspace visibility disabled for the
      vast majority of the kernel, except for localised regions where we
      want to explicitly access userspace.
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      2190fed6
  2. 21 8月, 2015 1 次提交
    • R
      ARM: domains: switch to keeping domain value in register · 1eef5d2f
      Russell King 提交于
      Rather than modifying both the domain access control register and our
      per-thread copy, modify only the domain access control register, and
      use the per-thread copy to save and restore the register over context
      switches.  We can also avoid the explicit initialisation of the
      init thread_info structure.
      
      This allows us to avoid needing to gain access to the thread information
      at the uaccess control sites.
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      1eef5d2f
  3. 03 7月, 2015 1 次提交
    • R
      ARM: fix lockdep unannotated irqs-off warning · 11b8b25c
      Russell King 提交于
      Wolfram Sang reported an unannotated irqs-off warning from lockdep:
      
      WARNING: CPU: 0 PID: 282 at kernel/locking/lockdep.c:3557 check_flags+0x84/0x1f4()
      DEBUG_LOCKS_WARN_ON(current->hardirqs_enabled)
      CPU: 0 PID: 282 Comm: rcS Tainted: G        W 4.1.0-00002-g5b076054611833 #179
      Hardware name: Generic Emma Mobile EV2 (Flattened Device Tree)
      Backtrace:
      [<c0012c94>] (dump_backtrace) from [<c0012e3c>] (show_stack+0x18/0x1c)
       r6:c02dcc67 r5:00000009 r4:00000000 r3:00400000
      [<c0012e24>] (show_stack) from [<c02510c8>] (dump_stack+0x20/0x28)
      [<c02510a8>] (dump_stack) from [<c0022c44>] (warn_slowpath_common+0x8c/0xb4)
      [<c0022bb8>] (warn_slowpath_common) from [<c0022cd8>] (warn_slowpath_fmt+0x38/0x40)
       r8:c780f470 r7:00000000 r6:00000000 r5:c03b0570 r4:c0b7ec04
      [<c0022ca4>] (warn_slowpath_fmt) from [<c004cd38>] (check_flags+0x84/0x1f4)
       r3:c02e13d8 r2:c02dceaa
      [<c004ccb4>] (check_flags) from [<c0050e50>] (lock_acquire+0x4c/0xbc)
       r5:00000000 r4:60000193
      [<c0050e04>] (lock_acquire) from [<c0256000>] (_raw_spin_lock+0x34/0x44)
       r9:000a8d5c r8:00000001 r7:c7806000 r6:c780f460 r5:c03b06a0 r4:c780f460
      [<c0255fcc>] (_raw_spin_lock) from [<c005a8cc>] (handle_fasteoi_irq+0x20/0x11c)
       r4:c780f400
      [<c005a8ac>] (handle_fasteoi_irq) from [<c0057a4c>] (generic_handle_irq+0x28/0x38)
       r6:00000000 r5:c03b038c r4:00000012 r3:c005a8ac
      [<c0057a24>] (generic_handle_irq) from [<c0057ae4>] (__handle_domain_irq+0x88/0xa8)
       r4:00000000 r3:00000026
      [<c0057a5c>] (__handle_domain_irq) from [<c000a3cc>] (gic_handle_irq+0x40/0x58)
       r8:10c5347d r7:10c5347d r6:c35b1fb0 r5:c03a6304 r4:c8802000 r3:c35b1fb0
      [<c000a38c>] (gic_handle_irq) from [<c0013bc8>] (__irq_usr+0x48/0x60)
      Exception stack(0xc35b1fb0 to 0xc35b1ff8)
      1fa0:                                     00000061 00000000 000ab736 00000066
      1fc0: 00000061 000aa1f0 000a8d54 000a8d54 000a8d88 000a8d5c 000a8cc8 000a8d68
      1fe0: 72727272 bef8a528 000398c0 00031334 20000010 ffffffff
       r6:ffffffff r5:20000010 r4:00031334 r3:00000061
      ---[ end trace cb88537fdc8fa202 ]---
      possible reason: unannotated irqs-off.
      irq event stamp: 769
      hardirqs last  enabled at (769): [<c000f82c>] ret_fast_syscall+0x2c/0x54
      hardirqs last disabled at (768): [<c000f80c>] ret_fast_syscall+0xc/0x54
      softirqs last  enabled at (0): [<c0020ec4>] copy_process.part.65+0x2e8/0x11dc
      softirqs last disabled at (0): [<  (null)>]   (null)
      
      His kernel configuration had:
      CONFIG_PROVE_LOCKING=y
      CONFIG_TRACE_IRQFLAGS=y
      but no IRQSOFF_TRACER, which means entry from userspace can result in the
      kernel seeing IRQs off without being notified of that change of state.
      Change the IRQSOFF ifdef in the usr_entry macro to TRACE_IRQFLAGS instead.
      Tested-by: NWolfram Sang <wsa+renesas@sang-engineering.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      11b8b25c
  4. 17 6月, 2015 1 次提交
  5. 09 5月, 2015 1 次提交
  6. 30 3月, 2015 1 次提交
  7. 14 1月, 2015 1 次提交
  8. 26 9月, 2014 1 次提交
  9. 18 9月, 2014 1 次提交
    • D
      ARM: 8150/3: fiq: Replace default FIQ handler · c0e7f7ee
      Daniel Thompson 提交于
      This patch introduces a new default FIQ handler that is structured in a
      similar way to the existing ARM exception handler and result in the FIQ
      being handled by C code running on the SVC stack (despite this code run
      in the FIQ handler is subject to severe limitations with respect to
      locking making normal interaction with the kernel impossible).
      
      This default handler allows concepts that on x86 would be handled using
      NMIs to be realized on ARM.
      
      Credit:
      
          This patch is a near complete re-write of a patch originally
          provided by Anton Vorontsov. Today only a couple of small fragments
          survive, however without Anton's work to build from this patch would
          not exist. Thanks also to Russell King for spoonfeeding me a variety
          of fixes during the review cycle.
      Signed-off-by: NDaniel Thompson <daniel.thompson@linaro.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Acked-by: NNicolas Pitre <nico@linaro.org>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      c0e7f7ee
  10. 18 7月, 2014 1 次提交
    • R
      ARM: convert all "mov.* pc, reg" to "bx reg" for ARMv6+ · 6ebbf2ce
      Russell King 提交于
      ARMv6 and greater introduced a new instruction ("bx") which can be used
      to return from function calls.  Recent CPUs perform better when the
      "bx lr" instruction is used rather than the "mov pc, lr" instruction,
      and this sequence is strongly recommended to be used by the ARM
      architecture manual (section A.4.1.1).
      
      We provide a new macro "ret" with all its variants for the condition
      code which will resolve to the appropriate instruction.
      
      Rather than doing this piecemeal, and miss some instances, change all
      the "mov pc" instances to use the new macro, with the exception of
      the "movs" instruction and the kprobes code.  This allows us to detect
      the "mov pc, lr" case and fix it up - and also gives us the possibility
      of deploying this for other registers depending on the CPU selection.
      Reported-by: NWill Deacon <will.deacon@arm.com>
      Tested-by: Stephen Warren <swarren@nvidia.com> # Tegra Jetson TK1
      Tested-by: Robert Jarzmik <robert.jarzmik@free.fr> # mioa701_bootresume.S
      Tested-by: Andrew Lunn <andrew@lunn.ch> # Kirkwood
      Tested-by: NShawn Guo <shawn.guo@freescale.com>
      Tested-by: Tony Lindgren <tony@atomide.com> # OMAPs
      Tested-by: Gregory CLEMENT <gregory.clement@free-electrons.com> # Armada XP, 375, 385
      Acked-by: Sekhar Nori <nsekhar@ti.com> # DaVinci
      Acked-by: Christoffer Dall <christoffer.dall@linaro.org> # kvm/hyp
      Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com> # PXA3xx
      Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> # Xen
      Tested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> # ARMv7M
      Tested-by: Simon Horman <horms+renesas@verge.net.au> # Shmobile
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      6ebbf2ce
  11. 02 6月, 2014 2 次提交
  12. 30 5月, 2014 1 次提交
    • A
      ARM: 8062/1: Modify ldrt fixup handler to re-execute the userspace instruction · 3780f7ab
      Arun K S 提交于
      We will reach fixup handler when one thread(say cpu0) caused an undefined exception, while another thread(say cpu1) is unmmaping the page.
      
      Fixup handler returns to the next userspace instruction which has caused the undef execption, rather than going to the same instruction.
      
      ARM ARM says that after undefined exception, the PC will be pointing
      to the next instruction. ie +4 offset in case of ARM and +2 in case of Thumb
      
      And there is no correction offset passed to vector_stub in case of
      undef exception.
      
      File: arch/arm/kernel/entry-armv.S +1085
      vector_stub     und, UND_MODE
      
      During an undefined exception, in normal scenario(ie when ldrt
      instruction does not cause an abort) after resorting the context in
      VFP hardware, the PC is modified as show below before jumping to
      ret_from_exception which is in r9.
      
      File: arch/arm/vfp/vfphw.S +169
      @ The context stored in the VFP hardware is up to date with this thread
      vfp_hw_state_valid:
         tst     r1, #FPEXC_EX
         bne     process_exception     @ might as well handle the pending
                                       @ exception before retrying branch
                                       @ out before setting an FPEXC that
                                       @ stops us reading stuff
              VFPFMXR FPEXC, r1        @ Restore FPEXC last
              sub     r2, r2, #4       @ Retry current instruction - if Thumb
              str     r2, [sp, #S_PC]  @ mode it's two 16-bit instructions,
                                       @ else it's one 32-bit instruction, so
                                       @ always subtract 4 from the following
                                       @ instruction address.
      
      But if ldrt results in an abort, we reach the fixup handler and return
      to ret_from_execption without correcting the pc.
      
      This patch modifes the fixup handler to re-execute the same instruction which caused undefined execption.
      Signed-off-by: NVinayak Menon <vinayakm.list@gmail.com>
      Signed-off-by: NArun KS <getarunks@gmail.com>
      Acked-by: NCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      3780f7ab
  13. 25 4月, 2014 1 次提交
  14. 28 1月, 2014 1 次提交
  15. 07 11月, 2013 1 次提交
  16. 20 10月, 2013 1 次提交
  17. 07 8月, 2013 1 次提交
    • R
      ARM: Fix !kuser helpers case · 1b16c4bc
      Russell King 提交于
      Fix yet another build failure caused by a weird set of configuration
      settings:
      
        LD      init/built-in.o
      arch/arm/kernel/built-in.o: In function `__dabt_usr':
      /home/tom3q/kernel/arch/arm/kernel/entry-armv.S:377: undefined reference to `kuser_cmpxchg64_fixup'
      arch/arm/kernel/built-in.o: In function `__irq_usr':
      /home/tom3q/kernel/arch/arm/kernel/entry-armv.S:387: undefined reference to `kuser_cmpxchg64_fixup'
      
      caused by:
      CONFIG_KUSER_HELPERS=n
      CONFIG_CPU_32v6K=n
      CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG=n
      Reported-by: NTomasz Figa <tomasz.figa@gmail.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      1b16c4bc
  18. 01 8月, 2013 5 次提交
  19. 24 6月, 2013 1 次提交
  20. 04 4月, 2013 1 次提交
    • K
      ARM: 7688/1: add support for context tracking subsystem · b0088480
      Kevin Hilman 提交于
      commit 91d1aa43 (context_tracking: New context tracking susbsystem)
      generalized parts of the RCU userspace extended quiescent state into
      the context tracking subsystem.  Context tracking is then used
      to implement adaptive tickless (a.k.a extended nohz)
      
      To support the new context tracking subsystem on ARM, the user/kernel
      boundary transtions need to be instrumented.
      
      For exceptions and IRQs in usermode, the existing usr_entry macro is
      used to instrument the user->kernel transition.  For the return to
      usermode path, the ret_to_user* path is instrumented.  Using the
      usr_entry macro, this covers interrupts in userspace, data abort and
      prefetch abort exceptions in userspace as well as undefined exceptions
      in userspace (which is where FP emulation and VFP are handled.)
      
      For syscalls, the slow return path is covered by instrumenting the
      ret_to_user path.  In addition, the syscall entry point is
      instrumented which covers the user->kernel transition for both fast
      and slow syscalls, and an additional instrumentation point is added
      for the fast syscall return path (ret_fast_syscall).
      
      Cc: Mats Liljegren <mats.liljegren@enea.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NKevin Hilman <khilman@linaro.org>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      b0088480
  21. 03 4月, 2013 2 次提交
  22. 24 2月, 2013 1 次提交
  23. 31 7月, 2012 1 次提交
    • R
      ARM: Fix undefined instruction exception handling · 15ac49b6
      Russell King 提交于
      While trying to get a v3.5 kernel booted on the cubox, I noticed that
      VFP does not work correctly with VFP bounce handling.  This is because
      of the confusion over 16-bit vs 32-bit instructions, and where PC is
      supposed to point to.
      
      The rule is that FP handlers are entered with regs->ARM_pc pointing at
      the _next_ instruction to be executed.  However, if the exception is
      not handled, regs->ARM_pc points at the faulting instruction.
      
      This is easy for ARM mode, because we know that the next instruction and
      previous instructions are separated by four bytes.  This is not true of
      Thumb2 though.
      
      Since all FP instructions are 32-bit in Thumb2, it makes things easy.
      We just need to select the appropriate adjustment.  Do this by moving
      the adjustment out of do_undefinstr() into the assembly code, as only
      the assembly code knows whether it's dealing with a 32-bit or 16-bit
      instruction.
      
      Cc: <stable@vger.kernel.org>
      Acked-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      15ac49b6
  24. 16 6月, 2012 1 次提交
  25. 05 5月, 2012 1 次提交
  26. 29 3月, 2012 1 次提交
  27. 14 3月, 2012 1 次提交
  28. 22 2月, 2012 1 次提交
  29. 03 2月, 2012 1 次提交
  30. 27 11月, 2011 1 次提交
  31. 16 11月, 2011 1 次提交
  32. 17 10月, 2011 2 次提交
  33. 02 7月, 2011 1 次提交