summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsephe <sephe@FreeBSD.org>2016-12-26 06:59:22 +0000
committersephe <sephe@FreeBSD.org>2016-12-26 06:59:22 +0000
commit07f1e61a12d229d80df3469fc35331b20f90eefd (patch)
tree9694364298e266a7ee7949b45acf506e59e729eb
parentba7066c86f158021c2dbabce94b8a8c42fba82d2 (diff)
downloadFreeBSD-src-07f1e61a12d229d80df3469fc35331b20f90eefd.zip
FreeBSD-src-07f1e61a12d229d80df3469fc35331b20f90eefd.tar.gz
r310348
hyperv: Unbreak EARLY_AP_STARUP Hyper-V bootstrap by using intrhook Properly working pause and friends are required. Sponsored by: Microsoft
-rw-r--r--sys/dev/hyperv/vmbus/vmbus.c29
-rw-r--r--sys/dev/hyperv/vmbus/vmbus_var.h3
2 files changed, 30 insertions, 2 deletions
diff --git a/sys/dev/hyperv/vmbus/vmbus.c b/sys/dev/hyperv/vmbus/vmbus.c
index a631502..fba673a 100644
--- a/sys/dev/hyperv/vmbus/vmbus.c
+++ b/sys/dev/hyperv/vmbus/vmbus.c
@@ -97,6 +97,9 @@ static int vmbus_probe_guid_method(device_t, device_t,
const struct hyperv_guid *);
static uint32_t vmbus_get_vcpu_id_method(device_t bus,
device_t dev, int cpu);
+#ifdef EARLY_AP_STARTUP
+static void vmbus_intrhook(void *);
+#endif
static int vmbus_init(struct vmbus_softc *);
static int vmbus_connect(struct vmbus_softc *, uint32_t);
@@ -1369,6 +1372,21 @@ vmbus_event_proc_dummy(struct vmbus_softc *sc __unused, int cpu __unused)
{
}
+#ifdef EARLY_AP_STARTUP
+
+static void
+vmbus_intrhook(void *xsc)
+{
+ struct vmbus_softc *sc = xsc;
+
+ if (bootverbose)
+ device_printf(sc->vmbus_dev, "intrhook\n");
+ vmbus_doattach(sc);
+ config_intrhook_disestablish(&sc->vmbus_intrhook);
+}
+
+#endif /* EARLY_AP_STARTUP */
+
static int
vmbus_attach(device_t dev)
{
@@ -1383,7 +1401,14 @@ vmbus_attach(device_t dev)
*/
vmbus_sc->vmbus_event_proc = vmbus_event_proc_dummy;
-#ifndef EARLY_AP_STARTUP
+#ifdef EARLY_AP_STARTUP
+ /*
+ * Defer the real attach until the pause(9) works as expected.
+ */
+ vmbus_sc->vmbus_intrhook.ich_func = vmbus_intrhook;
+ vmbus_sc->vmbus_intrhook.ich_arg = vmbus_sc;
+ config_intrhook_establish(&vmbus_sc->vmbus_intrhook);
+#else /* !EARLY_AP_STARTUP */
/*
* If the system has already booted and thread
* scheduling is possible indicated by the global
@@ -1391,8 +1416,8 @@ vmbus_attach(device_t dev)
* initialization directly.
*/
if (!cold)
-#endif
vmbus_doattach(vmbus_sc);
+#endif /* EARLY_AP_STARTUP */
return (0);
}
diff --git a/sys/dev/hyperv/vmbus/vmbus_var.h b/sys/dev/hyperv/vmbus/vmbus_var.h
index a5f4db5..b16548a 100644
--- a/sys/dev/hyperv/vmbus/vmbus_var.h
+++ b/sys/dev/hyperv/vmbus/vmbus_var.h
@@ -30,6 +30,7 @@
#define _VMBUS_VAR_H_
#include <sys/param.h>
+#include <sys/kernel.h>
#include <sys/taskqueue.h>
#include <sys/rman.h>
@@ -128,6 +129,8 @@ struct vmbus_softc {
struct mtx vmbus_chan_lock;
TAILQ_HEAD(, vmbus_channel) vmbus_chans;
+ struct intr_config_hook vmbus_intrhook;
+
#ifdef NEW_PCIB
/* The list of usable MMIO ranges for PCIe pass-through */
struct pcib_host_resources vmbus_mmio_res;
OpenPOWER on IntegriCloud