iPXE
vmbus.h
Go to the documentation of this file.
1#ifndef _IPXE_VMBUS_H
2#define _IPXE_VMBUS_H
3
4/** @file
5 *
6 * Hyper-V virtual machine bus
7 *
8 */
9
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11
12#include <byteswap.h>
13#include <ipxe/uuid.h>
14#include <ipxe/device.h>
15#include <ipxe/tables.h>
16#include <ipxe/iobuf.h>
17#include <ipxe/hyperv.h>
18
19/** VMBus message connection ID */
20#define VMBUS_MESSAGE_ID 1
21
22/** VMBus event connection ID */
23#define VMBUS_EVENT_ID 2
24
25/** VMBus message type */
26#define VMBUS_MESSAGE_TYPE 1
27
28/** VMBus message synthetic interrupt */
29#define VMBUS_MESSAGE_SINT 2
30
31/** VMBus version number */
33 /** Raw version */
35 /** Major/minor version */
36 struct {
37 /** Minor version */
39 /** Major version */
41 };
42} __attribute__ (( packed ));
43
44/** Known VMBus protocol versions */
46 /** Windows Server 2008 */
47 VMBUS_VERSION_WS2008 = ( ( 0 << 16 ) | ( 13 << 0 ) ),
48 /** Windows 7 */
49 VMBUS_VERSION_WIN7 = ( ( 1 << 16 ) | ( 1 << 0 ) ),
50 /** Windows 8 */
51 VMBUS_VERSION_WIN8 = ( ( 2 << 16 ) | ( 4 << 0 ) ),
52 /** Windows 8.1 */
53 VMBUS_VERSION_WIN8_1 = ( ( 3 << 16 ) | ( 0 << 0 ) ),
54};
55
56/** Guest physical address range descriptor */
58 /** Byte count */
60 /** Starting byte offset */
62 /** Page frame numbers
63 *
64 * The length of this array is implied by the byte count and
65 * starting offset.
66 */
68} __attribute__ (( packed ));
69
70/** VMBus message header */
72 /** Message type */
74 /** Reserved */
76} __attribute__ (( packed ));
77
78/** VMBus message types */
95
96/** VMBus "offer channel" message */
98 /** Message header */
100 /** Channel type */
101 union uuid type;
102 /** Channel instance */
104 /** Reserved */
106 /** Flags */
108 /** Reserved */
110 /** User data */
112 /** Reserved */
114 /** Channel ID */
116 /** Monitor ID */
118 /** Monitor exists */
120 /** Reserved */
122 /** Connection ID */
124} __attribute__ (( packed ));
125
126/** VMBus "open channel" message */
128 /** Message header */
130 /** Channel ID */
132 /** Open ID */
134 /** Ring buffer GPADL ID */
136 /** Reserved */
138 /** Outbound ring buffer size (in pages) */
140 /** User-specific data */
142} __attribute__ (( packed ));
143
144/** VMBus "open channel result" message */
146 /** Message header */
148 /** Channel ID */
150 /** Open ID */
152 /** Status */
154} __attribute__ (( packed ));
155
156/** VMBus "close channel" message */
158 /** Message header */
160 /** Channel ID */
162} __attribute__ (( packed ));
163
164/** VMBus "GPADL header" message */
166 /** Message header */
168 /** Channel ID */
170 /** GPADL ID */
172 /** Length of range descriptors */
174 /** Number of range descriptors */
176 /** Range descriptors */
178} __attribute__ (( packed ));
179
180/** VMBus "GPADL created" message */
182 /** Message header */
184 /** Channel ID */
186 /** GPADL ID */
188 /** Creation status */
190} __attribute__ (( packed ));
191
192/** VMBus "GPADL teardown" message */
194 /** Message header */
196 /** Channel ID */
198 /** GPADL ID */
200} __attribute__ (( packed ));
201
202/** VMBus "GPADL torndown" message */
204 /** Message header */
206 /** GPADL ID */
208} __attribute__ (( packed ));
209
210/** VMBus "initiate contact" message */
212 /** Message header */
214 /** Requested version */
216 /** Target virtual CPU */
218 /** Interrupt page base address */
220 /** Parent to child monitor page base address */
222 /** Child to parent monitor page base address */
224} __attribute__ (( packed ));
225
226/** VMBus "version response" message */
228 /** Message header */
230 /** Version is supported */
232 /** Reserved */
234 /** Version */
236} __attribute__ (( packed ));
237
238/** VMBus message */
240 /** Common message header */
242 /** "Offer channel" message */
244 /** "Open channel" message */
246 /** "Open channel result" message */
248 /** "Close channel" message */
250 /** "GPADL header" message */
252 /** "GPADL created" message */
254 /** "GPADL teardown" message */
256 /** "GPADL torndown" message */
258 /** "Initiate contact" message */
260 /** "Version response" message */
262};
263
264/** VMBus packet header */
266 /** Type */
268 /** Length of packet header (in quadwords) */
270 /** Length of packet (in quadwords) */
272 /** Flags */
274 /** Transaction ID
275 *
276 * This is an opaque token: we therefore treat it as
277 * native-endian and don't worry about byte-swapping.
278 */
280} __attribute__ (( packed ));
281
282/** VMBus packet types */
290
291/** VMBus packet flags */
295
296/** VMBus GPA direct header */
298 /** Packet header */
300 /** Reserved */
302 /** Number of range descriptors */
304 /** Range descriptors */
306} __attribute__ (( packed ));
307
308/** VMBus transfer page range */
310 /** Length */
312 /** Offset */
314} __attribute__ (( packed ));
315
316/** VMBus transfer page header */
318 /** Packet header */
320 /** Page set ID */
322 /** Sender owns page set */
324 /** Reserved */
326 /** Number of range descriptors */
328 /** Range descriptors */
330} __attribute__ (( packed ));
331
332/** Maximum expected size of VMBus packet header */
333#define VMBUS_PACKET_MAX_HEADER_LEN 64
334
335/** VMBus maximum-sized packet header */
337 /** Common header */
339 /** GPA direct header */
341 /** Transfer page header */
343 /** Padding to maximum supported size */
345} __attribute__ (( packed ));
346
347/** VMBus packet footer */
349 /** Reserved */
351 /** Producer index of the first byte of the packet */
353} __attribute__ (( packed ));
354
355/** VMBus ring buffer
356 *
357 * This is the structure of the each of the ring buffers created when
358 * a VMBus channel is opened.
359 */
361 /** Producer index (modulo ring length) */
363 /** Consumer index (modulo ring length) */
365 /** Interrupt mask */
367 /** Reserved */
369 /** Ring buffer contents */
371} __attribute__ (( packed ));
372
373/** VMBus interrupt page */
375 /** Inbound interrupts */
377 /** Outbound interrupts */
379} __attribute__ (( packed ));
380
381/** A virtual machine bus */
382struct vmbus {
383 /** Interrupt page */
385 /** Inbound notifications */
387 /** Outbound notifications */
389 /** Received message buffer */
390 const union vmbus_message *message;
391};
392
393struct vmbus_device;
394
395/** VMBus channel operations */
397 /**
398 * Handle received control packet
399 *
400 * @v vmdev VMBus device
401 * @v xid Transaction ID
402 * @v data Data
403 * @v len Length of data
404 * @ret rc Return status code
405 */
406 int ( * recv_control ) ( struct vmbus_device *vmdev, uint64_t xid,
407 const void *data, size_t len );
408 /**
409 * Handle received data packet
410 *
411 * @v vmdev VMBus device
412 * @v xid Transaction ID
413 * @v data Data
414 * @v len Length of data
415 * @v list List of I/O buffers
416 * @ret rc Return status code
417 *
418 * This function takes ownership of the I/O buffer. It should
419 * eventually call vmbus_send_completion() to indicate to the
420 * host that the buffer can be reused.
421 */
422 int ( * recv_data ) ( struct vmbus_device *vmdev, uint64_t xid,
423 const void *data, size_t len,
424 struct list_head *list );
425 /**
426 * Handle received completion packet
427 *
428 * @v vmdev VMBus device
429 * @v xid Transaction ID
430 * @v data Data
431 * @v len Length of data
432 * @ret rc Return status code
433 */
434 int ( * recv_completion ) ( struct vmbus_device *vmdev, uint64_t xid,
435 const void *data, size_t len );
436 /**
437 * Handle received cancellation packet
438 *
439 * @v vmdev VMBus device
440 * @v xid Transaction ID
441 * @ret rc Return status code
442 */
443 int ( * recv_cancellation ) ( struct vmbus_device *vmdev,
444 uint64_t xid );
445};
446
447struct vmbus_xfer_pages;
448
449/** VMBus transfer page set operations */
451 /**
452 * Copy data from transfer page
453 *
454 * @v pages Transfer page set
455 * @v data Data buffer
456 * @v offset Offset within page set
457 * @v len Length within page set
458 * @ret rc Return status code
459 */
460 int ( * copy ) ( struct vmbus_xfer_pages *pages, void *data,
461 size_t offset, size_t len );
462};
463
464/** VMBus transfer page set */
466 /** List of all transfer page sets */
468 /** Page set ID (in protocol byte order) */
470 /** Page set operations */
472};
473
474/** A VMBus device */
476 /** Generic iPXE device */
477 struct device dev;
478 /** Hyper-V hypervisor */
480
481 /** Channel instance */
483 /** Channel ID */
484 unsigned int channel;
485 /** Monitor ID */
486 unsigned int monitor;
487 /** Signal channel
488 *
489 * @v vmdev VMBus device
490 */
491 void ( * signal ) ( struct vmbus_device *vmdev );
492
493 /** Outbound ring buffer length */
495 /** Inbound ring buffer length */
497 /** Outbound ring buffer */
499 /** Inbound ring buffer */
500 struct vmbus_ring *in;
501 /** Ring buffer GPADL ID */
502 unsigned int gpadl;
503
504 /** Channel operations */
506 /** Maximum expected data packet length */
507 size_t mtu;
508 /** Packet buffer */
509 void *packet;
510 /** List of transfer page sets */
512
513 /** Driver */
515 /** Driver-private data */
516 void *priv;
517};
518
519/** A VMBus device driver */
521 /** Name */
522 const char *name;
523 /** Device type */
524 union uuid type;
525 /** Probe device
526 *
527 * @v vmdev VMBus device
528 * @ret rc Return status code
529 */
530 int ( * probe ) ( struct vmbus_device *vmdev );
531 /** Reset device
532 *
533 * @v vmdev VMBus device
534 * @ret rc Return status code
535 */
536 int ( * reset ) ( struct vmbus_device *vmdev );
537 /** Remove device
538 *
539 * @v vmdev VMBus device
540 */
541 void ( * remove ) ( struct vmbus_device *vmdev );
542};
543
544/** VMBus device driver table */
545#define VMBUS_DRIVERS __table ( struct vmbus_driver, "vmbus_drivers" )
546
547/** Declare a VMBus device driver */
548#define __vmbus_driver __table_entry ( VMBUS_DRIVERS, 01 )
549
550/** Define build rules for a VMBus device driver */
551#define VMBUS_ROM( _name, _desc )
552
553/**
554 * Set VMBus device driver-private data
555 *
556 * @v vmdev VMBus device
557 * @v priv Private data
558 */
559static inline void vmbus_set_drvdata ( struct vmbus_device *vmdev, void *priv ){
560 vmdev->priv = priv;
561}
562
563/**
564 * Get VMBus device driver-private data
565 *
566 * @v vmdev VMBus device
567 * @ret priv Private data
568 */
569static inline void * vmbus_get_drvdata ( struct vmbus_device *vmdev ) {
570 return vmdev->priv;
571}
572
573/** Construct VMBus type */
574#define VMBUS_TYPE( a, b, c, d, e0, e1, e2, e3, e4, e5 ) { \
575 .canonical = { \
576 cpu_to_le32 ( a ), cpu_to_le16 ( b ), \
577 cpu_to_le16 ( c ), cpu_to_be16 ( d ), \
578 { e0, e1, e2, e3, e4, e5 } \
579 } }
580
581/**
582 * Check if data is present in ring buffer
583 *
584 * @v vmdev VMBus device
585 * @v has_data Data is present
586 */
587static inline __attribute__ (( always_inline )) int
588vmbus_has_data ( struct vmbus_device *vmdev ) {
589
590 return ( vmdev->in->prod != vmdev->in->cons );
591}
592
593/**
594 * Register transfer page set
595 *
596 * @v vmdev VMBus device
597 * @v pages Transfer page set
598 * @ret rc Return status code
599 */
600static inline __attribute__ (( always_inline )) int
602 struct vmbus_xfer_pages *pages ) {
603
604 list_add ( &pages->list, &vmdev->pages );
605 return 0;
606}
607
608/**
609 * Unregister transfer page set
610 *
611 * @v vmdev VMBus device
612 * @v pages Transfer page set
613 */
614static inline __attribute__ (( always_inline )) void
616 struct vmbus_xfer_pages *pages ) {
617
618 list_check_contains_entry ( pages, &vmdev->pages, list );
619 list_del ( &pages->list );
620}
621
622extern unsigned int vmbus_obsolete_gpadl;
623
624/**
625 * Check if GPADL is obsolete
626 *
627 * @v gpadl GPADL ID
628 * @v is_obsolete GPADL ID is obsolete
629 *
630 * Check if GPADL is obsolete (i.e. was created before the most recent
631 * Hyper-V reset).
632 */
633static inline __attribute__ (( always_inline )) int
635
636 return ( gpadl <= vmbus_obsolete_gpadl );
637}
638
639extern int vmbus_establish_gpadl ( struct vmbus_device *vmdev, void *data,
640 size_t len );
641extern int vmbus_gpadl_teardown ( struct vmbus_device *vmdev,
642 unsigned int gpadl );
643extern int vmbus_open ( struct vmbus_device *vmdev,
645 size_t out_len, size_t in_len, size_t mtu );
646extern void vmbus_close ( struct vmbus_device *vmdev );
647extern int vmbus_send_control ( struct vmbus_device *vmdev, uint64_t xid,
648 const void *data, size_t len );
649extern int vmbus_send_data ( struct vmbus_device *vmdev, uint64_t xid,
650 const void *data, size_t len,
651 struct io_buffer *iobuf );
652extern int vmbus_send_completion ( struct vmbus_device *vmdev, uint64_t xid,
653 const void *data, size_t len );
654extern int vmbus_send_cancellation ( struct vmbus_device *vmdev, uint64_t xid );
655extern int vmbus_poll ( struct vmbus_device *vmdev );
656extern void vmbus_dump_channel ( struct vmbus_device *vmdev );
657
658extern int vmbus_probe ( struct hv_hypervisor *hv, struct device *parent );
659extern int vmbus_reset ( struct hv_hypervisor *hv, struct device *parent );
660extern void vmbus_remove ( struct hv_hypervisor *hv, struct device *parent );
661
662#endif /* _IPXE_VMBUS_H */
unsigned short uint16_t
Definition stdint.h:11
unsigned int uint32_t
Definition stdint.h:12
unsigned long long uint64_t
Definition stdint.h:13
unsigned char uint8_t
Definition stdint.h:10
uint16_t offset
Offset to command line.
Definition bzimage.h:3
Device model.
ring len
Length.
Definition dwmac.h:226
uint8_t data[48]
Additional event data.
Definition ena.h:11
uint32_t mtu
Maximum MTU.
Definition ena.h:17
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define __attribute__(x)
Definition compiler.h:10
Hyper-V interface.
#define PAGE_SIZE
Page size.
Definition io.h:28
I/O buffers.
#define list_del(list)
Delete an entry from a list.
Definition list.h:120
#define list_check_contains_entry(entry, head, member)
Check list contains a specified entry.
Definition list.h:550
#define list_add(new, head)
Add a new entry to the head of a list.
Definition list.h:70
uint32_t gpadl
GPADL ID.
Definition netvsc.h:3
static uint16_t struct vmbus_xfer_pages_operations * op
Definition netvsc.h:327
A hardware device.
Definition device.h:77
A Hyper-V hypervisor.
Definition hyperv.h:203
A monitor page.
Definition hyperv.h:165
A persistent I/O buffer.
Definition iobuf.h:38
A doubly-linked list entry (or list head)
Definition list.h:19
VMBus channel operations.
Definition vmbus.h:396
int(* recv_completion)(struct vmbus_device *vmdev, uint64_t xid, const void *data, size_t len)
Handle received completion packet.
Definition vmbus.h:434
int(* recv_data)(struct vmbus_device *vmdev, uint64_t xid, const void *data, size_t len, struct list_head *list)
Handle received data packet.
Definition vmbus.h:422
int(* recv_cancellation)(struct vmbus_device *vmdev, uint64_t xid)
Handle received cancellation packet.
Definition vmbus.h:443
int(* recv_control)(struct vmbus_device *vmdev, uint64_t xid, const void *data, size_t len)
Handle received control packet.
Definition vmbus.h:406
VMBus "close channel" message.
Definition vmbus.h:157
uint32_t channel
Channel ID.
Definition vmbus.h:161
struct vmbus_message_header header
Message header.
Definition vmbus.h:159
A VMBus device.
Definition vmbus.h:475
void(* signal)(struct vmbus_device *vmdev)
Signal channel.
Definition vmbus.h:491
void * packet
Packet buffer.
Definition vmbus.h:509
struct vmbus_ring * in
Inbound ring buffer.
Definition vmbus.h:500
unsigned int gpadl
Ring buffer GPADL ID.
Definition vmbus.h:502
struct vmbus_channel_operations * op
Channel operations.
Definition vmbus.h:505
struct vmbus_driver * driver
Driver.
Definition vmbus.h:514
uint32_t out_len
Outbound ring buffer length.
Definition vmbus.h:494
unsigned int monitor
Monitor ID.
Definition vmbus.h:486
struct vmbus_ring * out
Outbound ring buffer.
Definition vmbus.h:498
union uuid instance
Channel instance.
Definition vmbus.h:482
struct hv_hypervisor * hv
Hyper-V hypervisor.
Definition vmbus.h:479
struct list_head pages
List of transfer page sets.
Definition vmbus.h:511
void * priv
Driver-private data.
Definition vmbus.h:516
size_t mtu
Maximum expected data packet length.
Definition vmbus.h:507
unsigned int channel
Channel ID.
Definition vmbus.h:484
uint32_t in_len
Inbound ring buffer length.
Definition vmbus.h:496
struct device dev
Generic iPXE device.
Definition vmbus.h:477
A VMBus device driver.
Definition vmbus.h:520
int(* probe)(struct vmbus_device *vmdev)
Probe device.
Definition vmbus.h:530
int(* reset)(struct vmbus_device *vmdev)
Reset device.
Definition vmbus.h:536
void(* remove)(struct vmbus_device *vmdev)
Remove device.
Definition vmbus.h:541
const char * name
Name.
Definition vmbus.h:522
union uuid type
Device type.
Definition vmbus.h:524
VMBus GPA direct header.
Definition vmbus.h:297
uint32_t reserved
Reserved.
Definition vmbus.h:301
struct vmbus_gpa_range range[0]
Range descriptors.
Definition vmbus.h:305
uint32_t range_count
Number of range descriptors.
Definition vmbus.h:303
struct vmbus_packet_header header
Packet header.
Definition vmbus.h:299
Guest physical address range descriptor.
Definition vmbus.h:57
uint64_t pfn[0]
Page frame numbers.
Definition vmbus.h:67
uint32_t len
Byte count.
Definition vmbus.h:59
uint32_t offset
Starting byte offset.
Definition vmbus.h:61
VMBus "GPADL created" message.
Definition vmbus.h:181
uint32_t channel
Channel ID.
Definition vmbus.h:185
uint32_t gpadl
GPADL ID.
Definition vmbus.h:187
struct vmbus_message_header header
Message header.
Definition vmbus.h:183
uint32_t status
Creation status.
Definition vmbus.h:189
VMBus "GPADL header" message.
Definition vmbus.h:165
uint32_t gpadl
GPADL ID.
Definition vmbus.h:171
struct vmbus_gpa_range range[0]
Range descriptors.
Definition vmbus.h:177
uint32_t channel
Channel ID.
Definition vmbus.h:169
struct vmbus_message_header header
Message header.
Definition vmbus.h:167
uint16_t range_len
Length of range descriptors.
Definition vmbus.h:173
uint16_t range_count
Number of range descriptors.
Definition vmbus.h:175
VMBus "GPADL teardown" message.
Definition vmbus.h:193
struct vmbus_message_header header
Message header.
Definition vmbus.h:195
uint32_t channel
Channel ID.
Definition vmbus.h:197
uint32_t gpadl
GPADL ID.
Definition vmbus.h:199
VMBus "GPADL torndown" message.
Definition vmbus.h:203
struct vmbus_message_header header
Message header.
Definition vmbus.h:205
uint32_t gpadl
GPADL ID.
Definition vmbus.h:207
VMBus "initiate contact" message.
Definition vmbus.h:211
struct vmbus_message_header header
Message header.
Definition vmbus.h:213
union vmbus_version version
Requested version.
Definition vmbus.h:215
uint32_t vcpu
Target virtual CPU.
Definition vmbus.h:217
uint64_t monitor_in
Parent to child monitor page base address.
Definition vmbus.h:221
uint64_t intr
Interrupt page base address.
Definition vmbus.h:219
uint64_t monitor_out
Child to parent monitor page base address.
Definition vmbus.h:223
VMBus interrupt page.
Definition vmbus.h:374
uint8_t in[PAGE_SIZE/2]
Inbound interrupts.
Definition vmbus.h:376
uint8_t out[PAGE_SIZE/2]
Outbound interrupts.
Definition vmbus.h:378
VMBus message header.
Definition vmbus.h:71
uint32_t type
Message type.
Definition vmbus.h:73
uint32_t reserved
Reserved.
Definition vmbus.h:75
VMBus "offer channel" message.
Definition vmbus.h:97
union uuid type
Channel type.
Definition vmbus.h:101
uint8_t reserved_a[16]
Reserved.
Definition vmbus.h:105
union uuid instance
Channel instance.
Definition vmbus.h:103
uint8_t monitor
Monitor ID.
Definition vmbus.h:117
uint8_t reserved[2]
Reserved.
Definition vmbus.h:121
uint8_t data[120]
User data.
Definition vmbus.h:111
uint8_t reserved_c[4]
Reserved.
Definition vmbus.h:113
struct vmbus_message_header header
Message header.
Definition vmbus.h:99
uint32_t connection
Connection ID.
Definition vmbus.h:123
uint8_t monitored
Monitor exists.
Definition vmbus.h:119
uint16_t flags
Flags.
Definition vmbus.h:107
uint32_t channel
Channel ID.
Definition vmbus.h:115
uint8_t reserved_b[2]
Reserved.
Definition vmbus.h:109
VMBus "open channel result" message.
Definition vmbus.h:145
uint32_t status
Status.
Definition vmbus.h:153
uint32_t channel
Channel ID.
Definition vmbus.h:149
uint32_t id
Open ID.
Definition vmbus.h:151
struct vmbus_message_header header
Message header.
Definition vmbus.h:147
VMBus "open channel" message.
Definition vmbus.h:127
uint32_t id
Open ID.
Definition vmbus.h:133
struct vmbus_message_header header
Message header.
Definition vmbus.h:129
uint32_t reserved
Reserved.
Definition vmbus.h:137
uint32_t channel
Channel ID.
Definition vmbus.h:131
uint32_t gpadl
Ring buffer GPADL ID.
Definition vmbus.h:135
uint32_t out_pages
Outbound ring buffer size (in pages)
Definition vmbus.h:139
uint8_t data[120]
User-specific data.
Definition vmbus.h:141
VMBus packet header.
Definition vmbus.h:265
uint16_t hdr_qlen
Length of packet header (in quadwords)
Definition vmbus.h:269
uint16_t type
Type.
Definition vmbus.h:267
uint64_t xid
Transaction ID.
Definition vmbus.h:279
uint16_t flags
Flags.
Definition vmbus.h:273
uint16_t qlen
Length of packet (in quadwords)
Definition vmbus.h:271
VMBus ring buffer.
Definition vmbus.h:360
uint32_t intr_mask
Interrupt mask.
Definition vmbus.h:366
uint8_t data[0]
Ring buffer contents.
Definition vmbus.h:370
uint32_t cons
Consumer index (modulo ring length)
Definition vmbus.h:364
uint32_t prod
Producer index (modulo ring length)
Definition vmbus.h:362
uint8_t reserved[4084]
Reserved.
Definition vmbus.h:368
VMBus "version response" message.
Definition vmbus.h:227
union vmbus_version version
Version.
Definition vmbus.h:235
struct vmbus_message_header header
Message header.
Definition vmbus.h:229
uint8_t supported
Version is supported.
Definition vmbus.h:231
uint8_t reserved[3]
Reserved.
Definition vmbus.h:233
VMBus transfer page header.
Definition vmbus.h:317
struct vmbus_packet_header header
Packet header.
Definition vmbus.h:319
uint8_t reserved
Reserved.
Definition vmbus.h:325
uint32_t range_count
Number of range descriptors.
Definition vmbus.h:327
uint16_t pageset
Page set ID.
Definition vmbus.h:321
uint8_t owner
Sender owns page set.
Definition vmbus.h:323
struct vmbus_xfer_page_range range[0]
Range descriptors.
Definition vmbus.h:329
VMBus transfer page range.
Definition vmbus.h:309
uint32_t len
Length.
Definition vmbus.h:311
uint32_t offset
Offset.
Definition vmbus.h:313
VMBus transfer page set operations.
Definition vmbus.h:450
int(* copy)(struct vmbus_xfer_pages *pages, void *data, size_t offset, size_t len)
Copy data from transfer page.
Definition vmbus.h:460
VMBus transfer page set.
Definition vmbus.h:465
struct vmbus_xfer_pages_operations * op
Page set operations.
Definition vmbus.h:471
struct list_head list
List of all transfer page sets.
Definition vmbus.h:467
uint16_t pageset
Page set ID (in protocol byte order)
Definition vmbus.h:469
A virtual machine bus.
Definition vmbus.h:382
struct vmbus_interrupt * intr
Interrupt page.
Definition vmbus.h:384
struct hv_monitor * monitor_out
Outbound notifications.
Definition vmbus.h:388
const union vmbus_message * message
Received message buffer.
Definition vmbus.h:390
struct hv_monitor * monitor_in
Inbound notifications.
Definition vmbus.h:386
Linker tables.
static struct tlan_private * priv
Definition tlan.c:225
A universally unique ID.
Definition uuid.h:16
VMBus message.
Definition vmbus.h:239
struct vmbus_message_header header
Common message header.
Definition vmbus.h:241
struct vmbus_gpadl_created created
"GPADL created" message
Definition vmbus.h:253
struct vmbus_gpadl_torndown torndown
"GPADL torndown" message
Definition vmbus.h:257
struct vmbus_close_channel close
"Close channel" message
Definition vmbus.h:249
struct vmbus_open_channel_result opened
"Open channel result" message
Definition vmbus.h:247
struct vmbus_offer_channel offer
"Offer channel" message
Definition vmbus.h:243
struct vmbus_open_channel open
"Open channel" message
Definition vmbus.h:245
struct vmbus_version_response version
"Version response" message
Definition vmbus.h:261
struct vmbus_gpadl_teardown teardown
"GPADL teardown" message
Definition vmbus.h:255
struct vmbus_gpadl_header gpadlhdr
"GPADL header" message
Definition vmbus.h:251
struct vmbus_initiate_contact initiate
"Initiate contact" message
Definition vmbus.h:259
VMBus maximum-sized packet header.
Definition vmbus.h:336
struct vmbus_gpa_direct_header gpa
GPA direct header.
Definition vmbus.h:340
struct vmbus_xfer_page_header xfer
Transfer page header.
Definition vmbus.h:342
struct vmbus_packet_header header
Common header.
Definition vmbus.h:338
uint8_t padding[VMBUS_PACKET_MAX_HEADER_LEN]
Padding to maximum supported size.
Definition vmbus.h:344
VMBus version number.
Definition vmbus.h:32
uint32_t raw
Raw version.
Definition vmbus.h:34
uint16_t minor
Minor version.
Definition vmbus.h:38
uint16_t major
Major version.
Definition vmbus.h:40
Universally unique IDs.
unsigned int vmbus_obsolete_gpadl
Obsolete GPADL ID threshold.
Definition vmbus.c:61
int vmbus_send_data(struct vmbus_device *vmdev, uint64_t xid, const void *data, size_t len, struct io_buffer *iobuf)
Send data packet via ring buffer.
Definition vmbus.c:794
static void * vmbus_get_drvdata(struct vmbus_device *vmdev)
Get VMBus device driver-private data.
Definition vmbus.h:569
void vmbus_close(struct vmbus_device *vmdev)
Close VMBus channel.
Definition vmbus.c:524
int vmbus_probe(struct hv_hypervisor *hv, struct device *parent)
Probe Hyper-V virtual machine bus.
Definition vmbus.c:1365
static void vmbus_set_drvdata(struct vmbus_device *vmdev, void *priv)
Set VMBus device driver-private data.
Definition vmbus.h:559
int vmbus_send_control(struct vmbus_device *vmdev, uint64_t xid, const void *data, size_t len)
Send control packet via ring buffer.
Definition vmbus.c:765
#define VMBUS_PACKET_MAX_HEADER_LEN
Maximum expected size of VMBus packet header.
Definition vmbus.h:333
void vmbus_remove(struct hv_hypervisor *hv, struct device *parent)
Remove Hyper-V virtual machine bus.
Definition vmbus.c:1458
int vmbus_send_completion(struct vmbus_device *vmdev, uint64_t xid, const void *data, size_t len)
Send completion packet via ring buffer.
Definition vmbus.c:834
int vmbus_send_cancellation(struct vmbus_device *vmdev, uint64_t xid)
Send cancellation packet via ring buffer.
Definition vmbus.c:857
vmbus_packet_type
VMBus packet types.
Definition vmbus.h:283
@ VMBUS_DATA_INBAND
Definition vmbus.h:284
@ VMBUS_COMPLETION
Definition vmbus.h:288
@ VMBUS_DATA_XFER_PAGES
Definition vmbus.h:285
@ VMBUS_CANCELLATION
Definition vmbus.h:287
@ VMBUS_DATA_GPA_DIRECT
Definition vmbus.h:286
void vmbus_dump_channel(struct vmbus_device *vmdev)
Dump channel status (for debugging)
Definition vmbus.c:1089
vmbus_message_type
VMBus message types.
Definition vmbus.h:79
@ VMBUS_OPEN_CHANNEL_RESULT
Definition vmbus.h:84
@ VMBUS_GPADL_CREATED
Definition vmbus.h:87
@ VMBUS_REQUEST_OFFERS
Definition vmbus.h:81
@ VMBUS_INITIATE_CONTACT
Definition vmbus.h:90
@ VMBUS_GPADL_TORNDOWN
Definition vmbus.h:89
@ VMBUS_OPEN_CHANNEL
Definition vmbus.h:83
@ VMBUS_OFFER_CHANNEL
Definition vmbus.h:80
@ VMBUS_UNLOAD_RESPONSE
Definition vmbus.h:93
@ VMBUS_UNLOAD
Definition vmbus.h:92
@ VMBUS_GPADL_HEADER
Definition vmbus.h:86
@ VMBUS_VERSION_RESPONSE
Definition vmbus.h:91
@ VMBUS_ALL_OFFERS_DELIVERED
Definition vmbus.h:82
@ VMBUS_GPADL_TEARDOWN
Definition vmbus.h:88
@ VMBUS_CLOSE_CHANNEL
Definition vmbus.h:85
static int vmbus_gpadl_is_obsolete(unsigned int gpadl)
Check if GPADL is obsolete.
Definition vmbus.h:634
static int vmbus_has_data(struct vmbus_device *vmdev)
Check if data is present in ring buffer.
Definition vmbus.h:588
static void vmbus_unregister_pages(struct vmbus_device *vmdev, struct vmbus_xfer_pages *pages)
Unregister transfer page set.
Definition vmbus.h:615
int vmbus_reset(struct hv_hypervisor *hv, struct device *parent)
Reset Hyper-V virtual machine bus.
Definition vmbus.c:1426
int vmbus_establish_gpadl(struct vmbus_device *vmdev, void *data, size_t len)
Establish GPA descriptor list.
Definition vmbus.c:276
int vmbus_open(struct vmbus_device *vmdev, struct vmbus_channel_operations *op, size_t out_len, size_t in_len, size_t mtu)
Open VMBus channel.
Definition vmbus.c:403
vmbus_raw_version
Known VMBus protocol versions.
Definition vmbus.h:45
@ VMBUS_VERSION_WIN7
Windows 7.
Definition vmbus.h:49
@ VMBUS_VERSION_WIN8_1
Windows 8.1.
Definition vmbus.h:53
@ VMBUS_VERSION_WIN8
Windows 8.
Definition vmbus.h:51
@ VMBUS_VERSION_WS2008
Windows Server 2008.
Definition vmbus.h:47
static int vmbus_register_pages(struct vmbus_device *vmdev, struct vmbus_xfer_pages *pages)
Register transfer page set.
Definition vmbus.h:601
int vmbus_poll(struct vmbus_device *vmdev)
Poll ring buffer.
Definition vmbus.c:972
int vmbus_gpadl_teardown(struct vmbus_device *vmdev, unsigned int gpadl)
Tear down GPA descriptor list.
Definition vmbus.c:347
vmbus_packet_flags
VMBus packet flags.
Definition vmbus.h:292
@ VMBUS_COMPLETION_REQUESTED
Definition vmbus.h:293