diff options
author | Dean Nelson <dcn@sgi.com> | 2008-07-30 01:34:16 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-30 12:41:50 -0400 |
commit | a812dcc3a298eef650c381e094e2cf41a4ecc9ad (patch) | |
tree | cb6a24a623891054789f5340742c3c8ff1fb8cde /drivers/misc/sgi-xp/xpnet.c | |
parent | 261f3b4979db88d29fc86aad9f76fbc0c2c6d21a (diff) |
sgi-xp: add usage of GRU driver by xpc_remote_memcpy()
Add UV support to xpc_remote_memcpy(), which involves interfacing to the
GRU driver.
Signed-off-by: Dean Nelson <dcn@sgi.com>
Cc: Jack Steiner <steiner@sgi.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/misc/sgi-xp/xpnet.c')
-rw-r--r-- | drivers/misc/sgi-xp/xpnet.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/drivers/misc/sgi-xp/xpnet.c b/drivers/misc/sgi-xp/xpnet.c index 49385f441705..4f5d62230116 100644 --- a/drivers/misc/sgi-xp/xpnet.c +++ b/drivers/misc/sgi-xp/xpnet.c | |||
@@ -44,7 +44,7 @@ struct xpnet_message { | |||
44 | u16 version; /* Version for this message */ | 44 | u16 version; /* Version for this message */ |
45 | u16 embedded_bytes; /* #of bytes embedded in XPC message */ | 45 | u16 embedded_bytes; /* #of bytes embedded in XPC message */ |
46 | u32 magic; /* Special number indicating this is xpnet */ | 46 | u32 magic; /* Special number indicating this is xpnet */ |
47 | u64 buf_pa; /* phys address of buffer to retrieve */ | 47 | unsigned long buf_pa; /* phys address of buffer to retrieve */ |
48 | u32 size; /* #of bytes in buffer */ | 48 | u32 size; /* #of bytes in buffer */ |
49 | u8 leadin_ignore; /* #of bytes to ignore at the beginning */ | 49 | u8 leadin_ignore; /* #of bytes to ignore at the beginning */ |
50 | u8 tailout_ignore; /* #of bytes to ignore at the end */ | 50 | u8 tailout_ignore; /* #of bytes to ignore at the end */ |
@@ -152,6 +152,7 @@ static void | |||
152 | xpnet_receive(short partid, int channel, struct xpnet_message *msg) | 152 | xpnet_receive(short partid, int channel, struct xpnet_message *msg) |
153 | { | 153 | { |
154 | struct sk_buff *skb; | 154 | struct sk_buff *skb; |
155 | void *dst; | ||
155 | enum xp_retval ret; | 156 | enum xp_retval ret; |
156 | struct xpnet_dev_private *priv = | 157 | struct xpnet_dev_private *priv = |
157 | (struct xpnet_dev_private *)xpnet_device->priv; | 158 | (struct xpnet_dev_private *)xpnet_device->priv; |
@@ -166,9 +167,8 @@ xpnet_receive(short partid, int channel, struct xpnet_message *msg) | |||
166 | 167 | ||
167 | return; | 168 | return; |
168 | } | 169 | } |
169 | dev_dbg(xpnet, "received 0x%lx, %d, %d, %d\n", | 170 | dev_dbg(xpnet, "received 0x%lx, %d, %d, %d\n", msg->buf_pa, msg->size, |
170 | (unsigned long)msg->buf_pa, msg->size, msg->leadin_ignore, | 171 | msg->leadin_ignore, msg->tailout_ignore); |
171 | msg->tailout_ignore); | ||
172 | 172 | ||
173 | /* reserve an extra cache line */ | 173 | /* reserve an extra cache line */ |
174 | skb = dev_alloc_skb(msg->size + L1_CACHE_BYTES); | 174 | skb = dev_alloc_skb(msg->size + L1_CACHE_BYTES); |
@@ -210,15 +210,12 @@ xpnet_receive(short partid, int channel, struct xpnet_message *msg) | |||
210 | skb_copy_to_linear_data(skb, &msg->data, | 210 | skb_copy_to_linear_data(skb, &msg->data, |
211 | (size_t)msg->embedded_bytes); | 211 | (size_t)msg->embedded_bytes); |
212 | } else { | 212 | } else { |
213 | dst = (void *)((u64)skb->data & ~(L1_CACHE_BYTES - 1)); | ||
213 | dev_dbg(xpnet, "transferring buffer to the skb->data area;\n\t" | 214 | dev_dbg(xpnet, "transferring buffer to the skb->data area;\n\t" |
214 | "xp_remote_memcpy(0x%p, 0x%p, %hu)\n", (void *) | 215 | "xp_remote_memcpy(0x%p, 0x%p, %hu)\n", dst, |
215 | ((u64)skb->data & ~(L1_CACHE_BYTES - 1)), | ||
216 | (void *)msg->buf_pa, msg->size); | 216 | (void *)msg->buf_pa, msg->size); |
217 | 217 | ||
218 | ret = xp_remote_memcpy((void *)((u64)skb->data & | 218 | ret = xp_remote_memcpy(xp_pa(dst), msg->buf_pa, msg->size); |
219 | ~(L1_CACHE_BYTES - 1)), | ||
220 | (void *)msg->buf_pa, msg->size); | ||
221 | |||
222 | if (ret != xpSuccess) { | 219 | if (ret != xpSuccess) { |
223 | /* | 220 | /* |
224 | * !!! Need better way of cleaning skb. Currently skb | 221 | * !!! Need better way of cleaning skb. Currently skb |
@@ -226,8 +223,7 @@ xpnet_receive(short partid, int channel, struct xpnet_message *msg) | |||
226 | * !!! dev_kfree_skb. | 223 | * !!! dev_kfree_skb. |
227 | */ | 224 | */ |
228 | dev_err(xpnet, "xp_remote_memcpy(0x%p, 0x%p, 0x%hx) " | 225 | dev_err(xpnet, "xp_remote_memcpy(0x%p, 0x%p, 0x%hx) " |
229 | "returned error=0x%x\n", (void *) | 226 | "returned error=0x%x\n", dst, |
230 | ((u64)skb->data & ~(L1_CACHE_BYTES - 1)), | ||
231 | (void *)msg->buf_pa, msg->size, ret); | 227 | (void *)msg->buf_pa, msg->size, ret); |
232 | 228 | ||
233 | xpc_received(partid, channel, (void *)msg); | 229 | xpc_received(partid, channel, (void *)msg); |
@@ -428,13 +424,13 @@ xpnet_send(struct sk_buff *skb, struct xpnet_pending_msg *queued_msg, | |||
428 | msg->size = end_addr - start_addr; | 424 | msg->size = end_addr - start_addr; |
429 | msg->leadin_ignore = (u64)skb->data - start_addr; | 425 | msg->leadin_ignore = (u64)skb->data - start_addr; |
430 | msg->tailout_ignore = end_addr - (u64)skb_tail_pointer(skb); | 426 | msg->tailout_ignore = end_addr - (u64)skb_tail_pointer(skb); |
431 | msg->buf_pa = __pa(start_addr); | 427 | msg->buf_pa = xp_pa((void *)start_addr); |
432 | 428 | ||
433 | dev_dbg(xpnet, "sending XPC message to %d:%d\n" | 429 | dev_dbg(xpnet, "sending XPC message to %d:%d\n" |
434 | KERN_DEBUG "msg->buf_pa=0x%lx, msg->size=%u, " | 430 | KERN_DEBUG "msg->buf_pa=0x%lx, msg->size=%u, " |
435 | "msg->leadin_ignore=%u, msg->tailout_ignore=%u\n", | 431 | "msg->leadin_ignore=%u, msg->tailout_ignore=%u\n", |
436 | dest_partid, XPC_NET_CHANNEL, (unsigned long)msg->buf_pa, | 432 | dest_partid, XPC_NET_CHANNEL, msg->buf_pa, msg->size, |
437 | msg->size, msg->leadin_ignore, msg->tailout_ignore); | 433 | msg->leadin_ignore, msg->tailout_ignore); |
438 | 434 | ||
439 | atomic_inc(&queued_msg->use_count); | 435 | atomic_inc(&queued_msg->use_count); |
440 | 436 | ||