aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/sgi-xp/xp_sn2.c
diff options
context:
space:
mode:
authorDean Nelson <dcn@sgi.com>2008-07-30 01:34:16 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-30 12:41:50 -0400
commita812dcc3a298eef650c381e094e2cf41a4ecc9ad (patch)
treecb6a24a623891054789f5340742c3c8ff1fb8cde /drivers/misc/sgi-xp/xp_sn2.c
parent261f3b4979db88d29fc86aad9f76fbc0c2c6d21a (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/xp_sn2.c')
-rw-r--r--drivers/misc/sgi-xp/xp_sn2.c50
1 files changed, 24 insertions, 26 deletions
diff --git a/drivers/misc/sgi-xp/xp_sn2.c b/drivers/misc/sgi-xp/xp_sn2.c
index c6a1ede7d6e6..1440134caf31 100644
--- a/drivers/misc/sgi-xp/xp_sn2.c
+++ b/drivers/misc/sgi-xp/xp_sn2.c
@@ -63,7 +63,7 @@ xp_register_nofault_code_sn2(void)
63 return xpSuccess; 63 return xpSuccess;
64} 64}
65 65
66void 66static void
67xp_unregister_nofault_code_sn2(void) 67xp_unregister_nofault_code_sn2(void)
68{ 68{
69 u64 func_addr = *(u64 *)xp_nofault_PIOR; 69 u64 func_addr = *(u64 *)xp_nofault_PIOR;
@@ -75,44 +75,41 @@ xp_unregister_nofault_code_sn2(void)
75} 75}
76 76
77/* 77/*
78 * Convert a virtual memory address to a physical memory address.
79 */
80static unsigned long
81xp_pa_sn2(void *addr)
82{
83 return __pa(addr);
84}
85
86/*
78 * Wrapper for bte_copy(). 87 * Wrapper for bte_copy().
79 * 88 *
80 * vdst - virtual address of the destination of the transfer. 89 * dst_pa - physical address of the destination of the transfer.
81 * psrc - physical address of the source of the transfer. 90 * src_pa - physical address of the source of the transfer.
82 * len - number of bytes to transfer from source to destination. 91 * len - number of bytes to transfer from source to destination.
83 * 92 *
84 * Note: xp_remote_memcpy_sn2() should never be called while holding a spinlock. 93 * Note: xp_remote_memcpy_sn2() should never be called while holding a spinlock.
85 */ 94 */
86static enum xp_retval 95static enum xp_retval
87xp_remote_memcpy_sn2(void *vdst, const void *psrc, size_t len) 96xp_remote_memcpy_sn2(unsigned long dst_pa, const unsigned long src_pa,
97 size_t len)
88{ 98{
89 bte_result_t ret; 99 bte_result_t ret;
90 u64 pdst = ia64_tpa(vdst);
91 /* ??? What are the rules governing the src and dst addresses passed in?
92 * ??? Currently we're assuming that dst is a virtual address and src
93 * ??? is a physical address, is this appropriate? Can we allow them to
94 * ??? be whatever and we make the change here without damaging the
95 * ??? addresses?
96 */
97 100
98 /* 101 ret = bte_copy(src_pa, dst_pa, len, (BTE_NOTIFY | BTE_WACQUIRE), NULL);
99 * Ensure that the physically mapped memory is contiguous.
100 *
101 * We do this by ensuring that the memory is from region 7 only.
102 * If the need should arise to use memory from one of the other
103 * regions, then modify the BUG_ON() statement to ensure that the
104 * memory from that region is always physically contiguous.
105 */
106 BUG_ON(REGION_NUMBER(vdst) != RGN_KERNEL);
107
108 ret = bte_copy((u64)psrc, pdst, len, (BTE_NOTIFY | BTE_WACQUIRE), NULL);
109 if (ret == BTE_SUCCESS) 102 if (ret == BTE_SUCCESS)
110 return xpSuccess; 103 return xpSuccess;
111 104
112 if (is_shub2()) 105 if (is_shub2()) {
113 dev_err(xp, "bte_copy() on shub2 failed, error=0x%x\n", ret); 106 dev_err(xp, "bte_copy() on shub2 failed, error=0x%x dst_pa="
114 else 107 "0x%016lx src_pa=0x%016lx len=%ld\\n", ret, dst_pa,
115 dev_err(xp, "bte_copy() failed, error=%d\n", ret); 108 src_pa, len);
109 } else {
110 dev_err(xp, "bte_copy() failed, error=%d dst_pa=0x%016lx "
111 "src_pa=0x%016lx len=%ld\\n", ret, dst_pa, src_pa, len);
112 }
116 113
117 return xpBteCopyError; 114 return xpBteCopyError;
118} 115}
@@ -132,6 +129,7 @@ xp_init_sn2(void)
132 xp_partition_id = sn_partition_id; 129 xp_partition_id = sn_partition_id;
133 xp_region_size = sn_region_size; 130 xp_region_size = sn_region_size;
134 131
132 xp_pa = xp_pa_sn2;
135 xp_remote_memcpy = xp_remote_memcpy_sn2; 133 xp_remote_memcpy = xp_remote_memcpy_sn2;
136 xp_cpu_to_nasid = xp_cpu_to_nasid_sn2; 134 xp_cpu_to_nasid = xp_cpu_to_nasid_sn2;
137 135