aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/hyperv.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/hyperv.h')
-rw-r--r--include/linux/hyperv.h248
1 files changed, 230 insertions, 18 deletions
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index e73b852156b1..df77ba9a8166 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -325,14 +325,28 @@ struct hv_ring_buffer {
325 325
326 u32 interrupt_mask; 326 u32 interrupt_mask;
327 327
328 /* Pad it to PAGE_SIZE so that data starts on page boundary */ 328 /*
329 u8 reserved[4084]; 329 * Win8 uses some of the reserved bits to implement
330 330 * interrupt driven flow management. On the send side
331 /* NOTE: 331 * we can request that the receiver interrupt the sender
332 * The interrupt_mask field is used only for channels but since our 332 * when the ring transitions from being full to being able
333 * vmbus connection also uses this data structure and its data starts 333 * to handle a message of size "pending_send_sz".
334 * here, we commented out this field. 334 *
335 * Add necessary state for this enhancement.
335 */ 336 */
337 u32 pending_send_sz;
338
339 u32 reserved1[12];
340
341 union {
342 struct {
343 u32 feat_pending_send_sz:1;
344 };
345 u32 value;
346 } feature_bits;
347
348 /* Pad it to PAGE_SIZE so that data starts on page boundary */
349 u8 reserved2[4028];
336 350
337 /* 351 /*
338 * Ring data starts here + RingDataStartOffset 352 * Ring data starts here + RingDataStartOffset
@@ -405,12 +419,22 @@ hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
405 */ 419 */
406#define HV_DRV_VERSION "3.1" 420#define HV_DRV_VERSION "3.1"
407 421
408
409/* 422/*
410 * A revision number of vmbus that is used for ensuring both ends on a 423 * VMBUS version is 32 bit entity broken up into
411 * partition are using compatible versions. 424 * two 16 bit quantities: major_number. minor_number.
425 *
426 * 0 . 13 (Windows Server 2008)
427 * 1 . 1 (Windows 7)
428 * 2 . 4 (Windows 8)
412 */ 429 */
413#define VMBUS_REVISION_NUMBER 13 430
431#define VERSION_WS2008 ((0 << 16) | (13))
432#define VERSION_WIN7 ((1 << 16) | (1))
433#define VERSION_WIN8 ((2 << 16) | (4))
434
435#define VERSION_INVAL -1
436
437#define VERSION_CURRENT VERSION_WIN8
414 438
415/* Make maximum size of pipe payload of 16K */ 439/* Make maximum size of pipe payload of 16K */
416#define MAX_PIPE_DATA_PAYLOAD (sizeof(u8) * 16384) 440#define MAX_PIPE_DATA_PAYLOAD (sizeof(u8) * 16384)
@@ -432,9 +456,13 @@ hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
432struct vmbus_channel_offer { 456struct vmbus_channel_offer {
433 uuid_le if_type; 457 uuid_le if_type;
434 uuid_le if_instance; 458 uuid_le if_instance;
435 u64 int_latency; /* in 100ns units */ 459
436 u32 if_revision; 460 /*
437 u32 server_ctx_size; /* in bytes */ 461 * These two fields are not currently used.
462 */
463 u64 reserved1;
464 u64 reserved2;
465
438 u16 chn_flags; 466 u16 chn_flags;
439 u16 mmio_megabytes; /* in bytes * 1024 * 1024 */ 467 u16 mmio_megabytes; /* in bytes * 1024 * 1024 */
440 468
@@ -456,7 +484,11 @@ struct vmbus_channel_offer {
456 unsigned char user_def[MAX_PIPE_USER_DEFINED_BYTES]; 484 unsigned char user_def[MAX_PIPE_USER_DEFINED_BYTES];
457 } pipe; 485 } pipe;
458 } u; 486 } u;
459 u32 padding; 487 /*
488 * The sub_channel_index is defined in win8.
489 */
490 u16 sub_channel_index;
491 u16 reserved3;
460} __packed; 492} __packed;
461 493
462/* Server Flags */ 494/* Server Flags */
@@ -652,7 +684,25 @@ struct vmbus_channel_offer_channel {
652 struct vmbus_channel_offer offer; 684 struct vmbus_channel_offer offer;
653 u32 child_relid; 685 u32 child_relid;
654 u8 monitorid; 686 u8 monitorid;
655 u8 monitor_allocated; 687 /*
688 * win7 and beyond splits this field into a bit field.
689 */
690 u8 monitor_allocated:1;
691 u8 reserved:7;
692 /*
693 * These are new fields added in win7 and later.
694 * Do not access these fields without checking the
695 * negotiated protocol.
696 *
697 * If "is_dedicated_interrupt" is set, we must not set the
698 * associated bit in the channel bitmap while sending the
699 * interrupt to the host.
700 *
701 * connection_id is to be used in signaling the host.
702 */
703 u16 is_dedicated_interrupt:1;
704 u16 reserved1:15;
705 u32 connection_id;
656} __packed; 706} __packed;
657 707
658/* Rescind Offer parameters */ 708/* Rescind Offer parameters */
@@ -683,8 +733,15 @@ struct vmbus_channel_open_channel {
683 /* GPADL for the channel's ring buffer. */ 733 /* GPADL for the channel's ring buffer. */
684 u32 ringbuffer_gpadlhandle; 734 u32 ringbuffer_gpadlhandle;
685 735
686 /* GPADL for the channel's server context save area. */ 736 /*
687 u32 server_contextarea_gpadlhandle; 737 * Starting with win8, this field will be used to specify
738 * the target virtual processor on which to deliver the interrupt for
739 * the host to guest communication.
740 * Prior to win8, incoming channel interrupts would only
741 * be delivered on cpu 0. Setting this value to 0 would
742 * preserve the earlier behavior.
743 */
744 u32 target_vp;
688 745
689 /* 746 /*
690 * The upstream ring buffer begins at offset zero in the memory 747 * The upstream ring buffer begins at offset zero in the memory
@@ -848,6 +905,27 @@ struct vmbus_close_msg {
848 struct vmbus_channel_close_channel msg; 905 struct vmbus_channel_close_channel msg;
849}; 906};
850 907
908/* Define connection identifier type. */
909union hv_connection_id {
910 u32 asu32;
911 struct {
912 u32 id:24;
913 u32 reserved:8;
914 } u;
915};
916
917/* Definition of the hv_signal_event hypercall input structure. */
918struct hv_input_signal_event {
919 union hv_connection_id connectionid;
920 u16 flag_number;
921 u16 rsvdz;
922};
923
924struct hv_input_signal_event_buffer {
925 u64 align8;
926 struct hv_input_signal_event event;
927};
928
851struct vmbus_channel { 929struct vmbus_channel {
852 struct list_head listentry; 930 struct list_head listentry;
853 931
@@ -882,8 +960,42 @@ struct vmbus_channel {
882 960
883 void (*onchannel_callback)(void *context); 961 void (*onchannel_callback)(void *context);
884 void *channel_callback_context; 962 void *channel_callback_context;
963
964 /*
965 * A channel can be marked for efficient (batched)
966 * reading:
967 * If batched_reading is set to "true", we read until the
968 * channel is empty and hold off interrupts from the host
969 * during the entire read process.
970 * If batched_reading is set to "false", the client is not
971 * going to perform batched reading.
972 *
973 * By default we will enable batched reading; specific
974 * drivers that don't want this behavior can turn it off.
975 */
976
977 bool batched_reading;
978
979 bool is_dedicated_interrupt;
980 struct hv_input_signal_event_buffer sig_buf;
981 struct hv_input_signal_event *sig_event;
982
983 /*
984 * Starting with win8, this field will be used to specify
985 * the target virtual processor on which to deliver the interrupt for
986 * the host to guest communication.
987 * Prior to win8, incoming channel interrupts would only
988 * be delivered on cpu 0. Setting this value to 0 would
989 * preserve the earlier behavior.
990 */
991 u32 target_vp;
885}; 992};
886 993
994static inline void set_channel_read_state(struct vmbus_channel *c, bool state)
995{
996 c->batched_reading = state;
997}
998
887void vmbus_onmessage(void *context); 999void vmbus_onmessage(void *context);
888 1000
889int vmbus_request_offers(void); 1001int vmbus_request_offers(void);
@@ -1047,6 +1159,100 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver);
1047 g8, g9, ga, gb, gc, gd, ge, gf }, 1159 g8, g9, ga, gb, gc, gd, ge, gf },
1048 1160
1049/* 1161/*
1162 * GUID definitions of various offer types - services offered to the guest.
1163 */
1164
1165/*
1166 * Network GUID
1167 * {f8615163-df3e-46c5-913f-f2d2f965ed0e}
1168 */
1169#define HV_NIC_GUID \
1170 .guid = { \
1171 0x63, 0x51, 0x61, 0xf8, 0x3e, 0xdf, 0xc5, 0x46, \
1172 0x91, 0x3f, 0xf2, 0xd2, 0xf9, 0x65, 0xed, 0x0e \
1173 }
1174
1175/*
1176 * IDE GUID
1177 * {32412632-86cb-44a2-9b5c-50d1417354f5}
1178 */
1179#define HV_IDE_GUID \
1180 .guid = { \
1181 0x32, 0x26, 0x41, 0x32, 0xcb, 0x86, 0xa2, 0x44, \
1182 0x9b, 0x5c, 0x50, 0xd1, 0x41, 0x73, 0x54, 0xf5 \
1183 }
1184
1185/*
1186 * SCSI GUID
1187 * {ba6163d9-04a1-4d29-b605-72e2ffb1dc7f}
1188 */
1189#define HV_SCSI_GUID \
1190 .guid = { \
1191 0xd9, 0x63, 0x61, 0xba, 0xa1, 0x04, 0x29, 0x4d, \
1192 0xb6, 0x05, 0x72, 0xe2, 0xff, 0xb1, 0xdc, 0x7f \
1193 }
1194
1195/*
1196 * Shutdown GUID
1197 * {0e0b6031-5213-4934-818b-38d90ced39db}
1198 */
1199#define HV_SHUTDOWN_GUID \
1200 .guid = { \
1201 0x31, 0x60, 0x0b, 0x0e, 0x13, 0x52, 0x34, 0x49, \
1202 0x81, 0x8b, 0x38, 0xd9, 0x0c, 0xed, 0x39, 0xdb \
1203 }
1204
1205/*
1206 * Time Synch GUID
1207 * {9527E630-D0AE-497b-ADCE-E80AB0175CAF}
1208 */
1209#define HV_TS_GUID \
1210 .guid = { \
1211 0x30, 0xe6, 0x27, 0x95, 0xae, 0xd0, 0x7b, 0x49, \
1212 0xad, 0xce, 0xe8, 0x0a, 0xb0, 0x17, 0x5c, 0xaf \
1213 }
1214
1215/*
1216 * Heartbeat GUID
1217 * {57164f39-9115-4e78-ab55-382f3bd5422d}
1218 */
1219#define HV_HEART_BEAT_GUID \
1220 .guid = { \
1221 0x39, 0x4f, 0x16, 0x57, 0x15, 0x91, 0x78, 0x4e, \
1222 0xab, 0x55, 0x38, 0x2f, 0x3b, 0xd5, 0x42, 0x2d \
1223 }
1224
1225/*
1226 * KVP GUID
1227 * {a9a0f4e7-5a45-4d96-b827-8a841e8c03e6}
1228 */
1229#define HV_KVP_GUID \
1230 .guid = { \
1231 0xe7, 0xf4, 0xa0, 0xa9, 0x45, 0x5a, 0x96, 0x4d, \
1232 0xb8, 0x27, 0x8a, 0x84, 0x1e, 0x8c, 0x3, 0xe6 \
1233 }
1234
1235/*
1236 * Dynamic memory GUID
1237 * {525074dc-8985-46e2-8057-a307dc18a502}
1238 */
1239#define HV_DM_GUID \
1240 .guid = { \
1241 0xdc, 0x74, 0x50, 0X52, 0x85, 0x89, 0xe2, 0x46, \
1242 0x80, 0x57, 0xa3, 0x07, 0xdc, 0x18, 0xa5, 0x02 \
1243 }
1244
1245/*
1246 * Mouse GUID
1247 * {cfa8b69e-5b4a-4cc0-b98b-8ba1a1f3f95a}
1248 */
1249#define HV_MOUSE_GUID \
1250 .guid = { \
1251 0x9e, 0xb6, 0xa8, 0xcf, 0x4a, 0x5b, 0xc0, 0x4c, \
1252 0xb9, 0x8b, 0x8b, 0xa1, 0xa1, 0xf3, 0xf9, 0x5a \
1253 }
1254
1255/*
1050 * Common header for Hyper-V ICs 1256 * Common header for Hyper-V ICs
1051 */ 1257 */
1052 1258
@@ -1150,5 +1356,11 @@ int hv_kvp_init(struct hv_util_service *);
1150void hv_kvp_deinit(void); 1356void hv_kvp_deinit(void);
1151void hv_kvp_onchannelcallback(void *); 1357void hv_kvp_onchannelcallback(void *);
1152 1358
1359/*
1360 * Negotiated version with the Host.
1361 */
1362
1363extern __u32 vmbus_proto_version;
1364
1153#endif /* __KERNEL__ */ 1365#endif /* __KERNEL__ */
1154#endif /* _HYPERV_H */ 1366#endif /* _HYPERV_H */