[hyperv] Require support for VMBus version 3.0 or newer

We require the ability to disconnect from and reconnect to VMBus; if
we don't have this then there is no (viable) way for a loaded
operating system to continue to use any VMBus devices.  (There is also
a small but non-zero risk that the host will continue to write to our
interrupt and monitor pages, since the VMBUS_UNLOAD message in earlier
versions is essentially a no-op.)

This requires us to ensure that the host supports protocol version 3.0
(VMBUS_VERSION_WIN8_1).  However, we can't actually _use_ protocol
version 3.0, since doing so causes an iSCSI-booted Windows Server 2012
R2 VM to crash due to a NULL pointer dereference in vmbus.sys.

To work around this problem, we first ensure that we can connect using
protocol v3.0, then disconnect and reconnect using the oldest known
protocol.

This deliberately prevents the use of the iPXE native Hyper-V drivers
on older versions of Hyper-V, where we could use our drivers but in so
doing would break the loaded operating system.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2014-12-21 01:36:07 +00:00
parent af07324af9
commit 0166a68351
2 changed files with 83 additions and 17 deletions

View File

@@ -42,8 +42,17 @@ union vmbus_version {
};
} __attribute__ (( packed ));
/** Oldest known VMBus protocol version (Windows Server 2008) */
#define VMBUS_VERSION_WS2008 ( ( 0 << 16 ) | ( 13 << 0 ) )
/** Known VMBus protocol versions */
enum vmbus_raw_version {
/** Windows Server 2008 */
VMBUS_VERSION_WS2008 = ( ( 0 << 16 ) | ( 13 << 0 ) ),
/** Windows 7 */
VMBUS_VERSION_WIN7 = ( ( 1 << 16 ) | ( 1 << 0 ) ),
/** Windows 8 */
VMBUS_VERSION_WIN8 = ( ( 2 << 16 ) | ( 4 << 0 ) ),
/** Windows 8.1 */
VMBUS_VERSION_WIN8_1 = ( ( 3 << 16 ) | ( 0 << 0 ) ),
};
/** Guest physical address range descriptor */
struct vmbus_gpa_range {
@@ -82,6 +91,7 @@ enum vmbus_message_type {
VMBUS_INITIATE_CONTACT = 14,
VMBUS_VERSION_RESPONSE = 15,
VMBUS_UNLOAD = 16,
VMBUS_UNLOAD_RESPONSE = 17,
};
/** VMBus "offer channel" message */