1. 19 6月, 2015 6 次提交
  2. 26 8月, 2013 1 次提交
    • 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
  3. 27 7月, 2013 1 次提交
  4. 26 6月, 2013 1 次提交
    • 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
  5. 22 6月, 2013 8 次提交
    • V
      ARC: stop using pt_regs->orig_r8 · 352c1d95
      Vineet Gupta 提交于
      Historically, pt_regs have had orig_r8, an overloaded container for
        (1) backup copy of r8 (syscall number Trap Exceptions)
        (2) additional system state: (syscall/Exception/Interrupt)
      
      There is no point in keeping (1) since syscall number is never clobbered
      in-place, in pt_regs, unlike r0 which duals as first syscall arg as well
      as syscall return value and in case of syscall restart, the orig arg0
      needs restoring (from orig_r0)  after having been updated in-place with
      syscall ret value.
      
      This further paves way to convert (2) to contain ECR itself (rather than
      current madeup values)
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      352c1d95
    • 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
      ARC: K/U SP saved from one location in stack switching macro · ba3558c7
      Vineet Gupta 提交于
      This paves way for further simplifications.
      
      There's an overhead of 1 insn for the non-common case of interrupt taken
      from kernel mode.
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      ba3558c7
    • V
      ARC: Increase readability of entry handlers · 3ebedbb2
      Vineet Gupta 提交于
      * use artificial PUSH/POP contructs for CORE Reg save/restore to stack
      * use artificial PUSHAX/POPAX contructs for Auxiliary Space regs
      * macro'ize multiple copies of callee-reg-save/restore (SAVE_R13_TO_R24)
      * use BIC insn for inverse-and operation
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      3ebedbb2
    • V
      ARC: pt_regs update #3: Remove unused gutter at start of callee_regs · 16f9afe6
      Vineet Gupta 提交于
      This is trickier than prev two:
      
      * context switching code saves kernel mode callee regs in the format of
        struct callee_regs thus needs adjustment. This also reduces the height
        of topmost kernel stack frame by 1 word.
      
      * Since kernel stack unwinder is sensitive to height of topmost kernel
        stack frame, that needs a word of adjustment too.
      
      ptrace needs a bit of updating since pt_regs now diverges from
      user_regs_struct.
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      16f9afe6
    • V
    • V
      ARC: pt_regs update #1: Align pt_regs end with end of kernel stack page · 283237a0
      Vineet Gupta 提交于
      Historically, pt_regs would end at offset of 1 word from end of stack
      page.
      
              -----------------  -> START of page (task->stack)
              |               |
              | thread_info   |
              -----------------
              |               |
         ^    ~               ~
         |    ~               ~
         |    |               |
         |    |               | <---- pt_regs used to END here
              -----------------
              | 1 word GUTTER |
              ----------------- -> End of page (START of kernel stack)
      
      This required special "one-off" considerations in low level code.
      
      The root cause is very likely assumption of "empty" SP by the original
      ARC kernel hackers, despite ARC700 always been "full" SP.
      
      So finally RIP one word gutter !
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      283237a0
    • V
      ARC: pt_regs update #0: remove kernel stack canary · bed30976
      Vineet Gupta 提交于
      This stack slot is going to be used in subsequent commits
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      bed30976
  6. 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
  7. 16 2月, 2013 5 次提交
    • 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: [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
  8. 11 2月, 2013 1 次提交