* [PATCH 1/3] Fix sparse warning in xmon Cell code
@ 2006-11-03 7:28 Michael Ellerman
2006-11-03 7:28 ` [PATCH 3/3] Add a 'sd' command (spu dump) to xmon to dump spu local store Michael Ellerman
2006-11-03 7:28 ` [PATCH 2/3] Show state of spus as they're stopped in Cell xmon helper Michael Ellerman
0 siblings, 2 replies; 3+ messages in thread
From: Michael Ellerman @ 2006-11-03 7:28 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev, Arnd Bergmann
My patch to add spu helpers to xmon (a898497088f46252e6750405504064e2dce53117)
introduced a few sparse warnings, because I was dereferencing an __iomem
pointer.
I think the best way to handle it is to actually use the appropriate in_beXX
functions. Need to rejigger the DUMP macro a little to accomodate that.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
Arnd, it might be nice to merge this for SDK 2.0 if that's still an option,
just so that it matches upstream as much as possible.
arch/powerpc/xmon/xmon.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
Index: cell/arch/powerpc/xmon/xmon.c
===================================================================
--- cell.orig/arch/powerpc/xmon/xmon.c
+++ cell/arch/powerpc/xmon/xmon.c
@@ -2746,13 +2746,13 @@ static void restart_spus(void)
}
#define DUMP_WIDTH 23
-#define DUMP_FIELD(obj, format, field) \
+#define DUMP_VALUE(format, field, value) \
do { \
if (setjmp(bus_error_jmp) == 0) { \
catch_memory_errors = 1; \
sync(); \
printf(" %-*s = "format"\n", DUMP_WIDTH, \
- #field, obj->field); \
+ #field, value); \
sync(); \
__delay(200); \
} else { \
@@ -2763,6 +2763,9 @@ do { \
catch_memory_errors = 0; \
} while (0)
+#define DUMP_FIELD(obj, format, field) \
+ DUMP_VALUE(format, field, obj->field)
+
static void dump_spu_fields(struct spu *spu)
{
printf("Dumping spu fields at address %p:\n", spu);
@@ -2791,13 +2794,18 @@ static void dump_spu_fields(struct spu *
DUMP_FIELD(spu, "0x%p", timestamp);
DUMP_FIELD(spu, "0x%lx", problem_phys);
DUMP_FIELD(spu, "0x%p", problem);
- DUMP_FIELD(spu, "0x%x", problem->spu_runcntl_RW);
- DUMP_FIELD(spu, "0x%x", problem->spu_status_R);
- DUMP_FIELD(spu, "0x%x", problem->spu_npc_RW);
+ DUMP_VALUE("0x%x", problem->spu_runcntl_RW,
+ in_be32(&spu->problem->spu_runcntl_RW));
+ DUMP_VALUE("0x%x", problem->spu_status_R,
+ in_be32(&spu->problem->spu_status_R));
+ DUMP_VALUE("0x%x", problem->spu_npc_RW,
+ in_be32(&spu->problem->spu_npc_RW));
DUMP_FIELD(spu, "0x%p", priv1);
- if (spu->priv1)
- DUMP_FIELD(spu, "0x%lx", priv1->mfc_sr1_RW);
+ if (spu->priv1) {
+ DUMP_VALUE("0x%lx", priv1->mfc_sr1_RW,
+ in_be64(&spu->priv1->mfc_sr1_RW));
+ }
DUMP_FIELD(spu, "0x%p", priv2);
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/3] Show state of spus as they're stopped in Cell xmon helper
2006-11-03 7:28 [PATCH 1/3] Fix sparse warning in xmon Cell code Michael Ellerman
2006-11-03 7:28 ` [PATCH 3/3] Add a 'sd' command (spu dump) to xmon to dump spu local store Michael Ellerman
@ 2006-11-03 7:28 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2006-11-03 7:28 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev, Arnd Bergmann
After stopping spus in xmon I often find myself trawling through the
field dumps to find out which spus were running. The spu stopping
code actually knows what's running, so let's print it out to save
the user some futzing.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
arch/powerpc/xmon/xmon.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Index: cell/arch/powerpc/xmon/xmon.c
===================================================================
--- cell.orig/arch/powerpc/xmon/xmon.c
+++ cell/arch/powerpc/xmon/xmon.c
@@ -2700,7 +2700,10 @@ static void stop_spus(void)
__delay(200);
spu_info[i].stopped_ok = 1;
- printf("Stopped spu %.2d\n", i);
+
+ printf("Stopped spu %.2d (was %s)\n", i,
+ spu_info[i].saved_spu_runcntl_RW ?
+ "running" : "stopped");
} else {
catch_memory_errors = 0;
printf("*** Error stopping spu %.2d\n", i);
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 3/3] Add a 'sd' command (spu dump) to xmon to dump spu local store
2006-11-03 7:28 [PATCH 1/3] Fix sparse warning in xmon Cell code Michael Ellerman
@ 2006-11-03 7:28 ` Michael Ellerman
2006-11-03 7:28 ` [PATCH 2/3] Show state of spus as they're stopped in Cell xmon helper Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2006-11-03 7:28 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev, Arnd Bergmann
Add a command to xmon to dump the memory of a spu's local store.
This mimics the 'd' command which dumps regular memory, but does
a little hand holding by taking the user supplied address and
finding that offset in the local store for the specified spu.
This makes it easy for example to look at what was executing on a spu:
1:mon> ss
...
Stopped spu 04 (was running)
...
1:mon> sf 4
Dumping spu fields at address c0000000019e0a00:
...
problem->spu_npc_RW = 0x228
...
1:mon> sd 4 0x228
d000080080318228 01a00c021cffc408 4020007f217ff488 |........@ ..!...|
Aha, 01a00c02, which is of course rdch $2,$ch24 !
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
arch/powerpc/xmon/xmon.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 51 insertions(+), 1 deletion(-)
Index: cell/arch/powerpc/xmon/xmon.c
===================================================================
--- cell.orig/arch/powerpc/xmon/xmon.c
+++ cell/arch/powerpc/xmon/xmon.c
@@ -217,7 +217,8 @@ Commands:\n\
#ifdef CONFIG_PPC_CELL
" ss stop execution on all spus\n\
sr restore execution on stopped spus\n\
- sf # dump spu fields for spu # (in hex)\n"
+ sf # dump spu fields for spu # (in hex)\n\
+ sd # dump spu local store for spu # (in hex)\n"
#endif
" S print special registers\n\
t print backtrace\n\
@@ -2649,6 +2650,7 @@ struct spu_info {
struct spu *spu;
u64 saved_mfc_sr1_RW;
u32 saved_spu_runcntl_RW;
+ unsigned long dump_addr;
u8 stopped_ok;
};
@@ -2668,6 +2670,8 @@ void xmon_register_spus(struct list_head
spu_info[spu->number].spu = spu;
spu_info[spu->number].stopped_ok = 0;
+ spu_info[spu->number].dump_addr = (unsigned long)
+ spu_info[spu->number].spu->local_store;
}
}
@@ -2813,6 +2817,48 @@ static void dump_spu_fields(struct spu *
DUMP_FIELD(spu, "0x%p", priv2);
}
+static void dump_spu_ls(void)
+{
+ static unsigned long num;
+ unsigned long offset, addr, ls_addr;
+ int rc;
+
+ scanhex(&num);
+ if (num >= XMON_NUM_SPUS || !spu_info[num].spu) {
+ printf("*** Error: invalid spu number\n");
+ return;
+ }
+
+ rc = scanhex(&offset);
+
+ if (setjmp(bus_error_jmp) == 0) {
+ catch_memory_errors = 1;
+ sync();
+
+ ls_addr = (unsigned long)spu_info[num].spu->local_store;
+ if (rc)
+ addr = ls_addr + offset;
+ else
+ addr = spu_info[num].dump_addr;
+
+ if (addr < ls_addr + LS_SIZE) {
+ prdump(addr, 64);
+ spu_info[num].dump_addr = addr + 64;
+ } else {
+ printf("*** Error: address outside of local store\n");
+ last_cmd = NULL;
+ }
+
+ sync();
+ __delay(200);
+ } else {
+ catch_memory_errors = 0;
+ printf("*** Error: dumping local store for spu %d\n", num);
+ }
+
+ catch_memory_errors = 0;
+}
+
static int do_spu_cmd(void)
{
unsigned long num = 0;
@@ -2832,6 +2878,10 @@ static int do_spu_cmd(void)
else
printf("*** Error: invalid spu number\n");
break;
+ case 'd':
+ last_cmd = "sd\n";
+ dump_spu_ls();
+ break;
default:
return -1;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-11-03 7:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-03 7:28 [PATCH 1/3] Fix sparse warning in xmon Cell code Michael Ellerman
2006-11-03 7:28 ` [PATCH 3/3] Add a 'sd' command (spu dump) to xmon to dump spu local store Michael Ellerman
2006-11-03 7:28 ` [PATCH 2/3] Show state of spus as they're stopped in Cell xmon helper Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).