145d9ca49SDean Nelson /* 245d9ca49SDean Nelson * This file is subject to the terms and conditions of the GNU General Public 345d9ca49SDean Nelson * License. See the file "COPYING" in the main directory of this archive 445d9ca49SDean Nelson * for more details. 545d9ca49SDean Nelson * 6361916a9SDean Nelson * Copyright (c) 2004-2009 Silicon Graphics, Inc. All Rights Reserved. 745d9ca49SDean Nelson */ 845d9ca49SDean Nelson 945d9ca49SDean Nelson /* 1045d9ca49SDean Nelson * Cross Partition Communication (XPC) structures and macros. 1145d9ca49SDean Nelson */ 1245d9ca49SDean Nelson 1345d9ca49SDean Nelson #ifndef _DRIVERS_MISC_SGIXP_XPC_H 1445d9ca49SDean Nelson #define _DRIVERS_MISC_SGIXP_XPC_H 1545d9ca49SDean Nelson 16261f3b49SDean Nelson #include <linux/wait.h> 1745d9ca49SDean Nelson #include <linux/completion.h> 18261f3b49SDean Nelson #include <linux/timer.h> 19261f3b49SDean Nelson #include <linux/sched.h> 2045d9ca49SDean Nelson #include "xp.h" 2145d9ca49SDean Nelson 2245d9ca49SDean Nelson /* 2345d9ca49SDean Nelson * XPC Version numbers consist of a major and minor number. XPC can always 2445d9ca49SDean Nelson * talk to versions with same major #, and never talk to versions with a 2545d9ca49SDean Nelson * different major #. 2645d9ca49SDean Nelson */ 2745d9ca49SDean Nelson #define _XPC_VERSION(_maj, _min) (((_maj) << 4) | ((_min) & 0xf)) 2845d9ca49SDean Nelson #define XPC_VERSION_MAJOR(_v) ((_v) >> 4) 2945d9ca49SDean Nelson #define XPC_VERSION_MINOR(_v) ((_v) & 0xf) 3045d9ca49SDean Nelson 3104de7418SDean Nelson /* define frequency of the heartbeat and frequency how often it's checked */ 3245d9ca49SDean Nelson #define XPC_HB_DEFAULT_INTERVAL 5 /* incr HB every x secs */ 3345d9ca49SDean Nelson #define XPC_HB_CHECK_DEFAULT_INTERVAL 20 /* check HB every x secs */ 3445d9ca49SDean Nelson 3545d9ca49SDean Nelson /* define the process name of HB checker and the CPU it is pinned to */ 3645d9ca49SDean Nelson #define XPC_HB_CHECK_THREAD_NAME "xpc_hb" 3745d9ca49SDean Nelson #define XPC_HB_CHECK_CPU 0 3845d9ca49SDean Nelson 3945d9ca49SDean Nelson /* define the process name of the discovery thread */ 4045d9ca49SDean Nelson #define XPC_DISCOVERY_THREAD_NAME "xpc_discovery" 4145d9ca49SDean Nelson 4245d9ca49SDean Nelson /* 4345d9ca49SDean Nelson * the reserved page 4445d9ca49SDean Nelson * 4545d9ca49SDean Nelson * SAL reserves one page of memory per partition for XPC. Though a full page 4645d9ca49SDean Nelson * in length (16384 bytes), its starting address is not page aligned, but it 4745d9ca49SDean Nelson * is cacheline aligned. The reserved page consists of the following: 4845d9ca49SDean Nelson * 4945d9ca49SDean Nelson * reserved page header 5045d9ca49SDean Nelson * 5194bd2708SDean Nelson * The first two 64-byte cachelines of the reserved page contain the 5294bd2708SDean Nelson * header (struct xpc_rsvd_page). Before SAL initialization has completed, 5345d9ca49SDean Nelson * SAL has set up the following fields of the reserved page header: 5494bd2708SDean Nelson * SAL_signature, SAL_version, SAL_partid, and SAL_nasids_size. The 5594bd2708SDean Nelson * other fields are set up by XPC. (xpc_rsvd_page points to the local 5645d9ca49SDean Nelson * partition's reserved page.) 5745d9ca49SDean Nelson * 5845d9ca49SDean Nelson * part_nasids mask 5945d9ca49SDean Nelson * mach_nasids mask 6045d9ca49SDean Nelson * 6145d9ca49SDean Nelson * SAL also sets up two bitmaps (or masks), one that reflects the actual 6245d9ca49SDean Nelson * nasids in this partition (part_nasids), and the other that reflects 6345d9ca49SDean Nelson * the actual nasids in the entire machine (mach_nasids). We're only 6445d9ca49SDean Nelson * interested in the even numbered nasids (which contain the processors 6545d9ca49SDean Nelson * and/or memory), so we only need half as many bits to represent the 6604de7418SDean Nelson * nasids. When mapping nasid to bit in a mask (or bit to nasid) be sure 6704de7418SDean Nelson * to either divide or multiply by 2. The part_nasids mask is located 6804de7418SDean Nelson * starting at the first cacheline following the reserved page header. The 6904de7418SDean Nelson * mach_nasids mask follows right after the part_nasids mask. The size in 7004de7418SDean Nelson * bytes of each mask is reflected by the reserved page header field 7104de7418SDean Nelson * 'SAL_nasids_size'. (Local partition's mask pointers are xpc_part_nasids 7204de7418SDean Nelson * and xpc_mach_nasids.) 7345d9ca49SDean Nelson * 7494bd2708SDean Nelson * vars (ia64-sn2 only) 7594bd2708SDean Nelson * vars part (ia64-sn2 only) 7645d9ca49SDean Nelson * 7745d9ca49SDean Nelson * Immediately following the mach_nasids mask are the XPC variables 7845d9ca49SDean Nelson * required by other partitions. First are those that are generic to all 7945d9ca49SDean Nelson * partitions (vars), followed on the next available cacheline by those 8045d9ca49SDean Nelson * which are partition specific (vars part). These are setup by XPC. 8145d9ca49SDean Nelson * (Local partition's vars pointers are xpc_vars and xpc_vars_part.) 8245d9ca49SDean Nelson * 8381fe7883SDean Nelson * Note: Until 'ts_jiffies' is set non-zero, the partition XPC code has not been 8494bd2708SDean Nelson * initialized. 8545d9ca49SDean Nelson */ 8645d9ca49SDean Nelson struct xpc_rsvd_page { 8745d9ca49SDean Nelson u64 SAL_signature; /* SAL: unique signature */ 8845d9ca49SDean Nelson u64 SAL_version; /* SAL: version */ 8994bd2708SDean Nelson short SAL_partid; /* SAL: partition ID */ 9094bd2708SDean Nelson short max_npartitions; /* value of XPC_MAX_PARTITIONS */ 9145d9ca49SDean Nelson u8 version; 9294bd2708SDean Nelson u8 pad1[3]; /* align to next u64 in 1st 64-byte cacheline */ 9394bd2708SDean Nelson union { 94a812dcc3SDean Nelson unsigned long vars_pa; /* phys address of struct xpc_vars */ 95a812dcc3SDean Nelson unsigned long activate_mq_gpa; /* gru phy addr of activate_mq */ 9694bd2708SDean Nelson } sn; 9781fe7883SDean Nelson unsigned long ts_jiffies; /* timestamp when rsvd pg was setup by XPC */ 98aaa3cd69SDean Nelson u64 pad2[10]; /* align to last u64 in 2nd 64-byte cacheline */ 9994bd2708SDean Nelson u64 SAL_nasids_size; /* SAL: size of each nasid mask in bytes */ 10045d9ca49SDean Nelson }; 10145d9ca49SDean Nelson 10294bd2708SDean Nelson #define XPC_RP_VERSION _XPC_VERSION(2, 0) /* version 2.0 of the reserved page */ 10345d9ca49SDean Nelson 10445d9ca49SDean Nelson /* 10545d9ca49SDean Nelson * Define the structures by which XPC variables can be exported to other 10645d9ca49SDean Nelson * partitions. (There are two: struct xpc_vars and struct xpc_vars_part) 10745d9ca49SDean Nelson */ 10845d9ca49SDean Nelson 10945d9ca49SDean Nelson /* 11045d9ca49SDean Nelson * The following structure describes the partition generic variables 11145d9ca49SDean Nelson * needed by other partitions in order to properly initialize. 11245d9ca49SDean Nelson * 11345d9ca49SDean Nelson * struct xpc_vars version number also applies to struct xpc_vars_part. 11445d9ca49SDean Nelson * Changes to either structure and/or related functionality should be 11545d9ca49SDean Nelson * reflected by incrementing either the major or minor version numbers 11645d9ca49SDean Nelson * of struct xpc_vars. 11745d9ca49SDean Nelson */ 11833ba3c77SDean Nelson struct xpc_vars_sn2 { 11945d9ca49SDean Nelson u8 version; 12045d9ca49SDean Nelson u64 heartbeat; 12133ba3c77SDean Nelson DECLARE_BITMAP(heartbeating_to_mask, XP_MAX_NPARTITIONS_SN2); 12245d9ca49SDean Nelson u64 heartbeat_offline; /* if 0, heartbeat should be changing */ 123a47d5dacSDean Nelson int activate_IRQ_nasid; 124a47d5dacSDean Nelson int activate_IRQ_phys_cpuid; 125a812dcc3SDean Nelson unsigned long vars_part_pa; 126a812dcc3SDean Nelson unsigned long amos_page_pa;/* paddr of page of amos from MSPEC driver */ 127c39838ceSDean Nelson struct amo *amos_page; /* vaddr of page of amos from MSPEC driver */ 12845d9ca49SDean Nelson }; 12945d9ca49SDean Nelson 13045d9ca49SDean Nelson #define XPC_V_VERSION _XPC_VERSION(3, 1) /* version 3.1 of the cross vars */ 13145d9ca49SDean Nelson 13245d9ca49SDean Nelson /* 13345d9ca49SDean Nelson * The following structure describes the per partition specific variables. 13445d9ca49SDean Nelson * 13545d9ca49SDean Nelson * An array of these structures, one per partition, will be defined. As a 13645d9ca49SDean Nelson * partition becomes active XPC will copy the array entry corresponding to 13794bd2708SDean Nelson * itself from that partition. It is desirable that the size of this structure 13894bd2708SDean Nelson * evenly divides into a 128-byte cacheline, such that none of the entries in 13994bd2708SDean Nelson * this array crosses a 128-byte cacheline boundary. As it is now, each entry 140e17d416bSDean Nelson * occupies 64-bytes. 14145d9ca49SDean Nelson */ 142e17d416bSDean Nelson struct xpc_vars_part_sn2 { 1432c2b94f9SDean Nelson u64 magic; 14445d9ca49SDean Nelson 145a812dcc3SDean Nelson unsigned long openclose_args_pa; /* phys addr of open and close args */ 146a812dcc3SDean Nelson unsigned long GPs_pa; /* physical address of Get/Put values */ 14745d9ca49SDean Nelson 148a812dcc3SDean Nelson unsigned long chctl_amo_pa; /* physical address of chctl flags' amo */ 1497fb5e59dSDean Nelson 1507fb5e59dSDean Nelson int notify_IRQ_nasid; /* nasid of where to send notify IRQs */ 1517fb5e59dSDean Nelson int notify_IRQ_phys_cpuid; /* CPUID of where to send notify IRQs */ 15245d9ca49SDean Nelson 15345d9ca49SDean Nelson u8 nchannels; /* #of defined channels supported */ 15445d9ca49SDean Nelson 15545d9ca49SDean Nelson u8 reserved[23]; /* pad to a full 64 bytes */ 15645d9ca49SDean Nelson }; 15745d9ca49SDean Nelson 15845d9ca49SDean Nelson /* 15945d9ca49SDean Nelson * The vars_part MAGIC numbers play a part in the first contact protocol. 16045d9ca49SDean Nelson * 16145d9ca49SDean Nelson * MAGIC1 indicates that the per partition specific variables for a remote 16245d9ca49SDean Nelson * partition have been initialized by this partition. 16345d9ca49SDean Nelson * 16445d9ca49SDean Nelson * MAGIC2 indicates that this partition has pulled the remote partititions 16545d9ca49SDean Nelson * per partition variables that pertain to this partition. 16645d9ca49SDean Nelson */ 1675b8669dfSDean Nelson #define XPC_VP_MAGIC1_SN2 0x0053524156435058L /* 'XPCVARS\0'L (little endian) */ 1685b8669dfSDean Nelson #define XPC_VP_MAGIC2_SN2 0x0073726176435058L /* 'XPCvars\0'L (little endian) */ 16945d9ca49SDean Nelson 17045d9ca49SDean Nelson /* the reserved page sizes and offsets */ 17145d9ca49SDean Nelson 17245d9ca49SDean Nelson #define XPC_RP_HEADER_SIZE L1_CACHE_ALIGN(sizeof(struct xpc_rsvd_page)) 17333ba3c77SDean Nelson #define XPC_RP_VARS_SIZE L1_CACHE_ALIGN(sizeof(struct xpc_vars_sn2)) 17445d9ca49SDean Nelson 175261f3b49SDean Nelson #define XPC_RP_PART_NASIDS(_rp) ((unsigned long *)((u8 *)(_rp) + \ 176261f3b49SDean Nelson XPC_RP_HEADER_SIZE)) 17704de7418SDean Nelson #define XPC_RP_MACH_NASIDS(_rp) (XPC_RP_PART_NASIDS(_rp) + \ 17804de7418SDean Nelson xpc_nasid_mask_nlongs) 179ee6665e3SDean Nelson #define XPC_RP_VARS(_rp) ((struct xpc_vars_sn2 *) \ 180ee6665e3SDean Nelson (XPC_RP_MACH_NASIDS(_rp) + \ 18104de7418SDean Nelson xpc_nasid_mask_nlongs)) 18245d9ca49SDean Nelson 18345d9ca49SDean Nelson /* 1842525789bSDean Nelson * Info pertinent to a GRU message queue using a watch list for irq generation. 1852525789bSDean Nelson */ 1862525789bSDean Nelson struct xpc_gru_mq_uv { 1872525789bSDean Nelson void *address; /* address of GRU message queue */ 1882525789bSDean Nelson unsigned int order; /* size of GRU message queue as a power of 2 */ 1892525789bSDean Nelson int irq; /* irq raised when message is received in mq */ 1902525789bSDean Nelson int mmr_blade; /* blade where watchlist was allocated from */ 1912525789bSDean Nelson unsigned long mmr_offset; /* offset of irq mmr located on mmr_blade */ 1922525789bSDean Nelson int watchlist_num; /* number of watchlist allocatd by BIOS */ 1932525789bSDean Nelson }; 1942525789bSDean Nelson 1952525789bSDean Nelson /* 196bd3e64c1SDean Nelson * The activate_mq is used to send/receive GRU messages that affect XPC's 197bd3e64c1SDean Nelson * heartbeat, partition active state, and channel state. This is UV only. 1985b8669dfSDean Nelson */ 1995b8669dfSDean Nelson struct xpc_activate_mq_msghdr_uv { 2005b8669dfSDean Nelson short partid; /* sender's partid */ 2015b8669dfSDean Nelson u8 act_state; /* sender's act_state at time msg sent */ 2025b8669dfSDean Nelson u8 type; /* message's type */ 2035b8669dfSDean Nelson unsigned long rp_ts_jiffies; /* timestamp of sender's rp setup by XPC */ 2045b8669dfSDean Nelson }; 2055b8669dfSDean Nelson 2065b8669dfSDean Nelson /* activate_mq defined message types */ 2075b8669dfSDean Nelson #define XPC_ACTIVATE_MQ_MSG_SYNC_ACT_STATE_UV 0 2085b8669dfSDean Nelson #define XPC_ACTIVATE_MQ_MSG_INC_HEARTBEAT_UV 1 2095b8669dfSDean Nelson #define XPC_ACTIVATE_MQ_MSG_OFFLINE_HEARTBEAT_UV 2 2105b8669dfSDean Nelson #define XPC_ACTIVATE_MQ_MSG_ONLINE_HEARTBEAT_UV 3 2115b8669dfSDean Nelson 2125b8669dfSDean Nelson #define XPC_ACTIVATE_MQ_MSG_ACTIVATE_REQ_UV 4 2135b8669dfSDean Nelson #define XPC_ACTIVATE_MQ_MSG_DEACTIVATE_REQ_UV 5 2145b8669dfSDean Nelson 2155b8669dfSDean Nelson #define XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREQUEST_UV 6 2165b8669dfSDean Nelson #define XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREPLY_UV 7 2175b8669dfSDean Nelson #define XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREQUEST_UV 8 2185b8669dfSDean Nelson #define XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREPLY_UV 9 2195b8669dfSDean Nelson 2205b8669dfSDean Nelson #define XPC_ACTIVATE_MQ_MSG_MARK_ENGAGED_UV 10 2215b8669dfSDean Nelson #define XPC_ACTIVATE_MQ_MSG_MARK_DISENGAGED_UV 11 2225b8669dfSDean Nelson 2235b8669dfSDean Nelson struct xpc_activate_mq_msg_uv { 224bd3e64c1SDean Nelson struct xpc_activate_mq_msghdr_uv hdr; 2255b8669dfSDean Nelson }; 2265b8669dfSDean Nelson 2275b8669dfSDean Nelson struct xpc_activate_mq_msg_heartbeat_req_uv { 228bd3e64c1SDean Nelson struct xpc_activate_mq_msghdr_uv hdr; 2295b8669dfSDean Nelson u64 heartbeat; 2305b8669dfSDean Nelson }; 2315b8669dfSDean Nelson 2325b8669dfSDean Nelson struct xpc_activate_mq_msg_activate_req_uv { 233bd3e64c1SDean Nelson struct xpc_activate_mq_msghdr_uv hdr; 2345b8669dfSDean Nelson unsigned long rp_gpa; 2355b8669dfSDean Nelson unsigned long activate_mq_gpa; 2365b8669dfSDean Nelson }; 2375b8669dfSDean Nelson 2385b8669dfSDean Nelson struct xpc_activate_mq_msg_deactivate_req_uv { 239bd3e64c1SDean Nelson struct xpc_activate_mq_msghdr_uv hdr; 2405b8669dfSDean Nelson enum xp_retval reason; 2415b8669dfSDean Nelson }; 2425b8669dfSDean Nelson 2435b8669dfSDean Nelson struct xpc_activate_mq_msg_chctl_closerequest_uv { 244bd3e64c1SDean Nelson struct xpc_activate_mq_msghdr_uv hdr; 2455b8669dfSDean Nelson short ch_number; 2465b8669dfSDean Nelson enum xp_retval reason; 2475b8669dfSDean Nelson }; 2485b8669dfSDean Nelson 2495b8669dfSDean Nelson struct xpc_activate_mq_msg_chctl_closereply_uv { 250bd3e64c1SDean Nelson struct xpc_activate_mq_msghdr_uv hdr; 2515b8669dfSDean Nelson short ch_number; 2525b8669dfSDean Nelson }; 2535b8669dfSDean Nelson 2545b8669dfSDean Nelson struct xpc_activate_mq_msg_chctl_openrequest_uv { 255bd3e64c1SDean Nelson struct xpc_activate_mq_msghdr_uv hdr; 2565b8669dfSDean Nelson short ch_number; 257bd3e64c1SDean Nelson short entry_size; /* size of notify_mq's GRU messages */ 2585b8669dfSDean Nelson short local_nentries; /* ??? Is this needed? What is? */ 2595b8669dfSDean Nelson }; 2605b8669dfSDean Nelson 2615b8669dfSDean Nelson struct xpc_activate_mq_msg_chctl_openreply_uv { 262bd3e64c1SDean Nelson struct xpc_activate_mq_msghdr_uv hdr; 2635b8669dfSDean Nelson short ch_number; 2645b8669dfSDean Nelson short remote_nentries; /* ??? Is this needed? What is? */ 2655b8669dfSDean Nelson short local_nentries; /* ??? Is this needed? What is? */ 2665b8669dfSDean Nelson unsigned long local_notify_mq_gpa; 2675b8669dfSDean Nelson }; 2685b8669dfSDean Nelson 2695b8669dfSDean Nelson /* 27045d9ca49SDean Nelson * Functions registered by add_timer() or called by kernel_thread() only 27145d9ca49SDean Nelson * allow for a single 64-bit argument. The following macros can be used to 27245d9ca49SDean Nelson * pack and unpack two (32-bit, 16-bit or 8-bit) arguments into or out from 27345d9ca49SDean Nelson * the passed argument. 27445d9ca49SDean Nelson */ 27545d9ca49SDean Nelson #define XPC_PACK_ARGS(_arg1, _arg2) \ 27645d9ca49SDean Nelson ((((u64)_arg1) & 0xffffffff) | \ 27745d9ca49SDean Nelson ((((u64)_arg2) & 0xffffffff) << 32)) 27845d9ca49SDean Nelson 27945d9ca49SDean Nelson #define XPC_UNPACK_ARG1(_args) (((u64)_args) & 0xffffffff) 28045d9ca49SDean Nelson #define XPC_UNPACK_ARG2(_args) ((((u64)_args) >> 32) & 0xffffffff) 28145d9ca49SDean Nelson 28245d9ca49SDean Nelson /* 28345d9ca49SDean Nelson * Define a Get/Put value pair (pointers) used with a message queue. 28445d9ca49SDean Nelson */ 285261f3b49SDean Nelson struct xpc_gp_sn2 { 2862c2b94f9SDean Nelson s64 get; /* Get value */ 2872c2b94f9SDean Nelson s64 put; /* Put value */ 28845d9ca49SDean Nelson }; 28945d9ca49SDean Nelson 29045d9ca49SDean Nelson #define XPC_GP_SIZE \ 291261f3b49SDean Nelson L1_CACHE_ALIGN(sizeof(struct xpc_gp_sn2) * XPC_MAX_NCHANNELS) 29245d9ca49SDean Nelson 29345d9ca49SDean Nelson /* 29445d9ca49SDean Nelson * Define a structure that contains arguments associated with opening and 29545d9ca49SDean Nelson * closing a channel. 29645d9ca49SDean Nelson */ 29745d9ca49SDean Nelson struct xpc_openclose_args { 29845d9ca49SDean Nelson u16 reason; /* reason why channel is closing */ 299bd3e64c1SDean Nelson u16 entry_size; /* sizeof each message entry */ 30045d9ca49SDean Nelson u16 remote_nentries; /* #of message entries in remote msg queue */ 30145d9ca49SDean Nelson u16 local_nentries; /* #of message entries in local msg queue */ 302a812dcc3SDean Nelson unsigned long local_msgqueue_pa; /* phys addr of local message queue */ 30345d9ca49SDean Nelson }; 30445d9ca49SDean Nelson 30545d9ca49SDean Nelson #define XPC_OPENCLOSE_ARGS_SIZE \ 306bc63d387SDean Nelson L1_CACHE_ALIGN(sizeof(struct xpc_openclose_args) * \ 307bc63d387SDean Nelson XPC_MAX_NCHANNELS) 30845d9ca49SDean Nelson 30945d9ca49SDean Nelson 31045d9ca49SDean Nelson /* 311bd3e64c1SDean Nelson * Structures to define a fifo singly-linked list. 312bd3e64c1SDean Nelson */ 313bd3e64c1SDean Nelson 314bd3e64c1SDean Nelson struct xpc_fifo_entry_uv { 315bd3e64c1SDean Nelson struct xpc_fifo_entry_uv *next; 316bd3e64c1SDean Nelson }; 317bd3e64c1SDean Nelson 318bd3e64c1SDean Nelson struct xpc_fifo_head_uv { 319bd3e64c1SDean Nelson struct xpc_fifo_entry_uv *first; 320bd3e64c1SDean Nelson struct xpc_fifo_entry_uv *last; 321bd3e64c1SDean Nelson spinlock_t lock; 322bd3e64c1SDean Nelson int n_entries; 323bd3e64c1SDean Nelson }; 324bd3e64c1SDean Nelson 325bd3e64c1SDean Nelson /* 326bd3e64c1SDean Nelson * Define a sn2 styled message. 327bd3e64c1SDean Nelson * 328bd3e64c1SDean Nelson * A user-defined message resides in the payload area. The max size of the 329bd3e64c1SDean Nelson * payload is defined by the user via xpc_connect(). 330bd3e64c1SDean Nelson * 331bd3e64c1SDean Nelson * The size of a message entry (within a message queue) must be a 128-byte 332bd3e64c1SDean Nelson * cacheline sized multiple in order to facilitate the BTE transfer of messages 333bd3e64c1SDean Nelson * from one message queue to another. 334bd3e64c1SDean Nelson */ 335bd3e64c1SDean Nelson struct xpc_msg_sn2 { 336bd3e64c1SDean Nelson u8 flags; /* FOR XPC INTERNAL USE ONLY */ 337bd3e64c1SDean Nelson u8 reserved[7]; /* FOR XPC INTERNAL USE ONLY */ 338bd3e64c1SDean Nelson s64 number; /* FOR XPC INTERNAL USE ONLY */ 339bd3e64c1SDean Nelson 340bd3e64c1SDean Nelson u64 payload; /* user defined portion of message */ 341bd3e64c1SDean Nelson }; 342bd3e64c1SDean Nelson 343bd3e64c1SDean Nelson /* struct xpc_msg_sn2 flags */ 344bd3e64c1SDean Nelson 345bd3e64c1SDean Nelson #define XPC_M_SN2_DONE 0x01 /* msg has been received/consumed */ 346bd3e64c1SDean Nelson #define XPC_M_SN2_READY 0x02 /* msg is ready to be sent */ 347bd3e64c1SDean Nelson #define XPC_M_SN2_INTERRUPT 0x04 /* send interrupt when msg consumed */ 348bd3e64c1SDean Nelson 349bd3e64c1SDean Nelson /* 350bd3e64c1SDean Nelson * The format of a uv XPC notify_mq GRU message is as follows: 351bd3e64c1SDean Nelson * 352bd3e64c1SDean Nelson * A user-defined message resides in the payload area. The max size of the 353bd3e64c1SDean Nelson * payload is defined by the user via xpc_connect(). 354bd3e64c1SDean Nelson * 355bd3e64c1SDean Nelson * The size of a message (payload and header) sent via the GRU must be either 1 356bd3e64c1SDean Nelson * or 2 GRU_CACHE_LINE_BYTES in length. 357bd3e64c1SDean Nelson */ 358bd3e64c1SDean Nelson 359bd3e64c1SDean Nelson struct xpc_notify_mq_msghdr_uv { 360bd3e64c1SDean Nelson union { 361bd3e64c1SDean Nelson unsigned int gru_msg_hdr; /* FOR GRU INTERNAL USE ONLY */ 362bd3e64c1SDean Nelson struct xpc_fifo_entry_uv next; /* FOR XPC INTERNAL USE ONLY */ 363bd3e64c1SDean Nelson } u; 364bd3e64c1SDean Nelson short partid; /* FOR XPC INTERNAL USE ONLY */ 365bd3e64c1SDean Nelson u8 ch_number; /* FOR XPC INTERNAL USE ONLY */ 366bd3e64c1SDean Nelson u8 size; /* FOR XPC INTERNAL USE ONLY */ 367bd3e64c1SDean Nelson unsigned int msg_slot_number; /* FOR XPC INTERNAL USE ONLY */ 368bd3e64c1SDean Nelson }; 369bd3e64c1SDean Nelson 370bd3e64c1SDean Nelson struct xpc_notify_mq_msg_uv { 371bd3e64c1SDean Nelson struct xpc_notify_mq_msghdr_uv hdr; 372bd3e64c1SDean Nelson unsigned long payload; 373bd3e64c1SDean Nelson }; 374bd3e64c1SDean Nelson 375bd3e64c1SDean Nelson /* 376bd3e64c1SDean Nelson * Define sn2's notify entry. 37745d9ca49SDean Nelson * 37845d9ca49SDean Nelson * This is used to notify a message's sender that their message was received 37945d9ca49SDean Nelson * and consumed by the intended recipient. 38045d9ca49SDean Nelson */ 381bd3e64c1SDean Nelson struct xpc_notify_sn2 { 3822c2b94f9SDean Nelson u8 type; /* type of notification */ 38345d9ca49SDean Nelson 38445d9ca49SDean Nelson /* the following two fields are only used if type == XPC_N_CALL */ 38545d9ca49SDean Nelson xpc_notify_func func; /* user's notify function */ 38645d9ca49SDean Nelson void *key; /* pointer to user's key */ 38745d9ca49SDean Nelson }; 38845d9ca49SDean Nelson 389bd3e64c1SDean Nelson /* struct xpc_notify_sn2 type of notification */ 39045d9ca49SDean Nelson 39145d9ca49SDean Nelson #define XPC_N_CALL 0x01 /* notify function provided by user */ 39245d9ca49SDean Nelson 39345d9ca49SDean Nelson /* 394bd3e64c1SDean Nelson * Define uv's version of the notify entry. It additionally is used to allocate 395bd3e64c1SDean Nelson * a msg slot on the remote partition into which is copied a sent message. 396bd3e64c1SDean Nelson */ 397bd3e64c1SDean Nelson struct xpc_send_msg_slot_uv { 398bd3e64c1SDean Nelson struct xpc_fifo_entry_uv next; 399bd3e64c1SDean Nelson unsigned int msg_slot_number; 400bd3e64c1SDean Nelson xpc_notify_func func; /* user's notify function */ 401bd3e64c1SDean Nelson void *key; /* pointer to user's key */ 402bd3e64c1SDean Nelson }; 403bd3e64c1SDean Nelson 404bd3e64c1SDean Nelson /* 40545d9ca49SDean Nelson * Define the structure that manages all the stuff required by a channel. In 40645d9ca49SDean Nelson * particular, they are used to manage the messages sent across the channel. 40745d9ca49SDean Nelson * 40845d9ca49SDean Nelson * This structure is private to a partition, and is NOT shared across the 40945d9ca49SDean Nelson * partition boundary. 41045d9ca49SDean Nelson * 41145d9ca49SDean Nelson * There is an array of these structures for each remote partition. It is 41245d9ca49SDean Nelson * allocated at the time a partition becomes active. The array contains one 41345d9ca49SDean Nelson * of these structures for each potential channel connection to that partition. 414ea57f80cSDean Nelson */ 415ea57f80cSDean Nelson 416ea57f80cSDean Nelson /* 417ea57f80cSDean Nelson * The following is sn2 only. 41845d9ca49SDean Nelson * 419ea57f80cSDean Nelson * Each channel structure manages two message queues (circular buffers). 42045d9ca49SDean Nelson * They are allocated at the time a channel connection is made. One of 42145d9ca49SDean Nelson * these message queues (local_msgqueue) holds the locally created messages 42245d9ca49SDean Nelson * that are destined for the remote partition. The other of these message 42345d9ca49SDean Nelson * queues (remote_msgqueue) is a locally cached copy of the remote partition's 42445d9ca49SDean Nelson * own local_msgqueue. 42545d9ca49SDean Nelson * 42645d9ca49SDean Nelson * The following is a description of the Get/Put pointers used to manage these 42745d9ca49SDean Nelson * two message queues. Consider the local_msgqueue to be on one partition 42845d9ca49SDean Nelson * and the remote_msgqueue to be its cached copy on another partition. A 42945d9ca49SDean Nelson * description of what each of the lettered areas contains is included. 43045d9ca49SDean Nelson * 43145d9ca49SDean Nelson * 43245d9ca49SDean Nelson * local_msgqueue remote_msgqueue 43345d9ca49SDean Nelson * 43445d9ca49SDean Nelson * |/////////| |/////////| 43545d9ca49SDean Nelson * w_remote_GP.get --> +---------+ |/////////| 43645d9ca49SDean Nelson * | F | |/////////| 43745d9ca49SDean Nelson * remote_GP.get --> +---------+ +---------+ <-- local_GP->get 43845d9ca49SDean Nelson * | | | | 43945d9ca49SDean Nelson * | | | E | 44045d9ca49SDean Nelson * | | | | 44145d9ca49SDean Nelson * | | +---------+ <-- w_local_GP.get 44245d9ca49SDean Nelson * | B | |/////////| 44345d9ca49SDean Nelson * | | |////D////| 44445d9ca49SDean Nelson * | | |/////////| 44545d9ca49SDean Nelson * | | +---------+ <-- w_remote_GP.put 44645d9ca49SDean Nelson * | | |////C////| 44745d9ca49SDean Nelson * local_GP->put --> +---------+ +---------+ <-- remote_GP.put 44845d9ca49SDean Nelson * | | |/////////| 44945d9ca49SDean Nelson * | A | |/////////| 45045d9ca49SDean Nelson * | | |/////////| 45145d9ca49SDean Nelson * w_local_GP.put --> +---------+ |/////////| 45245d9ca49SDean Nelson * |/////////| |/////////| 45345d9ca49SDean Nelson * 45445d9ca49SDean Nelson * 45545d9ca49SDean Nelson * ( remote_GP.[get|put] are cached copies of the remote 45645d9ca49SDean Nelson * partition's local_GP->[get|put], and thus their values can 45745d9ca49SDean Nelson * lag behind their counterparts on the remote partition. ) 45845d9ca49SDean Nelson * 45945d9ca49SDean Nelson * 46045d9ca49SDean Nelson * A - Messages that have been allocated, but have not yet been sent to the 46145d9ca49SDean Nelson * remote partition. 46245d9ca49SDean Nelson * 46345d9ca49SDean Nelson * B - Messages that have been sent, but have not yet been acknowledged by the 46445d9ca49SDean Nelson * remote partition as having been received. 46545d9ca49SDean Nelson * 46645d9ca49SDean Nelson * C - Area that needs to be prepared for the copying of sent messages, by 46745d9ca49SDean Nelson * the clearing of the message flags of any previously received messages. 46845d9ca49SDean Nelson * 46945d9ca49SDean Nelson * D - Area into which sent messages are to be copied from the remote 47045d9ca49SDean Nelson * partition's local_msgqueue and then delivered to their intended 47145d9ca49SDean Nelson * recipients. [ To allow for a multi-message copy, another pointer 47245d9ca49SDean Nelson * (next_msg_to_pull) has been added to keep track of the next message 47345d9ca49SDean Nelson * number needing to be copied (pulled). It chases after w_remote_GP.put. 47445d9ca49SDean Nelson * Any messages lying between w_local_GP.get and next_msg_to_pull have 47545d9ca49SDean Nelson * been copied and are ready to be delivered. ] 47645d9ca49SDean Nelson * 47745d9ca49SDean Nelson * E - Messages that have been copied and delivered, but have not yet been 47845d9ca49SDean Nelson * acknowledged by the recipient as having been received. 47945d9ca49SDean Nelson * 48045d9ca49SDean Nelson * F - Messages that have been acknowledged, but XPC has not yet notified the 48145d9ca49SDean Nelson * sender that the message was received by its intended recipient. 48245d9ca49SDean Nelson * This is also an area that needs to be prepared for the allocating of 48345d9ca49SDean Nelson * new messages, by the clearing of the message flags of the acknowledged 48445d9ca49SDean Nelson * messages. 48545d9ca49SDean Nelson */ 486ea57f80cSDean Nelson 487a47d5dacSDean Nelson struct xpc_channel_sn2 { 4885b8669dfSDean Nelson struct xpc_openclose_args *local_openclose_args; /* args passed on */ 4895b8669dfSDean Nelson /* opening or closing of channel */ 4905b8669dfSDean Nelson 4915b8669dfSDean Nelson void *local_msgqueue_base; /* base address of kmalloc'd space */ 492bd3e64c1SDean Nelson struct xpc_msg_sn2 *local_msgqueue; /* local message queue */ 4935b8669dfSDean Nelson void *remote_msgqueue_base; /* base address of kmalloc'd space */ 494bd3e64c1SDean Nelson struct xpc_msg_sn2 *remote_msgqueue; /* cached copy of remote */ 495bd3e64c1SDean Nelson /* partition's local message queue */ 4965b8669dfSDean Nelson unsigned long remote_msgqueue_pa; /* phys addr of remote partition's */ 4975b8669dfSDean Nelson /* local message queue */ 4985b8669dfSDean Nelson 499bd3e64c1SDean Nelson struct xpc_notify_sn2 *notify_queue;/* notify queue for messages sent */ 500a47d5dacSDean Nelson 501a47d5dacSDean Nelson /* various flavors of local and remote Get/Put values */ 502a47d5dacSDean Nelson 503261f3b49SDean Nelson struct xpc_gp_sn2 *local_GP; /* local Get/Put values */ 504261f3b49SDean Nelson struct xpc_gp_sn2 remote_GP; /* remote Get/Put values */ 505261f3b49SDean Nelson struct xpc_gp_sn2 w_local_GP; /* working local Get/Put values */ 506261f3b49SDean Nelson struct xpc_gp_sn2 w_remote_GP; /* working remote Get/Put values */ 507a47d5dacSDean Nelson s64 next_msg_to_pull; /* Put value of next msg to pull */ 508a47d5dacSDean Nelson 509a47d5dacSDean Nelson struct mutex msg_to_pull_mutex; /* next msg to pull serialization */ 510a47d5dacSDean Nelson }; 511a47d5dacSDean Nelson 512a47d5dacSDean Nelson struct xpc_channel_uv { 5135b8669dfSDean Nelson unsigned long remote_notify_mq_gpa; /* gru phys address of remote */ 5145b8669dfSDean Nelson /* partition's notify mq */ 515bd3e64c1SDean Nelson 516bd3e64c1SDean Nelson struct xpc_send_msg_slot_uv *send_msg_slots; 517361916a9SDean Nelson void *recv_msg_slots; /* each slot will hold a xpc_notify_mq_msg_uv */ 518361916a9SDean Nelson /* structure plus the user's payload */ 519bd3e64c1SDean Nelson 520bd3e64c1SDean Nelson struct xpc_fifo_head_uv msg_slot_free_list; 521bd3e64c1SDean Nelson struct xpc_fifo_head_uv recv_msg_list; /* deliverable payloads */ 522a47d5dacSDean Nelson }; 523a47d5dacSDean Nelson 52445d9ca49SDean Nelson struct xpc_channel { 52564d032baSDean Nelson short partid; /* ID of remote partition connected */ 52645d9ca49SDean Nelson spinlock_t lock; /* lock for updating this structure */ 5275b8669dfSDean Nelson unsigned int flags; /* general flags */ 52845d9ca49SDean Nelson 52965c17b80SDean Nelson enum xp_retval reason; /* reason why channel is disconnect'g */ 53045d9ca49SDean Nelson int reason_line; /* line# disconnect initiated from */ 53145d9ca49SDean Nelson 53245d9ca49SDean Nelson u16 number; /* channel # */ 53345d9ca49SDean Nelson 534bd3e64c1SDean Nelson u16 entry_size; /* sizeof each msg entry */ 53545d9ca49SDean Nelson u16 local_nentries; /* #of msg entries in local msg queue */ 53645d9ca49SDean Nelson u16 remote_nentries; /* #of msg entries in remote msg queue */ 53745d9ca49SDean Nelson 53845d9ca49SDean Nelson atomic_t references; /* #of external references to queues */ 53945d9ca49SDean Nelson 54045d9ca49SDean Nelson atomic_t n_on_msg_allocate_wq; /* #on msg allocation wait queue */ 54145d9ca49SDean Nelson wait_queue_head_t msg_allocate_wq; /* msg allocation wait queue */ 54245d9ca49SDean Nelson 5437fb5e59dSDean Nelson u8 delayed_chctl_flags; /* chctl flags received, but delayed */ 54445d9ca49SDean Nelson /* action until channel disconnected */ 54545d9ca49SDean Nelson 54645d9ca49SDean Nelson atomic_t n_to_notify; /* #of msg senders to notify */ 54745d9ca49SDean Nelson 54845d9ca49SDean Nelson xpc_channel_func func; /* user's channel function */ 54945d9ca49SDean Nelson void *key; /* pointer to user's key */ 55045d9ca49SDean Nelson 55145d9ca49SDean Nelson struct completion wdisconnect_wait; /* wait for channel disconnect */ 55245d9ca49SDean Nelson 55345d9ca49SDean Nelson /* kthread management related fields */ 55445d9ca49SDean Nelson 55545d9ca49SDean Nelson atomic_t kthreads_assigned; /* #of kthreads assigned to channel */ 55645d9ca49SDean Nelson u32 kthreads_assigned_limit; /* limit on #of kthreads assigned */ 55745d9ca49SDean Nelson atomic_t kthreads_idle; /* #of kthreads idle waiting for work */ 55845d9ca49SDean Nelson u32 kthreads_idle_limit; /* limit on #of kthreads idle */ 55945d9ca49SDean Nelson atomic_t kthreads_active; /* #of kthreads actively working */ 56045d9ca49SDean Nelson 56145d9ca49SDean Nelson wait_queue_head_t idle_wq; /* idle kthread wait queue */ 56245d9ca49SDean Nelson 563a47d5dacSDean Nelson union { 564a47d5dacSDean Nelson struct xpc_channel_sn2 sn2; 565a47d5dacSDean Nelson struct xpc_channel_uv uv; 566a47d5dacSDean Nelson } sn; 567a47d5dacSDean Nelson 56845d9ca49SDean Nelson } ____cacheline_aligned; 56945d9ca49SDean Nelson 57045d9ca49SDean Nelson /* struct xpc_channel flags */ 57145d9ca49SDean Nelson 57245d9ca49SDean Nelson #define XPC_C_WASCONNECTED 0x00000001 /* channel was connected */ 57345d9ca49SDean Nelson 57445d9ca49SDean Nelson #define XPC_C_ROPENREPLY 0x00000002 /* remote open channel reply */ 57545d9ca49SDean Nelson #define XPC_C_OPENREPLY 0x00000004 /* local open channel reply */ 57645d9ca49SDean Nelson #define XPC_C_ROPENREQUEST 0x00000008 /* remote open channel request */ 57745d9ca49SDean Nelson #define XPC_C_OPENREQUEST 0x00000010 /* local open channel request */ 57845d9ca49SDean Nelson 57945d9ca49SDean Nelson #define XPC_C_SETUP 0x00000020 /* channel's msgqueues are alloc'd */ 58045d9ca49SDean Nelson #define XPC_C_CONNECTEDCALLOUT 0x00000040 /* connected callout initiated */ 58145d9ca49SDean Nelson #define XPC_C_CONNECTEDCALLOUT_MADE \ 58245d9ca49SDean Nelson 0x00000080 /* connected callout completed */ 58345d9ca49SDean Nelson #define XPC_C_CONNECTED 0x00000100 /* local channel is connected */ 58445d9ca49SDean Nelson #define XPC_C_CONNECTING 0x00000200 /* channel is being connected */ 58545d9ca49SDean Nelson 58645d9ca49SDean Nelson #define XPC_C_RCLOSEREPLY 0x00000400 /* remote close channel reply */ 58745d9ca49SDean Nelson #define XPC_C_CLOSEREPLY 0x00000800 /* local close channel reply */ 58845d9ca49SDean Nelson #define XPC_C_RCLOSEREQUEST 0x00001000 /* remote close channel request */ 58945d9ca49SDean Nelson #define XPC_C_CLOSEREQUEST 0x00002000 /* local close channel request */ 59045d9ca49SDean Nelson 59145d9ca49SDean Nelson #define XPC_C_DISCONNECTED 0x00004000 /* channel is disconnected */ 59245d9ca49SDean Nelson #define XPC_C_DISCONNECTING 0x00008000 /* channel is being disconnected */ 59345d9ca49SDean Nelson #define XPC_C_DISCONNECTINGCALLOUT \ 59445d9ca49SDean Nelson 0x00010000 /* disconnecting callout initiated */ 59545d9ca49SDean Nelson #define XPC_C_DISCONNECTINGCALLOUT_MADE \ 59645d9ca49SDean Nelson 0x00020000 /* disconnecting callout completed */ 59745d9ca49SDean Nelson #define XPC_C_WDISCONNECT 0x00040000 /* waiting for channel disconnect */ 59845d9ca49SDean Nelson 59945d9ca49SDean Nelson /* 6007fb5e59dSDean Nelson * The channel control flags (chctl) union consists of a 64-bit variable which 6017fb5e59dSDean Nelson * is divided up into eight bytes, ordered from right to left. Byte zero 6027fb5e59dSDean Nelson * pertains to channel 0, byte one to channel 1, and so on. Each channel's byte 6037fb5e59dSDean Nelson * can have one or more of the chctl flags set in it. 6047fb5e59dSDean Nelson */ 6057fb5e59dSDean Nelson 6067fb5e59dSDean Nelson union xpc_channel_ctl_flags { 6077fb5e59dSDean Nelson u64 all_flags; 6087fb5e59dSDean Nelson u8 flags[XPC_MAX_NCHANNELS]; 6097fb5e59dSDean Nelson }; 6107fb5e59dSDean Nelson 6117fb5e59dSDean Nelson /* chctl flags */ 6127fb5e59dSDean Nelson #define XPC_CHCTL_CLOSEREQUEST 0x01 6137fb5e59dSDean Nelson #define XPC_CHCTL_CLOSEREPLY 0x02 6147fb5e59dSDean Nelson #define XPC_CHCTL_OPENREQUEST 0x04 6157fb5e59dSDean Nelson #define XPC_CHCTL_OPENREPLY 0x08 6167fb5e59dSDean Nelson #define XPC_CHCTL_MSGREQUEST 0x10 6177fb5e59dSDean Nelson 6187fb5e59dSDean Nelson #define XPC_OPENCLOSE_CHCTL_FLAGS \ 6197fb5e59dSDean Nelson (XPC_CHCTL_CLOSEREQUEST | XPC_CHCTL_CLOSEREPLY | \ 6207fb5e59dSDean Nelson XPC_CHCTL_OPENREQUEST | XPC_CHCTL_OPENREPLY) 6217fb5e59dSDean Nelson #define XPC_MSG_CHCTL_FLAGS XPC_CHCTL_MSGREQUEST 6227fb5e59dSDean Nelson 6237fb5e59dSDean Nelson static inline int 6247fb5e59dSDean Nelson xpc_any_openclose_chctl_flags_set(union xpc_channel_ctl_flags *chctl) 6257fb5e59dSDean Nelson { 6267fb5e59dSDean Nelson int ch_number; 6277fb5e59dSDean Nelson 6287fb5e59dSDean Nelson for (ch_number = 0; ch_number < XPC_MAX_NCHANNELS; ch_number++) { 6297fb5e59dSDean Nelson if (chctl->flags[ch_number] & XPC_OPENCLOSE_CHCTL_FLAGS) 6307fb5e59dSDean Nelson return 1; 6317fb5e59dSDean Nelson } 6327fb5e59dSDean Nelson return 0; 6337fb5e59dSDean Nelson } 6347fb5e59dSDean Nelson 6357fb5e59dSDean Nelson static inline int 6367fb5e59dSDean Nelson xpc_any_msg_chctl_flags_set(union xpc_channel_ctl_flags *chctl) 6377fb5e59dSDean Nelson { 6387fb5e59dSDean Nelson int ch_number; 6397fb5e59dSDean Nelson 6407fb5e59dSDean Nelson for (ch_number = 0; ch_number < XPC_MAX_NCHANNELS; ch_number++) { 6417fb5e59dSDean Nelson if (chctl->flags[ch_number] & XPC_MSG_CHCTL_FLAGS) 6427fb5e59dSDean Nelson return 1; 6437fb5e59dSDean Nelson } 6447fb5e59dSDean Nelson return 0; 6457fb5e59dSDean Nelson } 6467fb5e59dSDean Nelson 6477fb5e59dSDean Nelson /* 648ea57f80cSDean Nelson * Manage channels on a partition basis. There is one of these structures 64945d9ca49SDean Nelson * for each partition (a partition will never utilize the structure that 65045d9ca49SDean Nelson * represents itself). 65145d9ca49SDean Nelson */ 652a47d5dacSDean Nelson 653a47d5dacSDean Nelson struct xpc_partition_sn2 { 654a812dcc3SDean Nelson unsigned long remote_amos_page_pa; /* paddr of partition's amos page */ 655a47d5dacSDean Nelson int activate_IRQ_nasid; /* active partition's act/deact nasid */ 656a47d5dacSDean Nelson int activate_IRQ_phys_cpuid; /* active part's act/deact phys cpuid */ 657a47d5dacSDean Nelson 658a812dcc3SDean Nelson unsigned long remote_vars_pa; /* phys addr of partition's vars */ 659a812dcc3SDean Nelson unsigned long remote_vars_part_pa; /* paddr of partition's vars part */ 660a47d5dacSDean Nelson u8 remote_vars_version; /* version# of partition's vars */ 661a47d5dacSDean Nelson 662a47d5dacSDean Nelson void *local_GPs_base; /* base address of kmalloc'd space */ 663261f3b49SDean Nelson struct xpc_gp_sn2 *local_GPs; /* local Get/Put values */ 664a47d5dacSDean Nelson void *remote_GPs_base; /* base address of kmalloc'd space */ 665261f3b49SDean Nelson struct xpc_gp_sn2 *remote_GPs; /* copy of remote partition's local */ 666a47d5dacSDean Nelson /* Get/Put values */ 667a812dcc3SDean Nelson unsigned long remote_GPs_pa; /* phys addr of remote partition's local */ 668a47d5dacSDean Nelson /* Get/Put values */ 669a47d5dacSDean Nelson 6705b8669dfSDean Nelson void *local_openclose_args_base; /* base address of kmalloc'd space */ 6715b8669dfSDean Nelson struct xpc_openclose_args *local_openclose_args; /* local's args */ 672a812dcc3SDean Nelson unsigned long remote_openclose_args_pa; /* phys addr of remote's args */ 673a47d5dacSDean Nelson 6747fb5e59dSDean Nelson int notify_IRQ_nasid; /* nasid of where to send notify IRQs */ 6757fb5e59dSDean Nelson int notify_IRQ_phys_cpuid; /* CPUID of where to send notify IRQs */ 6767fb5e59dSDean Nelson char notify_IRQ_owner[8]; /* notify IRQ's owner's name */ 677a47d5dacSDean Nelson 678c39838ceSDean Nelson struct amo *remote_chctl_amo_va; /* addr of remote chctl flags' amo */ 679c39838ceSDean Nelson struct amo *local_chctl_amo_va; /* address of chctl flags' amo */ 680a47d5dacSDean Nelson 681a47d5dacSDean Nelson struct timer_list dropped_notify_IRQ_timer; /* dropped IRQ timer */ 682a47d5dacSDean Nelson }; 683a47d5dacSDean Nelson 684a47d5dacSDean Nelson struct xpc_partition_uv { 6855b8669dfSDean Nelson unsigned long remote_activate_mq_gpa; /* gru phys address of remote */ 6865b8669dfSDean Nelson /* partition's activate mq */ 6875b8669dfSDean Nelson spinlock_t flags_lock; /* protect updating of flags */ 6885b8669dfSDean Nelson unsigned int flags; /* general flags */ 6895b8669dfSDean Nelson u8 remote_act_state; /* remote partition's act_state */ 6905b8669dfSDean Nelson u8 act_state_req; /* act_state request from remote partition */ 6915b8669dfSDean Nelson enum xp_retval reason; /* reason for deactivate act_state request */ 6925b8669dfSDean Nelson u64 heartbeat; /* incremented by remote partition */ 693a47d5dacSDean Nelson }; 694a47d5dacSDean Nelson 6955b8669dfSDean Nelson /* struct xpc_partition_uv flags */ 6965b8669dfSDean Nelson 6975b8669dfSDean Nelson #define XPC_P_HEARTBEAT_OFFLINE_UV 0x00000001 6985b8669dfSDean Nelson #define XPC_P_ENGAGED_UV 0x00000002 6995b8669dfSDean Nelson 7005b8669dfSDean Nelson /* struct xpc_partition_uv act_state change requests */ 7015b8669dfSDean Nelson 7025b8669dfSDean Nelson #define XPC_P_ASR_ACTIVATE_UV 0x01 7035b8669dfSDean Nelson #define XPC_P_ASR_REACTIVATE_UV 0x02 7045b8669dfSDean Nelson #define XPC_P_ASR_DEACTIVATE_UV 0x03 7055b8669dfSDean Nelson 70645d9ca49SDean Nelson struct xpc_partition { 70745d9ca49SDean Nelson 70845d9ca49SDean Nelson /* XPC HB infrastructure */ 70945d9ca49SDean Nelson 71045d9ca49SDean Nelson u8 remote_rp_version; /* version# of partition's rsvd pg */ 71181fe7883SDean Nelson unsigned long remote_rp_ts_jiffies; /* timestamp when rsvd pg setup */ 712a812dcc3SDean Nelson unsigned long remote_rp_pa; /* phys addr of partition's rsvd pg */ 71345d9ca49SDean Nelson u64 last_heartbeat; /* HB at last read */ 7146e41017aSDean Nelson u32 activate_IRQ_rcvd; /* IRQs since activation */ 71545d9ca49SDean Nelson spinlock_t act_lock; /* protect updating of act_state */ 71645d9ca49SDean Nelson u8 act_state; /* from XPC HB viewpoint */ 71765c17b80SDean Nelson enum xp_retval reason; /* reason partition is deactivating */ 71845d9ca49SDean Nelson int reason_line; /* line# deactivation initiated from */ 71945d9ca49SDean Nelson 720a47d5dacSDean Nelson unsigned long disengage_timeout; /* timeout in jiffies */ 721a47d5dacSDean Nelson struct timer_list disengage_timer; 72245d9ca49SDean Nelson 72345d9ca49SDean Nelson /* XPC infrastructure referencing and teardown control */ 72445d9ca49SDean Nelson 7252c2b94f9SDean Nelson u8 setup_state; /* infrastructure setup state */ 72645d9ca49SDean Nelson wait_queue_head_t teardown_wq; /* kthread waiting to teardown infra */ 72745d9ca49SDean Nelson atomic_t references; /* #of references to infrastructure */ 72845d9ca49SDean Nelson 72945d9ca49SDean Nelson u8 nchannels; /* #of defined channels supported */ 73045d9ca49SDean Nelson atomic_t nchannels_active; /* #of channels that are not DISCONNECTED */ 73145d9ca49SDean Nelson atomic_t nchannels_engaged; /* #of channels engaged with remote part */ 73245d9ca49SDean Nelson struct xpc_channel *channels; /* array of channel structures */ 73345d9ca49SDean Nelson 7347fb5e59dSDean Nelson /* fields used for managing channel avialability and activity */ 7357fb5e59dSDean Nelson 7367fb5e59dSDean Nelson union xpc_channel_ctl_flags chctl; /* chctl flags yet to be processed */ 7377fb5e59dSDean Nelson spinlock_t chctl_lock; /* chctl flags lock */ 73845d9ca49SDean Nelson 73945d9ca49SDean Nelson void *remote_openclose_args_base; /* base address of kmalloc'd space */ 74045d9ca49SDean Nelson struct xpc_openclose_args *remote_openclose_args; /* copy of remote's */ 74145d9ca49SDean Nelson /* args */ 74245d9ca49SDean Nelson 74345d9ca49SDean Nelson /* channel manager related fields */ 74445d9ca49SDean Nelson 74545d9ca49SDean Nelson atomic_t channel_mgr_requests; /* #of requests to activate chan mgr */ 74645d9ca49SDean Nelson wait_queue_head_t channel_mgr_wq; /* channel mgr's wait queue */ 74745d9ca49SDean Nelson 748a47d5dacSDean Nelson union { 749a47d5dacSDean Nelson struct xpc_partition_sn2 sn2; 750a47d5dacSDean Nelson struct xpc_partition_uv uv; 751a47d5dacSDean Nelson } sn; 752a47d5dacSDean Nelson 75345d9ca49SDean Nelson } ____cacheline_aligned; 75445d9ca49SDean Nelson 75545d9ca49SDean Nelson /* struct xpc_partition act_state values (for XPC HB) */ 75645d9ca49SDean Nelson 75783469b55SDean Nelson #define XPC_P_AS_INACTIVE 0x00 /* partition is not active */ 75883469b55SDean Nelson #define XPC_P_AS_ACTIVATION_REQ 0x01 /* created thread to activate */ 75983469b55SDean Nelson #define XPC_P_AS_ACTIVATING 0x02 /* activation thread started */ 76083469b55SDean Nelson #define XPC_P_AS_ACTIVE 0x03 /* xpc_partition_up() was called */ 76183469b55SDean Nelson #define XPC_P_AS_DEACTIVATING 0x04 /* partition deactivation initiated */ 76245d9ca49SDean Nelson 76345d9ca49SDean Nelson #define XPC_DEACTIVATE_PARTITION(_p, _reason) \ 76445d9ca49SDean Nelson xpc_deactivate_partition(__LINE__, (_p), (_reason)) 76545d9ca49SDean Nelson 76645d9ca49SDean Nelson /* struct xpc_partition setup_state values */ 76745d9ca49SDean Nelson 76883469b55SDean Nelson #define XPC_P_SS_UNSET 0x00 /* infrastructure was never setup */ 76983469b55SDean Nelson #define XPC_P_SS_SETUP 0x01 /* infrastructure is setup */ 77083469b55SDean Nelson #define XPC_P_SS_WTEARDOWN 0x02 /* waiting to teardown infrastructure */ 77183469b55SDean Nelson #define XPC_P_SS_TORNDOWN 0x03 /* infrastructure is torndown */ 77245d9ca49SDean Nelson 77345d9ca49SDean Nelson /* 7747fb5e59dSDean Nelson * struct xpc_partition_sn2's dropped notify IRQ timer is set to wait the 7757fb5e59dSDean Nelson * following interval #of seconds before checking for dropped notify IRQs. 7767fb5e59dSDean Nelson * These can occur whenever an IRQ's associated amo write doesn't complete 7777fb5e59dSDean Nelson * until after the IRQ was received. 77845d9ca49SDean Nelson */ 7797fb5e59dSDean Nelson #define XPC_DROPPED_NOTIFY_IRQ_WAIT_INTERVAL (0.25 * HZ) 78045d9ca49SDean Nelson 78145d9ca49SDean Nelson /* number of seconds to wait for other partitions to disengage */ 782a47d5dacSDean Nelson #define XPC_DISENGAGE_DEFAULT_TIMELIMIT 90 78345d9ca49SDean Nelson 784a47d5dacSDean Nelson /* interval in seconds to print 'waiting deactivation' messages */ 785a47d5dacSDean Nelson #define XPC_DEACTIVATE_PRINTMSG_INTERVAL 10 78645d9ca49SDean Nelson 78764d032baSDean Nelson #define XPC_PARTID(_p) ((short)((_p) - &xpc_partitions[0])) 78845d9ca49SDean Nelson 78945d9ca49SDean Nelson /* found in xp_main.c */ 79045d9ca49SDean Nelson extern struct xpc_registration xpc_registrations[]; 79145d9ca49SDean Nelson 79245d9ca49SDean Nelson /* found in xpc_main.c */ 79345d9ca49SDean Nelson extern struct device *xpc_part; 79445d9ca49SDean Nelson extern struct device *xpc_chan; 795a47d5dacSDean Nelson extern int xpc_disengage_timelimit; 796a47d5dacSDean Nelson extern int xpc_disengage_timedout; 7975b8669dfSDean Nelson extern int xpc_activate_IRQ_rcvd; 7985b8669dfSDean Nelson extern spinlock_t xpc_activate_IRQ_rcvd_lock; 7996e41017aSDean Nelson extern wait_queue_head_t xpc_activate_IRQ_wq; 80033ba3c77SDean Nelson extern void *xpc_heartbeating_to_mask; 8015b8669dfSDean Nelson extern void *xpc_kzalloc_cacheline_aligned(size_t, gfp_t, void **); 80245d9ca49SDean Nelson extern void xpc_activate_partition(struct xpc_partition *); 80345d9ca49SDean Nelson extern void xpc_activate_kthreads(struct xpc_channel *, int); 80445d9ca49SDean Nelson extern void xpc_create_kthreads(struct xpc_channel *, int, int); 80545d9ca49SDean Nelson extern void xpc_disconnect_wait(int); 8065b8669dfSDean Nelson extern int (*xpc_setup_partitions_sn) (void); 807a812dcc3SDean Nelson extern enum xp_retval (*xpc_get_partition_rsvd_page_pa) (void *, u64 *, 808a812dcc3SDean Nelson unsigned long *, 809261f3b49SDean Nelson size_t *); 8105b8669dfSDean Nelson extern int (*xpc_setup_rsvd_page_sn) (struct xpc_rsvd_page *); 81133ba3c77SDean Nelson extern void (*xpc_heartbeat_init) (void); 81233ba3c77SDean Nelson extern void (*xpc_heartbeat_exit) (void); 81333ba3c77SDean Nelson extern void (*xpc_increment_heartbeat) (void); 81433ba3c77SDean Nelson extern void (*xpc_offline_heartbeat) (void); 81533ba3c77SDean Nelson extern void (*xpc_online_heartbeat) (void); 81661deb86eSDean Nelson extern enum xp_retval (*xpc_get_remote_heartbeat) (struct xpc_partition *); 817e17d416bSDean Nelson extern enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *); 8187fb5e59dSDean Nelson extern u64 (*xpc_get_chctl_all_flags) (struct xpc_partition *); 8195b8669dfSDean Nelson extern enum xp_retval (*xpc_setup_msg_structures) (struct xpc_channel *); 8205b8669dfSDean Nelson extern void (*xpc_teardown_msg_structures) (struct xpc_channel *); 821a47d5dacSDean Nelson extern void (*xpc_notify_senders_of_disconnect) (struct xpc_channel *); 8227fb5e59dSDean Nelson extern void (*xpc_process_msg_chctl_flags) (struct xpc_partition *, int); 823bd3e64c1SDean Nelson extern int (*xpc_n_of_deliverable_payloads) (struct xpc_channel *); 824bd3e64c1SDean Nelson extern void *(*xpc_get_deliverable_payload) (struct xpc_channel *); 825a812dcc3SDean Nelson extern void (*xpc_request_partition_activation) (struct xpc_rsvd_page *, 826a812dcc3SDean Nelson unsigned long, int); 827a47d5dacSDean Nelson extern void (*xpc_request_partition_reactivation) (struct xpc_partition *); 828a47d5dacSDean Nelson extern void (*xpc_request_partition_deactivation) (struct xpc_partition *); 829a47d5dacSDean Nelson extern void (*xpc_cancel_partition_deactivation_request) ( 830a47d5dacSDean Nelson struct xpc_partition *); 8315b8669dfSDean Nelson extern void (*xpc_process_activate_IRQ_rcvd) (void); 8325b8669dfSDean Nelson extern enum xp_retval (*xpc_setup_ch_structures_sn) (struct xpc_partition *); 8335b8669dfSDean Nelson extern void (*xpc_teardown_ch_structures_sn) (struct xpc_partition *); 83433ba3c77SDean Nelson 835a47d5dacSDean Nelson extern void (*xpc_indicate_partition_engaged) (struct xpc_partition *); 836a47d5dacSDean Nelson extern int (*xpc_partition_engaged) (short); 837a47d5dacSDean Nelson extern int (*xpc_any_partition_engaged) (void); 838a47d5dacSDean Nelson extern void (*xpc_indicate_partition_disengaged) (struct xpc_partition *); 839a47d5dacSDean Nelson extern void (*xpc_assume_partition_disengaged) (short); 84033ba3c77SDean Nelson 8417fb5e59dSDean Nelson extern void (*xpc_send_chctl_closerequest) (struct xpc_channel *, 84233ba3c77SDean Nelson unsigned long *); 8437fb5e59dSDean Nelson extern void (*xpc_send_chctl_closereply) (struct xpc_channel *, 844a47d5dacSDean Nelson unsigned long *); 8457fb5e59dSDean Nelson extern void (*xpc_send_chctl_openrequest) (struct xpc_channel *, 846a47d5dacSDean Nelson unsigned long *); 8477fb5e59dSDean Nelson extern void (*xpc_send_chctl_openreply) (struct xpc_channel *, unsigned long *); 84833ba3c77SDean Nelson 8495b8669dfSDean Nelson extern void (*xpc_save_remote_msgqueue_pa) (struct xpc_channel *, 8505b8669dfSDean Nelson unsigned long); 8515b8669dfSDean Nelson 852bd3e64c1SDean Nelson extern enum xp_retval (*xpc_send_payload) (struct xpc_channel *, u32, void *, 853bd3e64c1SDean Nelson u16, u8, xpc_notify_func, void *); 854bd3e64c1SDean Nelson extern void (*xpc_received_payload) (struct xpc_channel *, void *); 85594bd2708SDean Nelson 85694bd2708SDean Nelson /* found in xpc_sn2.c */ 8576e41017aSDean Nelson extern int xpc_init_sn2(void); 8586e41017aSDean Nelson extern void xpc_exit_sn2(void); 85994bd2708SDean Nelson 86094bd2708SDean Nelson /* found in xpc_uv.c */ 8615b8669dfSDean Nelson extern int xpc_init_uv(void); 8626e41017aSDean Nelson extern void xpc_exit_uv(void); 86394bd2708SDean Nelson 86445d9ca49SDean Nelson /* found in xpc_partition.c */ 86545d9ca49SDean Nelson extern int xpc_exiting; 86604de7418SDean Nelson extern int xpc_nasid_mask_nlongs; 86745d9ca49SDean Nelson extern struct xpc_rsvd_page *xpc_rsvd_page; 86804de7418SDean Nelson extern unsigned long *xpc_mach_nasids; 869bc63d387SDean Nelson extern struct xpc_partition *xpc_partitions; 87045d9ca49SDean Nelson extern void *xpc_kmalloc_cacheline_aligned(size_t, gfp_t, void **); 8715b8669dfSDean Nelson extern int xpc_setup_rsvd_page(void); 8725b8669dfSDean Nelson extern void xpc_teardown_rsvd_page(void); 8736e41017aSDean Nelson extern int xpc_identify_activate_IRQ_sender(void); 87445d9ca49SDean Nelson extern int xpc_partition_disengaged(struct xpc_partition *); 87565c17b80SDean Nelson extern enum xp_retval xpc_mark_partition_active(struct xpc_partition *); 87645d9ca49SDean Nelson extern void xpc_mark_partition_inactive(struct xpc_partition *); 87745d9ca49SDean Nelson extern void xpc_discovery(void); 87804de7418SDean Nelson extern enum xp_retval xpc_get_remote_rp(int, unsigned long *, 879a812dcc3SDean Nelson struct xpc_rsvd_page *, 880a812dcc3SDean Nelson unsigned long *); 88145d9ca49SDean Nelson extern void xpc_deactivate_partition(const int, struct xpc_partition *, 88265c17b80SDean Nelson enum xp_retval); 88364d032baSDean Nelson extern enum xp_retval xpc_initiate_partid_to_nasids(short, void *); 88445d9ca49SDean Nelson 88545d9ca49SDean Nelson /* found in xpc_channel.c */ 88645d9ca49SDean Nelson extern void xpc_initiate_connect(int); 88745d9ca49SDean Nelson extern void xpc_initiate_disconnect(int); 88833ba3c77SDean Nelson extern enum xp_retval xpc_allocate_msg_wait(struct xpc_channel *); 88997bf1aa1SDean Nelson extern enum xp_retval xpc_initiate_send(short, int, u32, void *, u16); 89097bf1aa1SDean Nelson extern enum xp_retval xpc_initiate_send_notify(short, int, u32, void *, u16, 89145d9ca49SDean Nelson xpc_notify_func, void *); 89264d032baSDean Nelson extern void xpc_initiate_received(short, int, void *); 8937fb5e59dSDean Nelson extern void xpc_process_sent_chctl_flags(struct xpc_partition *); 89445d9ca49SDean Nelson extern void xpc_connected_callout(struct xpc_channel *); 895bd3e64c1SDean Nelson extern void xpc_deliver_payload(struct xpc_channel *); 89645d9ca49SDean Nelson extern void xpc_disconnect_channel(const int, struct xpc_channel *, 89765c17b80SDean Nelson enum xp_retval, unsigned long *); 89865c17b80SDean Nelson extern void xpc_disconnect_callout(struct xpc_channel *, enum xp_retval); 89965c17b80SDean Nelson extern void xpc_partition_going_down(struct xpc_partition *, enum xp_retval); 90045d9ca49SDean Nelson 90133ba3c77SDean Nelson static inline int 90233ba3c77SDean Nelson xpc_hb_allowed(short partid, void *heartbeating_to_mask) 90333ba3c77SDean Nelson { 90433ba3c77SDean Nelson return test_bit(partid, heartbeating_to_mask); 90533ba3c77SDean Nelson } 90633ba3c77SDean Nelson 90733ba3c77SDean Nelson static inline int 90833ba3c77SDean Nelson xpc_any_hbs_allowed(void) 90933ba3c77SDean Nelson { 91033ba3c77SDean Nelson DBUG_ON(xpc_heartbeating_to_mask == NULL); 91133ba3c77SDean Nelson return !bitmap_empty(xpc_heartbeating_to_mask, xp_max_npartitions); 91233ba3c77SDean Nelson } 91333ba3c77SDean Nelson 91433ba3c77SDean Nelson static inline void 91533ba3c77SDean Nelson xpc_allow_hb(short partid) 91633ba3c77SDean Nelson { 91733ba3c77SDean Nelson DBUG_ON(xpc_heartbeating_to_mask == NULL); 91833ba3c77SDean Nelson set_bit(partid, xpc_heartbeating_to_mask); 91933ba3c77SDean Nelson } 92033ba3c77SDean Nelson 92133ba3c77SDean Nelson static inline void 92233ba3c77SDean Nelson xpc_disallow_hb(short partid) 92333ba3c77SDean Nelson { 92433ba3c77SDean Nelson DBUG_ON(xpc_heartbeating_to_mask == NULL); 92533ba3c77SDean Nelson clear_bit(partid, xpc_heartbeating_to_mask); 92633ba3c77SDean Nelson } 92733ba3c77SDean Nelson 92833ba3c77SDean Nelson static inline void 92933ba3c77SDean Nelson xpc_disallow_all_hbs(void) 93033ba3c77SDean Nelson { 93133ba3c77SDean Nelson DBUG_ON(xpc_heartbeating_to_mask == NULL); 93233ba3c77SDean Nelson bitmap_zero(xpc_heartbeating_to_mask, xp_max_npartitions); 93333ba3c77SDean Nelson } 93433ba3c77SDean Nelson 93545d9ca49SDean Nelson static inline void 93645d9ca49SDean Nelson xpc_wakeup_channel_mgr(struct xpc_partition *part) 93745d9ca49SDean Nelson { 9382c2b94f9SDean Nelson if (atomic_inc_return(&part->channel_mgr_requests) == 1) 93945d9ca49SDean Nelson wake_up(&part->channel_mgr_wq); 94045d9ca49SDean Nelson } 94145d9ca49SDean Nelson 94245d9ca49SDean Nelson /* 94345d9ca49SDean Nelson * These next two inlines are used to keep us from tearing down a channel's 94445d9ca49SDean Nelson * msg queues while a thread may be referencing them. 94545d9ca49SDean Nelson */ 94645d9ca49SDean Nelson static inline void 94745d9ca49SDean Nelson xpc_msgqueue_ref(struct xpc_channel *ch) 94845d9ca49SDean Nelson { 94945d9ca49SDean Nelson atomic_inc(&ch->references); 95045d9ca49SDean Nelson } 95145d9ca49SDean Nelson 95245d9ca49SDean Nelson static inline void 95345d9ca49SDean Nelson xpc_msgqueue_deref(struct xpc_channel *ch) 95445d9ca49SDean Nelson { 95545d9ca49SDean Nelson s32 refs = atomic_dec_return(&ch->references); 95645d9ca49SDean Nelson 95745d9ca49SDean Nelson DBUG_ON(refs < 0); 9582c2b94f9SDean Nelson if (refs == 0) 95945d9ca49SDean Nelson xpc_wakeup_channel_mgr(&xpc_partitions[ch->partid]); 96045d9ca49SDean Nelson } 96145d9ca49SDean Nelson 96245d9ca49SDean Nelson #define XPC_DISCONNECT_CHANNEL(_ch, _reason, _irqflgs) \ 96345d9ca49SDean Nelson xpc_disconnect_channel(__LINE__, _ch, _reason, _irqflgs) 96445d9ca49SDean Nelson 96545d9ca49SDean Nelson /* 96645d9ca49SDean Nelson * These two inlines are used to keep us from tearing down a partition's 96745d9ca49SDean Nelson * setup infrastructure while a thread may be referencing it. 96845d9ca49SDean Nelson */ 96945d9ca49SDean Nelson static inline void 97045d9ca49SDean Nelson xpc_part_deref(struct xpc_partition *part) 97145d9ca49SDean Nelson { 97245d9ca49SDean Nelson s32 refs = atomic_dec_return(&part->references); 97345d9ca49SDean Nelson 97445d9ca49SDean Nelson DBUG_ON(refs < 0); 97583469b55SDean Nelson if (refs == 0 && part->setup_state == XPC_P_SS_WTEARDOWN) 97645d9ca49SDean Nelson wake_up(&part->teardown_wq); 97745d9ca49SDean Nelson } 97845d9ca49SDean Nelson 97945d9ca49SDean Nelson static inline int 98045d9ca49SDean Nelson xpc_part_ref(struct xpc_partition *part) 98145d9ca49SDean Nelson { 98245d9ca49SDean Nelson int setup; 98345d9ca49SDean Nelson 98445d9ca49SDean Nelson atomic_inc(&part->references); 98583469b55SDean Nelson setup = (part->setup_state == XPC_P_SS_SETUP); 9862c2b94f9SDean Nelson if (!setup) 98745d9ca49SDean Nelson xpc_part_deref(part); 9882c2b94f9SDean Nelson 98945d9ca49SDean Nelson return setup; 99045d9ca49SDean Nelson } 99145d9ca49SDean Nelson 99245d9ca49SDean Nelson /* 99345d9ca49SDean Nelson * The following macro is to be used for the setting of the reason and 99445d9ca49SDean Nelson * reason_line fields in both the struct xpc_channel and struct xpc_partition 99545d9ca49SDean Nelson * structures. 99645d9ca49SDean Nelson */ 99745d9ca49SDean Nelson #define XPC_SET_REASON(_p, _reason, _line) \ 99845d9ca49SDean Nelson { \ 99945d9ca49SDean Nelson (_p)->reason = _reason; \ 100045d9ca49SDean Nelson (_p)->reason_line = _line; \ 100145d9ca49SDean Nelson } 100245d9ca49SDean Nelson 100345d9ca49SDean Nelson #endif /* _DRIVERS_MISC_SGIXP_XPC_H */ 1004