Commit 27929029 authored by Dean Nelson's avatar Dean Nelson Committed by Tony Luck

[IA64-SGI] cleanup the way XPC locates the reserved page

Eliminate the passing in of a scratch buffer used for locating the
reserved page setup for XPC.
Signed-off-by: default avatarDean Nelson <dcn@sgi.com>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
parent 4b38fcd4
...@@ -85,13 +85,16 @@ char ____cacheline_aligned xpc_remote_copy_buffer[XPC_RP_HEADER_SIZE + ...@@ -85,13 +85,16 @@ char ____cacheline_aligned xpc_remote_copy_buffer[XPC_RP_HEADER_SIZE +
* for that nasid. This function returns 0 on any error. * for that nasid. This function returns 0 on any error.
*/ */
static u64 static u64
xpc_get_rsvd_page_pa(int nasid, u64 buf, u64 buf_size) xpc_get_rsvd_page_pa(int nasid)
{ {
bte_result_t bte_res; bte_result_t bte_res;
s64 status; s64 status;
u64 cookie = 0; u64 cookie = 0;
u64 rp_pa = nasid; /* seed with nasid */ u64 rp_pa = nasid; /* seed with nasid */
u64 len = 0; u64 len = 0;
u64 buf = buf;
u64 buf_len = 0;
void *buf_base = NULL;
while (1) { while (1) {
...@@ -107,13 +110,22 @@ xpc_get_rsvd_page_pa(int nasid, u64 buf, u64 buf_size) ...@@ -107,13 +110,22 @@ xpc_get_rsvd_page_pa(int nasid, u64 buf, u64 buf_size)
break; break;
} }
if (len > buf_size) { if (L1_CACHE_ALIGN(len) > buf_len) {
dev_err(xpc_part, "len (=0x%016lx) > buf_size\n", len); if (buf_base != NULL) {
kfree(buf_base);
}
buf_len = L1_CACHE_ALIGN(len);
buf = (u64) xpc_kmalloc_cacheline_aligned(buf_len,
GFP_KERNEL, &buf_base);
if (buf_base == NULL) {
dev_err(xpc_part, "unable to kmalloc "
"len=0x%016lx\n", buf_len);
status = SALRET_ERROR; status = SALRET_ERROR;
break; break;
} }
}
bte_res = xp_bte_copy(rp_pa, ia64_tpa(buf), buf_size, bte_res = xp_bte_copy(rp_pa, ia64_tpa(buf), buf_len,
(BTE_NOTIFY | BTE_WACQUIRE), NULL); (BTE_NOTIFY | BTE_WACQUIRE), NULL);
if (bte_res != BTE_SUCCESS) { if (bte_res != BTE_SUCCESS) {
dev_dbg(xpc_part, "xp_bte_copy failed %i\n", bte_res); dev_dbg(xpc_part, "xp_bte_copy failed %i\n", bte_res);
...@@ -122,6 +134,10 @@ xpc_get_rsvd_page_pa(int nasid, u64 buf, u64 buf_size) ...@@ -122,6 +134,10 @@ xpc_get_rsvd_page_pa(int nasid, u64 buf, u64 buf_size)
} }
} }
if (buf_base != NULL) {
kfree(buf_base);
}
if (status != SALRET_OK) { if (status != SALRET_OK) {
rp_pa = 0; rp_pa = 0;
} }
...@@ -146,10 +162,9 @@ xpc_rsvd_page_init(void) ...@@ -146,10 +162,9 @@ xpc_rsvd_page_init(void)
/* get the local reserved page's address */ /* get the local reserved page's address */
rp_pa = xpc_get_rsvd_page_pa(cnodeid_to_nasid(0), preempt_disable();
(u64) xpc_remote_copy_buffer, rp_pa = xpc_get_rsvd_page_pa(cpuid_to_nasid(smp_processor_id()));
XPC_RP_HEADER_SIZE + preempt_enable();
L1_CACHE_BYTES);
if (rp_pa == 0) { if (rp_pa == 0) {
dev_err(xpc_part, "SAL failed to locate the reserved page\n"); dev_err(xpc_part, "SAL failed to locate the reserved page\n");
return NULL; return NULL;
...@@ -455,9 +470,7 @@ xpc_get_remote_rp(int nasid, u64 *discovered_nasids, ...@@ -455,9 +470,7 @@ xpc_get_remote_rp(int nasid, u64 *discovered_nasids,
/* get the reserved page's physical address */ /* get the reserved page's physical address */
*remote_rp_pa = xpc_get_rsvd_page_pa(nasid, (u64) remote_rp, *remote_rp_pa = xpc_get_rsvd_page_pa(nasid);
XPC_RP_HEADER_SIZE +
xp_nasid_mask_bytes);
if (*remote_rp_pa == 0) { if (*remote_rp_pa == 0) {
return xpcNoRsvdPageAddr; return xpcNoRsvdPageAddr;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment