aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/sgi-xp/xpc_partition.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/sgi-xp/xpc_partition.c')
-rw-r--r--drivers/misc/sgi-xp/xpc_partition.c37
1 files changed, 17 insertions, 20 deletions
diff --git a/drivers/misc/sgi-xp/xpc_partition.c b/drivers/misc/sgi-xp/xpc_partition.c
index f84d66410205..f150dbfcfcc7 100644
--- a/drivers/misc/sgi-xp/xpc_partition.c
+++ b/drivers/misc/sgi-xp/xpc_partition.c
@@ -60,15 +60,15 @@ xpc_kmalloc_cacheline_aligned(size_t size, gfp_t flags, void **base)
60 * Given a nasid, get the physical address of the partition's reserved page 60 * Given a nasid, get the physical address of the partition's reserved page
61 * for that nasid. This function returns 0 on any error. 61 * for that nasid. This function returns 0 on any error.
62 */ 62 */
63static u64 63static unsigned long
64xpc_get_rsvd_page_pa(int nasid) 64xpc_get_rsvd_page_pa(int nasid)
65{ 65{
66 enum xp_retval ret; 66 enum xp_retval ret;
67 u64 cookie = 0; 67 u64 cookie = 0;
68 u64 rp_pa = nasid; /* seed with nasid */ 68 unsigned long rp_pa = nasid; /* seed with nasid */
69 size_t len = 0; 69 size_t len = 0;
70 u64 buf = buf; 70 size_t buf_len = 0;
71 u64 buf_len = 0; 71 void *buf = buf;
72 void *buf_base = NULL; 72 void *buf_base = NULL;
73 73
74 while (1) { 74 while (1) {
@@ -78,7 +78,7 @@ xpc_get_rsvd_page_pa(int nasid)
78 78
79 dev_dbg(xpc_part, "SAL returned with ret=%d, cookie=0x%016lx, " 79 dev_dbg(xpc_part, "SAL returned with ret=%d, cookie=0x%016lx, "
80 "address=0x%016lx, len=0x%016lx\n", ret, 80 "address=0x%016lx, len=0x%016lx\n", ret,
81 (unsigned long)cookie, (unsigned long)rp_pa, len); 81 (unsigned long)cookie, rp_pa, len);
82 82
83 if (ret != xpNeedMoreInfo) 83 if (ret != xpNeedMoreInfo)
84 break; 84 break;
@@ -87,19 +87,17 @@ xpc_get_rsvd_page_pa(int nasid)
87 if (L1_CACHE_ALIGN(len) > buf_len) { 87 if (L1_CACHE_ALIGN(len) > buf_len) {
88 kfree(buf_base); 88 kfree(buf_base);
89 buf_len = L1_CACHE_ALIGN(len); 89 buf_len = L1_CACHE_ALIGN(len);
90 buf = (u64)xpc_kmalloc_cacheline_aligned(buf_len, 90 buf = xpc_kmalloc_cacheline_aligned(buf_len, GFP_KERNEL,
91 GFP_KERNEL, 91 &buf_base);
92 &buf_base);
93 if (buf_base == NULL) { 92 if (buf_base == NULL) {
94 dev_err(xpc_part, "unable to kmalloc " 93 dev_err(xpc_part, "unable to kmalloc "
95 "len=0x%016lx\n", 94 "len=0x%016lx\n", buf_len);
96 (unsigned long)buf_len);
97 ret = xpNoMemory; 95 ret = xpNoMemory;
98 break; 96 break;
99 } 97 }
100 } 98 }
101 99
102 ret = xp_remote_memcpy((void *)buf, (void *)rp_pa, buf_len); 100 ret = xp_remote_memcpy(xp_pa(buf), rp_pa, buf_len);
103 if (ret != xpSuccess) { 101 if (ret != xpSuccess) {
104 dev_dbg(xpc_part, "xp_remote_memcpy failed %d\n", ret); 102 dev_dbg(xpc_part, "xp_remote_memcpy failed %d\n", ret);
105 break; 103 break;
@@ -111,8 +109,7 @@ xpc_get_rsvd_page_pa(int nasid)
111 if (ret != xpSuccess) 109 if (ret != xpSuccess)
112 rp_pa = 0; 110 rp_pa = 0;
113 111
114 dev_dbg(xpc_part, "reserved page at phys address 0x%016lx\n", 112 dev_dbg(xpc_part, "reserved page at phys address 0x%016lx\n", rp_pa);
115 (unsigned long)rp_pa);
116 return rp_pa; 113 return rp_pa;
117} 114}
118 115
@@ -125,7 +122,7 @@ struct xpc_rsvd_page *
125xpc_setup_rsvd_page(void) 122xpc_setup_rsvd_page(void)
126{ 123{
127 struct xpc_rsvd_page *rp; 124 struct xpc_rsvd_page *rp;
128 u64 rp_pa; 125 unsigned long rp_pa;
129 unsigned long new_ts_jiffies; 126 unsigned long new_ts_jiffies;
130 127
131 /* get the local reserved page's address */ 128 /* get the local reserved page's address */
@@ -193,7 +190,7 @@ xpc_setup_rsvd_page(void)
193 */ 190 */
194enum xp_retval 191enum xp_retval
195xpc_get_remote_rp(int nasid, unsigned long *discovered_nasids, 192xpc_get_remote_rp(int nasid, unsigned long *discovered_nasids,
196 struct xpc_rsvd_page *remote_rp, u64 *remote_rp_pa) 193 struct xpc_rsvd_page *remote_rp, unsigned long *remote_rp_pa)
197{ 194{
198 int l; 195 int l;
199 enum xp_retval ret; 196 enum xp_retval ret;
@@ -205,7 +202,7 @@ xpc_get_remote_rp(int nasid, unsigned long *discovered_nasids,
205 return xpNoRsvdPageAddr; 202 return xpNoRsvdPageAddr;
206 203
207 /* pull over the reserved page header and part_nasids mask */ 204 /* pull over the reserved page header and part_nasids mask */
208 ret = xp_remote_memcpy(remote_rp, (void *)*remote_rp_pa, 205 ret = xp_remote_memcpy(xp_pa(remote_rp), *remote_rp_pa,
209 XPC_RP_HEADER_SIZE + xpc_nasid_mask_nbytes); 206 XPC_RP_HEADER_SIZE + xpc_nasid_mask_nbytes);
210 if (ret != xpSuccess) 207 if (ret != xpSuccess)
211 return ret; 208 return ret;
@@ -389,7 +386,7 @@ xpc_discovery(void)
389{ 386{
390 void *remote_rp_base; 387 void *remote_rp_base;
391 struct xpc_rsvd_page *remote_rp; 388 struct xpc_rsvd_page *remote_rp;
392 u64 remote_rp_pa; 389 unsigned long remote_rp_pa;
393 int region; 390 int region;
394 int region_size; 391 int region_size;
395 int max_regions; 392 int max_regions;
@@ -500,7 +497,7 @@ enum xp_retval
500xpc_initiate_partid_to_nasids(short partid, void *nasid_mask) 497xpc_initiate_partid_to_nasids(short partid, void *nasid_mask)
501{ 498{
502 struct xpc_partition *part; 499 struct xpc_partition *part;
503 u64 part_nasid_pa; 500 unsigned long part_nasid_pa;
504 501
505 part = &xpc_partitions[partid]; 502 part = &xpc_partitions[partid];
506 if (part->remote_rp_pa == 0) 503 if (part->remote_rp_pa == 0)
@@ -508,8 +505,8 @@ xpc_initiate_partid_to_nasids(short partid, void *nasid_mask)
508 505
509 memset(nasid_mask, 0, xpc_nasid_mask_nbytes); 506 memset(nasid_mask, 0, xpc_nasid_mask_nbytes);
510 507
511 part_nasid_pa = (u64)XPC_RP_PART_NASIDS(part->remote_rp_pa); 508 part_nasid_pa = (unsigned long)XPC_RP_PART_NASIDS(part->remote_rp_pa);
512 509
513 return xp_remote_memcpy(nasid_mask, (void *)part_nasid_pa, 510 return xp_remote_memcpy(xp_pa(nasid_mask), part_nasid_pa,
514 xpc_nasid_mask_nbytes); 511 xpc_nasid_mask_nbytes);
515} 512}