diff options
author | Dean Nelson <dcn@sgi.com> | 2008-07-30 01:34:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-30 12:41:49 -0400 |
commit | 908787db9b95f548270af18d83d62b9d2020ca10 (patch) | |
tree | 7fd4837accae2af478af95618357f106d04c265e /drivers | |
parent | bc63d387e4f5dbbe4ea0c5ade862c38073fd7fa3 (diff) |
sgi-xp: create a common xp_remote_memcpy() function
Create a common remote memcpy function that maps to what the hardware
booted supports.
Signed-off-by: Dean Nelson <dcn@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/misc/sgi-xp/xp.h | 43 | ||||
-rw-r--r-- | drivers/misc/sgi-xp/xp_main.c | 3 | ||||
-rw-r--r-- | drivers/misc/sgi-xp/xp_sn2.c | 46 | ||||
-rw-r--r-- | drivers/misc/sgi-xp/xp_uv.c | 11 | ||||
-rw-r--r-- | drivers/misc/sgi-xp/xpc.h | 7 | ||||
-rw-r--r-- | drivers/misc/sgi-xp/xpc_channel.c | 20 | ||||
-rw-r--r-- | drivers/misc/sgi-xp/xpc_partition.c | 55 | ||||
-rw-r--r-- | drivers/misc/sgi-xp/xpnet.c | 28 |
8 files changed, 107 insertions, 106 deletions
diff --git a/drivers/misc/sgi-xp/xp.h b/drivers/misc/sgi-xp/xp.h index 51087e111887..c42196a1a6b7 100644 --- a/drivers/misc/sgi-xp/xp.h +++ b/drivers/misc/sgi-xp/xp.h | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/hardirq.h> | 17 | #include <linux/hardirq.h> |
18 | #include <linux/mutex.h> | 18 | #include <linux/mutex.h> |
19 | #include <asm/sn/types.h> | 19 | #include <asm/sn/types.h> |
20 | #include <asm/sn/bte.h> | ||
21 | #ifdef CONFIG_IA64 | 20 | #ifdef CONFIG_IA64 |
22 | #include <asm/sn/arch.h> | 21 | #include <asm/sn/arch.h> |
23 | #endif | 22 | #endif |
@@ -72,46 +71,6 @@ | |||
72 | #define XP_NASID_MASK_WORDS ((XP_MAX_PHYSNODE_ID + 63) / 64) | 71 | #define XP_NASID_MASK_WORDS ((XP_MAX_PHYSNODE_ID + 63) / 64) |
73 | 72 | ||
74 | /* | 73 | /* |
75 | * Wrapper for bte_copy() that should it return a failure status will retry | ||
76 | * the bte_copy() once in the hope that the failure was due to a temporary | ||
77 | * aberration (i.e., the link going down temporarily). | ||
78 | * | ||
79 | * src - physical address of the source of the transfer. | ||
80 | * vdst - virtual address of the destination of the transfer. | ||
81 | * len - number of bytes to transfer from source to destination. | ||
82 | * mode - see bte_copy() for definition. | ||
83 | * notification - see bte_copy() for definition. | ||
84 | * | ||
85 | * Note: xp_bte_copy() should never be called while holding a spinlock. | ||
86 | */ | ||
87 | static inline bte_result_t | ||
88 | xp_bte_copy(u64 src, u64 vdst, u64 len, u64 mode, void *notification) | ||
89 | { | ||
90 | bte_result_t ret; | ||
91 | u64 pdst = ia64_tpa(vdst); | ||
92 | |||
93 | /* | ||
94 | * Ensure that the physically mapped memory is contiguous. | ||
95 | * | ||
96 | * We do this by ensuring that the memory is from region 7 only. | ||
97 | * If the need should arise to use memory from one of the other | ||
98 | * regions, then modify the BUG_ON() statement to ensure that the | ||
99 | * memory from that region is always physically contiguous. | ||
100 | */ | ||
101 | BUG_ON(REGION_NUMBER(vdst) != RGN_KERNEL); | ||
102 | |||
103 | ret = bte_copy(src, pdst, len, mode, notification); | ||
104 | if ((ret != BTE_SUCCESS) && BTE_ERROR_RETRY(ret)) { | ||
105 | if (!in_interrupt()) | ||
106 | cond_resched(); | ||
107 | |||
108 | ret = bte_copy(src, pdst, len, mode, notification); | ||
109 | } | ||
110 | |||
111 | return ret; | ||
112 | } | ||
113 | |||
114 | /* | ||
115 | * XPC establishes channel connections between the local partition and any | 74 | * XPC establishes channel connections between the local partition and any |
116 | * other partition that is currently up. Over these channels, kernel-level | 75 | * other partition that is currently up. Over these channels, kernel-level |
117 | * `users' can communicate with their counterparts on the other partitions. | 76 | * `users' can communicate with their counterparts on the other partitions. |
@@ -408,6 +367,8 @@ xpc_partid_to_nasids(short partid, void *nasids) | |||
408 | 367 | ||
409 | extern short xp_max_npartitions; | 368 | extern short xp_max_npartitions; |
410 | 369 | ||
370 | extern enum xp_retval (*xp_remote_memcpy) (void *, const void *, size_t); | ||
371 | |||
411 | extern u64 xp_nofault_PIOR_target; | 372 | extern u64 xp_nofault_PIOR_target; |
412 | extern int xp_nofault_PIOR(void *); | 373 | extern int xp_nofault_PIOR(void *); |
413 | extern int xp_error_PIOR(void); | 374 | extern int xp_error_PIOR(void); |
diff --git a/drivers/misc/sgi-xp/xp_main.c b/drivers/misc/sgi-xp/xp_main.c index c5cec606377d..6f25613b27e3 100644 --- a/drivers/misc/sgi-xp/xp_main.c +++ b/drivers/misc/sgi-xp/xp_main.c | |||
@@ -36,6 +36,9 @@ struct device *xp = &xp_dbg_subname; | |||
36 | short xp_max_npartitions; | 36 | short xp_max_npartitions; |
37 | EXPORT_SYMBOL_GPL(xp_max_npartitions); | 37 | EXPORT_SYMBOL_GPL(xp_max_npartitions); |
38 | 38 | ||
39 | enum xp_retval (*xp_remote_memcpy) (void *dst, const void *src, size_t len); | ||
40 | EXPORT_SYMBOL_GPL(xp_remote_memcpy); | ||
41 | |||
39 | /* | 42 | /* |
40 | * xpc_registrations[] keeps track of xpc_connect()'s done by the kernel-level | 43 | * xpc_registrations[] keeps track of xpc_connect()'s done by the kernel-level |
41 | * users of XPC. | 44 | * users of XPC. |
diff --git a/drivers/misc/sgi-xp/xp_sn2.c b/drivers/misc/sgi-xp/xp_sn2.c index b92579356a64..3d553fa73f4d 100644 --- a/drivers/misc/sgi-xp/xp_sn2.c +++ b/drivers/misc/sgi-xp/xp_sn2.c | |||
@@ -13,6 +13,7 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/device.h> | 15 | #include <linux/device.h> |
16 | #include <asm/sn/bte.h> | ||
16 | #include <asm/sn/sn_sal.h> | 17 | #include <asm/sn/sn_sal.h> |
17 | #include "xp.h" | 18 | #include "xp.h" |
18 | 19 | ||
@@ -72,6 +73,49 @@ xp_unregister_nofault_code_sn2(void) | |||
72 | err_func_addr, 1, 0); | 73 | err_func_addr, 1, 0); |
73 | } | 74 | } |
74 | 75 | ||
76 | /* | ||
77 | * Wrapper for bte_copy(). | ||
78 | * | ||
79 | * vdst - virtual address of the destination of the transfer. | ||
80 | * psrc - physical address of the source of the transfer. | ||
81 | * len - number of bytes to transfer from source to destination. | ||
82 | * | ||
83 | * Note: xp_remote_memcpy_sn2() should never be called while holding a spinlock. | ||
84 | */ | ||
85 | static enum xp_retval | ||
86 | xp_remote_memcpy_sn2(void *vdst, const void *psrc, size_t len) | ||
87 | { | ||
88 | bte_result_t ret; | ||
89 | u64 pdst = ia64_tpa(vdst); | ||
90 | /* >>> What are the rules governing the src and dst addresses passed in? | ||
91 | * >>> Currently we're assuming that dst is a virtual address and src | ||
92 | * >>> is a physical address, is this appropriate? Can we allow them to | ||
93 | * >>> be whatever and we make the change here without damaging the | ||
94 | * >>> addresses? | ||
95 | */ | ||
96 | |||
97 | /* | ||
98 | * Ensure that the physically mapped memory is contiguous. | ||
99 | * | ||
100 | * We do this by ensuring that the memory is from region 7 only. | ||
101 | * If the need should arise to use memory from one of the other | ||
102 | * regions, then modify the BUG_ON() statement to ensure that the | ||
103 | * memory from that region is always physically contiguous. | ||
104 | */ | ||
105 | BUG_ON(REGION_NUMBER(vdst) != RGN_KERNEL); | ||
106 | |||
107 | ret = bte_copy((u64)psrc, pdst, len, (BTE_NOTIFY | BTE_WACQUIRE), NULL); | ||
108 | if (ret == BTE_SUCCESS) | ||
109 | return xpSuccess; | ||
110 | |||
111 | if (is_shub2()) | ||
112 | dev_err(xp, "bte_copy() on shub2 failed, error=0x%x\n", ret); | ||
113 | else | ||
114 | dev_err(xp, "bte_copy() failed, error=%d\n", ret); | ||
115 | |||
116 | return xpBteCopyError; | ||
117 | } | ||
118 | |||
75 | enum xp_retval | 119 | enum xp_retval |
76 | xp_init_sn2(void) | 120 | xp_init_sn2(void) |
77 | { | 121 | { |
@@ -79,6 +123,8 @@ xp_init_sn2(void) | |||
79 | 123 | ||
80 | xp_max_npartitions = XP_MAX_NPARTITIONS_SN2; | 124 | xp_max_npartitions = XP_MAX_NPARTITIONS_SN2; |
81 | 125 | ||
126 | xp_remote_memcpy = xp_remote_memcpy_sn2; | ||
127 | |||
82 | return xp_register_nofault_code_sn2(); | 128 | return xp_register_nofault_code_sn2(); |
83 | } | 129 | } |
84 | 130 | ||
diff --git a/drivers/misc/sgi-xp/xp_uv.c b/drivers/misc/sgi-xp/xp_uv.c index 30888be2cdb0..dca519fdef98 100644 --- a/drivers/misc/sgi-xp/xp_uv.c +++ b/drivers/misc/sgi-xp/xp_uv.c | |||
@@ -15,12 +15,23 @@ | |||
15 | 15 | ||
16 | #include "xp.h" | 16 | #include "xp.h" |
17 | 17 | ||
18 | static enum xp_retval | ||
19 | xp_remote_memcpy_uv(void *vdst, const void *psrc, size_t len) | ||
20 | { | ||
21 | /* >>> this function needs fleshing out */ | ||
22 | return xpUnsupported; | ||
23 | } | ||
24 | |||
18 | enum xp_retval | 25 | enum xp_retval |
19 | xp_init_uv(void) | 26 | xp_init_uv(void) |
20 | { | 27 | { |
21 | BUG_ON(!is_uv()); | 28 | BUG_ON(!is_uv()); |
22 | 29 | ||
23 | xp_max_npartitions = XP_MAX_NPARTITIONS_UV; | 30 | xp_max_npartitions = XP_MAX_NPARTITIONS_UV; |
31 | |||
32 | xp_remote_memcpy = xp_remote_memcpy_uv; | ||
33 | |||
34 | return xpSuccess; | ||
24 | } | 35 | } |
25 | 36 | ||
26 | void | 37 | void |
diff --git a/drivers/misc/sgi-xp/xpc.h b/drivers/misc/sgi-xp/xpc.h index 0f2affd01df1..60388bed7701 100644 --- a/drivers/misc/sgi-xp/xpc.h +++ b/drivers/misc/sgi-xp/xpc.h | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/completion.h> | 20 | #include <linux/completion.h> |
21 | #include <asm/pgtable.h> | 21 | #include <asm/pgtable.h> |
22 | #include <asm/processor.h> | 22 | #include <asm/processor.h> |
23 | #include <asm/sn/bte.h> | ||
24 | #include <asm/sn/clksupport.h> | 23 | #include <asm/sn/clksupport.h> |
25 | #include <asm/sn/addrs.h> | 24 | #include <asm/sn/addrs.h> |
26 | #include <asm/sn/mspec.h> | 25 | #include <asm/sn/mspec.h> |
@@ -1125,12 +1124,6 @@ xpc_IPI_init(int index) | |||
1125 | return amo; | 1124 | return amo; |
1126 | } | 1125 | } |
1127 | 1126 | ||
1128 | static inline enum xp_retval | ||
1129 | xpc_map_bte_errors(bte_result_t error) | ||
1130 | { | ||
1131 | return ((error == BTE_SUCCESS) ? xpSuccess : xpBteCopyError); | ||
1132 | } | ||
1133 | |||
1134 | /* | 1127 | /* |
1135 | * Check to see if there is any channel activity to/from the specified | 1128 | * Check to see if there is any channel activity to/from the specified |
1136 | * partition. | 1129 | * partition. |
diff --git a/drivers/misc/sgi-xp/xpc_channel.c b/drivers/misc/sgi-xp/xpc_channel.c index 12d8eb6957a7..9e79ad7eafe5 100644 --- a/drivers/misc/sgi-xp/xpc_channel.c +++ b/drivers/misc/sgi-xp/xpc_channel.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/interrupt.h> | 21 | #include <linux/interrupt.h> |
22 | #include <linux/mutex.h> | 22 | #include <linux/mutex.h> |
23 | #include <linux/completion.h> | 23 | #include <linux/completion.h> |
24 | #include <asm/sn/bte.h> | ||
25 | #include <asm/sn/sn_sal.h> | 24 | #include <asm/sn/sn_sal.h> |
26 | #include "xpc.h" | 25 | #include "xpc.h" |
27 | 26 | ||
@@ -252,13 +251,13 @@ xpc_setup_infrastructure(struct xpc_partition *part) | |||
252 | * | 251 | * |
253 | * src must be a cacheline aligned physical address on the remote partition. | 252 | * src must be a cacheline aligned physical address on the remote partition. |
254 | * dst must be a cacheline aligned virtual address on this partition. | 253 | * dst must be a cacheline aligned virtual address on this partition. |
255 | * cnt must be an cacheline sized | 254 | * cnt must be cacheline sized |
256 | */ | 255 | */ |
257 | static enum xp_retval | 256 | static enum xp_retval |
258 | xpc_pull_remote_cachelines(struct xpc_partition *part, void *dst, | 257 | xpc_pull_remote_cachelines(struct xpc_partition *part, void *dst, |
259 | const void *src, size_t cnt) | 258 | const void *src, size_t cnt) |
260 | { | 259 | { |
261 | bte_result_t bte_ret; | 260 | enum xp_retval ret; |
262 | 261 | ||
263 | DBUG_ON((u64)src != L1_CACHE_ALIGN((u64)src)); | 262 | DBUG_ON((u64)src != L1_CACHE_ALIGN((u64)src)); |
264 | DBUG_ON((u64)dst != L1_CACHE_ALIGN((u64)dst)); | 263 | DBUG_ON((u64)dst != L1_CACHE_ALIGN((u64)dst)); |
@@ -267,15 +266,12 @@ xpc_pull_remote_cachelines(struct xpc_partition *part, void *dst, | |||
267 | if (part->act_state == XPC_P_DEACTIVATING) | 266 | if (part->act_state == XPC_P_DEACTIVATING) |
268 | return part->reason; | 267 | return part->reason; |
269 | 268 | ||
270 | bte_ret = xp_bte_copy((u64)src, (u64)dst, (u64)cnt, | 269 | ret = xp_remote_memcpy(dst, src, cnt); |
271 | (BTE_NORMAL | BTE_WACQUIRE), NULL); | 270 | if (ret != xpSuccess) { |
272 | if (bte_ret == BTE_SUCCESS) | 271 | dev_dbg(xpc_chan, "xp_remote_memcpy() from partition %d failed," |
273 | return xpSuccess; | 272 | " ret=%d\n", XPC_PARTID(part), ret); |
274 | 273 | } | |
275 | dev_dbg(xpc_chan, "xp_bte_copy() from partition %d failed, ret=%d\n", | 274 | return ret; |
276 | XPC_PARTID(part), bte_ret); | ||
277 | |||
278 | return xpc_map_bte_errors(bte_ret); | ||
279 | } | 275 | } |
280 | 276 | ||
281 | /* | 277 | /* |
diff --git a/drivers/misc/sgi-xp/xpc_partition.c b/drivers/misc/sgi-xp/xpc_partition.c index 02a858eddd8d..6c82f2050974 100644 --- a/drivers/misc/sgi-xp/xpc_partition.c +++ b/drivers/misc/sgi-xp/xpc_partition.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/mmzone.h> | 21 | #include <linux/mmzone.h> |
22 | #include <linux/nodemask.h> | 22 | #include <linux/nodemask.h> |
23 | #include <asm/uncached.h> | 23 | #include <asm/uncached.h> |
24 | #include <asm/sn/bte.h> | ||
25 | #include <asm/sn/intr.h> | 24 | #include <asm/sn/intr.h> |
26 | #include <asm/sn/sn_sal.h> | 25 | #include <asm/sn/sn_sal.h> |
27 | #include <asm/sn/nodepda.h> | 26 | #include <asm/sn/nodepda.h> |
@@ -92,7 +91,7 @@ xpc_kmalloc_cacheline_aligned(size_t size, gfp_t flags, void **base) | |||
92 | static u64 | 91 | static u64 |
93 | xpc_get_rsvd_page_pa(int nasid) | 92 | xpc_get_rsvd_page_pa(int nasid) |
94 | { | 93 | { |
95 | bte_result_t bte_res; | 94 | enum xp_retval ret; |
96 | s64 status; | 95 | s64 status; |
97 | u64 cookie = 0; | 96 | u64 cookie = 0; |
98 | u64 rp_pa = nasid; /* seed with nasid */ | 97 | u64 rp_pa = nasid; /* seed with nasid */ |
@@ -113,6 +112,7 @@ xpc_get_rsvd_page_pa(int nasid) | |||
113 | if (status != SALRET_MORE_PASSES) | 112 | if (status != SALRET_MORE_PASSES) |
114 | break; | 113 | break; |
115 | 114 | ||
115 | /* >>> L1_CACHE_ALIGN() is only a sn2-bte_copy requirement */ | ||
116 | if (L1_CACHE_ALIGN(len) > buf_len) { | 116 | if (L1_CACHE_ALIGN(len) > buf_len) { |
117 | kfree(buf_base); | 117 | kfree(buf_base); |
118 | buf_len = L1_CACHE_ALIGN(len); | 118 | buf_len = L1_CACHE_ALIGN(len); |
@@ -127,10 +127,9 @@ xpc_get_rsvd_page_pa(int nasid) | |||
127 | } | 127 | } |
128 | } | 128 | } |
129 | 129 | ||
130 | bte_res = xp_bte_copy(rp_pa, buf, buf_len, | 130 | ret = xp_remote_memcpy((void *)buf, (void *)rp_pa, buf_len); |
131 | (BTE_NOTIFY | BTE_WACQUIRE), NULL); | 131 | if (ret != xpSuccess) { |
132 | if (bte_res != BTE_SUCCESS) { | 132 | dev_dbg(xpc_part, "xp_remote_memcpy failed %d\n", ret); |
133 | dev_dbg(xpc_part, "xp_bte_copy failed %i\n", bte_res); | ||
134 | status = SALRET_ERROR; | 133 | status = SALRET_ERROR; |
135 | break; | 134 | break; |
136 | } | 135 | } |
@@ -398,7 +397,7 @@ xpc_check_remote_hb(void) | |||
398 | struct xpc_vars *remote_vars; | 397 | struct xpc_vars *remote_vars; |
399 | struct xpc_partition *part; | 398 | struct xpc_partition *part; |
400 | short partid; | 399 | short partid; |
401 | bte_result_t bres; | 400 | enum xp_retval ret; |
402 | 401 | ||
403 | remote_vars = (struct xpc_vars *)xpc_remote_copy_buffer; | 402 | remote_vars = (struct xpc_vars *)xpc_remote_copy_buffer; |
404 | 403 | ||
@@ -418,13 +417,11 @@ xpc_check_remote_hb(void) | |||
418 | } | 417 | } |
419 | 418 | ||
420 | /* pull the remote_hb cache line */ | 419 | /* pull the remote_hb cache line */ |
421 | bres = xp_bte_copy(part->remote_vars_pa, | 420 | ret = xp_remote_memcpy(remote_vars, |
422 | (u64)remote_vars, | 421 | (void *)part->remote_vars_pa, |
423 | XPC_RP_VARS_SIZE, | 422 | XPC_RP_VARS_SIZE); |
424 | (BTE_NOTIFY | BTE_WACQUIRE), NULL); | 423 | if (ret != xpSuccess) { |
425 | if (bres != BTE_SUCCESS) { | 424 | XPC_DEACTIVATE_PARTITION(part, ret); |
426 | XPC_DEACTIVATE_PARTITION(part, | ||
427 | xpc_map_bte_errors(bres)); | ||
428 | continue; | 425 | continue; |
429 | } | 426 | } |
430 | 427 | ||
@@ -457,7 +454,8 @@ static enum xp_retval | |||
457 | xpc_get_remote_rp(int nasid, u64 *discovered_nasids, | 454 | xpc_get_remote_rp(int nasid, u64 *discovered_nasids, |
458 | struct xpc_rsvd_page *remote_rp, u64 *remote_rp_pa) | 455 | struct xpc_rsvd_page *remote_rp, u64 *remote_rp_pa) |
459 | { | 456 | { |
460 | int bres, i; | 457 | int i; |
458 | enum xp_retval ret; | ||
461 | 459 | ||
462 | /* get the reserved page's physical address */ | 460 | /* get the reserved page's physical address */ |
463 | 461 | ||
@@ -466,11 +464,10 @@ xpc_get_remote_rp(int nasid, u64 *discovered_nasids, | |||
466 | return xpNoRsvdPageAddr; | 464 | return xpNoRsvdPageAddr; |
467 | 465 | ||
468 | /* pull over the reserved page header and part_nasids mask */ | 466 | /* pull over the reserved page header and part_nasids mask */ |
469 | bres = xp_bte_copy(*remote_rp_pa, (u64)remote_rp, | 467 | ret = xp_remote_memcpy(remote_rp, (void *)*remote_rp_pa, |
470 | XPC_RP_HEADER_SIZE + xp_nasid_mask_bytes, | 468 | XPC_RP_HEADER_SIZE + xp_nasid_mask_bytes); |
471 | (BTE_NOTIFY | BTE_WACQUIRE), NULL); | 469 | if (ret != xpSuccess) |
472 | if (bres != BTE_SUCCESS) | 470 | return ret; |
473 | return xpc_map_bte_errors(bres); | ||
474 | 471 | ||
475 | if (discovered_nasids != NULL) { | 472 | if (discovered_nasids != NULL) { |
476 | u64 *remote_part_nasids = XPC_RP_PART_NASIDS(remote_rp); | 473 | u64 *remote_part_nasids = XPC_RP_PART_NASIDS(remote_rp); |
@@ -504,16 +501,16 @@ xpc_get_remote_rp(int nasid, u64 *discovered_nasids, | |||
504 | static enum xp_retval | 501 | static enum xp_retval |
505 | xpc_get_remote_vars(u64 remote_vars_pa, struct xpc_vars *remote_vars) | 502 | xpc_get_remote_vars(u64 remote_vars_pa, struct xpc_vars *remote_vars) |
506 | { | 503 | { |
507 | int bres; | 504 | enum xp_retval ret; |
508 | 505 | ||
509 | if (remote_vars_pa == 0) | 506 | if (remote_vars_pa == 0) |
510 | return xpVarsNotSet; | 507 | return xpVarsNotSet; |
511 | 508 | ||
512 | /* pull over the cross partition variables */ | 509 | /* pull over the cross partition variables */ |
513 | bres = xp_bte_copy(remote_vars_pa, (u64)remote_vars, XPC_RP_VARS_SIZE, | 510 | ret = xp_remote_memcpy(remote_vars, (void *)remote_vars_pa, |
514 | (BTE_NOTIFY | BTE_WACQUIRE), NULL); | 511 | XPC_RP_VARS_SIZE); |
515 | if (bres != BTE_SUCCESS) | 512 | if (ret != xpSuccess) |
516 | return xpc_map_bte_errors(bres); | 513 | return ret; |
517 | 514 | ||
518 | if (XPC_VERSION_MAJOR(remote_vars->version) != | 515 | if (XPC_VERSION_MAJOR(remote_vars->version) != |
519 | XPC_VERSION_MAJOR(XPC_V_VERSION)) { | 516 | XPC_VERSION_MAJOR(XPC_V_VERSION)) { |
@@ -1148,7 +1145,6 @@ xpc_initiate_partid_to_nasids(short partid, void *nasid_mask) | |||
1148 | { | 1145 | { |
1149 | struct xpc_partition *part; | 1146 | struct xpc_partition *part; |
1150 | u64 part_nasid_pa; | 1147 | u64 part_nasid_pa; |
1151 | int bte_res; | ||
1152 | 1148 | ||
1153 | part = &xpc_partitions[partid]; | 1149 | part = &xpc_partitions[partid]; |
1154 | if (part->remote_rp_pa == 0) | 1150 | if (part->remote_rp_pa == 0) |
@@ -1158,9 +1154,6 @@ xpc_initiate_partid_to_nasids(short partid, void *nasid_mask) | |||
1158 | 1154 | ||
1159 | part_nasid_pa = (u64)XPC_RP_PART_NASIDS(part->remote_rp_pa); | 1155 | part_nasid_pa = (u64)XPC_RP_PART_NASIDS(part->remote_rp_pa); |
1160 | 1156 | ||
1161 | bte_res = xp_bte_copy(part_nasid_pa, (u64)nasid_mask, | 1157 | return xp_remote_memcpy(nasid_mask, (void *)part_nasid_pa, |
1162 | xp_nasid_mask_bytes, (BTE_NOTIFY | BTE_WACQUIRE), | 1158 | xp_nasid_mask_bytes); |
1163 | NULL); | ||
1164 | |||
1165 | return xpc_map_bte_errors(bte_res); | ||
1166 | } | 1159 | } |
diff --git a/drivers/misc/sgi-xp/xpnet.c b/drivers/misc/sgi-xp/xpnet.c index cc252f201b25..9c540eb1847d 100644 --- a/drivers/misc/sgi-xp/xpnet.c +++ b/drivers/misc/sgi-xp/xpnet.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <linux/mii.h> | 32 | #include <linux/mii.h> |
33 | #include <linux/smp.h> | 33 | #include <linux/smp.h> |
34 | #include <linux/string.h> | 34 | #include <linux/string.h> |
35 | #include <asm/sn/bte.h> | ||
36 | #include <asm/sn/io.h> | 35 | #include <asm/sn/io.h> |
37 | #include <asm/sn/sn_sal.h> | 36 | #include <asm/sn/sn_sal.h> |
38 | #include <asm/atomic.h> | 37 | #include <asm/atomic.h> |
@@ -169,7 +168,7 @@ static void | |||
169 | xpnet_receive(short partid, int channel, struct xpnet_message *msg) | 168 | xpnet_receive(short partid, int channel, struct xpnet_message *msg) |
170 | { | 169 | { |
171 | struct sk_buff *skb; | 170 | struct sk_buff *skb; |
172 | bte_result_t bret; | 171 | enum xp_retval ret; |
173 | struct xpnet_dev_private *priv = | 172 | struct xpnet_dev_private *priv = |
174 | (struct xpnet_dev_private *)xpnet_device->priv; | 173 | (struct xpnet_dev_private *)xpnet_device->priv; |
175 | 174 | ||
@@ -201,7 +200,7 @@ xpnet_receive(short partid, int channel, struct xpnet_message *msg) | |||
201 | 200 | ||
202 | /* | 201 | /* |
203 | * The allocated skb has some reserved space. | 202 | * The allocated skb has some reserved space. |
204 | * In order to use bte_copy, we need to get the | 203 | * In order to use xp_remote_memcpy(), we need to get the |
205 | * skb->data pointer moved forward. | 204 | * skb->data pointer moved forward. |
206 | */ | 205 | */ |
207 | skb_reserve(skb, (L1_CACHE_BYTES - ((u64)skb->data & | 206 | skb_reserve(skb, (L1_CACHE_BYTES - ((u64)skb->data & |
@@ -227,25 +226,24 @@ xpnet_receive(short partid, int channel, struct xpnet_message *msg) | |||
227 | (size_t)msg->embedded_bytes); | 226 | (size_t)msg->embedded_bytes); |
228 | } else { | 227 | } else { |
229 | dev_dbg(xpnet, "transferring buffer to the skb->data area;\n\t" | 228 | dev_dbg(xpnet, "transferring buffer to the skb->data area;\n\t" |
230 | "bte_copy(0x%p, 0x%p, %hu)\n", (void *)msg->buf_pa, | 229 | "xp_remote_memcpy(0x%p, 0x%p, %hu)\n", (void *) |
231 | (void *)__pa((u64)skb->data & ~(L1_CACHE_BYTES - 1)), | 230 | ((u64)skb->data & ~(L1_CACHE_BYTES - 1)), |
232 | msg->size); | 231 | (void *)msg->buf_pa, msg->size); |
233 | 232 | ||
234 | bret = bte_copy(msg->buf_pa, | 233 | ret = xp_remote_memcpy((void *)((u64)skb->data & |
235 | __pa((u64)skb->data & ~(L1_CACHE_BYTES - 1)), | 234 | ~(L1_CACHE_BYTES - 1)), |
236 | msg->size, (BTE_NOTIFY | BTE_WACQUIRE), NULL); | 235 | (void *)msg->buf_pa, msg->size); |
237 | 236 | ||
238 | if (bret != BTE_SUCCESS) { | 237 | if (ret != xpSuccess) { |
239 | /* | 238 | /* |
240 | * >>> Need better way of cleaning skb. Currently skb | 239 | * >>> Need better way of cleaning skb. Currently skb |
241 | * >>> appears in_use and we can't just call | 240 | * >>> appears in_use and we can't just call |
242 | * >>> dev_kfree_skb. | 241 | * >>> dev_kfree_skb. |
243 | */ | 242 | */ |
244 | dev_err(xpnet, "bte_copy(0x%p, 0x%p, 0x%hx) returned " | 243 | dev_err(xpnet, "xp_remote_memcpy(0x%p, 0x%p, 0x%hx) " |
245 | "error=0x%x\n", (void *)msg->buf_pa, | 244 | "returned error=0x%x\n", (void *) |
246 | (void *)__pa((u64)skb->data & | 245 | ((u64)skb->data & ~(L1_CACHE_BYTES - 1)), |
247 | ~(L1_CACHE_BYTES - 1)), | 246 | (void *)msg->buf_pa, msg->size, ret); |
248 | msg->size, bret); | ||
249 | 247 | ||
250 | xpc_received(partid, channel, (void *)msg); | 248 | xpc_received(partid, channel, (void *)msg); |
251 | 249 | ||