aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Steiner <steiner@sgi.com>2009-06-17 19:28:34 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-18 16:04:04 -0400
commit2b702b28addc0f9eb2f37148f0b99f546cadd30a (patch)
tree9313d3f09de281de0291baa77bc4f5d0057b4b8d
parent1926ee85a903d189c5702eed6531be321e33eb47 (diff)
gru: fixes to grudump utility
Minor fixes to the SGI GRU grudump facility: - fix address where user data is written - add gru number to data passed to user - indicate if context is locked Signed-off-by: Jack Steiner <steiner@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/misc/sgi-gru/grukdump.c8
-rw-r--r--drivers/misc/sgi-gru/grulib.h4
2 files changed, 8 insertions, 4 deletions
diff --git a/drivers/misc/sgi-gru/grukdump.c b/drivers/misc/sgi-gru/grukdump.c
index 7b1bdf3906ba..0f9dd3e64b57 100644
--- a/drivers/misc/sgi-gru/grukdump.c
+++ b/drivers/misc/sgi-gru/grukdump.c
@@ -26,7 +26,7 @@
26 26
27static int gru_user_copy_handle(void __user **dp, void *s) 27static int gru_user_copy_handle(void __user **dp, void *s)
28{ 28{
29 if (copy_to_user(dp, s, GRU_HANDLE_BYTES)) 29 if (copy_to_user(*dp, s, GRU_HANDLE_BYTES))
30 return -1; 30 return -1;
31 *dp += GRU_HANDLE_BYTES; 31 *dp += GRU_HANDLE_BYTES;
32 return 0; 32 return 0;
@@ -109,7 +109,7 @@ static int gru_dump_context(struct gru_state *gru, int ctxnum,
109{ 109{
110 struct gru_dump_context_header hdr; 110 struct gru_dump_context_header hdr;
111 struct gru_dump_context_header __user *uhdr = ubuf; 111 struct gru_dump_context_header __user *uhdr = ubuf;
112 struct gru_context_configuration_handle *cch; 112 struct gru_context_configuration_handle *cch, *ubufcch;
113 struct gru_thread_state *gts; 113 struct gru_thread_state *gts;
114 int try, cch_locked, cbrcnt = 0, dsrcnt = 0, bytes = 0, ret = 0; 114 int try, cch_locked, cbrcnt = 0, dsrcnt = 0, bytes = 0, ret = 0;
115 void *grubase; 115 void *grubase;
@@ -125,8 +125,11 @@ static int gru_dump_context(struct gru_state *gru, int ctxnum,
125 } 125 }
126 126
127 ubuf += sizeof(hdr); 127 ubuf += sizeof(hdr);
128 ubufcch = ubuf;
128 if (gru_user_copy_handle(&ubuf, cch)) 129 if (gru_user_copy_handle(&ubuf, cch))
129 goto fail; 130 goto fail;
131 if (cch_locked)
132 ubufcch->delresp = 0;
130 bytes = sizeof(hdr) + GRU_CACHE_LINE_BYTES; 133 bytes = sizeof(hdr) + GRU_CACHE_LINE_BYTES;
131 134
132 if (cch_locked || !lock_cch) { 135 if (cch_locked || !lock_cch) {
@@ -155,6 +158,7 @@ static int gru_dump_context(struct gru_state *gru, int ctxnum,
155 return ret; 158 return ret;
156 159
157 hdr.magic = GRU_DUMP_MAGIC; 160 hdr.magic = GRU_DUMP_MAGIC;
161 hdr.gid = gru->gs_gid;
158 hdr.ctxnum = ctxnum; 162 hdr.ctxnum = ctxnum;
159 hdr.cbrcnt = cbrcnt; 163 hdr.cbrcnt = cbrcnt;
160 hdr.dsrcnt = dsrcnt; 164 hdr.dsrcnt = dsrcnt;
diff --git a/drivers/misc/sgi-gru/grulib.h b/drivers/misc/sgi-gru/grulib.h
index a484a9fee3ce..889bc442a3e8 100644
--- a/drivers/misc/sgi-gru/grulib.h
+++ b/drivers/misc/sgi-gru/grulib.h
@@ -120,7 +120,7 @@ struct gru_flush_tlb_req {
120enum {dcs_pid, dcs_gid}; 120enum {dcs_pid, dcs_gid};
121struct gru_dump_chiplet_state_req { 121struct gru_dump_chiplet_state_req {
122 unsigned int op; 122 unsigned int op;
123 int gid; 123 unsigned int gid;
124 int ctxnum; 124 int ctxnum;
125 char data_opt; 125 char data_opt;
126 char lock_cch; 126 char lock_cch;
@@ -134,7 +134,7 @@ struct gru_dump_chiplet_state_req {
134#define GRU_DUMP_MAGIC 0x3474ab6c 134#define GRU_DUMP_MAGIC 0x3474ab6c
135struct gru_dump_context_header { 135struct gru_dump_context_header {
136 unsigned int magic; 136 unsigned int magic;
137 unsigned char gid; 137 unsigned int gid;
138 unsigned char ctxnum; 138 unsigned char ctxnum;
139 unsigned char cbrcnt; 139 unsigned char cbrcnt;
140 unsigned char dsrcnt; 140 unsigned char dsrcnt;