/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (c) 2004-2009 Silicon Graphics, Inc. All Rights Reserved.
*/
/* * Cross Partition Communication (XPC) structures and macros.
*/
/* * XPC Version numbers consist of a major and minor number. XPC can always * talk to versions with same major #, and never talk to versions with a * different major #.
*/ #define _XPC_VERSION(_maj, _min) (((_maj) << 4) | ((_min) & 0xf)) #define XPC_VERSION_MAJOR(_v) ((_v) >> 4) #define XPC_VERSION_MINOR(_v) ((_v) & 0xf)
/* define frequency of the heartbeat and frequency how often it's checked */ #define XPC_HB_DEFAULT_INTERVAL 5 /* incr HB every x secs */ #define XPC_HB_CHECK_DEFAULT_INTERVAL 20 /* check HB every x secs */
/* define the process name of HB checker and the CPU it is pinned to */ #define XPC_HB_CHECK_THREAD_NAME "xpc_hb" #define XPC_HB_CHECK_CPU 0
/* define the process name of the discovery thread */ #define XPC_DISCOVERY_THREAD_NAME "xpc_discovery"
/* * the reserved page * * SAL reserves one page of memory per partition for XPC. Though a full page * in length (16384 bytes), its starting address is not page aligned, but it * is cacheline aligned. The reserved page consists of the following: * * reserved page header * * The first two 64-byte cachelines of the reserved page contain the * header (struct xpc_rsvd_page). Before SAL initialization has completed, * SAL has set up the following fields of the reserved page header: * SAL_signature, SAL_version, SAL_partid, and SAL_nasids_size. The * other fields are set up by XPC. (xpc_rsvd_page points to the local * partition's reserved page.) * * part_nasids mask * mach_nasids mask * * SAL also sets up two bitmaps (or masks), one that reflects the actual * nasids in this partition (part_nasids), and the other that reflects * the actual nasids in the entire machine (mach_nasids). We're only * interested in the even numbered nasids (which contain the processors * and/or memory), so we only need half as many bits to represent the * nasids. When mapping nasid to bit in a mask (or bit to nasid) be sure * to either divide or multiply by 2. The part_nasids mask is located * starting at the first cacheline following the reserved page header. The * mach_nasids mask follows right after the part_nasids mask. The size in * bytes of each mask is reflected by the reserved page header field * 'SAL_nasids_size'. (Local partition's mask pointers are xpc_part_nasids * and xpc_mach_nasids.) * * Immediately following the mach_nasids mask are the XPC variables * required by other partitions. First are those that are generic to all * partitions (vars), followed on the next available cacheline by those * which are partition specific (vars part). These are setup by XPC. * * Note: Until 'ts_jiffies' is set non-zero, the partition XPC code has not been * initialized.
*/ struct xpc_rsvd_page {
u64 SAL_signature; /* SAL: unique signature */
u64 SAL_version; /* SAL: version */ short SAL_partid; /* SAL: partition ID */ short max_npartitions; /* value of XPC_MAX_PARTITIONS */
u8 version;
u8 pad1[3]; /* align to next u64 in 1st 64-byte cacheline */ unsignedlong ts_jiffies; /* timestamp when rsvd pg was setup by XPC */ union { struct { unsignedlong heartbeat_gpa; /* phys addr */ unsignedlong activate_gru_mq_desc_gpa; /* phys addr */
} uv;
} sn;
u64 pad2[9]; /* align to last u64 in 2nd 64-byte cacheline */
u64 SAL_nasids_size; /* SAL: size of each nasid mask in bytes */
};
#define XPC_RP_VERSION _XPC_VERSION(3, 0) /* version 3.0 of the reserved page */
/* * The following structure describes the partition's heartbeat info which * will be periodically read by other partitions to determine whether this * XPC is still 'alive'.
*/ struct xpc_heartbeat_uv { unsignedlong value; unsignedlong offline; /* if 0, heartbeat should be changing */
};
/* * Info pertinent to a GRU message queue using a watch list for irq generation.
*/ struct xpc_gru_mq_uv { void *address; /* address of GRU message queue */ unsignedint order; /* size of GRU message queue as a power of 2 */ int irq; /* irq raised when message is received in mq */ int mmr_blade; /* blade where watchlist was allocated from */ unsignedlong mmr_offset; /* offset of irq mmr located on mmr_blade */ unsignedlong mmr_value; /* value of irq mmr located on mmr_blade */ int watchlist_num; /* number of watchlist allocatd by BIOS */ void *gru_mq_desc; /* opaque structure used by the GRU driver */
};
/* * The activate_mq is used to send/receive GRU messages that affect XPC's * partition active state and channel state. This is uv only.
*/ struct xpc_activate_mq_msghdr_uv { unsignedint gru_msg_hdr; /* FOR GRU INTERNAL USE ONLY */ short partid; /* sender's partid */
u8 act_state; /* sender's act_state at time msg sent */
u8 type; /* message's type */ unsignedlong rp_ts_jiffies; /* timestamp of sender's rp setup by XPC */
};
/* activate_mq defined message types */ #define XPC_ACTIVATE_MQ_MSG_SYNC_ACT_STATE_UV 0
struct xpc_activate_mq_msg_chctl_closereply_uv { struct xpc_activate_mq_msghdr_uv hdr; short ch_number;
};
struct xpc_activate_mq_msg_chctl_openrequest_uv { struct xpc_activate_mq_msghdr_uv hdr; short ch_number; short entry_size; /* size of notify_mq's GRU messages */ short local_nentries; /* ??? Is this needed? What is? */
};
struct xpc_activate_mq_msg_chctl_openreply_uv { struct xpc_activate_mq_msghdr_uv hdr; short ch_number; short remote_nentries; /* ??? Is this needed? What is? */ short local_nentries; /* ??? Is this needed? What is? */ unsignedlong notify_gru_mq_desc_gpa;
};
struct xpc_activate_mq_msg_chctl_opencomplete_uv { struct xpc_activate_mq_msghdr_uv hdr; short ch_number;
};
/* * Functions registered by add_timer() or called by kernel_thread() only * allow for a single 64-bit argument. The following macros can be used to * pack and unpack two (32-bit, 16-bit or 8-bit) arguments into or out from * the passed argument.
*/ #define XPC_PACK_ARGS(_arg1, _arg2) \
((((u64)_arg1) & 0xffffffff) | \
((((u64)_arg2) & 0xffffffff) << 32))
/* * The format of a uv XPC notify_mq GRU message is as follows: * * A user-defined message resides in the payload area. The max size of the * payload is defined by the user via xpc_connect(). * * The size of a message (payload and header) sent via the GRU must be either 1 * or 2 GRU_CACHE_LINE_BYTES in length.
*/
struct xpc_notify_mq_msghdr_uv { union { unsignedint gru_msg_hdr; /* FOR GRU INTERNAL USE ONLY */ struct xpc_fifo_entry_uv next; /* FOR XPC INTERNAL USE ONLY */
} u; short partid; /* FOR XPC INTERNAL USE ONLY */
u8 ch_number; /* FOR XPC INTERNAL USE ONLY */
u8 size; /* FOR XPC INTERNAL USE ONLY */ unsignedint msg_slot_number; /* FOR XPC INTERNAL USE ONLY */
};
#define XPC_N_CALL 0x01 /* notify function provided by user */
/* * Define uv's version of the notify entry. It additionally is used to allocate * a msg slot on the remote partition into which is copied a sent message.
*/ struct xpc_send_msg_slot_uv { struct xpc_fifo_entry_uv next; unsignedint msg_slot_number;
xpc_notify_func func; /* user's notify function */ void *key; /* pointer to user's key */
};
/* * Define the structure that manages all the stuff required by a channel. In * particular, they are used to manage the messages sent across the channel. * * This structure is private to a partition, and is NOT shared across the * partition boundary. * * There is an array of these structures for each remote partition. It is * allocated at the time a partition becomes active. The array contains one * of these structures for each potential channel connection to that partition.
*/
struct xpc_send_msg_slot_uv *send_msg_slots; void *recv_msg_slots; /* each slot will hold a xpc_notify_mq_msg_uv */ /* structure plus the user's payload */
struct xpc_channel { short partid; /* ID of remote partition connected */
spinlock_t lock; /* lock for updating this structure */ unsignedint flags; /* general flags */
enum xp_retval reason; /* reason why channel is disconnect'g */ int reason_line; /* line# disconnect initiated from */
u16 number; /* channel # */
u16 entry_size; /* sizeof each msg entry */
u16 local_nentries; /* #of msg entries in local msg queue */
u16 remote_nentries; /* #of msg entries in remote msg queue */
atomic_t references; /* #of external references to queues */
/* * 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];
};
u8 remote_rp_version; /* version# of partition's rsvd pg */ unsignedlong remote_rp_ts_jiffies; /* timestamp when rsvd pg setup */ unsignedlong remote_rp_pa; /* phys addr of partition's rsvd pg */
u64 last_heartbeat; /* HB at last read */
u32 activate_IRQ_rcvd; /* IRQs since activation */
spinlock_t act_lock; /* protect updating of act_state */
u8 act_state; /* from XPC HB viewpoint */ enum xp_retval reason; /* reason partition is deactivating */ int reason_line; /* line# deactivation initiated from */
unsignedlong disengage_timeout; /* timeout in jiffies */ struct timer_list disengage_timer;
/* XPC infrastructure referencing and teardown control */
u8 setup_state; /* infrastructure setup state */
wait_queue_head_t teardown_wq; /* kthread waiting to teardown infra */
atomic_t references; /* #of references to infrastructure */
u8 nchannels; /* #of defined channels supported */
atomic_t nchannels_active; /* #of channels that are not DISCONNECTED */
atomic_t nchannels_engaged; /* #of channels engaged with remote part */ struct xpc_channel *channels; /* array of channel structures */
/* 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 *remote_openclose_args_base; /* base address of kmalloc'd space */ struct xpc_openclose_args *remote_openclose_args; /* copy of remote's */ /* args */
/* * These next two inlines are used to keep us from tearing down a channel's * msg queues while a thread may be referencing them.
*/ staticinlinevoid
xpc_msgqueue_ref(struct xpc_channel *ch)
{
atomic_inc(&ch->references);
}
/* * These two inlines are used to keep us from tearing down a partition's * setup infrastructure while a thread may be referencing it.
*/ staticinlinevoid
xpc_part_deref(struct xpc_partition *part)
{
s32 refs = atomic_dec_return(&part->references);
staticinlineint
xpc_part_ref(struct xpc_partition *part)
{ int setup;
atomic_inc(&part->references);
setup = (part->setup_state == XPC_P_SS_SETUP); if (!setup)
xpc_part_deref(part);
return setup;
}
/* * The following macro is to be used for the setting of the reason and * reason_line fields in both the struct xpc_channel and struct xpc_partition * structures.
*/ #define XPC_SET_REASON(_p, _reason, _line) \
{ \
(_p)->reason = _reason; \
(_p)->reason_line = _line; \
}
#endif/* _DRIVERS_MISC_SGIXP_XPC_H */
Messung V0.5
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.