3 * Copyright (c) 2011, Microsoft Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16 * Place - Suite 330, Boston, MA 02111-1307 USA.
19 * Haiyang Zhang <haiyangz@microsoft.com>
20 * Hank Janssen <hjanssen@microsoft.com>
21 * K. Y. Srinivasan <kys@microsoft.com>
28 #include <linux/scatterlist.h>
29 #include <linux/list.h>
30 #include <linux/uuid.h>
31 #include <linux/timer.h>
32 #include <linux/workqueue.h>
33 #include <linux/completion.h>
34 #include <linux/device.h>
35 #include <linux/mod_devicetable.h>
38 #include <asm/hyperv.h>
41 #define MAX_PAGE_BUFFER_COUNT 16
42 #define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */
46 /* Single-page buffer */
47 struct hv_page_buffer
{
53 /* Multiple-page buffer */
54 struct hv_multipage_buffer
{
55 /* Length and Offset determines the # of pfns in the array */
58 u64 pfn_array
[MAX_MULTIPAGE_BUFFER_COUNT
];
61 /* 0x18 includes the proprietary packet header */
62 #define MAX_PAGE_BUFFER_PACKET (0x18 + \
63 (sizeof(struct hv_page_buffer) * \
64 MAX_PAGE_BUFFER_COUNT))
65 #define MAX_MULTIPAGE_BUFFER_PACKET (0x18 + \
66 sizeof(struct hv_multipage_buffer))
71 struct hv_ring_buffer
{
72 /* Offset in bytes from the start of ring data below */
75 /* Offset in bytes from the start of ring data below */
80 /* Pad it to PAGE_SIZE so that data starts on page boundary */
84 * The interrupt_mask field is used only for channels but since our
85 * vmbus connection also uses this data structure and its data starts
86 * here, we commented out this field.
90 * Ring data starts here + RingDataStartOffset
91 * !!! DO NOT place any fields below this !!!
96 struct hv_ring_buffer_info
{
97 struct hv_ring_buffer
*ring_buffer
;
98 u32 ring_size
; /* Include the shared header */
101 u32 ring_datasize
; /* < ring_size */
102 u32 ring_data_startoffset
;
105 struct hv_ring_buffer_debug_info
{
106 u32 current_interrupt_mask
;
107 u32 current_read_index
;
108 u32 current_write_index
;
109 u32 bytes_avail_toread
;
110 u32 bytes_avail_towrite
;
114 * We use the same version numbering for all Hyper-V modules.
116 * Definition of versioning is as follows;
118 * Major Number Changes for these scenarios;
119 * 1. When a new version of Windows Hyper-V
121 * 2. A Major change has occurred in the
123 * (For example the merge for the first time
124 * into the kernel) Every time the Major Number
125 * changes, the Revision number is reset to 0.
126 * Minor Number Changes when new functionality is added
127 * to the Linux IC's that is not a bug fix.
129 * 3.1 - Added completed hv_utils driver. Shutdown/Heartbeat/Timesync
131 #define HV_DRV_VERSION "3.1"
135 * A revision number of vmbus that is used for ensuring both ends on a
136 * partition are using compatible versions.
138 #define VMBUS_REVISION_NUMBER 13
140 /* Make maximum size of pipe payload of 16K */
141 #define MAX_PIPE_DATA_PAYLOAD (sizeof(u8) * 16384)
143 /* Define PipeMode values. */
144 #define VMBUS_PIPE_TYPE_BYTE 0x00000000
145 #define VMBUS_PIPE_TYPE_MESSAGE 0x00000004
147 /* The size of the user defined data buffer for non-pipe offers. */
148 #define MAX_USER_DEFINED_BYTES 120
150 /* The size of the user defined data buffer for pipe offers. */
151 #define MAX_PIPE_USER_DEFINED_BYTES 116
154 * At the center of the Channel Management library is the Channel Offer. This
155 * struct contains the fundamental information about an offer.
157 struct vmbus_channel_offer
{
160 u64 int_latency
; /* in 100ns units */
162 u32 server_ctx_size
; /* in bytes */
164 u16 mmio_megabytes
; /* in bytes * 1024 * 1024 */
167 /* Non-pipes: The user has MAX_USER_DEFINED_BYTES bytes. */
169 unsigned char user_def
[MAX_USER_DEFINED_BYTES
];
174 * The following sructure is an integrated pipe protocol, which
175 * is implemented on top of standard user-defined data. Pipe
176 * clients have MAX_PIPE_USER_DEFINED_BYTES left for their own
181 unsigned char user_def
[MAX_PIPE_USER_DEFINED_BYTES
];
188 #define VMBUS_CHANNEL_ENUMERATE_DEVICE_INTERFACE 1
189 #define VMBUS_CHANNEL_SERVER_SUPPORTS_TRANSFER_PAGES 2
190 #define VMBUS_CHANNEL_SERVER_SUPPORTS_GPADLS 4
191 #define VMBUS_CHANNEL_NAMED_PIPE_MODE 0x10
192 #define VMBUS_CHANNEL_LOOPBACK_OFFER 0x100
193 #define VMBUS_CHANNEL_PARENT_OFFER 0x200
194 #define VMBUS_CHANNEL_REQUEST_MONITORED_NOTIFICATION 0x400
196 struct vmpacket_descriptor
{
204 struct vmpacket_header
{
205 u32 prev_pkt_start_offset
;
206 struct vmpacket_descriptor descriptor
;
209 struct vmtransfer_page_range
{
214 struct vmtransfer_page_packet_header
{
215 struct vmpacket_descriptor d
;
217 bool sender_owns_set
;
220 struct vmtransfer_page_range ranges
[1];
223 struct vmgpadl_packet_header
{
224 struct vmpacket_descriptor d
;
229 struct vmadd_remove_transfer_page_set
{
230 struct vmpacket_descriptor d
;
237 * This structure defines a range in guest physical space that can be made to
238 * look virtually contiguous.
247 * This is the format for an Establish Gpadl packet, which contains a handle by
248 * which this GPADL will be known and a set of GPA ranges associated with it.
249 * This can be converted to a MDL by the guest OS. If there are multiple GPA
250 * ranges, then the resulting MDL will be "chained," representing multiple VA
253 struct vmestablish_gpadl
{
254 struct vmpacket_descriptor d
;
257 struct gpa_range range
[1];
261 * This is the format for a Teardown Gpadl packet, which indicates that the
262 * GPADL handle in the Establish Gpadl packet will never be referenced again.
264 struct vmteardown_gpadl
{
265 struct vmpacket_descriptor d
;
267 u32 reserved
; /* for alignment to a 8-byte boundary */
271 * This is the format for a GPA-Direct packet, which contains a set of GPA
272 * ranges, in addition to commands and/or data.
274 struct vmdata_gpa_direct
{
275 struct vmpacket_descriptor d
;
278 struct gpa_range range
[1];
281 /* This is the format for a Additional Data Packet. */
282 struct vmadditional_data
{
283 struct vmpacket_descriptor d
;
287 unsigned char data
[1];
290 union vmpacket_largest_possible_header
{
291 struct vmpacket_descriptor simple_hdr
;
292 struct vmtransfer_page_packet_header xfer_page_hdr
;
293 struct vmgpadl_packet_header gpadl_hdr
;
294 struct vmadd_remove_transfer_page_set add_rm_xfer_page_hdr
;
295 struct vmestablish_gpadl establish_gpadl_hdr
;
296 struct vmteardown_gpadl teardown_gpadl_hdr
;
297 struct vmdata_gpa_direct data_gpa_direct_hdr
;
300 #define VMPACKET_DATA_START_ADDRESS(__packet) \
301 (void *)(((unsigned char *)__packet) + \
302 ((struct vmpacket_descriptor)__packet)->offset8 * 8)
304 #define VMPACKET_DATA_LENGTH(__packet) \
305 ((((struct vmpacket_descriptor)__packet)->len8 - \
306 ((struct vmpacket_descriptor)__packet)->offset8) * 8)
308 #define VMPACKET_TRANSFER_MODE(__packet) \
309 (((struct IMPACT)__packet)->type)
311 enum vmbus_packet_type
{
312 VM_PKT_INVALID
= 0x0,
314 VM_PKT_ADD_XFER_PAGESET
= 0x2,
315 VM_PKT_RM_XFER_PAGESET
= 0x3,
316 VM_PKT_ESTABLISH_GPADL
= 0x4,
317 VM_PKT_TEARDOWN_GPADL
= 0x5,
318 VM_PKT_DATA_INBAND
= 0x6,
319 VM_PKT_DATA_USING_XFER_PAGES
= 0x7,
320 VM_PKT_DATA_USING_GPADL
= 0x8,
321 VM_PKT_DATA_USING_GPA_DIRECT
= 0x9,
322 VM_PKT_CANCEL_REQUEST
= 0xa,
324 VM_PKT_DATA_USING_ADDITIONAL_PKT
= 0xc,
325 VM_PKT_ADDITIONAL_DATA
= 0xd
328 #define VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED 1
331 /* Version 1 messages */
332 enum vmbus_channel_message_type
{
333 CHANNELMSG_INVALID
= 0,
334 CHANNELMSG_OFFERCHANNEL
= 1,
335 CHANNELMSG_RESCIND_CHANNELOFFER
= 2,
336 CHANNELMSG_REQUESTOFFERS
= 3,
337 CHANNELMSG_ALLOFFERS_DELIVERED
= 4,
338 CHANNELMSG_OPENCHANNEL
= 5,
339 CHANNELMSG_OPENCHANNEL_RESULT
= 6,
340 CHANNELMSG_CLOSECHANNEL
= 7,
341 CHANNELMSG_GPADL_HEADER
= 8,
342 CHANNELMSG_GPADL_BODY
= 9,
343 CHANNELMSG_GPADL_CREATED
= 10,
344 CHANNELMSG_GPADL_TEARDOWN
= 11,
345 CHANNELMSG_GPADL_TORNDOWN
= 12,
346 CHANNELMSG_RELID_RELEASED
= 13,
347 CHANNELMSG_INITIATE_CONTACT
= 14,
348 CHANNELMSG_VERSION_RESPONSE
= 15,
349 CHANNELMSG_UNLOAD
= 16,
350 #ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD
351 CHANNELMSG_VIEWRANGE_ADD
= 17,
352 CHANNELMSG_VIEWRANGE_REMOVE
= 18,
357 struct vmbus_channel_message_header
{
358 enum vmbus_channel_message_type msgtype
;
362 /* Query VMBus Version parameters */
363 struct vmbus_channel_query_vmbus_version
{
364 struct vmbus_channel_message_header header
;
368 /* VMBus Version Supported parameters */
369 struct vmbus_channel_version_supported
{
370 struct vmbus_channel_message_header header
;
371 bool version_supported
;
374 /* Offer Channel parameters */
375 struct vmbus_channel_offer_channel
{
376 struct vmbus_channel_message_header header
;
377 struct vmbus_channel_offer offer
;
380 bool monitor_allocated
;
383 /* Rescind Offer parameters */
384 struct vmbus_channel_rescind_offer
{
385 struct vmbus_channel_message_header header
;
390 * Request Offer -- no parameters, SynIC message contains the partition ID
391 * Set Snoop -- no parameters, SynIC message contains the partition ID
392 * Clear Snoop -- no parameters, SynIC message contains the partition ID
393 * All Offers Delivered -- no parameters, SynIC message contains the partition
395 * Flush Client -- no parameters, SynIC message contains the partition ID
398 /* Open Channel parameters */
399 struct vmbus_channel_open_channel
{
400 struct vmbus_channel_message_header header
;
402 /* Identifies the specific VMBus channel that is being opened. */
405 /* ID making a particular open request at a channel offer unique. */
408 /* GPADL for the channel's ring buffer. */
409 u32 ringbuffer_gpadlhandle
;
411 /* GPADL for the channel's server context save area. */
412 u32 server_contextarea_gpadlhandle
;
415 * The upstream ring buffer begins at offset zero in the memory
416 * described by RingBufferGpadlHandle. The downstream ring buffer
417 * follows it at this offset (in pages).
419 u32 downstream_ringbuffer_pageoffset
;
421 /* User-specific data to be passed along to the server endpoint. */
422 unsigned char userdata
[MAX_USER_DEFINED_BYTES
];
425 /* Open Channel Result parameters */
426 struct vmbus_channel_open_result
{
427 struct vmbus_channel_message_header header
;
433 /* Close channel parameters; */
434 struct vmbus_channel_close_channel
{
435 struct vmbus_channel_message_header header
;
439 /* Channel Message GPADL */
440 #define GPADL_TYPE_RING_BUFFER 1
441 #define GPADL_TYPE_SERVER_SAVE_AREA 2
442 #define GPADL_TYPE_TRANSACTION 8
445 * The number of PFNs in a GPADL message is defined by the number of
446 * pages that would be spanned by ByteCount and ByteOffset. If the
447 * implied number of PFNs won't fit in this packet, there will be a
448 * follow-up packet that contains more.
450 struct vmbus_channel_gpadl_header
{
451 struct vmbus_channel_message_header header
;
456 struct gpa_range range
[0];
459 /* This is the followup packet that contains more PFNs. */
460 struct vmbus_channel_gpadl_body
{
461 struct vmbus_channel_message_header header
;
467 struct vmbus_channel_gpadl_created
{
468 struct vmbus_channel_message_header header
;
474 struct vmbus_channel_gpadl_teardown
{
475 struct vmbus_channel_message_header header
;
480 struct vmbus_channel_gpadl_torndown
{
481 struct vmbus_channel_message_header header
;
485 #ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD
486 struct vmbus_channel_view_range_add
{
487 struct vmbus_channel_message_header header
;
488 PHYSICAL_ADDRESS viewrange_base
;
489 u64 viewrange_length
;
493 struct vmbus_channel_view_range_remove
{
494 struct vmbus_channel_message_header header
;
495 PHYSICAL_ADDRESS viewrange_base
;
500 struct vmbus_channel_relid_released
{
501 struct vmbus_channel_message_header header
;
505 struct vmbus_channel_initiate_contact
{
506 struct vmbus_channel_message_header header
;
507 u32 vmbus_version_requested
;
514 struct vmbus_channel_version_response
{
515 struct vmbus_channel_message_header header
;
516 bool version_supported
;
519 enum vmbus_channel_state
{
521 CHANNEL_OPENING_STATE
,
525 struct vmbus_channel_debug_info
{
527 enum vmbus_channel_state state
;
528 uuid_le interfacetype
;
529 uuid_le interface_instance
;
531 u32 servermonitor_pending
;
532 u32 servermonitor_latency
;
533 u32 servermonitor_connectionid
;
534 u32 clientmonitor_pending
;
535 u32 clientmonitor_latency
;
536 u32 clientmonitor_connectionid
;
538 struct hv_ring_buffer_debug_info inbound
;
539 struct hv_ring_buffer_debug_info outbound
;
543 * Represents each channel msg on the vmbus connection This is a
544 * variable-size data structure depending on the msg type itself
546 struct vmbus_channel_msginfo
{
547 /* Bookkeeping stuff */
548 struct list_head msglistentry
;
550 /* So far, this is only used to handle gpadl body message */
551 struct list_head submsglist
;
553 /* Synchronize the request/response if needed */
554 struct completion waitevent
;
556 struct vmbus_channel_version_supported version_supported
;
557 struct vmbus_channel_open_result open_result
;
558 struct vmbus_channel_gpadl_torndown gpadl_torndown
;
559 struct vmbus_channel_gpadl_created gpadl_created
;
560 struct vmbus_channel_version_response version_response
;
565 * The channel message that goes out on the "wire".
566 * It will contain at minimum the VMBUS_CHANNEL_MESSAGE_HEADER header
568 unsigned char msg
[0];
571 struct vmbus_close_msg
{
572 struct vmbus_channel_msginfo info
;
573 struct vmbus_channel_close_channel msg
;
576 struct vmbus_channel
{
577 struct list_head listentry
;
579 struct hv_device
*device_obj
;
581 struct work_struct work
;
583 enum vmbus_channel_state state
;
585 struct vmbus_channel_offer_channel offermsg
;
587 * These are based on the OfferMsg.MonitorId.
588 * Save it here for easy access.
593 u32 ringbuffer_gpadlhandle
;
595 /* Allocated memory for ring buffer */
596 void *ringbuffer_pages
;
597 u32 ringbuffer_pagecount
;
598 struct hv_ring_buffer_info outbound
; /* send to parent */
599 struct hv_ring_buffer_info inbound
; /* receive from parent */
600 spinlock_t inbound_lock
;
601 struct workqueue_struct
*controlwq
;
603 struct vmbus_close_msg close_msg
;
605 /* Channel callback are invoked in this workqueue context */
606 /* HANDLE dataWorkQueue; */
608 void (*onchannel_callback
)(void *context
);
609 void *channel_callback_context
;
612 void free_channel(struct vmbus_channel
*channel
);
614 void vmbus_onmessage(void *context
);
616 int vmbus_request_offers(void);
618 /* The format must be the same as struct vmdata_gpa_direct */
619 struct vmbus_channel_packet_page_buffer
{
627 struct hv_page_buffer range
[MAX_PAGE_BUFFER_COUNT
];
630 /* The format must be the same as struct vmdata_gpa_direct */
631 struct vmbus_channel_packet_multipage_buffer
{
638 u32 rangecount
; /* Always 1 in this case */
639 struct hv_multipage_buffer range
;
643 extern int vmbus_open(struct vmbus_channel
*channel
,
644 u32 send_ringbuffersize
,
645 u32 recv_ringbuffersize
,
648 void(*onchannel_callback
)(void *context
),
651 extern void vmbus_close(struct vmbus_channel
*channel
);
653 extern int vmbus_sendpacket(struct vmbus_channel
*channel
,
657 enum vmbus_packet_type type
,
660 extern int vmbus_sendpacket_pagebuffer(struct vmbus_channel
*channel
,
661 struct hv_page_buffer pagebuffers
[],
667 extern int vmbus_sendpacket_multipagebuffer(struct vmbus_channel
*channel
,
668 struct hv_multipage_buffer
*mpb
,
673 extern int vmbus_establish_gpadl(struct vmbus_channel
*channel
,
678 extern int vmbus_teardown_gpadl(struct vmbus_channel
*channel
,
681 extern int vmbus_recvpacket(struct vmbus_channel
*channel
,
684 u32
*buffer_actual_len
,
687 extern int vmbus_recvpacket_raw(struct vmbus_channel
*channel
,
690 u32
*buffer_actual_len
,
694 extern void vmbus_get_debug_info(struct vmbus_channel
*channel
,
695 struct vmbus_channel_debug_info
*debug
);
697 extern void vmbus_ontimer(unsigned long data
);
700 #define LOWORD(dw) ((unsigned short)(dw))
701 #define HIWORD(dw) ((unsigned short)(((unsigned int) (dw) >> 16) & 0xFFFF))
705 #define STORVSC 0x0002
706 #define NETVSC 0x0004
707 #define INPUTVSC 0x0008
708 #define BLKVSC 0x0010
709 #define VMBUS_DRV 0x0100
710 #define STORVSC_DRV 0x0200
711 #define NETVSC_DRV 0x0400
712 #define INPUTVSC_DRV 0x0800
713 #define BLKVSC_DRV 0x1000
715 #define ALL_MODULES (VMBUS |\
728 #define WARNING_LVL 4
731 #define DEBUG_LVL_ENTEREXIT 8
732 #define DEBUG_RING_LVL 9
734 extern unsigned int vmbus_loglevel
;
736 #define DPRINT(mod, lvl, fmt, args...) do {\
737 if ((mod & (HIWORD(vmbus_loglevel))) && \
738 (lvl <= LOWORD(vmbus_loglevel))) \
739 printk(KERN_DEBUG #mod": %s() " fmt "\n", __func__, ## args);\
742 #define DPRINT_DBG(mod, fmt, args...) do {\
743 if ((mod & (HIWORD(vmbus_loglevel))) && \
744 (DEBUG_LVL <= LOWORD(vmbus_loglevel))) \
745 printk(KERN_DEBUG #mod": %s() " fmt "\n", __func__, ## args);\
748 #define DPRINT_INFO(mod, fmt, args...) do {\
749 if ((mod & (HIWORD(vmbus_loglevel))) && \
750 (INFO_LVL <= LOWORD(vmbus_loglevel))) \
751 printk(KERN_INFO #mod": " fmt "\n", ## args);\
754 #define DPRINT_WARN(mod, fmt, args...) do {\
755 if ((mod & (HIWORD(vmbus_loglevel))) && \
756 (WARNING_LVL <= LOWORD(vmbus_loglevel))) \
757 printk(KERN_WARNING #mod": WARNING! " fmt "\n", ## args);\
760 #define DPRINT_ERR(mod, fmt, args...) do {\
761 if ((mod & (HIWORD(vmbus_loglevel))) && \
762 (ERROR_LVL <= LOWORD(vmbus_loglevel))) \
763 printk(KERN_ERR #mod": %s() ERROR!! " fmt "\n", \
772 struct hv_dev_port_info
{
776 u32 bytes_avail_toread
;
777 u32 bytes_avail_towrite
;
780 struct hv_device_info
{
784 uuid_le chn_instance
;
787 u32 server_monitor_pending
;
788 u32 server_monitor_latency
;
789 u32 server_monitor_conn_id
;
790 u32 client_monitor_pending
;
791 u32 client_monitor_latency
;
792 u32 client_monitor_conn_id
;
794 struct hv_dev_port_info inbound
;
795 struct hv_dev_port_info outbound
;
798 /* Base driver object */
802 /* the device type supported by this driver */
804 const struct hv_vmbus_device_id
*id_table
;
806 struct device_driver driver
;
808 int (*probe
)(struct hv_device
*, const struct hv_vmbus_device_id
*);
809 int (*remove
)(struct hv_device
*);
810 void (*shutdown
)(struct hv_device
*);
814 /* Base device object */
816 /* the device type id of this device */
819 /* the device instance id of this device */
820 uuid_le dev_instance
;
822 struct device device
;
824 struct vmbus_channel
*channel
;
828 static inline struct hv_device
*device_to_hv_device(struct device
*d
)
830 return container_of(d
, struct hv_device
, device
);
833 static inline struct hv_driver
*drv_to_hv_drv(struct device_driver
*d
)
835 return container_of(d
, struct hv_driver
, driver
);
838 static inline void hv_set_drvdata(struct hv_device
*dev
, void *data
)
840 dev_set_drvdata(&dev
->device
, data
);
843 static inline void *hv_get_drvdata(struct hv_device
*dev
)
845 return dev_get_drvdata(&dev
->device
);
848 /* Vmbus interface */
849 #define vmbus_driver_register(driver) \
850 __vmbus_driver_register(driver, THIS_MODULE, KBUILD_MODNAME)
851 int __must_check
__vmbus_driver_register(struct hv_driver
*hv_driver
,
852 struct module
*owner
,
853 const char *mod_name
);
854 void vmbus_driver_unregister(struct hv_driver
*hv_driver
);
857 * VMBUS_DEVICE - macro used to describe a specific hyperv vmbus device
859 * This macro is used to create a struct hv_vmbus_device_id that matches a
862 #define VMBUS_DEVICE(g0, g1, g2, g3, g4, g5, g6, g7, \
863 g8, g9, ga, gb, gc, gd, ge, gf) \
864 .guid = { g0, g1, g2, g3, g4, g5, g6, g7, \
865 g8, g9, ga, gb, gc, gd, ge, gf },
868 * Common header for Hyper-V ICs
871 #define ICMSGTYPE_NEGOTIATE 0
872 #define ICMSGTYPE_HEARTBEAT 1
873 #define ICMSGTYPE_KVPEXCHANGE 2
874 #define ICMSGTYPE_SHUTDOWN 3
875 #define ICMSGTYPE_TIMESYNC 4
876 #define ICMSGTYPE_VSS 5
878 #define ICMSGHDRFLAG_TRANSACTION 1
879 #define ICMSGHDRFLAG_REQUEST 2
880 #define ICMSGHDRFLAG_RESPONSE 4
882 #define HV_S_OK 0x00000000
883 #define HV_E_FAIL 0x80004005
884 #define HV_ERROR_NOT_SUPPORTED 0x80070032
885 #define HV_ERROR_MACHINE_LOCKED 0x800704F7
888 * While we want to handle util services as regular devices,
889 * there is only one instance of each of these services; so
890 * we statically allocate the service specific state.
893 struct hv_util_service
{
895 void (*util_cb
)(void *);
896 int (*util_init
)(struct hv_util_service
*);
897 void (*util_deinit
)(void);
900 struct vmbuspipe_hdr
{
911 struct ic_version icverframe
;
913 struct ic_version icvermsg
;
921 struct icmsg_negotiate
{
925 struct ic_version icversion_data
[1]; /* any size array */
928 struct shutdown_msg_data
{
932 u8 display_message
[2048];
935 struct heartbeat_msg_data
{
940 /* Time Sync IC defs */
941 #define ICTIMESYNCFLAG_PROBE 0
942 #define ICTIMESYNCFLAG_SYNC 1
943 #define ICTIMESYNCFLAG_SAMPLE 2
946 #define WLTIMEDELTA 116444736000000000L /* in 100ns unit */
948 #define WLTIMEDELTA 116444736000000000LL
951 struct ictimesync_data
{
958 struct hyperv_service_callback
{
962 struct vmbus_channel
*channel
;
963 void (*callback
) (void *context
);
966 extern void prep_negotiate_resp(struct icmsg_hdr
*,
967 struct icmsg_negotiate
*, u8
*);
969 #endif /* _HYPERV_H */