aboutsummaryrefslogtreecommitdiff
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.c328
1 files changed, 138 insertions, 190 deletions
diff --git a/drivers/misc/sgi-xp/xpc_partition.c b/drivers/misc/sgi-xp/xpc_partition.c
index 7412dc7351c..57f1d0b3ac2 100644
--- a/drivers/misc/sgi-xp/xpc_partition.c
+++ b/drivers/misc/sgi-xp/xpc_partition.c
@@ -6,7 +6,6 @@
* Copyright (c) 2004-2008 Silicon Graphics, Inc. All Rights Reserved.
*/
-
/*
* Cross Partition Communication (XPC) partition support.
*
@@ -16,7 +15,6 @@
*
*/
-
#include <linux/kernel.h>
#include <linux/sysctl.h>
#include <linux/cache.h>
@@ -30,11 +28,9 @@
#include <asm/sn/addrs.h>
#include "xpc.h"
-
/* XPC is exiting flag */
int xpc_exiting;
-
/* SH_IPI_ACCESS shub register value on startup */
static u64 xpc_sh1_IPI_access;
static u64 xpc_sh2_IPI_access0;
@@ -42,11 +38,9 @@ static u64 xpc_sh2_IPI_access1;
static u64 xpc_sh2_IPI_access2;
static u64 xpc_sh2_IPI_access3;
-
/* original protection values for each node */
u64 xpc_prot_vec[MAX_NUMNODES];
-
/* this partition's reserved page pointers */
struct xpc_rsvd_page *xpc_rsvd_page;
static u64 *xpc_part_nasids;
@@ -57,7 +51,6 @@ struct xpc_vars_part *xpc_vars_part;
static int xp_nasid_mask_bytes; /* actual size in bytes of nasid mask */
static int xp_nasid_mask_words; /* actual size in words of nasid mask */
-
/*
* For performance reasons, each entry of xpc_partitions[] is cacheline
* aligned. And xpc_partitions[] is padded with an additional entry at the
@@ -66,7 +59,6 @@ static int xp_nasid_mask_words; /* actual size in words of nasid mask */
*/
struct xpc_partition xpc_partitions[XP_MAX_PARTITIONS + 1];
-
/*
* Generic buffer used to store a local copy of portions of a remote
* partition's reserved page (either its header and part_nasids mask,
@@ -75,7 +67,6 @@ struct xpc_partition xpc_partitions[XP_MAX_PARTITIONS + 1];
char *xpc_remote_copy_buffer;
void *xpc_remote_copy_buffer_base;
-
/*
* Guarantee that the kmalloc'd memory is cacheline aligned.
*/
@@ -87,7 +78,7 @@ xpc_kmalloc_cacheline_aligned(size_t size, gfp_t flags, void **base)
if (*base == NULL) {
return NULL;
}
- if ((u64) *base == L1_CACHE_ALIGN((u64) *base)) {
+ if ((u64)*base == L1_CACHE_ALIGN((u64)*base)) {
return *base;
}
kfree(*base);
@@ -97,10 +88,9 @@ xpc_kmalloc_cacheline_aligned(size_t size, gfp_t flags, void **base)
if (*base == NULL) {
return NULL;
}
- return (void *) L1_CACHE_ALIGN((u64) *base);
+ return (void *)L1_CACHE_ALIGN((u64)*base);
}
-
/*
* Given a nasid, get the physical address of the partition's reserved page
* for that nasid. This function returns 0 on any error.
@@ -117,11 +107,10 @@ xpc_get_rsvd_page_pa(int nasid)
u64 buf_len = 0;
void *buf_base = NULL;
-
while (1) {
status = sn_partition_reserved_page_pa(buf, &cookie, &rp_pa,
- &len);
+ &len);
dev_dbg(xpc_part, "SAL returned with status=%li, cookie="
"0x%016lx, address=0x%016lx, len=0x%016lx\n",
@@ -134,8 +123,9 @@ xpc_get_rsvd_page_pa(int nasid)
if (L1_CACHE_ALIGN(len) > buf_len) {
kfree(buf_base);
buf_len = L1_CACHE_ALIGN(len);
- buf = (u64) xpc_kmalloc_cacheline_aligned(buf_len,
- GFP_KERNEL, &buf_base);
+ 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);
@@ -145,7 +135,7 @@ xpc_get_rsvd_page_pa(int nasid)
}
bte_res = xp_bte_copy(rp_pa, buf, buf_len,
- (BTE_NOTIFY | BTE_WACQUIRE), NULL);
+ (BTE_NOTIFY | BTE_WACQUIRE), NULL);
if (bte_res != BTE_SUCCESS) {
dev_dbg(xpc_part, "xp_bte_copy failed %i\n", bte_res);
status = SALRET_ERROR;
@@ -162,7 +152,6 @@ xpc_get_rsvd_page_pa(int nasid)
return rp_pa;
}
-
/*
* Fill the partition reserved page with the information needed by
* other partitions to discover we are alive and establish initial
@@ -176,7 +165,6 @@ xpc_rsvd_page_init(void)
u64 rp_pa, nasid_array = 0;
int i, ret;
-
/* get the local reserved page's address */
preempt_disable();
@@ -186,7 +174,7 @@ xpc_rsvd_page_init(void)
dev_err(xpc_part, "SAL failed to locate the reserved page\n");
return NULL;
}
- rp = (struct xpc_rsvd_page *) __va(rp_pa);
+ rp = (struct xpc_rsvd_page *)__va(rp_pa);
if (rp->partid != sn_partition_id) {
dev_err(xpc_part, "the reserved page's partid of %d should be "
@@ -223,7 +211,7 @@ xpc_rsvd_page_init(void)
* memory protections are never restricted.
*/
if ((amos_page = xpc_vars->amos_page) == NULL) {
- amos_page = (AMO_t *) TO_AMO(uncached_alloc_page(0));
+ amos_page = (AMO_t *)TO_AMO(uncached_alloc_page(0));
if (amos_page == NULL) {
dev_err(xpc_part, "can't allocate page of AMOs\n");
return NULL;
@@ -234,30 +222,31 @@ xpc_rsvd_page_init(void)
* when xpc_allow_IPI_ops() is called via xpc_hb_init().
*/
if (!enable_shub_wars_1_1()) {
- ret = sn_change_memprotect(ia64_tpa((u64) amos_page),
- PAGE_SIZE, SN_MEMPROT_ACCESS_CLASS_1,
- &nasid_array);
+ ret = sn_change_memprotect(ia64_tpa((u64)amos_page),
+ PAGE_SIZE,
+ SN_MEMPROT_ACCESS_CLASS_1,
+ &nasid_array);
if (ret != 0) {
dev_err(xpc_part, "can't change memory "
"protections\n");
uncached_free_page(__IA64_UNCACHED_OFFSET |
- TO_PHYS((u64) amos_page));
+ TO_PHYS((u64)amos_page));
return NULL;
}
}
- } else if (!IS_AMO_ADDRESS((u64) amos_page)) {
+ } else if (!IS_AMO_ADDRESS((u64)amos_page)) {
/*
* EFI's XPBOOT can also set amos_page in the reserved page,
* but it happens to leave it as an uncached physical address
* and we need it to be an uncached virtual, so we'll have to
* convert it.
*/
- if (!IS_AMO_PHYS_ADDRESS((u64) amos_page)) {
+ if (!IS_AMO_PHYS_ADDRESS((u64)amos_page)) {
dev_err(xpc_part, "previously used amos_page address "
- "is bad = 0x%p\n", (void *) amos_page);
+ "is bad = 0x%p\n", (void *)amos_page);
return NULL;
}
- amos_page = (AMO_t *) TO_AMO((u64) amos_page);
+ amos_page = (AMO_t *)TO_AMO((u64)amos_page);
}
/* clear xpc_vars */
@@ -267,22 +256,21 @@ xpc_rsvd_page_init(void)
xpc_vars->act_nasid = cpuid_to_nasid(0);
xpc_vars->act_phys_cpuid = cpu_physical_id(0);
xpc_vars->vars_part_pa = __pa(xpc_vars_part);
- xpc_vars->amos_page_pa = ia64_tpa((u64) amos_page);
- xpc_vars->amos_page = amos_page; /* save for next load of XPC */
-
+ xpc_vars->amos_page_pa = ia64_tpa((u64)amos_page);
+ xpc_vars->amos_page = amos_page; /* save for next load of XPC */
/* clear xpc_vars_part */
- memset((u64 *) xpc_vars_part, 0, sizeof(struct xpc_vars_part) *
- XP_MAX_PARTITIONS);
+ memset((u64 *)xpc_vars_part, 0, sizeof(struct xpc_vars_part) *
+ XP_MAX_PARTITIONS);
/* initialize the activate IRQ related AMO variables */
for (i = 0; i < xp_nasid_mask_words; i++) {
- (void) xpc_IPI_init(XPC_ACTIVATE_IRQ_AMOS + i);
+ (void)xpc_IPI_init(XPC_ACTIVATE_IRQ_AMOS + i);
}
/* initialize the engaged remote partitions related AMO variables */
- (void) xpc_IPI_init(XPC_ENGAGED_PARTITIONS_AMO);
- (void) xpc_IPI_init(XPC_DISENGAGE_REQUEST_AMO);
+ (void)xpc_IPI_init(XPC_ENGAGED_PARTITIONS_AMO);
+ (void)xpc_IPI_init(XPC_DISENGAGE_REQUEST_AMO);
/* timestamp of when reserved page was setup by XPC */
rp->stamp = CURRENT_TIME;
@@ -296,7 +284,6 @@ xpc_rsvd_page_init(void)
return rp;
}
-
/*
* Change protections to allow IPI operations (and AMO operations on
* Shub 1.1 systems).
@@ -307,39 +294,38 @@ xpc_allow_IPI_ops(void)
int node;
int nasid;
-
// >>> Change SH_IPI_ACCESS code to use SAL call once it is available.
if (is_shub2()) {
xpc_sh2_IPI_access0 =
- (u64) HUB_L((u64 *) LOCAL_MMR_ADDR(SH2_IPI_ACCESS0));
+ (u64)HUB_L((u64 *)LOCAL_MMR_ADDR(SH2_IPI_ACCESS0));
xpc_sh2_IPI_access1 =
- (u64) HUB_L((u64 *) LOCAL_MMR_ADDR(SH2_IPI_ACCESS1));
+ (u64)HUB_L((u64 *)LOCAL_MMR_ADDR(SH2_IPI_ACCESS1));
xpc_sh2_IPI_access2 =
- (u64) HUB_L((u64 *) LOCAL_MMR_ADDR(SH2_IPI_ACCESS2));
+ (u64)HUB_L((u64 *)LOCAL_MMR_ADDR(SH2_IPI_ACCESS2));
xpc_sh2_IPI_access3 =
- (u64) HUB_L((u64 *) LOCAL_MMR_ADDR(SH2_IPI_ACCESS3));
+ (u64)HUB_L((u64 *)LOCAL_MMR_ADDR(SH2_IPI_ACCESS3));
for_each_online_node(node) {
nasid = cnodeid_to_nasid(node);
- HUB_S((u64 *) GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS0),
- -1UL);
- HUB_S((u64 *) GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS1),
- -1UL);
- HUB_S((u64 *) GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS2),
- -1UL);
- HUB_S((u64 *) GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS3),
- -1UL);
+ HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS0),
+ -1UL);
+ HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS1),
+ -1UL);
+ HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS2),
+ -1UL);
+ HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS3),
+ -1UL);
}
} else {
xpc_sh1_IPI_access =
- (u64) HUB_L((u64 *) LOCAL_MMR_ADDR(SH1_IPI_ACCESS));
+ (u64)HUB_L((u64 *)LOCAL_MMR_ADDR(SH1_IPI_ACCESS));
for_each_online_node(node) {
nasid = cnodeid_to_nasid(node);
- HUB_S((u64 *) GLOBAL_MMR_ADDR(nasid, SH1_IPI_ACCESS),
- -1UL);
+ HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH1_IPI_ACCESS),
+ -1UL);
/*
* Since the BIST collides with memory operations on
@@ -347,21 +333,23 @@ xpc_allow_IPI_ops(void)
*/
if (enable_shub_wars_1_1()) {
/* open up everything */
- xpc_prot_vec[node] = (u64) HUB_L((u64 *)
- GLOBAL_MMR_ADDR(nasid,
- SH1_MD_DQLP_MMR_DIR_PRIVEC0));
- HUB_S((u64 *) GLOBAL_MMR_ADDR(nasid,
- SH1_MD_DQLP_MMR_DIR_PRIVEC0),
- -1UL);
- HUB_S((u64 *) GLOBAL_MMR_ADDR(nasid,
- SH1_MD_DQRP_MMR_DIR_PRIVEC0),
- -1UL);
+ xpc_prot_vec[node] = (u64)HUB_L((u64 *)
+ GLOBAL_MMR_ADDR
+ (nasid,
+ SH1_MD_DQLP_MMR_DIR_PRIVEC0));
+ HUB_S((u64 *)
+ GLOBAL_MMR_ADDR(nasid,
+ SH1_MD_DQLP_MMR_DIR_PRIVEC0),
+ -1UL);
+ HUB_S((u64 *)
+ GLOBAL_MMR_ADDR(nasid,
+ SH1_MD_DQRP_MMR_DIR_PRIVEC0),
+ -1UL);
}
}
}
}
-
/*
* Restrict protections to disallow IPI operations (and AMO operations on
* Shub 1.1 systems).
@@ -372,43 +360,41 @@ xpc_restrict_IPI_ops(void)
int node;
int nasid;
-
// >>> Change SH_IPI_ACCESS code to use SAL call once it is available.
if (is_shub2()) {
for_each_online_node(node) {
nasid = cnodeid_to_nasid(node);
- HUB_S((u64 *) GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS0),
- xpc_sh2_IPI_access0);
- HUB_S((u64 *) GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS1),
- xpc_sh2_IPI_access1);
- HUB_S((u64 *) GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS2),
- xpc_sh2_IPI_access2);
- HUB_S((u64 *) GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS3),
- xpc_sh2_IPI_access3);
+ HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS0),
+ xpc_sh2_IPI_access0);
+ HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS1),
+ xpc_sh2_IPI_access1);
+ HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS2),
+ xpc_sh2_IPI_access2);
+ HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS3),
+ xpc_sh2_IPI_access3);
}
} else {
for_each_online_node(node) {
nasid = cnodeid_to_nasid(node);
- HUB_S((u64 *) GLOBAL_MMR_ADDR(nasid, SH1_IPI_ACCESS),
- xpc_sh1_IPI_access);
+ HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH1_IPI_ACCESS),
+ xpc_sh1_IPI_access);
if (enable_shub_wars_1_1()) {
- HUB_S((u64 *) GLOBAL_MMR_ADDR(nasid,
- SH1_MD_DQLP_MMR_DIR_PRIVEC0),
- xpc_prot_vec[node]);
- HUB_S((u64 *) GLOBAL_MMR_ADDR(nasid,
- SH1_MD_DQRP_MMR_DIR_PRIVEC0),
- xpc_prot_vec[node]);
+ HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid,
+ SH1_MD_DQLP_MMR_DIR_PRIVEC0),
+ xpc_prot_vec[node]);
+ HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid,
+ SH1_MD_DQRP_MMR_DIR_PRIVEC0),
+ xpc_prot_vec[node]);
}
}
}
}
-
/*
* At periodic intervals, scan through all active partitions and ensure
* their heartbeat is still active. If not, the partition is deactivated.
@@ -421,8 +407,7 @@ xpc_check_remote_hb(void)
partid_t partid;
bte_result_t bres;
-
- remote_vars = (struct xpc_vars *) xpc_remote_copy_buffer;
+ remote_vars = (struct xpc_vars *)xpc_remote_copy_buffer;
for (partid = 1; partid < XP_MAX_PARTITIONS; partid++) {
@@ -437,18 +422,18 @@ xpc_check_remote_hb(void)
part = &xpc_partitions[partid];
if (part->act_state == XPC_P_INACTIVE ||
- part->act_state == XPC_P_DEACTIVATING) {
+ part->act_state == XPC_P_DEACTIVATING) {
continue;
}
/* pull the remote_hb cache line */
bres = xp_bte_copy(part->remote_vars_pa,
- (u64) remote_vars,
- XPC_RP_VARS_SIZE,
- (BTE_NOTIFY | BTE_WACQUIRE), NULL);
+ (u64)remote_vars,
+ XPC_RP_VARS_SIZE,
+ (BTE_NOTIFY | BTE_WACQUIRE), NULL);
if (bres != BTE_SUCCESS) {
XPC_DEACTIVATE_PARTITION(part,
- xpc_map_bte_errors(bres));
+ xpc_map_bte_errors(bres));
continue;
}
@@ -459,8 +444,8 @@ xpc_check_remote_hb(void)
remote_vars->heartbeating_to_mask);
if (((remote_vars->heartbeat == part->last_heartbeat) &&
- (remote_vars->heartbeat_offline == 0)) ||
- !xpc_hb_allowed(sn_partition_id, remote_vars)) {
+ (remote_vars->heartbeat_offline == 0)) ||
+ !xpc_hb_allowed(sn_partition_id, remote_vars)) {
XPC_DEACTIVATE_PARTITION(part, xpcNoHeartbeat);
continue;
@@ -470,7 +455,6 @@ xpc_check_remote_hb(void)
}
}
-
/*
* Get a copy of a portion of the remote partition's rsvd page.
*
@@ -480,11 +464,10 @@ xpc_check_remote_hb(void)
*/
static enum xpc_retval
xpc_get_remote_rp(int nasid, u64 *discovered_nasids,
- struct xpc_rsvd_page *remote_rp, u64 *remote_rp_pa)
+ struct xpc_rsvd_page *remote_rp, u64 *remote_rp_pa)
{
int bres, i;
-
/* get the reserved page's physical address */
*remote_rp_pa = xpc_get_rsvd_page_pa(nasid);
@@ -492,30 +475,26 @@ xpc_get_remote_rp(int nasid, u64 *discovered_nasids,
return xpcNoRsvdPageAddr;
}
-
/* pull over the reserved page header and part_nasids mask */
- bres = xp_bte_copy(*remote_rp_pa, (u64) remote_rp,
- XPC_RP_HEADER_SIZE + xp_nasid_mask_bytes,
- (BTE_NOTIFY | BTE_WACQUIRE), NULL);
+ bres = xp_bte_copy(*remote_rp_pa, (u64)remote_rp,
+ XPC_RP_HEADER_SIZE + xp_nasid_mask_bytes,
+ (BTE_NOTIFY | BTE_WACQUIRE), NULL);
if (bres != BTE_SUCCESS) {
return xpc_map_bte_errors(bres);
}
-
if (discovered_nasids != NULL) {
u64 *remote_part_nasids = XPC_RP_PART_NASIDS(remote_rp);
-
for (i = 0; i < xp_nasid_mask_words; i++) {
discovered_nasids[i] |= remote_part_nasids[i];
}
}
-
/* check that the partid is for another partition */
if (remote_rp->partid < 1 ||
- remote_rp->partid > (XP_MAX_PARTITIONS - 1)) {
+ remote_rp->partid > (XP_MAX_PARTITIONS - 1)) {
return xpcInvalidPartid;
}
@@ -523,16 +502,14 @@ xpc_get_remote_rp(int nasid, u64 *discovered_nasids,
return xpcLocalPartid;
}
-
if (XPC_VERSION_MAJOR(remote_rp->version) !=
- XPC_VERSION_MAJOR(XPC_RP_VERSION)) {
+ XPC_VERSION_MAJOR(XPC_RP_VERSION)) {
return xpcBadVersion;
}
return xpcSuccess;
}
-
/*
* Get a copy of the remote partition's XPC variables from the reserved page.
*
@@ -544,34 +521,32 @@ xpc_get_remote_vars(u64 remote_vars_pa, struct xpc_vars *remote_vars)
{
int bres;
-
if (remote_vars_pa == 0) {
return xpcVarsNotSet;
}
/* pull over the cross partition variables */
- bres = xp_bte_copy(remote_vars_pa, (u64) remote_vars, XPC_RP_VARS_SIZE,
- (BTE_NOTIFY | BTE_WACQUIRE), NULL);
+ bres = xp_bte_copy(remote_vars_pa, (u64)remote_vars, XPC_RP_VARS_SIZE,
+ (BTE_NOTIFY | BTE_WACQUIRE), NULL);
if (bres != BTE_SUCCESS) {
return xpc_map_bte_errors(bres);
}
if (XPC_VERSION_MAJOR(remote_vars->version) !=
- XPC_VERSION_MAJOR(XPC_V_VERSION)) {
+ XPC_VERSION_MAJOR(XPC_V_VERSION)) {
return xpcBadVersion;
}
return xpcSuccess;
}
-
/*
* Update the remote partition's info.
*/
static void
xpc_update_partition_info(struct xpc_partition *part, u8 remote_rp_version,
- struct timespec *remote_rp_stamp, u64 remote_rp_pa,
- u64 remote_vars_pa, struct xpc_vars *remote_vars)
+ struct timespec *remote_rp_stamp, u64 remote_rp_pa,
+ u64 remote_vars_pa, struct xpc_vars *remote_vars)
{
part->remote_rp_version = remote_rp_version;
dev_dbg(xpc_part, " remote_rp_version = 0x%016x\n",
@@ -613,7 +588,6 @@ xpc_update_partition_info(struct xpc_partition *part, u8 remote_rp_version,
part->remote_vars_version);
}
-
/*
* Prior code has determined the nasid which generated an IPI. Inspect
* that nasid to determine if its partition needs to be activated or
@@ -643,15 +617,14 @@ xpc_identify_act_IRQ_req(int nasid)
struct xpc_partition *part;
enum xpc_retval ret;
-
/* pull over the reserved page structure */
- remote_rp = (struct xpc_rsvd_page *) xpc_remote_copy_buffer;
+ remote_rp = (struct xpc_rsvd_page *)xpc_remote_copy_buffer;
ret = xpc_get_remote_rp(nasid, NULL, remote_rp, &remote_rp_pa);
if (ret != xpcSuccess) {
dev_warn(xpc_part, "unable to get reserved page from nasid %d, "
- "which sent interrupt, reason=%d\n", nasid, ret);
+ "which sent interrupt, reason=%d\n", nasid, ret);
return;
}
@@ -663,34 +636,31 @@ xpc_identify_act_IRQ_req(int nasid)
partid = remote_rp->partid;
part = &xpc_partitions[partid];
-
/* pull over the cross partition variables */
- remote_vars = (struct xpc_vars *) xpc_remote_copy_buffer;
+ remote_vars = (struct xpc_vars *)xpc_remote_copy_buffer;
ret = xpc_get_remote_vars(remote_vars_pa, remote_vars);
if (ret != xpcSuccess) {
dev_warn(xpc_part, "unable to get XPC variables from nasid %d, "
- "which sent interrupt, reason=%d\n", nasid, ret);
+ "which sent interrupt, reason=%d\n", nasid, ret);
XPC_DEACTIVATE_PARTITION(part, ret);
return;
}
-
part->act_IRQ_rcvd++;
dev_dbg(xpc_part, "partid for nasid %d is %d; IRQs = %d; HB = "
- "%ld:0x%lx\n", (int) nasid, (int) partid, part->act_IRQ_rcvd,
+ "%ld:0x%lx\n", (int)nasid, (int)partid, part->act_IRQ_rcvd,
remote_vars->heartbeat, remote_vars->heartbeating_to_mask);
- if (xpc_partition_disengaged(part) &&
- part->act_state == XPC_P_INACTIVE) {
+ if (xpc_partition_disengaged(part) && part->act_state == XPC_P_INACTIVE) {
xpc_update_partition_info(part, remote_rp_version,
- &remote_rp_stamp, remote_rp_pa,
- remote_vars_pa, remote_vars);
+ &remote_rp_stamp, remote_rp_pa,
+ remote_vars_pa, remote_vars);
if (XPC_SUPPORTS_DISENGAGE_REQUEST(part->remote_vars_version)) {
if (xpc_partition_disengage_requested(1UL << partid)) {
@@ -714,16 +684,15 @@ xpc_identify_act_IRQ_req(int nasid)
if (!XPC_SUPPORTS_RP_STAMP(part->remote_rp_version)) {
DBUG_ON(XPC_SUPPORTS_DISENGAGE_REQUEST(part->
- remote_vars_version));
+ remote_vars_version));
if (!XPC_SUPPORTS_RP_STAMP(remote_rp_version)) {
DBUG_ON(XPC_SUPPORTS_DISENGAGE_REQUEST(remote_vars->
- version));
+ version));
/* see if the other side rebooted */
if (part->remote_amos_page_pa ==
- remote_vars->amos_page_pa &&
- xpc_hb_allowed(sn_partition_id,
- remote_vars)) {
+ remote_vars->amos_page_pa &&
+ xpc_hb_allowed(sn_partition_id, remote_vars)) {
/* doesn't look that way, so ignore the IPI */
return;
}
@@ -735,8 +704,8 @@ xpc_identify_act_IRQ_req(int nasid)
*/
xpc_update_partition_info(part, remote_rp_version,
- &remote_rp_stamp, remote_rp_pa,
- remote_vars_pa, remote_vars);
+ &remote_rp_stamp, remote_rp_pa,
+ remote_vars_pa, remote_vars);
part->reactivate_nasid = nasid;
XPC_DEACTIVATE_PARTITION(part, xpcReactivating);
return;
@@ -756,15 +725,15 @@ xpc_identify_act_IRQ_req(int nasid)
xpc_clear_partition_disengage_request(1UL << partid);
xpc_update_partition_info(part, remote_rp_version,
- &remote_rp_stamp, remote_rp_pa,
- remote_vars_pa, remote_vars);
+ &remote_rp_stamp, remote_rp_pa,
+ remote_vars_pa, remote_vars);
reactivate = 1;
} else {
DBUG_ON(!XPC_SUPPORTS_DISENGAGE_REQUEST(remote_vars->version));
stamp_diff = xpc_compare_stamps(&part->remote_rp_stamp,
- &remote_rp_stamp);
+ &remote_rp_stamp);
if (stamp_diff != 0) {
DBUG_ON(stamp_diff >= 0);
@@ -775,17 +744,18 @@ xpc_identify_act_IRQ_req(int nasid)
DBUG_ON(xpc_partition_engaged(1UL << partid));
DBUG_ON(xpc_partition_disengage_requested(1UL <<
- partid));
+ partid));
xpc_update_partition_info(part, remote_rp_version,
- &remote_rp_stamp, remote_rp_pa,
- remote_vars_pa, remote_vars);
+ &remote_rp_stamp,
+ remote_rp_pa, remote_vars_pa,
+ remote_vars);
reactivate = 1;
}
}
if (part->disengage_request_timeout > 0 &&
- !xpc_partition_disengaged(part)) {
+ !xpc_partition_disengaged(part)) {
/* still waiting on other side to disengage from us */
return;
}
@@ -795,12 +765,11 @@ xpc_identify_act_IRQ_req(int nasid)
XPC_DEACTIVATE_PARTITION(part, xpcReactivating);
} else if (XPC_SUPPORTS_DISENGAGE_REQUEST(part->remote_vars_version) &&
- xpc_partition_disengage_requested(1UL << partid)) {
+ xpc_partition_disengage_requested(1UL << partid)) {
XPC_DEACTIVATE_PARTITION(part, xpcOtherGoingDown);
}
}
-
/*
* Loop through the activation AMO variables and process any bits
* which are set. Each bit indicates a nasid sending a partition
@@ -813,14 +782,12 @@ xpc_identify_act_IRQ_sender(void)
{
int word, bit;
u64 nasid_mask;
- u64 nasid; /* remote nasid */
+ u64 nasid; /* remote nasid */
int n_IRQs_detected = 0;
AMO_t *act_amos;
-
act_amos = xpc_vars->amos_page + XPC_ACTIVATE_IRQ_AMOS;
-
/* scan through act AMO variable looking for non-zero entries */
for (word = 0; word < xp_nasid_mask_words; word++) {
@@ -837,7 +804,6 @@ xpc_identify_act_IRQ_sender(void)
dev_dbg(xpc_part, "AMO[%d] gave back 0x%lx\n", word,
nasid_mask);
-
/*
* If this nasid has been added to the machine since
* our partition was reset, this will retain the
@@ -846,7 +812,6 @@ xpc_identify_act_IRQ_sender(void)
*/
xpc_mach_nasids[word] |= nasid_mask;
-
/* locate the nasid(s) which sent interrupts */
for (bit = 0; bit < (8 * sizeof(u64)); bit++) {
@@ -862,7 +827,6 @@ xpc_identify_act_IRQ_sender(void)
return n_IRQs_detected;
}
-
/*
* See if the other side has responded to a partition disengage request
* from us.
@@ -873,7 +837,6 @@ xpc_partition_disengaged(struct xpc_partition *part)
partid_t partid = XPC_PARTID(part);
int disengaged;
-
disengaged = (xpc_partition_engaged(1UL << partid) == 0);
if (part->disengage_request_timeout) {
if (!disengaged) {
@@ -888,7 +851,7 @@ xpc_partition_disengaged(struct xpc_partition *part)
*/
dev_info(xpc_part, "disengage from remote partition %d "
- "timed out\n", partid);
+ "timed out\n", partid);
xpc_disengage_request_timedout = 1;
xpc_clear_partition_engaged(1UL << partid);
disengaged = 1;
@@ -898,11 +861,11 @@ xpc_partition_disengaged(struct xpc_partition *part)
/* cancel the timer function, provided it's not us */
if (!in_interrupt()) {
del_singleshot_timer_sync(&part->
- disengage_request_timer);
+ disengage_request_timer);
}
DBUG_ON(part->act_state != XPC_P_DEACTIVATING &&
- part->act_state != XPC_P_INACTIVE);
+ part->act_state != XPC_P_INACTIVE);
if (part->act_state != XPC_P_INACTIVE) {
xpc_wakeup_channel_mgr(part);
}
@@ -914,7 +877,6 @@ xpc_partition_disengaged(struct xpc_partition *part)
return disengaged;
}
-
/*
* Mark specified partition as active.
*/
@@ -924,7 +886,6 @@ xpc_mark_partition_active(struct xpc_partition *part)
unsigned long irq_flags;
enum xpc_retval ret;
-
dev_dbg(xpc_part, "setting partition %d to ACTIVE\n", XPC_PARTID(part));
spin_lock_irqsave(&part->act_lock, irq_flags);
@@ -940,17 +901,15 @@ xpc_mark_partition_active(struct xpc_partition *part)
return ret;
}
-
/*
* Notify XPC that the partition is down.
*/
void
xpc_deactivate_partition(const int line, struct xpc_partition *part,
- enum xpc_retval reason)
+ enum xpc_retval reason)
{
unsigned long irq_flags;
-
spin_lock_irqsave(&part->act_lock, irq_flags);
if (part->act_state == XPC_P_INACTIVE) {
@@ -964,7 +923,7 @@ xpc_deactivate_partition(const int line, struct xpc_partition *part,
}
if (part->act_state == XPC_P_DEACTIVATING) {
if ((part->reason == xpcUnloading && reason != xpcUnloading) ||
- reason == xpcReactivating) {
+ reason == xpcReactivating) {
XPC_SET_REASON(part, reason, line);
}
spin_unlock_irqrestore(&part->act_lock, irq_flags);
@@ -982,9 +941,9 @@ xpc_deactivate_partition(const int line, struct xpc_partition *part,
/* set a timelimit on the disengage request */
part->disengage_request_timeout = jiffies +
- (xpc_disengage_request_timelimit * HZ);
+ (xpc_disengage_request_timelimit * HZ);
part->disengage_request_timer.expires =
- part->disengage_request_timeout;
+ part->disengage_request_timeout;
add_timer(&part->disengage_request_timer);
}
@@ -994,7 +953,6 @@ xpc_deactivate_partition(const int line, struct xpc_partition *part,
xpc_partition_going_down(part, reason);
}
-
/*
* Mark specified partition as inactive.
*/
@@ -1003,7 +961,6 @@ xpc_mark_partition_inactive(struct xpc_partition *part)
{
unsigned long irq_flags;
-
dev_dbg(xpc_part, "setting partition %d to INACTIVE\n",
XPC_PARTID(part));
@@ -1013,7 +970,6 @@ xpc_mark_partition_inactive(struct xpc_partition *part)
part->remote_rp_pa = 0;
}
-
/*
* SAL has provided a partition and machine mask. The partition mask
* contains a bit for each even nasid in our partition. The machine
@@ -1041,24 +997,22 @@ xpc_discovery(void)
u64 *discovered_nasids;
enum xpc_retval ret;
-
remote_rp = xpc_kmalloc_cacheline_aligned(XPC_RP_HEADER_SIZE +
- xp_nasid_mask_bytes,
- GFP_KERNEL, &remote_rp_base);
+ xp_nasid_mask_bytes,
+ GFP_KERNEL, &remote_rp_base);
if (remote_rp == NULL) {
return;
}
- remote_vars = (struct xpc_vars *) remote_rp;
-
+ remote_vars = (struct xpc_vars *)remote_rp;
discovered_nasids = kzalloc(sizeof(u64) * xp_nasid_mask_words,
- GFP_KERNEL);
+ GFP_KERNEL);
if (discovered_nasids == NULL) {
kfree(remote_rp_base);
return;
}
- rp = (struct xpc_rsvd_page *) xpc_rsvd_page;
+ rp = (struct xpc_rsvd_page *)xpc_rsvd_page;
/*
* The term 'region' in this context refers to the minimum number of
@@ -1081,23 +1035,21 @@ xpc_discovery(void)
for (region = 0; region < max_regions; region++) {
- if ((volatile int) xpc_exiting) {
+ if ((volatile int)xpc_exiting) {
break;
}
dev_dbg(xpc_part, "searching region %d\n", region);
for (nasid = (region * region_size * 2);
- nasid < ((region + 1) * region_size * 2);
- nasid += 2) {
+ nasid < ((region + 1) * region_size * 2); nasid += 2) {
- if ((volatile int) xpc_exiting) {
+ if ((volatile int)xpc_exiting) {
break;
}
dev_dbg(xpc_part, "checking nasid %d\n", nasid);
-
if (XPC_NASID_IN_ARRAY(nasid, xpc_part_nasids)) {
dev_dbg(xpc_part, "PROM indicates Nasid %d is "
"part of the local partition; skipping "
@@ -1119,11 +1071,10 @@ xpc_discovery(void)
continue;
}
-
/* pull over the reserved page structure */
ret = xpc_get_remote_rp(nasid, discovered_nasids,
- remote_rp, &remote_rp_pa);
+ remote_rp, &remote_rp_pa);
if (ret != xpcSuccess) {
dev_dbg(xpc_part, "unable to get reserved page "
"from nasid %d, reason=%d\n", nasid,
@@ -1140,7 +1091,6 @@ xpc_discovery(void)
partid = remote_rp->partid;
part = &xpc_partitions[partid];
-
/* pull over the cross partition variables */
ret = xpc_get_remote_vars(remote_vars_pa, remote_vars);
@@ -1171,15 +1121,15 @@ xpc_discovery(void)
* get the same page for remote_act_amos_pa after
* module reloads and system reboots.
*/
- if (sn_register_xp_addr_region(
- remote_vars->amos_page_pa,
- PAGE_SIZE, 1) < 0) {
- dev_dbg(xpc_part, "partition %d failed to "
+ if (sn_register_xp_addr_region
+ (remote_vars->amos_page_pa, PAGE_SIZE, 1) < 0) {
+ dev_dbg(xpc_part,
+ "partition %d failed to "
"register xp_addr region 0x%016lx\n",
partid, remote_vars->amos_page_pa);
XPC_SET_REASON(part, xpcPhysAddrRegFailed,
- __LINE__);
+ __LINE__);
break;
}
@@ -1195,9 +1145,9 @@ xpc_discovery(void)
remote_vars->act_phys_cpuid);
if (XPC_SUPPORTS_DISENGAGE_REQUEST(remote_vars->
- version)) {
+ version)) {
part->remote_amos_page_pa =
- remote_vars->amos_page_pa;
+ remote_vars->amos_page_pa;
xpc_mark_partition_disengaged(part);
xpc_cancel_partition_disengage_request(part);
}
@@ -1209,7 +1159,6 @@ xpc_discovery(void)
kfree(remote_rp_base);
}
-
/*
* Given a partid, get the nasids owned by that partition from the
* remote partition's reserved page.
@@ -1221,7 +1170,6 @@ xpc_initiate_partid_to_nasids(partid_t partid, void *nasid_mask)
u64 part_nasid_pa;
int bte_res;
-
part = &xpc_partitions[partid];
if (part->remote_rp_pa == 0) {
return xpcPartitionDown;
@@ -1229,11 +1177,11 @@ xpc_initiate_partid_to_nasids(partid_t partid, void *nasid_mask)
memset(nasid_mask, 0, XP_NASID_MASK_BYTES);
- part_nasid_pa = (u64) XPC_RP_PART_NASIDS(part->remote_rp_pa);
+ part_nasid_pa = (u64)XPC_RP_PART_NASIDS(part->remote_rp_pa);
- bte_res = xp_bte_copy(part_nasid_pa, (u64) nasid_mask,
- xp_nasid_mask_bytes, (BTE_NOTIFY | BTE_WACQUIRE), NULL);
+ bte_res = xp_bte_copy(part_nasid_pa, (u64)nasid_mask,
+ xp_nasid_mask_bytes, (BTE_NOTIFY | BTE_WACQUIRE),
+ NULL);
return xpc_map_bte_errors(bte_res);
}
-