1. 06 Sep, 2017 6 commits
    • Corey Minyard's avatar
      mips: Save all registers when saving the frame · 5b6b0847
      Corey Minyard authored
      The MIPS frame save code was just saving a few registers, enough to
      do a backtrace if every function set up a frame.  However, this is
      not working if you are using DWARF unwinding, because most of the
      registers are wrong.  This was causing kdump backtraces to be short
      or bogus.
      
      So save all the registers.
      Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/16989/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      5b6b0847
    • Corey Minyard's avatar
      MIPS: Add DWARF unwinding to assembly · 866b6a89
      Corey Minyard authored
      This will allow kdump dumps to work correclty with MIPS and
      future DWARF unwinding of the stack to give accurate tracebacks.
      Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/16990/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      866b6a89
    • Corey Minyard's avatar
      MIPS: Make SAVE_SOME more standard · 9fef6868
      Corey Minyard authored
      Modify the SAVE_SOME macro to look more like a standard
      function, doing the arithmetic for the frame on the SP
      register instead of copying it from K1, and by saving
      the stored EPC from the RA.  This lets the get_frame_info()
      function process this function like any other.  It also
      remove an instruction or two from the kernel entry,
      making it more efficient.
      
      unwind_stack_by_address() has special handling for
      the top of the interrupt stack, but without this change
      unwinding will still fail if you get an interrupt while
      handling an interrupt and try to do a traceback from
      the second interrupt.
      
      This change modifies the get_saved_sp macro to
      optionally store the fetched value right into sp and store the
      old SP value into K0.  Then it's just a matter of subtracting
      the frame from SP and storing the old SP from K0.
      
      This required changing the DADDI workaround a bit, since K0
      holds the SP, we had to use K1 for AT.  But it eliminated
      some of the special handling for the DADDI workaround.
      
      Saving the RA register was moved up to before fetching the
      CP0_EPC register, so the CP0_EPC register could be stored
      into RA and the saved.  This lets the traceback code know
      where RA is actually stored.
      Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/16991/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      9fef6868
    • Corey Minyard's avatar
      MIPS: Fix issues in backtraces · aee16625
      Corey Minyard authored
      I saw two problems when doing backtraces:
      
      The compiler was putting a "fast return" at the top of some
      functions, before it set up the frame.  The backtrace code
      would stop when it saw a jump instruction, so it would never
      get to the stack frame setup and would thus misinterpret it.
      To fix this, don't look for jump instructions until the
      frame setup has been seen.
      
      The assembly code here is:
      
      ffffffff80b885a0 <serial8250_handle_irq>:
      ffffffff80b885a0:       c8a00003        bbit0   a1,0x0,ffffffff80b885b0 <serial8250_handle_irq+0x10>
      ffffffff80b885a4:       0000102d        move    v0,zero
      ffffffff80b885a8:       03e00008        jr      ra
      ffffffff80b885ac:       00000000        nop
      ffffffff80b885b0:       67bdffd0        daddiu  sp,sp,-48
      ffffffff80b885b4:       ffb00008        sd      s0,8(sp)
      
      The second problem was the compiler was putting the last
      instruction of the frame save in the delay slot of the
      jump instruction.  If it saved the RA in there, the
      backtrace could would miss it and misinterpret the frame.
      To fix this, make sure to process the instruction after
      the first jump seen.
      
      The assembly code for this is:
      
      ffffffff80806fd0 <plat_irq_dispatch>:
      ffffffff80806fd0:       67bdffd0        daddiu  sp,sp,-48
      ffffffff80806fd4:       ffb30020        sd      s3,32(sp)
      ffffffff80806fd8:       24130018        li      s3,24
      ffffffff80806fdc:       ffb20018        sd      s2,24(sp)
      ffffffff80806fe0:       3c12811c        lui     s2,0x811c
      ffffffff80806fe4:       ffb10010        sd      s1,16(sp)
      ffffffff80806fe8:       3c11811c        lui     s1,0x811c
      ffffffff80806fec:       ffb00008        sd      s0,8(sp)
      ffffffff80806ff0:       3c10811c        lui     s0,0x811c
      ffffffff80806ff4:       08201c03        j       ffffffff8080700c <plat_irq_dispa
      tch+0x3c>
      ffffffff80806ff8:       ffbf0028        sd      ra,40(sp)
      Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/16992/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      aee16625
    • Mathieu Malaterre's avatar
      MIPS: jz4780: DTS: Probe the jz4740-rtc driver from devicetree · ed326616
      Mathieu Malaterre authored
      The jz4740-rtc driver supports both jz4740 & jz4780, setup the compatible
      string to jz4780.
      Signed-off-by: default avatarMathieu Malaterre <malat@debian.org>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Paul Cercueil <paul@crapouillou.net>
      Cc: Krzysztof Kozlowski <krzk@kernel.org>
      Cc: devicetree@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/17237/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      ed326616
    • Mathieu Malaterre's avatar
      MIPS: Ci20: Enable RTC driver · c76a5ba2
      Mathieu Malaterre authored
      Update the Ci20's defconfig to enable the JZ4780's RTC driver.
      Signed-off-by: default avatarMathieu Malaterre <malat@debian.org>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Paul Cercueil <paul@crapouillou.net>
      Cc: Krzysztof Kozlowski <krzk@kernel.org>
      Cc: devicetree@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/17236/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      c76a5ba2
  2. 04 Sep, 2017 34 commits