diff options
author | Dean Nelson <dcn@sgi.com> | 2005-10-25 15:11:53 -0400 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2005-10-25 19:33:22 -0400 |
commit | 279290294662d4a35d209fb7d7c46523cfa3d63d (patch) | |
tree | e321f7bfe1d684b769a55917aea61b65def09c20 /arch/ia64/sn/kernel/xpc_partition.c | |
parent | 4b38fcd4858204cb3667eb7b3aca48ffb1002f05 (diff) |
[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: Dean Nelson <dcn@sgi.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'arch/ia64/sn/kernel/xpc_partition.c')
-rw-r--r-- | arch/ia64/sn/kernel/xpc_partition.c | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/arch/ia64/sn/kernel/xpc_partition.c b/arch/ia64/sn/kernel/xpc_partition.c index 6bb1091f2a4d..ce5a37ff4388 100644 --- a/arch/ia64/sn/kernel/xpc_partition.c +++ b/arch/ia64/sn/kernel/xpc_partition.c | |||
@@ -85,13 +85,16 @@ char ____cacheline_aligned xpc_remote_copy_buffer[XPC_RP_HEADER_SIZE + | |||
85 | * for that nasid. This function returns 0 on any error. | 85 | * for that nasid. This function returns 0 on any error. |
86 | */ | 86 | */ |
87 | static u64 | 87 | static u64 |
88 | xpc_get_rsvd_page_pa(int nasid, u64 buf, u64 buf_size) | 88 | xpc_get_rsvd_page_pa(int nasid) |
89 | { | 89 | { |
90 | bte_result_t bte_res; | 90 | bte_result_t bte_res; |
91 | s64 status; | 91 | s64 status; |
92 | u64 cookie = 0; | 92 | u64 cookie = 0; |
93 | u64 rp_pa = nasid; /* seed with nasid */ | 93 | u64 rp_pa = nasid; /* seed with nasid */ |
94 | u64 len = 0; | 94 | u64 len = 0; |
95 | u64 buf = buf; | ||
96 | u64 buf_len = 0; | ||
97 | void *buf_base = NULL; | ||
95 | 98 | ||
96 | 99 | ||
97 | while (1) { | 100 | while (1) { |
@@ -107,13 +110,22 @@ xpc_get_rsvd_page_pa(int nasid, u64 buf, u64 buf_size) | |||
107 | break; | 110 | break; |
108 | } | 111 | } |
109 | 112 | ||
110 | if (len > buf_size) { | 113 | if (L1_CACHE_ALIGN(len) > buf_len) { |
111 | dev_err(xpc_part, "len (=0x%016lx) > buf_size\n", len); | 114 | if (buf_base != NULL) { |
112 | status = SALRET_ERROR; | 115 | kfree(buf_base); |
113 | break; | 116 | } |
117 | buf_len = L1_CACHE_ALIGN(len); | ||
118 | buf = (u64) xpc_kmalloc_cacheline_aligned(buf_len, | ||
119 | GFP_KERNEL, &buf_base); | ||
120 | if (buf_base == NULL) { | ||
121 | dev_err(xpc_part, "unable to kmalloc " | ||
122 | "len=0x%016lx\n", buf_len); | ||
123 | status = SALRET_ERROR; | ||
124 | break; | ||
125 | } | ||
114 | } | 126 | } |
115 | 127 | ||
116 | bte_res = xp_bte_copy(rp_pa, ia64_tpa(buf), buf_size, | 128 | bte_res = xp_bte_copy(rp_pa, ia64_tpa(buf), buf_len, |
117 | (BTE_NOTIFY | BTE_WACQUIRE), NULL); | 129 | (BTE_NOTIFY | BTE_WACQUIRE), NULL); |
118 | if (bte_res != BTE_SUCCESS) { | 130 | if (bte_res != BTE_SUCCESS) { |
119 | dev_dbg(xpc_part, "xp_bte_copy failed %i\n", bte_res); | 131 | 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 | } | 134 | } |
123 | } | 135 | } |
124 | 136 | ||
137 | if (buf_base != NULL) { | ||
138 | kfree(buf_base); | ||
139 | } | ||
140 | |||
125 | if (status != SALRET_OK) { | 141 | if (status != SALRET_OK) { |
126 | rp_pa = 0; | 142 | rp_pa = 0; |
127 | } | 143 | } |
@@ -146,10 +162,9 @@ xpc_rsvd_page_init(void) | |||
146 | 162 | ||
147 | /* get the local reserved page's address */ | 163 | /* get the local reserved page's address */ |
148 | 164 | ||
149 | rp_pa = xpc_get_rsvd_page_pa(cnodeid_to_nasid(0), | 165 | preempt_disable(); |
150 | (u64) xpc_remote_copy_buffer, | 166 | rp_pa = xpc_get_rsvd_page_pa(cpuid_to_nasid(smp_processor_id())); |
151 | XPC_RP_HEADER_SIZE + | 167 | preempt_enable(); |
152 | L1_CACHE_BYTES); | ||
153 | if (rp_pa == 0) { | 168 | if (rp_pa == 0) { |
154 | dev_err(xpc_part, "SAL failed to locate the reserved page\n"); | 169 | dev_err(xpc_part, "SAL failed to locate the reserved page\n"); |
155 | return NULL; | 170 | return NULL; |
@@ -455,9 +470,7 @@ xpc_get_remote_rp(int nasid, u64 *discovered_nasids, | |||
455 | 470 | ||
456 | /* get the reserved page's physical address */ | 471 | /* get the reserved page's physical address */ |
457 | 472 | ||
458 | *remote_rp_pa = xpc_get_rsvd_page_pa(nasid, (u64) remote_rp, | 473 | *remote_rp_pa = xpc_get_rsvd_page_pa(nasid); |
459 | XPC_RP_HEADER_SIZE + | ||
460 | xp_nasid_mask_bytes); | ||
461 | if (*remote_rp_pa == 0) { | 474 | if (*remote_rp_pa == 0) { |
462 | return xpcNoRsvdPageAddr; | 475 | return xpcNoRsvdPageAddr; |
463 | } | 476 | } |