Commit a7665b0a authored by Robin Holt's avatar Robin Holt Committed by Linus Torvalds

sgi-xpc: clean up numerous globals

Introduce xpc_arch_ops and eliminate numerous individual global definitions.
Signed-off-by: default avatarRobin Holt <holt@sgi.com>
Cc: Dean Nelson <dcn@sgi.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent efdd06ed
...@@ -780,6 +780,62 @@ struct xpc_partition { ...@@ -780,6 +780,62 @@ struct xpc_partition {
} ____cacheline_aligned; } ____cacheline_aligned;
struct xpc_arch_operations {
int (*setup_partitions) (void);
void (*teardown_partitions) (void);
void (*process_activate_IRQ_rcvd) (void);
enum xp_retval (*get_partition_rsvd_page_pa)
(void *, u64 *, unsigned long *, size_t *);
int (*setup_rsvd_page) (struct xpc_rsvd_page *);
void (*allow_hb) (short);
void (*disallow_hb) (short);
void (*disallow_all_hbs) (void);
void (*increment_heartbeat) (void);
void (*offline_heartbeat) (void);
void (*online_heartbeat) (void);
void (*heartbeat_init) (void);
void (*heartbeat_exit) (void);
enum xp_retval (*get_remote_heartbeat) (struct xpc_partition *);
void (*request_partition_activation) (struct xpc_rsvd_page *,
unsigned long, int);
void (*request_partition_reactivation) (struct xpc_partition *);
void (*request_partition_deactivation) (struct xpc_partition *);
void (*cancel_partition_deactivation_request) (struct xpc_partition *);
enum xp_retval (*setup_ch_structures) (struct xpc_partition *);
void (*teardown_ch_structures) (struct xpc_partition *);
enum xp_retval (*make_first_contact) (struct xpc_partition *);
u64 (*get_chctl_all_flags) (struct xpc_partition *);
void (*send_chctl_closerequest) (struct xpc_channel *, unsigned long *);
void (*send_chctl_closereply) (struct xpc_channel *, unsigned long *);
void (*send_chctl_openrequest) (struct xpc_channel *, unsigned long *);
void (*send_chctl_openreply) (struct xpc_channel *, unsigned long *);
void (*send_chctl_opencomplete) (struct xpc_channel *, unsigned long *);
void (*process_msg_chctl_flags) (struct xpc_partition *, int);
enum xp_retval (*save_remote_msgqueue_pa) (struct xpc_channel *,
unsigned long);
enum xp_retval (*setup_msg_structures) (struct xpc_channel *);
void (*teardown_msg_structures) (struct xpc_channel *);
void (*indicate_partition_engaged) (struct xpc_partition *);
void (*indicate_partition_disengaged) (struct xpc_partition *);
void (*assume_partition_disengaged) (short);
int (*partition_engaged) (short);
int (*any_partition_engaged) (void);
int (*n_of_deliverable_payloads) (struct xpc_channel *);
enum xp_retval (*send_payload) (struct xpc_channel *, u32, void *,
u16, u8, xpc_notify_func, void *);
void *(*get_deliverable_payload) (struct xpc_channel *);
void (*received_payload) (struct xpc_channel *, void *);
void (*notify_senders_of_disconnect) (struct xpc_channel *);
};
/* struct xpc_partition act_state values (for XPC HB) */ /* struct xpc_partition act_state values (for XPC HB) */
#define XPC_P_AS_INACTIVE 0x00 /* partition is not active */ #define XPC_P_AS_INACTIVE 0x00 /* partition is not active */
...@@ -820,6 +876,7 @@ extern struct xpc_registration xpc_registrations[]; ...@@ -820,6 +876,7 @@ extern struct xpc_registration xpc_registrations[];
/* found in xpc_main.c */ /* found in xpc_main.c */
extern struct device *xpc_part; extern struct device *xpc_part;
extern struct device *xpc_chan; extern struct device *xpc_chan;
extern struct xpc_arch_operations xpc_arch_ops;
extern int xpc_disengage_timelimit; extern int xpc_disengage_timelimit;
extern int xpc_disengage_timedout; extern int xpc_disengage_timedout;
extern int xpc_activate_IRQ_rcvd; extern int xpc_activate_IRQ_rcvd;
...@@ -830,61 +887,6 @@ extern void xpc_activate_partition(struct xpc_partition *); ...@@ -830,61 +887,6 @@ extern void xpc_activate_partition(struct xpc_partition *);
extern void xpc_activate_kthreads(struct xpc_channel *, int); extern void xpc_activate_kthreads(struct xpc_channel *, int);
extern void xpc_create_kthreads(struct xpc_channel *, int, int); extern void xpc_create_kthreads(struct xpc_channel *, int, int);
extern void xpc_disconnect_wait(int); extern void xpc_disconnect_wait(int);
extern int (*xpc_setup_partitions_sn) (void);
extern void (*xpc_teardown_partitions_sn) (void);
extern enum xp_retval (*xpc_get_partition_rsvd_page_pa) (void *, u64 *,
unsigned long *,
size_t *);
extern int (*xpc_setup_rsvd_page_sn) (struct xpc_rsvd_page *);
extern void (*xpc_heartbeat_init) (void);
extern void (*xpc_heartbeat_exit) (void);
extern void (*xpc_increment_heartbeat) (void);
extern void (*xpc_offline_heartbeat) (void);
extern void (*xpc_online_heartbeat) (void);
extern enum xp_retval (*xpc_get_remote_heartbeat) (struct xpc_partition *);
extern void (*xpc_allow_hb) (short);
extern void (*xpc_disallow_hb) (short);
extern void (*xpc_disallow_all_hbs) (void);
extern enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *);
extern u64 (*xpc_get_chctl_all_flags) (struct xpc_partition *);
extern enum xp_retval (*xpc_setup_msg_structures) (struct xpc_channel *);
extern void (*xpc_teardown_msg_structures) (struct xpc_channel *);
extern void (*xpc_notify_senders_of_disconnect) (struct xpc_channel *);
extern void (*xpc_process_msg_chctl_flags) (struct xpc_partition *, int);
extern int (*xpc_n_of_deliverable_payloads) (struct xpc_channel *);
extern void *(*xpc_get_deliverable_payload) (struct xpc_channel *);
extern void (*xpc_request_partition_activation) (struct xpc_rsvd_page *,
unsigned long, int);
extern void (*xpc_request_partition_reactivation) (struct xpc_partition *);
extern void (*xpc_request_partition_deactivation) (struct xpc_partition *);
extern void (*xpc_cancel_partition_deactivation_request) (
struct xpc_partition *);
extern void (*xpc_process_activate_IRQ_rcvd) (void);
extern enum xp_retval (*xpc_setup_ch_structures_sn) (struct xpc_partition *);
extern void (*xpc_teardown_ch_structures_sn) (struct xpc_partition *);
extern void (*xpc_indicate_partition_engaged) (struct xpc_partition *);
extern int (*xpc_partition_engaged) (short);
extern int (*xpc_any_partition_engaged) (void);
extern void (*xpc_indicate_partition_disengaged) (struct xpc_partition *);
extern void (*xpc_assume_partition_disengaged) (short);
extern void (*xpc_send_chctl_closerequest) (struct xpc_channel *,
unsigned long *);
extern void (*xpc_send_chctl_closereply) (struct xpc_channel *,
unsigned long *);
extern void (*xpc_send_chctl_openrequest) (struct xpc_channel *,
unsigned long *);
extern void (*xpc_send_chctl_openreply) (struct xpc_channel *, unsigned long *);
extern void (*xpc_send_chctl_opencomplete) (struct xpc_channel *,
unsigned long *);
extern enum xp_retval (*xpc_save_remote_msgqueue_pa) (struct xpc_channel *,
unsigned long);
extern enum xp_retval (*xpc_send_payload) (struct xpc_channel *, u32, void *,
u16, u8, xpc_notify_func, void *);
extern void (*xpc_received_payload) (struct xpc_channel *, void *);
/* found in xpc_sn2.c */ /* found in xpc_sn2.c */
extern int xpc_init_sn2(void); extern int xpc_init_sn2(void);
......
...@@ -39,7 +39,7 @@ xpc_process_connect(struct xpc_channel *ch, unsigned long *irq_flags) ...@@ -39,7 +39,7 @@ xpc_process_connect(struct xpc_channel *ch, unsigned long *irq_flags)
if (!(ch->flags & XPC_C_SETUP)) { if (!(ch->flags & XPC_C_SETUP)) {
spin_unlock_irqrestore(&ch->lock, *irq_flags); spin_unlock_irqrestore(&ch->lock, *irq_flags);
ret = xpc_setup_msg_structures(ch); ret = xpc_arch_ops.setup_msg_structures(ch);
spin_lock_irqsave(&ch->lock, *irq_flags); spin_lock_irqsave(&ch->lock, *irq_flags);
if (ret != xpSuccess) if (ret != xpSuccess)
...@@ -53,7 +53,7 @@ xpc_process_connect(struct xpc_channel *ch, unsigned long *irq_flags) ...@@ -53,7 +53,7 @@ xpc_process_connect(struct xpc_channel *ch, unsigned long *irq_flags)
if (!(ch->flags & XPC_C_OPENREPLY)) { if (!(ch->flags & XPC_C_OPENREPLY)) {
ch->flags |= XPC_C_OPENREPLY; ch->flags |= XPC_C_OPENREPLY;
xpc_send_chctl_openreply(ch, irq_flags); xpc_arch_ops.send_chctl_openreply(ch, irq_flags);
} }
if (!(ch->flags & XPC_C_ROPENREPLY)) if (!(ch->flags & XPC_C_ROPENREPLY))
...@@ -61,7 +61,7 @@ xpc_process_connect(struct xpc_channel *ch, unsigned long *irq_flags) ...@@ -61,7 +61,7 @@ xpc_process_connect(struct xpc_channel *ch, unsigned long *irq_flags)
if (!(ch->flags & XPC_C_OPENCOMPLETE)) { if (!(ch->flags & XPC_C_OPENCOMPLETE)) {
ch->flags |= (XPC_C_OPENCOMPLETE | XPC_C_CONNECTED); ch->flags |= (XPC_C_OPENCOMPLETE | XPC_C_CONNECTED);
xpc_send_chctl_opencomplete(ch, irq_flags); xpc_arch_ops.send_chctl_opencomplete(ch, irq_flags);
} }
if (!(ch->flags & XPC_C_ROPENCOMPLETE)) if (!(ch->flags & XPC_C_ROPENCOMPLETE))
...@@ -100,7 +100,7 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags) ...@@ -100,7 +100,7 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
if (part->act_state == XPC_P_AS_DEACTIVATING) { if (part->act_state == XPC_P_AS_DEACTIVATING) {
/* can't proceed until the other side disengages from us */ /* can't proceed until the other side disengages from us */
if (xpc_partition_engaged(ch->partid)) if (xpc_arch_ops.partition_engaged(ch->partid))
return; return;
} else { } else {
...@@ -112,7 +112,7 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags) ...@@ -112,7 +112,7 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
if (!(ch->flags & XPC_C_CLOSEREPLY)) { if (!(ch->flags & XPC_C_CLOSEREPLY)) {
ch->flags |= XPC_C_CLOSEREPLY; ch->flags |= XPC_C_CLOSEREPLY;
xpc_send_chctl_closereply(ch, irq_flags); xpc_arch_ops.send_chctl_closereply(ch, irq_flags);
} }
if (!(ch->flags & XPC_C_RCLOSEREPLY)) if (!(ch->flags & XPC_C_RCLOSEREPLY))
...@@ -122,7 +122,7 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags) ...@@ -122,7 +122,7 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
/* wake those waiting for notify completion */ /* wake those waiting for notify completion */
if (atomic_read(&ch->n_to_notify) > 0) { if (atomic_read(&ch->n_to_notify) > 0) {
/* we do callout while holding ch->lock, callout can't block */ /* we do callout while holding ch->lock, callout can't block */
xpc_notify_senders_of_disconnect(ch); xpc_arch_ops.notify_senders_of_disconnect(ch);
} }
/* both sides are disconnected now */ /* both sides are disconnected now */
...@@ -136,7 +136,7 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags) ...@@ -136,7 +136,7 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
DBUG_ON(atomic_read(&ch->n_to_notify) != 0); DBUG_ON(atomic_read(&ch->n_to_notify) != 0);
/* it's now safe to free the channel's message queues */ /* it's now safe to free the channel's message queues */
xpc_teardown_msg_structures(ch); xpc_arch_ops.teardown_msg_structures(ch);
ch->func = NULL; ch->func = NULL;
ch->key = NULL; ch->key = NULL;
...@@ -148,8 +148,9 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags) ...@@ -148,8 +148,9 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
/* /*
* Mark the channel disconnected and clear all other flags, including * Mark the channel disconnected and clear all other flags, including
* XPC_C_SETUP (because of call to xpc_teardown_msg_structures()) but * XPC_C_SETUP (because of call to
* not including XPC_C_WDISCONNECT (if it was set). * xpc_arch_ops.teardown_msg_structures()) but not including
* XPC_C_WDISCONNECT (if it was set).
*/ */
ch->flags = (XPC_C_DISCONNECTED | (ch->flags & XPC_C_WDISCONNECT)); ch->flags = (XPC_C_DISCONNECTED | (ch->flags & XPC_C_WDISCONNECT));
...@@ -395,7 +396,8 @@ xpc_process_openclose_chctl_flags(struct xpc_partition *part, int ch_number, ...@@ -395,7 +396,8 @@ xpc_process_openclose_chctl_flags(struct xpc_partition *part, int ch_number,
DBUG_ON(args->local_nentries == 0); DBUG_ON(args->local_nentries == 0);
DBUG_ON(args->remote_nentries == 0); DBUG_ON(args->remote_nentries == 0);
ret = xpc_save_remote_msgqueue_pa(ch, args->local_msgqueue_pa); ret = xpc_arch_ops.save_remote_msgqueue_pa(ch,
args->local_msgqueue_pa);
if (ret != xpSuccess) { if (ret != xpSuccess) {
XPC_DISCONNECT_CHANNEL(ch, ret, &irq_flags); XPC_DISCONNECT_CHANNEL(ch, ret, &irq_flags);
goto out; goto out;
...@@ -531,7 +533,7 @@ xpc_connect_channel(struct xpc_channel *ch) ...@@ -531,7 +533,7 @@ xpc_connect_channel(struct xpc_channel *ch)
/* initiate the connection */ /* initiate the connection */
ch->flags |= (XPC_C_OPENREQUEST | XPC_C_CONNECTING); ch->flags |= (XPC_C_OPENREQUEST | XPC_C_CONNECTING);
xpc_send_chctl_openrequest(ch, &irq_flags); xpc_arch_ops.send_chctl_openrequest(ch, &irq_flags);
xpc_process_connect(ch, &irq_flags); xpc_process_connect(ch, &irq_flags);
...@@ -549,7 +551,7 @@ xpc_process_sent_chctl_flags(struct xpc_partition *part) ...@@ -549,7 +551,7 @@ xpc_process_sent_chctl_flags(struct xpc_partition *part)
int ch_number; int ch_number;
u32 ch_flags; u32 ch_flags;
chctl.all_flags = xpc_get_chctl_all_flags(part); chctl.all_flags = xpc_arch_ops.get_chctl_all_flags(part);
/* /*
* Initiate channel connections for registered channels. * Initiate channel connections for registered channels.
...@@ -598,7 +600,7 @@ xpc_process_sent_chctl_flags(struct xpc_partition *part) ...@@ -598,7 +600,7 @@ xpc_process_sent_chctl_flags(struct xpc_partition *part)
*/ */
if (chctl.flags[ch_number] & XPC_MSG_CHCTL_FLAGS) if (chctl.flags[ch_number] & XPC_MSG_CHCTL_FLAGS)
xpc_process_msg_chctl_flags(part, ch_number); xpc_arch_ops.process_msg_chctl_flags(part, ch_number);
} }
} }
...@@ -774,7 +776,7 @@ xpc_disconnect_channel(const int line, struct xpc_channel *ch, ...@@ -774,7 +776,7 @@ xpc_disconnect_channel(const int line, struct xpc_channel *ch,
XPC_C_ROPENREQUEST | XPC_C_ROPENREPLY | XPC_C_ROPENREQUEST | XPC_C_ROPENREPLY |
XPC_C_CONNECTING | XPC_C_CONNECTED); XPC_C_CONNECTING | XPC_C_CONNECTED);
xpc_send_chctl_closerequest(ch, irq_flags); xpc_arch_ops.send_chctl_closerequest(ch, irq_flags);
if (channel_was_connected) if (channel_was_connected)
ch->flags |= XPC_C_WASCONNECTED; ch->flags |= XPC_C_WASCONNECTED;
...@@ -881,8 +883,8 @@ xpc_initiate_send(short partid, int ch_number, u32 flags, void *payload, ...@@ -881,8 +883,8 @@ xpc_initiate_send(short partid, int ch_number, u32 flags, void *payload,
DBUG_ON(payload == NULL); DBUG_ON(payload == NULL);
if (xpc_part_ref(part)) { if (xpc_part_ref(part)) {
ret = xpc_send_payload(&part->channels[ch_number], flags, ret = xpc_arch_ops.send_payload(&part->channels[ch_number],
payload, payload_size, 0, NULL, NULL); flags, payload, payload_size, 0, NULL, NULL);
xpc_part_deref(part); xpc_part_deref(part);
} }
...@@ -933,9 +935,8 @@ xpc_initiate_send_notify(short partid, int ch_number, u32 flags, void *payload, ...@@ -933,9 +935,8 @@ xpc_initiate_send_notify(short partid, int ch_number, u32 flags, void *payload,
DBUG_ON(func == NULL); DBUG_ON(func == NULL);
if (xpc_part_ref(part)) { if (xpc_part_ref(part)) {
ret = xpc_send_payload(&part->channels[ch_number], flags, ret = xpc_arch_ops.send_payload(&part->channels[ch_number],
payload, payload_size, XPC_N_CALL, func, flags, payload, payload_size, XPC_N_CALL, func, key);
key);
xpc_part_deref(part); xpc_part_deref(part);
} }
return ret; return ret;
...@@ -949,7 +950,7 @@ xpc_deliver_payload(struct xpc_channel *ch) ...@@ -949,7 +950,7 @@ xpc_deliver_payload(struct xpc_channel *ch)
{ {
void *payload; void *payload;
payload = xpc_get_deliverable_payload(ch); payload = xpc_arch_ops.get_deliverable_payload(ch);
if (payload != NULL) { if (payload != NULL) {
/* /*
...@@ -1003,7 +1004,7 @@ xpc_initiate_received(short partid, int ch_number, void *payload) ...@@ -1003,7 +1004,7 @@ xpc_initiate_received(short partid, int ch_number, void *payload)
DBUG_ON(ch_number < 0 || ch_number >= part->nchannels); DBUG_ON(ch_number < 0 || ch_number >= part->nchannels);
ch = &part->channels[ch_number]; ch = &part->channels[ch_number];
xpc_received_payload(ch, payload); xpc_arch_ops.received_payload(ch, payload);
/* the call to xpc_msgqueue_ref() was done by xpc_deliver_payload() */ /* the call to xpc_msgqueue_ref() was done by xpc_deliver_payload() */
xpc_msgqueue_deref(ch); xpc_msgqueue_deref(ch);
......
This diff is collapsed.
...@@ -70,6 +70,9 @@ xpc_get_rsvd_page_pa(int nasid) ...@@ -70,6 +70,9 @@ xpc_get_rsvd_page_pa(int nasid)
size_t buf_len = 0; size_t buf_len = 0;
void *buf = buf; void *buf = buf;
void *buf_base = NULL; void *buf_base = NULL;
enum xp_retval (*get_partition_rsvd_page_pa)
(void *, u64 *, unsigned long *, size_t *) =
xpc_arch_ops.get_partition_rsvd_page_pa;
while (1) { while (1) {
...@@ -79,8 +82,7 @@ xpc_get_rsvd_page_pa(int nasid) ...@@ -79,8 +82,7 @@ xpc_get_rsvd_page_pa(int nasid)
* ??? function or have two versions? Rename rp_pa for UV to * ??? function or have two versions? Rename rp_pa for UV to
* ??? rp_gpa? * ??? rp_gpa?
*/ */
ret = xpc_get_partition_rsvd_page_pa(buf, &cookie, &rp_pa, ret = get_partition_rsvd_page_pa(buf, &cookie, &rp_pa, &len);
&len);
dev_dbg(xpc_part, "SAL returned with ret=%d, cookie=0x%016lx, " dev_dbg(xpc_part, "SAL returned with ret=%d, cookie=0x%016lx, "
"address=0x%016lx, len=0x%016lx\n", ret, "address=0x%016lx, len=0x%016lx\n", ret,
...@@ -172,7 +174,7 @@ xpc_setup_rsvd_page(void) ...@@ -172,7 +174,7 @@ xpc_setup_rsvd_page(void)
xpc_part_nasids = XPC_RP_PART_NASIDS(rp); xpc_part_nasids = XPC_RP_PART_NASIDS(rp);
xpc_mach_nasids = XPC_RP_MACH_NASIDS(rp); xpc_mach_nasids = XPC_RP_MACH_NASIDS(rp);
ret = xpc_setup_rsvd_page_sn(rp); ret = xpc_arch_ops.setup_rsvd_page(rp);
if (ret != 0) if (ret != 0)
return ret; return ret;
...@@ -264,7 +266,7 @@ xpc_partition_disengaged(struct xpc_partition *part) ...@@ -264,7 +266,7 @@ xpc_partition_disengaged(struct xpc_partition *part)
short partid = XPC_PARTID(part); short partid = XPC_PARTID(part);
int disengaged; int disengaged;
disengaged = !xpc_partition_engaged(partid); disengaged = !xpc_arch_ops.partition_engaged(partid);
if (part->disengage_timeout) { if (part->disengage_timeout) {
if (!disengaged) { if (!disengaged) {
if (time_is_after_jiffies(part->disengage_timeout)) { if (time_is_after_jiffies(part->disengage_timeout)) {
...@@ -280,7 +282,7 @@ xpc_partition_disengaged(struct xpc_partition *part) ...@@ -280,7 +282,7 @@ xpc_partition_disengaged(struct xpc_partition *part)
dev_info(xpc_part, "deactivate request to remote " dev_info(xpc_part, "deactivate request to remote "
"partition %d timed out\n", partid); "partition %d timed out\n", partid);
xpc_disengage_timedout = 1; xpc_disengage_timedout = 1;
xpc_assume_partition_disengaged(partid); xpc_arch_ops.assume_partition_disengaged(partid);
disengaged = 1; disengaged = 1;
} }
part->disengage_timeout = 0; part->disengage_timeout = 0;
...@@ -294,7 +296,7 @@ xpc_partition_disengaged(struct xpc_partition *part) ...@@ -294,7 +296,7 @@ xpc_partition_disengaged(struct xpc_partition *part)
if (part->act_state != XPC_P_AS_INACTIVE) if (part->act_state != XPC_P_AS_INACTIVE)
xpc_wakeup_channel_mgr(part); xpc_wakeup_channel_mgr(part);
xpc_cancel_partition_deactivation_request(part); xpc_arch_ops.cancel_partition_deactivation_request(part);
} }
return disengaged; return disengaged;
} }
...@@ -339,7 +341,7 @@ xpc_deactivate_partition(const int line, struct xpc_partition *part, ...@@ -339,7 +341,7 @@ xpc_deactivate_partition(const int line, struct xpc_partition *part,
spin_unlock_irqrestore(&part->act_lock, irq_flags); spin_unlock_irqrestore(&part->act_lock, irq_flags);
if (reason == xpReactivating) { if (reason == xpReactivating) {
/* we interrupt ourselves to reactivate partition */ /* we interrupt ourselves to reactivate partition */
xpc_request_partition_reactivation(part); xpc_arch_ops.request_partition_reactivation(part);
} }
return; return;
} }
...@@ -358,7 +360,7 @@ xpc_deactivate_partition(const int line, struct xpc_partition *part, ...@@ -358,7 +360,7 @@ xpc_deactivate_partition(const int line, struct xpc_partition *part,
spin_unlock_irqrestore(&part->act_lock, irq_flags); spin_unlock_irqrestore(&part->act_lock, irq_flags);
/* ask remote partition to deactivate with regard to us */ /* ask remote partition to deactivate with regard to us */
xpc_request_partition_deactivation(part); xpc_arch_ops.request_partition_deactivation(part);
/* set a timelimit on the disengage phase of the deactivation request */ /* set a timelimit on the disengage phase of the deactivation request */
part->disengage_timeout = jiffies + (xpc_disengage_timelimit * HZ); part->disengage_timeout = jiffies + (xpc_disengage_timelimit * HZ);
...@@ -496,7 +498,7 @@ xpc_discovery(void) ...@@ -496,7 +498,7 @@ xpc_discovery(void)
continue; continue;
} }
xpc_request_partition_activation(remote_rp, xpc_arch_ops.request_partition_activation(remote_rp,
remote_rp_pa, nasid); remote_rp_pa, nasid);
} }
} }
......
...@@ -60,14 +60,14 @@ static struct xpc_vars_sn2 *xpc_vars_sn2; ...@@ -60,14 +60,14 @@ static struct xpc_vars_sn2 *xpc_vars_sn2;
static struct xpc_vars_part_sn2 *xpc_vars_part_sn2; static struct xpc_vars_part_sn2 *xpc_vars_part_sn2;
static int static int
xpc_setup_partitions_sn_sn2(void) xpc_setup_partitions_sn2(void)
{ {
/* nothing needs to be done */ /* nothing needs to be done */
return 0; return 0;
} }
static void static void
xpc_teardown_partitions_sn_sn2(void) xpc_teardown_partitions_sn2(void)
{ {
/* nothing needs to be done */ /* nothing needs to be done */
} }
...@@ -628,7 +628,7 @@ xpc_get_partition_rsvd_page_pa_sn2(void *buf, u64 *cookie, unsigned long *rp_pa, ...@@ -628,7 +628,7 @@ xpc_get_partition_rsvd_page_pa_sn2(void *buf, u64 *cookie, unsigned long *rp_pa,
static int static int
xpc_setup_rsvd_page_sn_sn2(struct xpc_rsvd_page *rp) xpc_setup_rsvd_page_sn2(struct xpc_rsvd_page *rp)
{ {
struct amo *amos_page; struct amo *amos_page;
int i; int i;
...@@ -1162,7 +1162,7 @@ xpc_process_activate_IRQ_rcvd_sn2(void) ...@@ -1162,7 +1162,7 @@ xpc_process_activate_IRQ_rcvd_sn2(void)
* Setup the channel structures that are sn2 specific. * Setup the channel structures that are sn2 specific.
*/ */
static enum xp_retval static enum xp_retval
xpc_setup_ch_structures_sn_sn2(struct xpc_partition *part) xpc_setup_ch_structures_sn2(struct xpc_partition *part)
{ {
struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2; struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2;
struct xpc_channel_sn2 *ch_sn2; struct xpc_channel_sn2 *ch_sn2;
...@@ -1284,7 +1284,7 @@ xpc_setup_ch_structures_sn_sn2(struct xpc_partition *part) ...@@ -1284,7 +1284,7 @@ xpc_setup_ch_structures_sn_sn2(struct xpc_partition *part)
* Teardown the channel structures that are sn2 specific. * Teardown the channel structures that are sn2 specific.
*/ */
static void static void
xpc_teardown_ch_structures_sn_sn2(struct xpc_partition *part) xpc_teardown_ch_structures_sn2(struct xpc_partition *part)
{ {
struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2; struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2;
short partid = XPC_PARTID(part); short partid = XPC_PARTID(part);
...@@ -2348,66 +2348,70 @@ xpc_received_payload_sn2(struct xpc_channel *ch, void *payload) ...@@ -2348,66 +2348,70 @@ xpc_received_payload_sn2(struct xpc_channel *ch, void *payload)
xpc_acknowledge_msgs_sn2(ch, get, msg->flags); xpc_acknowledge_msgs_sn2(ch, get, msg->flags);
} }
static struct xpc_arch_operations xpc_arch_ops_sn2 = {
.setup_partitions = xpc_setup_partitions_sn2,
.teardown_partitions = xpc_teardown_partitions_sn2,
.process_activate_IRQ_rcvd = xpc_process_activate_IRQ_rcvd_sn2,
.get_partition_rsvd_page_pa = xpc_get_partition_rsvd_page_pa_sn2,
.setup_rsvd_page = xpc_setup_rsvd_page_sn2,
.allow_hb = xpc_allow_hb_sn2,
.disallow_hb = xpc_disallow_hb_sn2,
.disallow_all_hbs = xpc_disallow_all_hbs_sn2,
.increment_heartbeat = xpc_increment_heartbeat_sn2,
.offline_heartbeat = xpc_offline_heartbeat_sn2,
.online_heartbeat = xpc_online_heartbeat_sn2,
.heartbeat_init = xpc_heartbeat_init_sn2,
.heartbeat_exit = xpc_heartbeat_exit_sn2,
.get_remote_heartbeat = xpc_get_remote_heartbeat_sn2,
.request_partition_activation =
xpc_request_partition_activation_sn2,
.request_partition_reactivation =
xpc_request_partition_reactivation_sn2,
.request_partition_deactivation =
xpc_request_partition_deactivation_sn2,
.cancel_partition_deactivation_request =
xpc_cancel_partition_deactivation_request_sn2,
.setup_ch_structures = xpc_setup_ch_structures_sn2,
.teardown_ch_structures = xpc_teardown_ch_structures_sn2,
.make_first_contact = xpc_make_first_contact_sn2,
.get_chctl_all_flags = xpc_get_chctl_all_flags_sn2,
.send_chctl_closerequest = xpc_send_chctl_closerequest_sn2,
.send_chctl_closereply = xpc_send_chctl_closereply_sn2,
.send_chctl_openrequest = xpc_send_chctl_openrequest_sn2,
.send_chctl_openreply = xpc_send_chctl_openreply_sn2,
.send_chctl_opencomplete = xpc_send_chctl_opencomplete_sn2,
.process_msg_chctl_flags = xpc_process_msg_chctl_flags_sn2,
.save_remote_msgqueue_pa = xpc_save_remote_msgqueue_pa_sn2,
.setup_msg_structures = xpc_setup_msg_structures_sn2,
.teardown_msg_structures = xpc_teardown_msg_structures_sn2,
.indicate_partition_engaged = xpc_indicate_partition_engaged_sn2,
.indicate_partition_disengaged = xpc_indicate_partition_disengaged_sn2,
.partition_engaged = xpc_partition_engaged_sn2,
.any_partition_engaged = xpc_any_partition_engaged_sn2,
.assume_partition_disengaged = xpc_assume_partition_disengaged_sn2,
.n_of_deliverable_payloads = xpc_n_of_deliverable_payloads_sn2,
.send_payload = xpc_send_payload_sn2,
.get_deliverable_payload = xpc_get_deliverable_payload_sn2,
.received_payload = xpc_received_payload_sn2,
.notify_senders_of_disconnect = xpc_notify_senders_of_disconnect_sn2,
};
int int
xpc_init_sn2(void) xpc_init_sn2(void)
{ {
int ret; int ret;
size_t buf_size; size_t buf_size;
xpc_setup_partitions_sn = xpc_setup_partitions_sn_sn2; xpc_arch_ops = xpc_arch_ops_sn2;
xpc_teardown_partitions_sn = xpc_teardown_partitions_sn_sn2;
xpc_get_partition_rsvd_page_pa = xpc_get_partition_rsvd_page_pa_sn2;
xpc_setup_rsvd_page_sn = xpc_setup_rsvd_page_sn_sn2;
xpc_allow_hb = xpc_allow_hb_sn2;
xpc_disallow_hb = xpc_disallow_hb_sn2;
xpc_disallow_all_hbs = xpc_disallow_all_hbs_sn2;
xpc_increment_heartbeat = xpc_increment_heartbeat_sn2;
xpc_offline_heartbeat = xpc_offline_heartbeat_sn2;
xpc_online_heartbeat = xpc_online_heartbeat_sn2;
xpc_heartbeat_init = xpc_heartbeat_init_sn2;
xpc_heartbeat_exit = xpc_heartbeat_exit_sn2;
xpc_get_remote_heartbeat = xpc_get_remote_heartbeat_sn2;
xpc_request_partition_activation = xpc_request_partition_activation_sn2;
xpc_request_partition_reactivation =
xpc_request_partition_reactivation_sn2;
xpc_request_partition_deactivation =
xpc_request_partition_deactivation_sn2;
xpc_cancel_partition_deactivation_request =
xpc_cancel_partition_deactivation_request_sn2;
xpc_process_activate_IRQ_rcvd = xpc_process_activate_IRQ_rcvd_sn2;
xpc_setup_ch_structures_sn = xpc_setup_ch_structures_sn_sn2;
xpc_teardown_ch_structures_sn = xpc_teardown_ch_structures_sn_sn2;
xpc_make_first_contact = xpc_make_first_contact_sn2;
xpc_get_chctl_all_flags = xpc_get_chctl_all_flags_sn2;
xpc_send_chctl_closerequest = xpc_send_chctl_closerequest_sn2;
xpc_send_chctl_closereply = xpc_send_chctl_closereply_sn2;
xpc_send_chctl_openrequest = xpc_send_chctl_openrequest_sn2;
xpc_send_chctl_openreply = xpc_send_chctl_openreply_sn2;
xpc_send_chctl_opencomplete = xpc_send_chctl_opencomplete_sn2;
xpc_save_remote_msgqueue_pa = xpc_save_remote_msgqueue_pa_sn2;
xpc_setup_msg_structures = xpc_setup_msg_structures_sn2;
xpc_teardown_msg_structures = xpc_teardown_msg_structures_sn2;
xpc_notify_senders_of_disconnect = xpc_notify_senders_of_disconnect_sn2;
xpc_process_msg_chctl_flags = xpc_process_msg_chctl_flags_sn2;
xpc_n_of_deliverable_payloads = xpc_n_of_deliverable_payloads_sn2;
xpc_get_deliverable_payload = xpc_get_deliverable_payload_sn2;
xpc_indicate_partition_engaged = xpc_indicate_partition_engaged_sn2;
xpc_indicate_partition_disengaged =
xpc_indicate_partition_disengaged_sn2;
xpc_partition_engaged = xpc_partition_engaged_sn2;
xpc_any_partition_engaged = xpc_any_partition_engaged_sn2;
xpc_assume_partition_disengaged = xpc_assume_partition_disengaged_sn2;
xpc_send_payload = xpc_send_payload_sn2;
xpc_received_payload = xpc_received_payload_sn2;
if (offsetof(struct xpc_msg_sn2, payload) > XPC_MSG_HDR_MAX_SIZE) { if (offsetof(struct xpc_msg_sn2, payload) > XPC_MSG_HDR_MAX_SIZE) {
dev_err(xpc_part, "header portion of struct xpc_msg_sn2 is " dev_err(xpc_part, "header portion of struct xpc_msg_sn2 is "
......
...@@ -62,7 +62,7 @@ static struct xpc_gru_mq_uv *xpc_activate_mq_uv; ...@@ -62,7 +62,7 @@ static struct xpc_gru_mq_uv *xpc_activate_mq_uv;
static struct xpc_gru_mq_uv *xpc_notify_mq_uv; static struct xpc_gru_mq_uv *xpc_notify_mq_uv;
static int static int
xpc_setup_partitions_sn_uv(void) xpc_setup_partitions_uv(void)
{ {
short partid; short partid;
struct xpc_partition_uv *part_uv; struct xpc_partition_uv *part_uv;
...@@ -78,7 +78,7 @@ xpc_setup_partitions_sn_uv(void) ...@@ -78,7 +78,7 @@ xpc_setup_partitions_sn_uv(void)
} }
static void static void
xpc_teardown_partitions_sn_uv(void) xpc_teardown_partitions_uv(void)
{ {
short partid; short partid;
struct xpc_partition_uv *part_uv; struct xpc_partition_uv *part_uv;
...@@ -782,7 +782,7 @@ xpc_get_partition_rsvd_page_pa_uv(void *buf, u64 *cookie, unsigned long *rp_pa, ...@@ -782,7 +782,7 @@ xpc_get_partition_rsvd_page_pa_uv(void *buf, u64 *cookie, unsigned long *rp_pa,
} }
static int static int
xpc_setup_rsvd_page_sn_uv(struct xpc_rsvd_page *rp) xpc_setup_rsvd_page_uv(struct xpc_rsvd_page *rp)
{ {
xpc_heartbeat_uv = xpc_heartbeat_uv =
&xpc_partitions[sn_partition_id].sn.uv.cached_heartbeat; &xpc_partitions[sn_partition_id].sn.uv.cached_heartbeat;
...@@ -980,7 +980,7 @@ xpc_n_of_fifo_entries_uv(struct xpc_fifo_head_uv *head) ...@@ -980,7 +980,7 @@ xpc_n_of_fifo_entries_uv(struct xpc_fifo_head_uv *head)
* Setup the channel structures that are uv specific. * Setup the channel structures that are uv specific.
*/ */
static enum xp_retval static enum xp_retval
xpc_setup_ch_structures_sn_uv(struct xpc_partition *part) xpc_setup_ch_structures_uv(struct xpc_partition *part)
{ {
struct xpc_channel_uv *ch_uv; struct xpc_channel_uv *ch_uv;
int ch_number; int ch_number;
...@@ -999,7 +999,7 @@ xpc_setup_ch_structures_sn_uv(struct xpc_partition *part) ...@@ -999,7 +999,7 @@ xpc_setup_ch_structures_sn_uv(struct xpc_partition *part)
* Teardown the channel structures that are uv specific. * Teardown the channel structures that are uv specific.
*/ */
static void static void
xpc_teardown_ch_structures_sn_uv(struct xpc_partition *part) xpc_teardown_ch_structures_uv(struct xpc_partition *part)
{ {
/* nothing needs to be done */ /* nothing needs to be done */
return; return;
...@@ -1649,63 +1649,67 @@ xpc_received_payload_uv(struct xpc_channel *ch, void *payload) ...@@ -1649,63 +1649,67 @@ xpc_received_payload_uv(struct xpc_channel *ch, void *payload)
msg->hdr.msg_slot_number += ch->remote_nentries; msg->hdr.msg_slot_number += ch->remote_nentries;
} }
static struct xpc_arch_operations xpc_arch_ops_uv = {
.setup_partitions = xpc_setup_partitions_uv,
.teardown_partitions = xpc_teardown_partitions_uv,
.process_activate_IRQ_rcvd = xpc_process_activate_IRQ_rcvd_uv,
.get_partition_rsvd_page_pa = xpc_get_partition_rsvd_page_pa_uv,
.setup_rsvd_page = xpc_setup_rsvd_page_uv,
.allow_hb = xpc_allow_hb_uv,
.disallow_hb = xpc_disallow_hb_uv,
.disallow_all_hbs = xpc_disallow_all_hbs_uv,
.increment_heartbeat = xpc_increment_heartbeat_uv,
.offline_heartbeat = xpc_offline_heartbeat_uv,
.online_heartbeat = xpc_online_heartbeat_uv,
.heartbeat_init = xpc_heartbeat_init_uv,
.heartbeat_exit = xpc_heartbeat_exit_uv,
.get_remote_heartbeat = xpc_get_remote_heartbeat_uv,
.request_partition_activation =
xpc_request_partition_activation_uv,
.request_partition_reactivation =
xpc_request_partition_reactivation_uv,
.request_partition_deactivation =
xpc_request_partition_deactivation_uv,
.cancel_partition_deactivation_request =
xpc_cancel_partition_deactivation_request_uv,
.setup_ch_structures = xpc_setup_ch_structures_uv,
.teardown_ch_structures = xpc_teardown_ch_structures_uv,
.make_first_contact = xpc_make_first_contact_uv,
.get_chctl_all_flags = xpc_get_chctl_all_flags_uv,
.send_chctl_closerequest = xpc_send_chctl_closerequest_uv,
.send_chctl_closereply = xpc_send_chctl_closereply_uv,
.send_chctl_openrequest = xpc_send_chctl_openrequest_uv,
.send_chctl_openreply = xpc_send_chctl_openreply_uv,
.send_chctl_opencomplete = xpc_send_chctl_opencomplete_uv,
.process_msg_chctl_flags = xpc_process_msg_chctl_flags_uv,
.save_remote_msgqueue_pa = xpc_save_remote_msgqueue_pa_uv,
.setup_msg_structures = xpc_setup_msg_structures_uv,
.teardown_msg_structures = xpc_teardown_msg_structures_uv,
.indicate_partition_engaged = xpc_indicate_partition_engaged_uv,
.indicate_partition_disengaged = xpc_indicate_partition_disengaged_uv,
.assume_partition_disengaged = xpc_assume_partition_disengaged_uv,
.partition_engaged = xpc_partition_engaged_uv,
.any_partition_engaged = xpc_any_partition_engaged_uv,
.n_of_deliverable_payloads = xpc_n_of_deliverable_payloads_uv,
.send_payload = xpc_send_payload_uv,
.get_deliverable_payload = xpc_get_deliverable_payload_uv,
.received_payload = xpc_received_payload_uv,
.notify_senders_of_disconnect = xpc_notify_senders_of_disconnect_uv,
};
int int
xpc_init_uv(void) xpc_init_uv(void)
{ {
xpc_setup_partitions_sn = xpc_setup_partitions_sn_uv; xpc_arch_ops = xpc_arch_ops_uv;
xpc_teardown_partitions_sn = xpc_teardown_partitions_sn_uv;
xpc_process_activate_IRQ_rcvd = xpc_process_activate_IRQ_rcvd_uv;
xpc_get_partition_rsvd_page_pa = xpc_get_partition_rsvd_page_pa_uv;
xpc_setup_rsvd_page_sn = xpc_setup_rsvd_page_sn_uv;
xpc_allow_hb = xpc_allow_hb_uv;
xpc_disallow_hb = xpc_disallow_hb_uv;
xpc_disallow_all_hbs = xpc_disallow_all_hbs_uv;
xpc_increment_heartbeat = xpc_increment_heartbeat_uv;
xpc_offline_heartbeat = xpc_offline_heartbeat_uv;
xpc_online_heartbeat = xpc_online_heartbeat_uv;
xpc_heartbeat_init = xpc_heartbeat_init_uv;
xpc_heartbeat_exit = xpc_heartbeat_exit_uv;
xpc_get_remote_heartbeat = xpc_get_remote_heartbeat_uv;
xpc_request_partition_activation = xpc_request_partition_activation_uv;
xpc_request_partition_reactivation =
xpc_request_partition_reactivation_uv;
xpc_request_partition_deactivation =
xpc_request_partition_deactivation_uv;
xpc_cancel_partition_deactivation_request =
xpc_cancel_partition_deactivation_request_uv;
xpc_setup_ch_structures_sn = xpc_setup_ch_structures_sn_uv;
xpc_teardown_ch_structures_sn = xpc_teardown_ch_structures_sn_uv;
xpc_make_first_contact = xpc_make_first_contact_uv;
xpc_get_chctl_all_flags = xpc_get_chctl_all_flags_uv;
xpc_send_chctl_closerequest = xpc_send_chctl_closerequest_uv;
xpc_send_chctl_closereply = xpc_send_chctl_closereply_uv;
xpc_send_chctl_openrequest = xpc_send_chctl_openrequest_uv;
xpc_send_chctl_openreply = xpc_send_chctl_openreply_uv;
xpc_send_chctl_opencomplete = xpc_send_chctl_opencomplete_uv;
xpc_save_remote_msgqueue_pa = xpc_save_remote_msgqueue_pa_uv;
xpc_setup_msg_structures = xpc_setup_msg_structures_uv;
xpc_teardown_msg_structures = xpc_teardown_msg_structures_uv;
xpc_indicate_partition_engaged = xpc_indicate_partition_engaged_uv;
xpc_indicate_partition_disengaged =
xpc_indicate_partition_disengaged_uv;
xpc_assume_partition_disengaged = xpc_assume_partition_disengaged_uv;
xpc_partition_engaged = xpc_partition_engaged_uv;
xpc_any_partition_engaged = xpc_any_partition_engaged_uv;
xpc_n_of_deliverable_payloads = xpc_n_of_deliverable_payloads_uv;
xpc_process_msg_chctl_flags = xpc_process_msg_chctl_flags_uv;
xpc_send_payload = xpc_send_payload_uv;
xpc_notify_senders_of_disconnect = xpc_notify_senders_of_disconnect_uv;
xpc_get_deliverable_payload = xpc_get_deliverable_payload_uv;
xpc_received_payload = xpc_received_payload_uv;
if (sizeof(struct xpc_notify_mq_msghdr_uv) > XPC_MSG_HDR_MAX_SIZE) { if (sizeof(struct xpc_notify_mq_msghdr_uv) > XPC_MSG_HDR_MAX_SIZE) {
dev_err(xpc_part, "xpc_notify_mq_msghdr_uv is larger than %d\n", dev_err(xpc_part, "xpc_notify_mq_msghdr_uv is larger than %d\n",
......
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