Commit 7fb5e59d authored by Dean Nelson's avatar Dean Nelson Committed by Linus Torvalds

sgi-xp: separate chctl_flags from XPC's notify IRQ

Tie current IPI references to either XPC's notify IRQ or channel control
flags.
Signed-off-by: default avatarDean 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 a47d5dac
......@@ -186,9 +186,10 @@ struct xpc_vars_part_sn2 {
u64 openclose_args_pa; /* physical address of open and close args */
u64 GPs_pa; /* physical address of Get/Put values */
u64 IPI_amo_pa; /* physical address of IPI AMO_t structure */
int IPI_nasid; /* nasid of where to send IPIs */
int IPI_phys_cpuid; /* physical CPU ID of where to send IPIs */
u64 chctl_amo_pa; /* physical address of chctl flags' AMO_t */
int notify_IRQ_nasid; /* nasid of where to send notify IRQs */
int notify_IRQ_phys_cpuid; /* CPUID of where to send notify IRQs */
u8 nchannels; /* #of defined channels supported */
......@@ -407,7 +408,7 @@ struct xpc_channel {
atomic_t n_on_msg_allocate_wq; /* #on msg allocation wait queue */
wait_queue_head_t msg_allocate_wq; /* msg allocation wait queue */
u8 delayed_IPI_flags; /* IPI flags received, but delayed */
u8 delayed_chctl_flags; /* chctl flags received, but delayed */
/* action until channel disconnected */
/* queue of msg senders who want to be notified when msg received */
......@@ -469,6 +470,54 @@ struct xpc_channel {
0x00020000 /* disconnecting callout completed */
#define XPC_C_WDISCONNECT 0x00040000 /* waiting for channel disconnect */
/*
* The channel control flags (chctl) union consists of a 64-bit variable which
* is divided up into eight bytes, ordered from right to left. Byte zero
* pertains to channel 0, byte one to channel 1, and so on. Each channel's byte
* can have one or more of the chctl flags set in it.
*/
union xpc_channel_ctl_flags {
u64 all_flags;
u8 flags[XPC_MAX_NCHANNELS];
};
/* chctl flags */
#define XPC_CHCTL_CLOSEREQUEST 0x01
#define XPC_CHCTL_CLOSEREPLY 0x02
#define XPC_CHCTL_OPENREQUEST 0x04
#define XPC_CHCTL_OPENREPLY 0x08
#define XPC_CHCTL_MSGREQUEST 0x10
#define XPC_OPENCLOSE_CHCTL_FLAGS \
(XPC_CHCTL_CLOSEREQUEST | XPC_CHCTL_CLOSEREPLY | \
XPC_CHCTL_OPENREQUEST | XPC_CHCTL_OPENREPLY)
#define XPC_MSG_CHCTL_FLAGS XPC_CHCTL_MSGREQUEST
static inline int
xpc_any_openclose_chctl_flags_set(union xpc_channel_ctl_flags *chctl)
{
int ch_number;
for (ch_number = 0; ch_number < XPC_MAX_NCHANNELS; ch_number++) {
if (chctl->flags[ch_number] & XPC_OPENCLOSE_CHCTL_FLAGS)
return 1;
}
return 0;
}
static inline int
xpc_any_msg_chctl_flags_set(union xpc_channel_ctl_flags *chctl)
{
int ch_number;
for (ch_number = 0; ch_number < XPC_MAX_NCHANNELS; ch_number++) {
if (chctl->flags[ch_number] & XPC_MSG_CHCTL_FLAGS)
return 1;
}
return 0;
}
/*
* Manages channels on a partition basis. There is one of these structures
* for each partition (a partition will never utilize the structure that
......@@ -494,12 +543,12 @@ struct xpc_partition_sn2 {
u64 remote_openclose_args_pa; /* phys addr of remote's args */
int remote_IPI_nasid; /* nasid of where to send IPIs */
int remote_IPI_phys_cpuid; /* phys CPU ID of where to send IPIs */
char IPI_owner[8]; /* IPI owner's name */
int notify_IRQ_nasid; /* nasid of where to send notify IRQs */
int notify_IRQ_phys_cpuid; /* CPUID of where to send notify IRQs */
char notify_IRQ_owner[8]; /* notify IRQ's owner's name */
AMO_t *remote_IPI_amo_va; /* address of remote IPI AMO_t structure */
AMO_t *local_IPI_amo_va; /* address of IPI AMO_t structure */
AMO_t *remote_chctl_amo_va; /* address of remote chctl flags' AMO_t */
AMO_t *local_chctl_amo_va; /* address of chctl flags' AMO_t */
struct timer_list dropped_notify_IRQ_timer; /* dropped IRQ timer */
};
......@@ -536,7 +585,10 @@ struct xpc_partition {
atomic_t nchannels_engaged; /* #of channels engaged with remote part */
struct xpc_channel *channels; /* array of channel structures */
/* fields used to pass args when opening or closing a channel */
/* fields used for managing channel avialability and activity */
union xpc_channel_ctl_flags chctl; /* chctl flags yet to be processed */
spinlock_t chctl_lock; /* chctl flags lock */
void *local_openclose_args_base; /* base address of kmalloc'd space */
struct xpc_openclose_args *local_openclose_args; /* local's args */
......@@ -544,11 +596,6 @@ struct xpc_partition {
struct xpc_openclose_args *remote_openclose_args; /* copy of remote's */
/* args */
/* IPI sending, receiving and handling related fields */
u64 local_IPI_amo; /* IPI amo flags yet to be handled */
spinlock_t IPI_lock; /* IPI handler lock */
/* channel manager related fields */
atomic_t channel_mgr_requests; /* #of requests to activate chan mgr */
......@@ -580,11 +627,12 @@ struct xpc_partition {
#define XPC_P_TORNDOWN 0x03 /* infrastructure is torndown */
/*
* struct xpc_partition IPI_timer #of seconds to wait before checking for
* dropped IPIs. These occur whenever an IPI amo write doesn't complete until
* after the IPI was received.
* struct xpc_partition_sn2's dropped notify IRQ timer is set to wait the
* following interval #of seconds before checking for dropped notify IRQs.
* These can occur whenever an IRQ's associated amo write doesn't complete
* until after the IRQ was received.
*/
#define XPC_P_DROPPED_IPI_WAIT_INTERVAL (0.25 * HZ)
#define XPC_DROPPED_NOTIFY_IRQ_WAIT_INTERVAL (0.25 * HZ)
/* number of seconds to wait for other partitions to disengage */
#define XPC_DISENGAGE_DEFAULT_TIMELIMIT 90
......@@ -617,9 +665,9 @@ extern void (*xpc_offline_heartbeat) (void);
extern void (*xpc_online_heartbeat) (void);
extern void (*xpc_check_remote_hb) (void);
extern enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *);
extern u64 (*xpc_get_IPI_flags) (struct xpc_partition *);
extern u64 (*xpc_get_chctl_all_flags) (struct xpc_partition *);
extern void (*xpc_notify_senders_of_disconnect) (struct xpc_channel *);
extern void (*xpc_process_msg_IPI) (struct xpc_partition *, int);
extern void (*xpc_process_msg_chctl_flags) (struct xpc_partition *, int);
extern int (*xpc_n_of_deliverable_msgs) (struct xpc_channel *);
extern struct xpc_msg *(*xpc_get_deliverable_msg) (struct xpc_channel *);
extern void (*xpc_request_partition_activation) (struct xpc_rsvd_page *, u64,
......@@ -638,14 +686,13 @@ 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_channel_closerequest) (struct xpc_channel *,
extern void (*xpc_send_chctl_closerequest) (struct xpc_channel *,
unsigned long *);
extern void (*xpc_send_channel_closereply) (struct xpc_channel *,
extern void (*xpc_send_chctl_closereply) (struct xpc_channel *,
unsigned long *);
extern void (*xpc_send_channel_openrequest) (struct xpc_channel *,
unsigned long *);
extern void (*xpc_send_channel_openreply) (struct xpc_channel *,
extern void (*xpc_send_chctl_openrequest) (struct xpc_channel *,
unsigned long *);
extern void (*xpc_send_chctl_openreply) (struct xpc_channel *, unsigned long *);
extern enum xp_retval (*xpc_send_msg) (struct xpc_channel *, u32, void *, u16,
u8, xpc_notify_func, void *);
......@@ -689,7 +736,7 @@ extern enum xp_retval xpc_initiate_send(short, int, u32, void *, u16);
extern enum xp_retval xpc_initiate_send_notify(short, int, u32, void *, u16,
xpc_notify_func, void *);
extern void xpc_initiate_received(short, int, void *);
extern void xpc_process_channel_activity(struct xpc_partition *);
extern void xpc_process_sent_chctl_flags(struct xpc_partition *);
extern void xpc_connected_callout(struct xpc_channel *);
extern void xpc_deliver_msg(struct xpc_channel *);
extern void xpc_disconnect_channel(const int, struct xpc_channel *,
......@@ -799,25 +846,4 @@ xpc_part_ref(struct xpc_partition *part)
(_p)->reason_line = _line; \
}
/*
* The sending and receiving of IPIs includes the setting of an >>>AMO variable
* to indicate the reason the IPI was sent. The 64-bit variable is divided
* up into eight bytes, ordered from right to left. Byte zero pertains to
* channel 0, byte one to channel 1, and so on. Each byte is described by
* the following IPI flags.
*/
#define XPC_IPI_CLOSEREQUEST 0x01
#define XPC_IPI_CLOSEREPLY 0x02
#define XPC_IPI_OPENREQUEST 0x04
#define XPC_IPI_OPENREPLY 0x08
#define XPC_IPI_MSGREQUEST 0x10
/* given an >>>AMO variable and a channel#, get its associated IPI flags */
#define XPC_GET_IPI_FLAGS(_amo, _c) ((u8) (((_amo) >> ((_c) * 8)) & 0xff))
#define XPC_SET_IPI_FLAGS(_amo, _c, _f) (_amo) |= ((u64) (_f) << ((_c) * 8))
#define XPC_ANY_OPENCLOSE_IPI_FLAGS_SET(_amo) ((_amo) & 0x0f0f0f0f0f0f0f0fUL)
#define XPC_ANY_MSG_IPI_FLAGS_SET(_amo) ((_amo) & 0x1010101010101010UL)
#endif /* _DRIVERS_MISC_SGIXP_XPC_H */
This diff is collapsed.
......@@ -25,18 +25,18 @@
*
* Caveats:
*
* . We currently have no way to determine which nasid an IPI came
* from. Thus, >>> xpc_IPI_send() does a remote AMO write followed by
* an IPI. The AMO indicates where data is to be pulled from, so
* after the IPI arrives, the remote partition checks the AMO word.
* The IPI can actually arrive before the AMO however, so other code
* must periodically check for this case. Also, remote AMO operations
* do not reliably time out. Thus we do a remote PIO read solely to
* know whether the remote partition is down and whether we should
* stop sending IPIs to it. This remote PIO read operation is set up
* in a special nofault region so SAL knows to ignore (and cleanup)
* any errors due to the remote AMO write, PIO read, and/or PIO
* write operations.
* . Currently on sn2, we have no way to determine which nasid an IRQ
* came from. Thus, xpc_send_IRQ_sn2() does a remote AMO write
* followed by an IPI. The AMO indicates where data is to be pulled
* from, so after the IPI arrives, the remote partition checks the AMO
* word. The IPI can actually arrive before the AMO however, so other
* code must periodically check for this case. Also, remote AMO
* operations do not reliably time out. Thus we do a remote PIO read
* solely to know whether the remote partition is down and whether we
* should stop sending IPIs to it. This remote PIO read operation is
* set up in a special nofault region so SAL knows to ignore (and
* cleanup) any errors due to the remote AMO write, PIO read, and/or
* PIO write operations.
*
* If/when new hardware solves this IPI problem, we should abandon
* the current approach.
......@@ -185,8 +185,8 @@ void (*xpc_check_remote_hb) (void);
enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *part);
void (*xpc_notify_senders_of_disconnect) (struct xpc_channel *ch);
u64 (*xpc_get_IPI_flags) (struct xpc_partition *part);
void (*xpc_process_msg_IPI) (struct xpc_partition *part, int ch_number);
u64 (*xpc_get_chctl_all_flags) (struct xpc_partition *part);
void (*xpc_process_msg_chctl_flags) (struct xpc_partition *part, int ch_number);
int (*xpc_n_of_deliverable_msgs) (struct xpc_channel *ch);
struct xpc_msg *(*xpc_get_deliverable_msg) (struct xpc_channel *ch);
......@@ -206,13 +206,13 @@ int (*xpc_any_partition_engaged) (void);
void (*xpc_indicate_partition_disengaged) (struct xpc_partition *part);
void (*xpc_assume_partition_disengaged) (short partid);
void (*xpc_send_channel_closerequest) (struct xpc_channel *ch,
void (*xpc_send_chctl_closerequest) (struct xpc_channel *ch,
unsigned long *irq_flags);
void (*xpc_send_channel_closereply) (struct xpc_channel *ch,
void (*xpc_send_chctl_closereply) (struct xpc_channel *ch,
unsigned long *irq_flags);
void (*xpc_send_channel_openrequest) (struct xpc_channel *ch,
void (*xpc_send_chctl_openrequest) (struct xpc_channel *ch,
unsigned long *irq_flags);
void (*xpc_send_channel_openreply) (struct xpc_channel *ch,
void (*xpc_send_chctl_openreply) (struct xpc_channel *ch,
unsigned long *irq_flags);
enum xp_retval (*xpc_send_msg) (struct xpc_channel *ch, u32 flags,
......@@ -302,7 +302,7 @@ xpc_hb_checker(void *ignore)
/*
* We need to periodically recheck to ensure no
* IPI/AMO pairs have been missed. That check
* IRQ/AMO pairs have been missed. That check
* must always reset xpc_hb_check_timeout.
*/
force_IRQ = 1;
......@@ -378,7 +378,7 @@ xpc_channel_mgr(struct xpc_partition *part)
atomic_read(&part->nchannels_active) > 0 ||
!xpc_partition_disengaged(part)) {
xpc_process_channel_activity(part);
xpc_process_sent_chctl_flags(part);
/*
* Wait until we've been requested to activate kthreads or
......@@ -396,7 +396,7 @@ xpc_channel_mgr(struct xpc_partition *part)
atomic_dec(&part->channel_mgr_requests);
(void)wait_event_interruptible(part->channel_mgr_wq,
(atomic_read(&part->channel_mgr_requests) > 0 ||
part->local_IPI_amo != 0 ||
part->chctl.all_flags != 0 ||
(part->act_state == XPC_P_DEACTIVATING &&
atomic_read(&part->nchannels_active) == 0 &&
xpc_partition_disengaged(part))));
......@@ -753,16 +753,15 @@ xpc_disconnect_wait(int ch_number)
DBUG_ON(!(ch->flags & XPC_C_DISCONNECTED));
wakeup_channel_mgr = 0;
if (ch->delayed_IPI_flags) {
if (ch->delayed_chctl_flags) {
if (part->act_state != XPC_P_DEACTIVATING) {
spin_lock(&part->IPI_lock);
XPC_SET_IPI_FLAGS(part->local_IPI_amo,
ch->number,
ch->delayed_IPI_flags);
spin_unlock(&part->IPI_lock);
spin_lock(&part->chctl_lock);
part->chctl.flags[ch->number] |=
ch->delayed_chctl_flags;
spin_unlock(&part->chctl_lock);
wakeup_channel_mgr = 1;
}
ch->delayed_IPI_flags = 0;
ch->delayed_chctl_flags = 0;
}
ch->flags &= ~XPC_C_WDISCONNECT;
......
This diff is collapsed.
......@@ -26,7 +26,7 @@ static DECLARE_BITMAP(xpc_heartbeating_to_mask_uv, XP_MAX_NPARTITIONS_UV);
static void *xpc_activate_mq;
static void
xpc_IPI_send_local_activate_uv(struct xpc_partition *part)
xpc_send_local_activate_IRQ_uv(struct xpc_partition *part)
{
/*
* >>> make our side think that the remote parition sent an activate
......@@ -75,13 +75,13 @@ xpc_request_partition_activation_uv(struct xpc_rsvd_page *remote_rp,
* >>> part->sn.uv.activate_mq_gpa = remote_rp->sn.activate_mq_gpa;
*/
xpc_IPI_send_local_activate_uv(part);
xpc_send_local_activate_IRQ_uv(part);
}
static void
xpc_request_partition_reactivation_uv(struct xpc_partition *part)
{
xpc_IPI_send_local_activate_uv(part);
xpc_send_local_activate_IRQ_uv(part);
}
/*
......@@ -114,7 +114,7 @@ xpc_make_first_contact_uv(struct xpc_partition *part)
}
static u64
xpc_get_IPI_flags_uv(struct xpc_partition *part)
xpc_get_chctl_all_flags_uv(struct xpc_partition *part)
{
/* >>> this function needs fleshing out */
return 0UL;
......@@ -140,7 +140,7 @@ xpc_init_uv(void)
xpc_setup_infrastructure = xpc_setup_infrastructure_uv;
xpc_teardown_infrastructure = xpc_teardown_infrastructure_uv;
xpc_make_first_contact = xpc_make_first_contact_uv;
xpc_get_IPI_flags = xpc_get_IPI_flags_uv;
xpc_get_chctl_all_flags = xpc_get_chctl_all_flags_uv;
xpc_get_deliverable_msg = xpc_get_deliverable_msg_uv;
}
......
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