1. May 23, 2022
    • Stafford Horne's avatar
      openrisc/traps: Remove die_if_kernel function · de901d12
      Stafford Horne authored
      
      
      This was noticed when I saw this warning:
      
          arch/openrisc/kernel/traps.c:234:6: warning: no previous prototype for 'die_if_kernel' [-Wmissing-prototypes]
            234 | void die_if_kernel(const char *str, struct pt_regs *regs, long err)
      	  |      ^~~~~~~~~~~~~
      
      The die_if_kernel function is not used in the OpenRISC port so remove
      it.
      
      Signed-off-by: default avatarStafford Horne <shorne@gmail.com>
      de901d12
    • Stafford Horne's avatar
      openrisc/traps: Declare file scope symbols as static · f4b26b1a
      Stafford Horne authored
      
      
      Sparse was reporting the following warnings:
      
          arch/openrisc/kernel/traps.c:37:5: warning: symbol 'kstack_depth_to_print' was not declared. Should it be static?
          arch/openrisc/kernel/traps.c:39:22: warning: symbol 'lwa_addr' was not declared. Should it be static?
          arch/openrisc/kernel/traps.c:41:6: warning: symbol 'print_trace' was not declared. Should it be static?
      
      The function print_trace and local variables kstack_depth_to_print and
      lwa_addr are not used outside of this file.  This patch marks them as
      static.
      
      Signed-off-by: default avatarStafford Horne <shorne@gmail.com>
      f4b26b1a
    • Stafford Horne's avatar
      openrisc: Update litex defconfig to support glibc userland · fe47623a
      Stafford Horne authored
      
      
      I have been using a litex SoC for glibc verification.  Update the
      default litex config to support required userspace API's needed for the
      full glibc testsuite to pass.
      
      This includes enabling the litex mmc driver and filesystems used
      in a typical litex environment.
      
      Signed-off-by: default avatarStafford Horne <shorne@gmail.com>
      fe47623a
    • Stafford Horne's avatar
      openrisc: Pretty print show_registers memory dumps · 7d2ae3de
      Stafford Horne authored
      
      
      Currently show registers, print memory dumps character by character and
      there is no address information, so its a bit difficult to use.  For
      example before a stack dump looks as follows.
      
          [   13.650000] Stack:
          [   13.650000] Call trace
          [   13.690000] [<(ptrval)>] ? put_timespec64+0x44/0x60
          [   13.690000] [<(ptrval)>] ? _data_page_fault_handler+0x104/0x10c
          [   13.700000]
          [   13.700000] Code:
          [   13.700000] 13
          [   13.700000] ff
          [   13.700000] ff
          [   13.700000] f9
          [   13.710000] 84
          [   13.710000] 82
          [   13.710000] ff
          [   13.710000] bc
          [   13.710000] 07
          [   13.710000] fd
          [   13.720000] 4e
          [   13.720000] 67
          [   13.720000] 84
          [   13.720000] 62
          [   13.720000] ff
          ...
      
      This change updates this to print the address and data a word at time.
      
          [    0.830000] Stack:
          [    0.830000] Call trace:
          [    0.830000] [<(ptrval)>] load_elf_binary+0x744/0xf5c
          [    0.830000] [<(ptrval)>] ? __kernel_read+0x144/0x184
          [    0.830000] [<(ptrval)>] bprm_execve+0x27c/0x3e4
          [    0.830000] [<(ptrval)>] kernel_execve+0x16c/0x1a0
          [    0.830000] [<(ptrval)>] run_init_process+0xa0/0xec
          [    0.830000] [<(ptrval)>] ? kernel_init+0x0/0x14c
          [    0.830000] [<(ptrval)>] kernel_init+0x7c/0x14c
          [    0.830000] [<(ptrval)>] ? calculate_sigpending+0x30/0x40
          [    0.830000] [<(ptrval)>] ret_from_fork+0x1c/0x84
          [    0.830000]
          [    0.830000]  c1033dbc:       c1033dec
          [    0.830000]  c1033dc0:       c015258c
          [    0.830000]  c1033dc4:       c129da00
          [    0.830000]  c1033dc8:       00000002
          [    0.830000]  c1033dcc:       00000000
          [    0.830000]  c1033dd0:       c129da00
          [    0.830000]  c1033dd4:       00000000
          [    0.830000]  c1033dd8:       00000000
          [    0.830000] (c1033ddc:)      00001e04
          [    0.830000]  c1033de0:       001501fc
          [    0.830000]  c1033de4:       c1033e68
          [    0.830000]  c1033de8:       c0152e60
          [    0.830000]  c1033dec:       c129da5c
          [    0.830000]  c1033df0:       c0674a20
          [    0.830000]  c1033df4:       c1033e50
          [    0.830000]  c1033df8:       c00e3d6c
          [    0.830000]  c1033dfc:       c129da5c
          [    0.830000]  c1033e00:       00000003
          [    0.830000]  c1033e04:       00150000
          [    0.830000]  c1033e08:       00002034
          [    0.830000]  c1033e0c:       001501fc
          [    0.830000]  c1033e10:       00000000
          [    0.830000]  c1033e14:       00150000
          [    0.830000]  c1033e18:       0014ebbc
          [    0.830000]  c1033e1c:       00002000
          [    0.830000]  c1033e20:       00000003
          [    0.830000]  c1033e24:       c12a07e0
          [    0.830000]  c1033e28:       00000000
          [    0.830000]  c1033e2c:       00000000
          [    0.830000]  c1033e30:       00000000
          [    0.830000]  c1033e34:       40040000
          [    0.830000]  c1033e38:       00000000
          [    0.830000]
          [    0.830000] Code:
          [    0.830000]  c00047a4:       9c21fff8
          [    0.830000]  c00047a8:       d4012000
          [    0.830000]  c00047ac:       d4011804
          [    0.830000]  c00047b0:       e4040000
          [    0.830000]  c00047b4:       10000005
          [    0.830000]  c00047b8:       9c84ffff
          [    0.830000] (c00047bc:)      d8030000
          [    0.830000]  c00047c0:       03fffffc
          [    0.830000]  c00047c4:       9c630001
          [    0.830000]  c00047c8:       9d640001
          [    0.830000]  c00047cc:       84810000
          [    0.830000]  c00047d0:       84610004
      
      Now we are also printing a bit of the stack as well as the code.  The
      stack is output to help with debugging.  There may be concern about
      exposing sensitive information on the stack, but we are already dumping
      all register content which would have similar sensitive information.  So
      I am going ahead as this proves useful in investigation.
      
      Signed-off-by: default avatarStafford Horne <shorne@gmail.com>
      7d2ae3de
    • Stafford Horne's avatar
      openrisc: Add syscall details to emergency syscall debugging · a0a94bc9
      Stafford Horne authored
      
      
      When bringing linux on the or1k Marocchino we ran into issues starting
      init.  This patch adds the syscall number and return address to
      assist tracing syscalls even before strace is able to be used.
      
      By default this is all disabled but a developer could adjust the ifdef
      to enable debugging.
      
      Cc: Andrey Bacherov <bandvig@mail.ru>
      Signed-off-by: default avatarStafford Horne <shorne@gmail.com>
      a0a94bc9
    • Stafford Horne's avatar
      openrisc: Add support for liteuart emergency printing · 29bbb2a9
      Stafford Horne authored
      
      
      This patch adds support for sending emergency print output, such as
      unhandled exception details, to a liteuart serial device.  This is the
      default device available on litex platforms.
      
      If a developer want to use this they should update UART_BASE_ADD
      to the address of liteuart.
      
      Signed-off-by: default avatarStafford Horne <shorne@gmail.com>
      29bbb2a9
    • Stafford Horne's avatar
      openrisc: Cleanup emergency print handling · e449759c
      Stafford Horne authored
      
      
      The emergency print support only works for 8250 compatible serial ports.
      Now that OpenRISC platforms may be configured with different serial port
      hardware we don't want emergency print to try to print to non-existent
      hardware which will cause lockups.
      
      This patch contains several fixes to get emergency print working again:
      
       - Update symbol loading to not assume the location of symbols
       - Split the putc print operation out to its own function to allow
         for different future implementations.
       - Update _emergency_print_nr and _emergency_print to use the putc
         function.
       - Guard serial 8250 specific sequences by CONFIG_SERIAL_8250
       - Update string line feed from lf,cr to cr,lf.
      
      Signed-off-by: default avatarStafford Horne <shorne@gmail.com>
      e449759c
    • Stafford Horne's avatar
      openrisc: Add gcc machine instruction flag configuration · 87e387ac
      Stafford Horne authored
      
      
      OpenRISC GCC supports flags to enable the backend to output instructions
      if they are supported by a target processor.  This patch adds
      configuration flags to enable configuring these flags to tune the kernel
      for a particular CPU configuration.
      
      In the future we could also enable all of these flags by default and
      provide instruction emulation in the kernel to make these choices easier
      for users but this is what we provide for now.
      
      Signed-off-by: default avatarStafford Horne <shorne@gmail.com>
      87e387ac
    • Jason A. Donenfeld's avatar
      openrisc: define nop command for simulator reboot · 635267b7
      Jason A. Donenfeld authored
      The simulator defines `l.nop 1` for shutdown, but doesn't have anything
      for reboot. Use 13 for this, which is currently unused, dubbed
      `NOP_REBOOT`.
      
      Cc: Stafford Horne <shorne@gmail.com>
      Cc: Peter Maydell <peter.maydell@linaro.org>
      Link: https://lore.kernel.org/all/YmnaDUpVI5ihgvg6@zx2c4.com/
      
      
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: default avatarStafford Horne <shorne@gmail.com>
      635267b7
  2. May 12, 2022
  3. Apr 25, 2022
  4. Apr 24, 2022
  5. Apr 23, 2022