summaryrefslogtreecommitdiffstats
path: root/src/drivers/net/netvsc.h
diff options
context:
space:
mode:
authorMichael Brown2017-04-25 15:13:22 +0200
committerMichael Brown2017-04-28 17:20:47 +0200
commitb91cc983da48b2791a672431551f7859e33126ec (patch)
tree466bc46ef18d86a619769a49acf4c149193237b1 /src/drivers/net/netvsc.h
parent[hyperv] Remove redundant return status code from mapping functions (diff)
downloadipxe-b91cc983da48b2791a672431551f7859e33126ec.tar.gz
ipxe-b91cc983da48b2791a672431551f7859e33126ec.tar.xz
ipxe-b91cc983da48b2791a672431551f7859e33126ec.zip
[hyperv] Cope with Windows Server 2016 enlightenments
An "enlightened" external bootloader (such as Windows Server 2016's winload.exe) may take ownership of the Hyper-V connection before all INT 13 operations have been completed. When this happens, all VMBus devices are implicitly closed and we are left with a non-functional network connection. Detect when our Hyper-V connection has been lost (by checking the SynIC message page MSR). Reclaim ownership of the Hyper-V connection and reestablish any VMBus devices, without disrupting any existing iPXE state (such as IPv4 settings attached to the network device). Windows Server 2016 will not cleanly take ownership of an active Hyper-V connection. Experimentation shows that we can quiesce by resetting only the SynIC message page MSR; this results in a successful SAN boot (on a Windows 2012 R2 physical host). Choose to quiesce by resetting (almost) all MSRs, in the hope that this will be more robust against corner cases such as a stray synthetic interrupt occurring during the handover. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/net/netvsc.h')
-rw-r--r--src/drivers/net/netvsc.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/drivers/net/netvsc.h b/src/drivers/net/netvsc.h
index 39eeb891..93192357 100644
--- a/src/drivers/net/netvsc.h
+++ b/src/drivers/net/netvsc.h
@@ -362,4 +362,19 @@ struct netvsc_device {
int wait_rc;
};
+/**
+ * Check if NetVSC device is obsolete
+ *
+ * @v netvsc NetVSC device
+ * @v is_obsolete NetVSC device is obsolete
+ *
+ * Check if NetVSC device is obsolete (i.e. was opened before the most
+ * recent Hyper-V reset).
+ */
+static inline __attribute__ (( always_inline )) int
+netvsc_is_obsolete ( struct netvsc_device *netvsc ) {
+
+ return vmbus_gpadl_is_obsolete ( netvsc->rx.gpadl );
+}
+
#endif /* _NETVSC_H */