1. 14 7月, 2016 2 次提交
  2. 11 5月, 2016 2 次提交
    • P
      powerpc/xmon: Fix SPR read/write commands and add command to dump SPRs · 31cdd0c3
      Paul Mackerras 提交于
      xmon has commands for reading and writing SPRs, but they don't work
      currently for several reasons. They attempt to synthesize a small
      function containing an mfspr or mtspr instruction and call it. However,
      the instructions are on the stack, which is usually not executable.
      Also, for 64-bit we set up a procedure descriptor, which is fine for the
      big-endian ABIv1, but not correct for ABIv2. Finally, the code uses the
      infrastructure for catching memory errors, but that only catches data
      storage interrupts and machine check interrupts, but a failed
      mfspr/mtspr can generate a program interrupt or a hypervisor emulation
      assist interrupt, or be a no-op.
      
      Instead of trying to synthesize a function on the fly, this adds two new
      functions, xmon_mfspr() and xmon_mtspr(), which take an SPR number as an
      argument and read or write the SPR. Because there is no Power ISA
      instruction which takes an SPR number in a register, we have to generate
      one of each possible mfspr and mtspr instruction, for all 1024 possible
      SPRs. Thus we get just over 8k bytes of code for each of xmon_mfspr()
      and xmon_mtspr(). However, this 16kB of code pales in comparison to the
      > 130kB of PPC opcode tables used by the xmon disassembler.
      
      To catch interrupts caused by the mfspr/mtspr instructions, we add a new
      'catch_spr_faults' flag. If an interrupt occurs while it is set, we come
      back into xmon() via program_check_interrupt(), _exception() and die(),
      see that catch_spr_faults is set and do a longjmp to bus_error_jmp, back
      into read_spr() or write_spr().
      
      This adds a couple of other nice features: first, a "Sa" command that
      attempts to read and print out the value of all 1024 SPRs. If any mfspr
      instruction acts as a no-op, then the SPR is not implemented and not
      printed.
      
      Secondly, the Sr and Sw commands detect when an SPR is not
      implemented (i.e. mfspr is a no-op) and print a message to that effect
      rather than printing a bogus value.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      31cdd0c3
    • A
      powerpc/mm/radix: Use STD_MMU_64 to properly isolate hash related code · caca285e
      Aneesh Kumar K.V 提交于
      We also use MMU_FTR_RADIX to branch out from code path specific to
      hash.
      
      No functionality change.
      Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      caca285e
  3. 10 2月, 2016 1 次提交
  4. 09 2月, 2016 1 次提交
  5. 08 2月, 2016 1 次提交
  6. 17 12月, 2015 1 次提交
  7. 14 12月, 2015 1 次提交
    • R
      powerpc/xmon: Append linux_banner to exception information in xmon. · eb925d64
      Rashmica Gupta 提交于
      Currently if you are in xmon without an oops etc. to view the kernel
      version you have to type "d $linux_banner" - not necessarily obvious. As
      this is useful information, append to the output of "e" command.
      
      Example output:
        $mon> e
        cpu 0x1: Vector: 0  at [c0000000f879ba80]
            pc: c000000000081718: sysrq_handle_xmon+0x68/0x80
            lr: c000000000081718: sysrq_handle_xmon+0x68/0x80
            sp: c0000000f879bbe0
           msr: 8000000000009033
          current = 0xc0000000f604d5c0
          paca    = 0xc00000000fdc0480	 softe: 0	 irq_happened: 0x01
            pid   = 2467, comm = bash
        Linux version 4.4.0-rc2-00008-gc51af91c3ab3-dirty (rashmica@circle) (gcc
        version 5.1.1 20150629 (GCC) ) #45 SMP Wed Nov 25 10:25:12 AEDT 2015
      Signed-off-by: NRashmica Gupta <rashmicy@gmail.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      eb925d64
  8. 15 10月, 2015 3 次提交
    • M
      powerpc/xmon: Add some more elements to the existing PACA dump list · ad987fc8
      Michael Ellerman 提交于
      This patch adds a set of new elements to the existing PACA dump list
      inside an xmon session which can be listed below improving the overall
      xmon debug support.
      
      With this patch, a typical xmon PACA dump looks something like this.
      
      paca for cpu 0x0 @ c00000000fdc0000:
       possible             = yes
       present              = yes
       online               = yes
       lock_token           = 0x8000            	(0xa)
       paca_index           = 0x0               	(0x8)
       kernel_toc           = 0xc000000001393200	(0x10)
       kernelbase           = 0xc000000000000000	(0x18)
       kernel_msr           = 0xb000000000001033	(0x20)
       emergency_sp         = 0xc00000003fff0000	(0x28)
       mc_emergency_sp      = 0xc00000003ffec000	(0x2e0)
       in_mce               = 0x0               	(0x2e8)
       hmi_event_available  = 0x0               	(0x2ea)
       data_offset          = 0x1fe7b0000       	(0x30)
       hw_cpu_id            = 0x0               	(0x38)
       cpu_start            = 0x1               	(0x3a)
       kexec_state          = 0x0               	(0x3b)
       slb_shadow[0]:       = 0xc000000008000000 0x40016e7779000510
       slb_shadow[1]:       = 0xd000000008000001 0x400142add1000510
       vmalloc_sllp         = 0x510             	(0x1b8)
       slb_cache_ptr        = 0x4               	(0x1ba)
       slb_cache[0]:        = 0x000000000003f000
       slb_cache[1]:        = 0x0000000000000001
       slb_cache[2]:        = 0x0000000000000003
       slb_cache[3]:        = 0x0000000000001000
       slb_cache[4]:        = 0x0000000000001000
       slb_cache[5]:        = 0x0000000000000000
       slb_cache[6]:        = 0x0000000000000000
       slb_cache[7]:        = 0x0000000000000000
       dscr_default         = 0x0               	(0x58)
       __current            = 0xc000000001331e80	(0x290)
       kstack               = 0xc000000001393e30	(0x298)
       stab_rr              = 0x11              	(0x2a0)
       saved_r1             = 0xc0000001fffef5e0	(0x2a8)
       trap_save            = 0x0               	(0x2b8)
       soft_enabled         = 0x0               	(0x2ba)
       irq_happened         = 0x1               	(0x2bb)
       io_sync              = 0x0               	(0x2bc)
       irq_work_pending     = 0x0               	(0x2bd)
       nap_state_lost       = 0x0               	(0x2be)
       sprg_vdso            = 0x0               	(0x2c0)
       tm_scratch           = 0x8000000100009033	(0x2c8)
       core_idle_state_ptr  = (null)            	(0x2d0)
       thread_idle_state    = 0x0               	(0x2d8)
       thread_mask          = 0x0               	(0x2d9)
       subcore_sibling_mask = 0x0               	(0x2da)
       user_time            = 0x0               	(0x2f0)
       system_time          = 0x0               	(0x2f8)
       user_time_scaled     = 0x0               	(0x300)
       starttime            = 0x3f462418b5cf4   	(0x308)
       starttime_user       = 0x3f4622a57092a   	(0x310)
       startspurr           = 0xd62a5718        	(0x318)
       utime_sspurr         = 0x0               	(0x320)
       stolen_time          = 0x0               	(0x328)
      Signed-off-by: NAnshuman Khandual <khandual@linux.vnet.ibm.com>
      [mpe: Endian swap slb_shadow before display, minor formatting]
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      ad987fc8
    • S
      powerpc/xmon: Paginate kernel log buffer display · 0c23a88c
      Sam bobroff 提交于
      The kernel log buffer is often much longer than the size of a terminal
      so paginate it's output.
      Signed-off-by: NSam Bobroff <sam.bobroff@au1.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      0c23a88c
    • S
      powerpc/xmon: Paged output for paca display · 958b7c80
      Sam bobroff 提交于
      The paca display is already more than 24 lines, which can be problematic
      if you have an old school 80x24 terminal, or more likely you are on a
      virtual terminal which does not scroll for whatever reason.
      
      This patch adds a new command "#", which takes a single (hex) numeric
      argument: lines per page. It will cause the output of "dp" and "dpa"
      to be broken into pages, if necessary.
      
      Sample output:
      
      0:mon> # 10
      0:mon> dp1
      paca for cpu 0x1 @ c00000000fdc0480:
       possible         = yes
       present          = yes
       online           = yes
       lock_token       = 0x8000            	(0x8)
       paca_index       = 0x1               	(0xa)
       kernel_toc       = 0xc000000000eb2400	(0x10)
       kernelbase       = 0xc000000000000000	(0x18)
       kernel_msr       = 0xb000000000001032	(0x20)
       emergency_sp     = 0xc00000003ffe8000	(0x28)
       mc_emergency_sp  = 0xc00000003ffe4000	(0x2e0)
       in_mce           = 0x0               	(0x2e8)
       data_offset      = 0x7f170000        	(0x30)
       hw_cpu_id        = 0x8               	(0x38)
       cpu_start        = 0x1               	(0x3a)
       kexec_state      = 0x0               	(0x3b)
      [Hit a key (a:all, q:truncate, any:next page)]
      0:mon>
       __current        = 0xc00000007e696620	(0x290)
       kstack           = 0xc00000007e6ebe30	(0x298)
       stab_rr          = 0xb               	(0x2a0)
       saved_r1         = 0xc00000007ef37860	(0x2a8)
       trap_save        = 0x0               	(0x2b8)
       soft_enabled     = 0x0               	(0x2ba)
       irq_happened     = 0x1               	(0x2bb)
       io_sync          = 0x0               	(0x2bc)
       irq_work_pending = 0x0               	(0x2bd)
       nap_state_lost   = 0x0               	(0x2be)
      0:mon>
      Signed-off-by: NSam Bobroff <sam.bobroff@au1.ibm.com>
      [mpe: Use bool, make some variables static]
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      958b7c80
  9. 12 8月, 2015 1 次提交
  10. 06 8月, 2015 1 次提交
  11. 19 1月, 2015 1 次提交
  12. 29 12月, 2014 1 次提交
  13. 02 12月, 2014 2 次提交
    • M
      powerpc/xmon: Cleanup the breakpoint flags · abb90ee7
      Michael Ellerman 提交于
      Drop BP_IABR_TE, which though used, does not do anything useful. Rename
      BP_IABR to BP_CIABR. Renumber the flags.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      abb90ee7
    • A
      powerpc/xmon: Enable HW instruction breakpoint on POWER8 · 1ad7d705
      Anshuman Khandual 提交于
      This patch enables support for hardware instruction breakpoint in xmon
      on POWER8 platform with the help of a new register called the CIABR
      (Completed Instruction Address Breakpoint Register). With this patch, a
      single hardware instruction breakpoint can be added and cleared during
      any active xmon debug session. The hardware based instruction breakpoint
      mechanism works correctly with the existing TRAP based instruction
      breakpoint available on xmon.
      
      There are no powerpc CPU with CPU_FTR_IABR feature any more. This patch
      has re-purposed all the existing IABR related code to work with CIABR
      register based HW instruction breakpoint.
      
      This has one odd feature, which is that when we hit a breakpoint xmon
      doesn't tell us we have hit the breakpoint. This is because xmon is
      expecting bp->address == regs->nip. Because CIABR fires on completition
      regs->nip points to the instruction after the breakpoint. We could fix
      that, but it would then confuse other parts of the xmon code which think
      we need to emulate the instruction. [mpe]
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NAnshuman Khandual <khandual@linux.vnet.ibm.com>
      1ad7d705
  14. 27 11月, 2014 1 次提交
    • L
      powerpc/pseries: Fix endiannes issue in RTAS call from xmon · 3b8a3c01
      Laurent Dufour 提交于
      On pseries system (LPAR) xmon failed to enter when running in LE mode,
      system is hunging. Inititating xmon will lead to such an output on the
      console:
      
      SysRq : Entering xmon
      cpu 0x15: Vector: 0  at [c0000003f39ffb10]
          pc: c00000000007ed7c: sysrq_handle_xmon+0x5c/0x70
          lr: c00000000007ed7c: sysrq_handle_xmon+0x5c/0x70
          sp: c0000003f39ffc70
         msr: 8000000000009033
        current = 0xc0000003fafa7180
        paca    = 0xc000000007d75e80	 softe: 0	 irq_happened: 0x01
          pid   = 14617, comm = bash
      Bad kernel stack pointer fafb4b0 at eca7cc4
      cpu 0x15: Vector: 300 (Data Access) at [c000000007f07d40]
          pc: 000000000eca7cc4
          lr: 000000000eca7c44
          sp: fafb4b0
         msr: 8000000000001000
         dar: 10000000
       dsisr: 42000000
        current = 0xc0000003fafa7180
        paca    = 0xc000000007d75e80	 softe: 0	 irq_happened: 0x01
          pid   = 14617, comm = bash
      cpu 0x15: Exception 300 (Data Access) in xmon, returning to main loop
      xmon: WARNING: bad recursive fault on cpu 0x15
      
      The root cause is that xmon is calling RTAS to turn off the surveillance
      when entering xmon, and RTAS is requiring big endian parameters.
      
      This patch is byte swapping the RTAS arguments when running in LE mode.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NLaurent Dufour <ldufour@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      3b8a3c01
  15. 12 11月, 2014 1 次提交
  16. 03 11月, 2014 1 次提交
    • A
      powerpc: Convert power off logic to pm_power_off · 9178ba29
      Alexander Graf 提交于
      The generic Linux framework to power off the machine is a function pointer
      called pm_power_off. The trick about this pointer is that device drivers can
      potentially implement it rather than board files.
      
      Today on powerpc we set pm_power_off to invoke our generic full machine power
      off logic which then calls ppc_md.power_off to invoke machine specific power
      off.
      
      However, when we want to add a power off GPIO via the "gpio-poweroff" driver,
      this card house falls apart. That driver only registers itself if pm_power_off
      is NULL to ensure it doesn't override board specific logic. However, since we
      always set pm_power_off to the generic power off logic (which will just not
      power off the machine if no ppc_md.power_off call is implemented), we can't
      implement power off via the generic GPIO power off driver.
      
      To fix this up, let's get rid of the ppc_md.power_off logic and just always use
      pm_power_off as was intended. Then individual drivers such as the GPIO power off
      driver can implement power off logic via that function pointer.
      
      With this patch set applied and a few patches on top of QEMU that implement a
      power off GPIO on the virt e500 machine, I can successfully turn off my virtual
      machine after halt.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      [mpe: Squash into one patch and update changelog based on cover letter]
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      9178ba29
  17. 13 8月, 2014 1 次提交
  18. 28 7月, 2014 2 次提交
  19. 05 6月, 2014 1 次提交
    • M
      powerpc/xmon: Fix up xmon format strings · 736256e4
      Michael Ellerman 提交于
      There are a couple of places where xmon is using %x to print values that
      are unsigned long.
      
      I found this out the hard way recently:
      
       0:mon> p c000000000d0e7c8 c00000033dc90000 00000000a0000089 c000000000000000
       return value is 0x96300500
      
      Which is calling find_linux_pte_or_hugepte(), the result should be a
      kernel pointer. After decoding the page tables by hand I discovered the
      correct value was c000000396300500.
      
      So fix up that case and a few others.
      
      We also use a mix of 0x%x, %x and %u to print cpu numbers. So
      standardise on 0x%x.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      736256e4
  20. 20 5月, 2014 1 次提交
    • P
      powerpc: Fix smp_processor_id() in preemptible splat in set_breakpoint · 21f58507
      Paul Gortmaker 提交于
      Currently, on 8641D, which doesn't set CONFIG_HAVE_HW_BREAKPOINT
      we get the following splat:
      
      BUG: using smp_processor_id() in preemptible [00000000] code: login/1382
      caller is set_breakpoint+0x1c/0xa0
      CPU: 0 PID: 1382 Comm: login Not tainted 3.15.0-rc3-00041-g2aafe1a4 #1
      Call Trace:
      [decd5d80] [c0008dc4] show_stack+0x50/0x158 (unreliable)
      [decd5dc0] [c03c6fa0] dump_stack+0x7c/0xdc
      [decd5de0] [c01f8818] check_preemption_disabled+0xf4/0x104
      [decd5e00] [c00086b8] set_breakpoint+0x1c/0xa0
      [decd5e10] [c00d4530] flush_old_exec+0x2bc/0x588
      [decd5e40] [c011c468] load_elf_binary+0x2ac/0x1164
      [decd5ec0] [c00d35f8] search_binary_handler+0xc4/0x1f8
      [decd5ef0] [c00d4ee8] do_execve+0x3d8/0x4b8
      [decd5f40] [c001185c] ret_from_syscall+0x0/0x38
       --- Exception: c01 at 0xfeee554
          LR = 0xfeee7d4
      
      The call path in this case is:
      
      	flush_thread
      	   --> set_debug_reg_defaults
      	     --> set_breakpoint
      	       --> __get_cpu_var
      
      Since preemption is enabled in the cleanup of flush thread, and
      there is no need to disable it, introduce the distinction between
      set_breakpoint and __set_breakpoint, leaving only the flush_thread
      instance as the current user of set_breakpoint.
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      21f58507
  21. 07 3月, 2014 1 次提交
  22. 11 2月, 2014 3 次提交
    • M
      powerpc/xmon: Don't signal we've entered until we're finished printing · d2b496e5
      Michael Ellerman 提交于
      Currently we set our cpu's bit in cpus_in_xmon, and then we take the
      output lock and print the exception information.
      
      This can race with the master cpu entering the command loop and printing
      the backtrace. The result is that the backtrace gets garbled with
      another cpu's exception print out.
      
      Fix it by delaying the set of cpus_in_xmon until we are finished
      printing.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      d2b496e5
    • M
      powerpc/xmon: Fix timeout loop in get_output_lock() · 15075897
      Michael Ellerman 提交于
      As far as I can tell, our 70s era timeout loop in get_output_lock() is
      generating no code.
      
      This leads to the hostile takeover happening more or less simultaneously
      on all cpus. The result is "interesting", some example output that is
      more readable than most:
      
          cpu 0x1: Vector: 100 (Scypsut e0mx bR:e setV)e catto xc0p:u[ c 00
          c0:0  000t0o0V0erc0td:o5 rfc28050000]0c00 0 0  0 6t(pSrycsV1ppuot
          uxe 1m 2 0Rx21e3:0s0ce000c00000t00)00 60602oV2SerucSayt0y 0p 1sxs
      
      Fix it by using udelay() in the timeout loop. The wait time and check
      frequency are arbitrary, but seem to work OK. We already rely on
      udelay() working so this is not a new dependency.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      15075897
    • M
      powerpc/xmon: Don't loop forever in get_output_lock() · 730efb61
      Michael Ellerman 提交于
      If we enter with xmon_speaker != 0 we skip the first cmpxchg(), we also
      skip the while loop because xmon_speaker != last_speaker (0) - meaning we
      skip the second cmpxchg() also.
      
      Following that code path the compiler sees no memory barriers and so is
      within its rights to never reload xmon_speaker. The end result is we loop
      forever.
      
      This manifests as all cpus being in xmon ('c' command), but they refuse
      to take control when you switch to them ('c x' for cpu # x).
      
      I have seen this deadlock in practice and also checked the generated code to
      confirm this is what's happening.
      
      The simplest fix is just to always try the cmpxchg().
      Signed-off-by: NMichael Ellerman <michael@ellerman.id.au>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      730efb61
  23. 05 12月, 2013 1 次提交
  24. 05 9月, 2013 1 次提交
    • P
      powerpc/xmon: Fix printing of set of CPUs in xmon · fd3bb912
      Paul Mackerras 提交于
      Commit 24ec2125f3 ("powerpc/xmon: Use cpumask iterator to avoid warning")
      replaced a loop from 0 to NR_CPUS-1 with a for_each_possible_cpu() loop,
      which means that if the last possible cpu is in xmon, we print the
      wrong value for the end of the range.  For example, if 4 cpus are
      possible, NR_CPUS is 128, and all cpus are in xmon, we print "0-7f"
      rather than "0-3".  The code also assumes that the set of possible
      cpus is contiguous, which may not necessarily be true.
      
      This fixes the code to check explicitly for contiguity, and to print
      the ending value correctly.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      fd3bb912
  25. 27 8月, 2013 1 次提交
  26. 01 5月, 2013 1 次提交
  27. 30 4月, 2013 1 次提交
  28. 16 1月, 2013 1 次提交
  29. 10 1月, 2013 1 次提交
  30. 15 11月, 2012 3 次提交