1. 19 6月, 2015 9 次提交
  2. 02 2月, 2015 1 次提交
  3. 05 5月, 2014 1 次提交
  4. 30 4月, 2014 1 次提交
    • V
      ARC: !PREEMPT: Ensure Return to kernel mode is IRQ safe · 8aa9e85a
      Vineet Gupta 提交于
      There was a very small race window where resume to kernel mode from a
      Exception Path (or pure kernel mode which is true for most of ARC
      exceptions anyways), was not disabling interrupts in restore_regs,
      clobbering the exception regs
      
      Anton found the culprit call flow (after many sleepless nights)
      
      | 1. we got a Trap from user land
      | 2. started to service it.
      | 3. While doing some stuff on user-land memory (I think it is padzero()),
      |     we got a DataTlbMiss
      | 4. On return from it we are taking "resume_kernel_mode" path
      | 5. NEED_RESHED is not set, so we go to "return from exception" path in
      |     restore regs.
      | 6. there seems to be IRQ happening
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      Cc: <stable@vger.kernel.org>   #3.10, 3.12, 3.13, 3.14
      Cc: Anton Kolesov <Anton.Kolesov@synopsys.com>
      Cc: Francois Bedard <Francois.Bedard@synopsys.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8aa9e85a
  5. 26 3月, 2014 1 次提交
  6. 06 11月, 2013 3 次提交
  7. 26 8月, 2013 2 次提交
    • V
      ARC: Entry Handler tweaks: Optimize away redundant IRQ_DISABLE_SAVE · fce16bc3
      Vineet Gupta 提交于
      In the exception return path, for both U/K cases, intr are already
      disabled (for various existing reasons). So when we drop down to
      @restore_regs, we need not redo that.
      
      There was subtle issue - when intr were NOT being disabled for
      ret-to-kernel-but-no-preemption case - now fixed by moving the
      IRQ_DISABLE further up in @resume_kernel_mode.
      
      So what do we gain:
      
      * Shaves off a few insn in return path.
      
      * Eliminates the need for IRQ_DISABLE_SAVE assembler macro for ARCv2
        hence allows for entry code sharing.
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      fce16bc3
    • V
      ARC: Exception Handlers Code consolidation · 37f3ac49
      Vineet Gupta 提交于
      After the recent cleanups, all the exception handlers now have same
      boilerplate prologue code. Move that into common macro.
      
      This reduces readability but helps greatly with sharing / duplicating
      entry code with ARCv2 ISA where the handlers are pretty much the same,
      just the entry prologue is different (due to hardware assist).
      
      Also while at it, add the missing FAKE_RET_FROM_EXCPN calls in couple of
      places to drop down to pure kernel mode (from exception mode) before
      jumping off into "C" code.
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      37f3ac49
  8. 26 6月, 2013 2 次提交
    • V
      ARC: Remove explicit passing around of ECR · 38a9ff6d
      Vineet Gupta 提交于
      With ECR now part of pt_regs
      
      * No need to propagate from lowest asm handlers as arg
      * No need to save it in tsk->thread.cause_code
      * Avoid bit chopping to access the bit-fields
      
      More code consolidation, cleanup
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      38a9ff6d
    • V
      ARC: pt_regs update #5: Use real ECR for pt_regs->event vs. synth values · 502a0c77
      Vineet Gupta 提交于
      pt_regs->event was set with artificial values to identify the low level
      system event (syscall trap / breakpoint trap / exceptions / interrupts)
      
      With r8 saving out of the way, the full word can be used to save real
      ECR (Exception Cause Register) which helps idenify the event naturally,
      including additional info such as cause code, param.
      Only for Interrupts, where ECR is not applicable, do we resort to
      synthetic non ECR values.
      
      SAVE_ALL_TRAP/EXCEPTIONS can now be merged as they both use ECR with
      different runtime values.
      
      The ptrace helpers now use the sub-fields of ECR to distinguish the
      events (e.g. vector 0x25 is trap, param 0 is syscall...)
      
      The following benefits will follow:
      
      (1) This centralizes the location of where ECR is saved and will allow
          the cleanup of task->thread.cause_code ECR placeholder which is set
          in non-uniform way. Then ARC VM code can safely rely on it being
          there for purpose of finer grained VM_EXEC dcache flush (based on
          exec fault: I-TLB Miss)
      
      (2) Further, ECR being passed around from low level handlers as arg can
          be eliminated as it is part of standard reg-file in pt_regs
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      502a0c77
  9. 22 6月, 2013 4 次提交
    • V
      ARC: pt_regs update #4: r25 saved/restored unconditionally · 359105bd
      Vineet Gupta 提交于
      (This is a VERY IMP change for low level interrupt/exception handling)
      
      -----------------------------------------------------------------------
      WHAT
      -----------------------------------------------------------------------
      * User 25 now saved in pt_regs->user_r25 (vs. tsk->thread_info.user_r25)
      
      * This allows Low level interrupt code to unconditionally save r25
        (vs. the prev version which would only do it for U->K transition).
        Ofcourse for nested interrupts, only the pt_regs->user_r25 of
        bottom-most frame is useful.
      
      * simplifies the interrupt prologue/epilogue
      
      * Needed for ARCv2 ISA code and done here to keep design similar with
        ARCompact event handling
      
      -----------------------------------------------------------------------
      WHY
      -------------------------------------------------------------------------
      With CONFIG_ARC_CURR_IN_REG, r25 is used to cache "current" task pointer
      in kernel mode. So when entering kernel mode from User Mode
      - user r25 is specially safe-kept (it being a callee reg is NOT part of
        pt_regs which are saved by default on each interrupt/trap/exception)
      - r25 loaded with current task pointer.
      
      Further, if interrupt was taken in kernel mode, this is skipped since we
      know that r25 already has valid "current" pointer.
      
      With 2 level of interrupts in ARCompact ISA, detecting this is difficult
      but still possible, since we could be in kernel mode but r25 not already saved
      (in fact the stack itself might not have been switched).
      
      A. User mode
      B. L1 IRQ taken
      C. L2 IRQ taken (while on 1st line of L1 ISR)
      
      So in #C, although in kernel mode, r25 not saved (infact SP not
      switched at all)
      
      Given that ARcompact has manual stack switching, we could use a bit of
      trickey - The low level code would make sure that SP is only set to kernel
      mode value at the very end (after saving r25). So a non kernel mode SP,
      even if in kernel mode, meant r25 was NOT saved.
      
      The same paradigm won't work in ARCv2 ISA since SP is auto-switched so
      it's setting can't be delayed/constrained.
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      359105bd
    • V
    • V
    • V
      ARC: [mm] Remove @write argument to do_page_fault() · 3e1ae441
      Vineet Gupta 提交于
      This can be ascertained within do_page_fault() since it gets the full
      ECR (Exception Cause Register).
      
      Further, for both the callers of do_page_fault(): Prot-V / D-TLB-Miss,
      the cause sub-fields in ECR are same for same type of access, making the
      code much more simpler.
      
      D-TLB-Miss [LD] 0x00_21_01_00
      Prot-V     [LD] 0x00_23_01_00
                              ^^
      D-TLB-Miss [ST] 0x00_21_02_00
      Prot-V     [ST] 0x00_23_02_00
                              ^^
      D-TLB-Miss [EX] 0x00_21_03_00
      Prot-V     [EX] 0x00_23_03_00
                              ^^
      
      This helps code consolidation, which is even better when moving code from
      assembler to "C".
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      3e1ae441
  10. 07 5月, 2013 2 次提交
  11. 20 3月, 2013 1 次提交
    • V
      ARC: Fix the typo in event identifier flags used by ptrace · 367f3fcd
      Vineet Gupta 提交于
      orig_r8_IS_EXCPN and orig_r8_IS_BRKPT were same values due to a
      copy/paste error. Although it looks bad and is wrong, it really doesn't
      affect gdb working.
      
      orig_r8_IS_BRKPT is the one relevant to debugging (breakpoints), since
      it is used to provide EFA vs. ERET to a ptrace "stop_pc" request.
      
      So when gdb has inserted a breakpoint, orig_r8_IS_BRKPT is already set,
      and anything else (i.e. orig_r8_IS_EXCPN) becoming same as it, really
      doesn't hurt gdb. The corollary case, could be nasty but nobody uses the
      ptrace "stop_pc" request in that case
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      367f3fcd
  12. 11 3月, 2013 1 次提交
  13. 16 2月, 2013 10 次提交
    • V
      ARC: Fix pt_orig_r8 access · 3eb3e7dd
      Vineet Gupta 提交于
      Syscall restarting fixes made pt_regs->orig_r8 a short word, which was
      not reflected in the assembler code - thus could potentially break gdb
      debugging.
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      3eb3e7dd
    • V
      ARC: Support for single cycle Close Coupled Mem (CCM) · 8b5850f8
      Vineet Gupta 提交于
      * Includes mapping of CCMs in address space
      * Annotations to move arbitrary code/data into CCM
      * Moving some of the critical code/data into CCM
      * Runtime detection/reporting
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      8b5850f8
    • V
      ARC: Unaligned access emulation · 2e651ea1
      Vineet Gupta 提交于
      ARC700 doesn't natively support unaligned access, but can be emulated
      -Unaligned Access Exception
      -Disassembly at the Fault address to find the exact insn (long/short)
      
      Also per Arnd's comment, we runtime control it using 2 sysctl knobs:
      * SYSCTL_ARCH_UNALIGN_ALLOW: Runtime enable/disble
      * SYSCTL_ARCH_UNALIGN_NO_WARN: Warn on each emulation attempt
      
      Originally contributed by Tim Yao <tim.yao@amlogic.com>
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      Cc: Tim Yao <tim.yao@amlogic.com>
      Acked-by: NArnd Bergmann <arnd@arndb.de>
      2e651ea1
    • V
      ARC: DWARF2 .debug_frame based stack unwinder · 854a0d95
      Vineet Gupta 提交于
      -Originally written by Rajeshwar Ranga
      -Derived off of generic unwinder in 2.6.19 and adapted to ARC
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      Cc: Rajeshwar Ranga <rajeshwar.ranga@gmail.com>
      854a0d95
    • V
      ARC: SMP support · 41195d23
      Vineet Gupta 提交于
      ARC common code to enable a SMP system + ISS provided SMP extensions.
      
      ARC700 natively lacks SMP support, hence some of the core features are
      are only enabled if SoCs have the necessary h/w pixie-dust. This
      includes:
      -Inter Processor Interrupts (IPI)
      -Cache coherency
      -load-locked/store-conditional
      ...
      
      The low level exception handling would be completely broken in SMP
      because we don't have hardware assisted stack switching. Thus a fair bit
      of this code is repurposing the MMU_SCRATCH reg for event handler
      prologues to keep them re-entrant.
      
      Many thanks to Rajeshwar Ranga for his initial "major" contributions to
      SMP Port (back in 2008), and to Noam Camus and Gilad Ben-Yossef for help
      with resurrecting that in 3.2 kernel (2012).
      
      Note that this platform code is again singleton design pattern - so
      multiple SMP platforms won't build at the moment - this deficiency is
      addressed in subsequent patches within this series.
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Rajeshwar Ranga <rajeshwar.ranga@gmail.com>
      Cc: Noam Camus <noamc@ezchip.com>
      Cc: Gilad Ben-Yossef <gilad@benyossef.com>
      41195d23
    • V
      ARC: Support for high priority interrupts in the in-core intc · 4788a594
      Vineet Gupta 提交于
      There is a bit of hack/kludge right now where we disable preemption if a
      L2 (High prio) IRQ is taken while L1 (Low prio) is active.
      
      Need to revisit this
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      4788a594
    • V
      ARC: ptrace support · 547f1125
      Vineet Gupta 提交于
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      Acked-by: NArnd Bergmann <arnd@arndb.de>
      547f1125
    • V
      ARC: [optim] Cache "current" in Register r25 · 080c3747
      Vineet Gupta 提交于
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      080c3747
    • V
      ARC: [Review] Preparing to fix incorrect syscall restarts due to signals · 5c39c0ab
      Vineet Gupta 提交于
      To avoid multiple syscall restarts (multiple signals) or no restart at
      all (sigreturn), we need just an extra bit of state "literally 1 bit" in
      struct pt_regs. orig_r8 is the best place to do this, however given the
      way it is encoded currently, we can't add anything simplistically.
      
      Current orig_r8:
      * syscalls   -> 1 to NR_SYSCALLS
      * Exceptions -> NR_SYSCALLS + 1
      * Break-point-> NR_SYSCALLS + 2
      
      In new scheme it is a bit-field
      * lower short word contains the  exact event type (and a new bit to represent
         restart semantics : if syscall was already / can't be restarted)
      * upper short word optionally containing the syscall num - needed by
        likes of tracehooks etc
      
      This patch only changes how orig_r8 is organised and nothing should
      change behaviourily.
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      Cc: Al Viro <viro@ZenIV.linux.org.uk>
      5c39c0ab
    • V
      ARC: Signal handling · c3581039
      Vineet Gupta 提交于
      Includes following fixes courtesy review by Al-Viro
      
      * Tracer poke to Callee-regs were lost
      
        Before going off into do_signal( ) we save the user-mode callee regs
        (as they are not saved by default as part of pt_regs). This is to make
        sure that that a Tracer (if tracing related signal) is able to do likes
        of PEEKUSR(callee-reg).
      
        However in return path we were simply discarding the user-mode callee
        regs, which would break a POKEUSR(callee-reg) from a tracer.
      
      * Issue related to multiple syscall restarts are addressed in next patch
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      Cc: Al Viro <viro@ZenIV.linux.org.uk>
      Acked-by: NJonas Bonn <jonas@southpole.se>
      c3581039
  14. 11 2月, 2013 2 次提交