summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/xmon
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2017-04-12 08:25:02 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2017-04-12 08:31:37 -0400
commit3c19d5ada1bec8b97119215298df7669d3ffb3db (patch)
treebbc728296e01ff7403164072e4f87ad01de2c6ea /arch/powerpc/xmon
parent17ed4c8f81da2bf340d33a8c875f4d6b1dfd9398 (diff)
parent08a1e650cc631ccc8cfe670beb38b2f9c58402cd (diff)
Merge branch 'topic/xive' (early part) into next
This merges the arch part of the XIVE support, leaving the final commit with the KVM specific pieces dangling on the branch for Paul to merge via the kvm-ppc tree.
Diffstat (limited to 'arch/powerpc/xmon')
-rw-r--r--arch/powerpc/xmon/xmon.c94
1 files changed, 92 insertions, 2 deletions
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index fddc857af772..f77a104abf9f 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -31,6 +31,7 @@
31 31
32#include <asm/debugfs.h> 32#include <asm/debugfs.h>
33#include <asm/ptrace.h> 33#include <asm/ptrace.h>
34#include <asm/smp.h>
34#include <asm/string.h> 35#include <asm/string.h>
35#include <asm/prom.h> 36#include <asm/prom.h>
36#include <asm/machdep.h> 37#include <asm/machdep.h>
@@ -49,7 +50,7 @@
49#include <asm/reg.h> 50#include <asm/reg.h>
50#include <asm/debug.h> 51#include <asm/debug.h>
51#include <asm/hw_breakpoint.h> 52#include <asm/hw_breakpoint.h>
52 53#include <asm/xive.h>
53#include <asm/opal.h> 54#include <asm/opal.h>
54#include <asm/firmware.h> 55#include <asm/firmware.h>
55 56
@@ -232,7 +233,13 @@ Commands:\n\
232 "\ 233 "\
233 dr dump stream of raw bytes\n\ 234 dr dump stream of raw bytes\n\
234 dt dump the tracing buffers (uses printk)\n\ 235 dt dump the tracing buffers (uses printk)\n\
235 e print exception information\n\ 236"
237#ifdef CONFIG_PPC_POWERNV
238" dx# dump xive on CPU #\n\
239 dxi# dump xive irq state #\n\
240 dxa dump xive on all CPUs\n"
241#endif
242" e print exception information\n\
236 f flush cache\n\ 243 f flush cache\n\
237 la lookup symbol+offset of specified address\n\ 244 la lookup symbol+offset of specified address\n\
238 ls lookup address of specified symbol\n\ 245 ls lookup address of specified symbol\n\
@@ -2335,6 +2342,81 @@ static void dump_pacas(void)
2335} 2342}
2336#endif 2343#endif
2337 2344
2345#ifdef CONFIG_PPC_POWERNV
2346static void dump_one_xive(int cpu)
2347{
2348 unsigned int hwid = get_hard_smp_processor_id(cpu);
2349
2350 opal_xive_dump(XIVE_DUMP_TM_HYP, hwid);
2351 opal_xive_dump(XIVE_DUMP_TM_POOL, hwid);
2352 opal_xive_dump(XIVE_DUMP_TM_OS, hwid);
2353 opal_xive_dump(XIVE_DUMP_TM_USER, hwid);
2354 opal_xive_dump(XIVE_DUMP_VP, hwid);
2355 opal_xive_dump(XIVE_DUMP_EMU_STATE, hwid);
2356
2357 if (setjmp(bus_error_jmp) != 0) {
2358 catch_memory_errors = 0;
2359 printf("*** Error dumping xive on cpu %d\n", cpu);
2360 return;
2361 }
2362
2363 catch_memory_errors = 1;
2364 sync();
2365 xmon_xive_do_dump(cpu);
2366 sync();
2367 __delay(200);
2368 catch_memory_errors = 0;
2369}
2370
2371static void dump_all_xives(void)
2372{
2373 int cpu;
2374
2375 if (num_possible_cpus() == 0) {
2376 printf("No possible cpus, use 'dx #' to dump individual cpus\n");
2377 return;
2378 }
2379
2380 for_each_possible_cpu(cpu)
2381 dump_one_xive(cpu);
2382}
2383
2384static void dump_one_xive_irq(u32 num)
2385{
2386 s64 rc;
2387 __be64 vp;
2388 u8 prio;
2389 __be32 lirq;
2390
2391 rc = opal_xive_get_irq_config(num, &vp, &prio, &lirq);
2392 xmon_printf("IRQ 0x%x config: vp=0x%llx prio=%d lirq=0x%x (rc=%lld)\n",
2393 num, be64_to_cpu(vp), prio, be32_to_cpu(lirq), rc);
2394}
2395
2396static void dump_xives(void)
2397{
2398 unsigned long num;
2399 int c;
2400
2401 c = inchar();
2402 if (c == 'a') {
2403 dump_all_xives();
2404 return;
2405 } else if (c == 'i') {
2406 if (scanhex(&num))
2407 dump_one_xive_irq(num);
2408 return;
2409 }
2410
2411 termch = c; /* Put c back, it wasn't 'a' */
2412
2413 if (scanhex(&num))
2414 dump_one_xive(num);
2415 else
2416 dump_one_xive(xmon_owner);
2417}
2418#endif /* CONFIG_PPC_POWERNV */
2419
2338static void dump_by_size(unsigned long addr, long count, int size) 2420static void dump_by_size(unsigned long addr, long count, int size)
2339{ 2421{
2340 unsigned char temp[16]; 2422 unsigned char temp[16];
@@ -2383,6 +2465,14 @@ dump(void)
2383 return; 2465 return;
2384 } 2466 }
2385#endif 2467#endif
2468#ifdef CONFIG_PPC_POWERNV
2469 if (c == 'x') {
2470 xmon_start_pagination();
2471 dump_xives();
2472 xmon_end_pagination();
2473 return;
2474 }
2475#endif
2386 2476
2387 if (c == '\n') 2477 if (c == '\n')
2388 termch = c; 2478 termch = c;