git: 4f8c634de09f - main - arm64 Hyper-V: enable Hyper-V SMP for ARM64
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 07 Jun 2023 08:24:50 UTC
The branch main has been updated by whu:
URL: https://cgit.FreeBSD.org/src/commit/?id=4f8c634de09ffa2583306821e235f6f92104e729
commit 4f8c634de09ffa2583306821e235f6f92104e729
Author: Wei Hu <whu@FreeBSD.org>
AuthorDate: 2023-06-07 08:03:59 +0000
Commit: Wei Hu <whu@FreeBSD.org>
CommitDate: 2023-06-07 08:24:13 +0000
arm64 Hyper-V: enable Hyper-V SMP for ARM64
Vmbus_synic_setup() is invoked via vmbus_intrhook -> vmbus_doattach
-> smp_rendezvous. On !EARLY_AP_STARTUP (e.g., aarch64), SMP isn't
functional in intrhooks and smp_rendezvous() will just call
vmbus_synic_setup() on the boot processor. There's nothing that will
initialize the pcpu data on every other AP.
To fix it we need to use SI_SUB_SMP for vmbus_doattach(). With this
patch the vmbus interrupt should work on all arm64 cpus on HyperV.
Reported by: kevans
Reviewed by: kevans, whu
Tested by: Souradeep Chakrabarti <schakrabarti@microsoft.com>
Obtained from: Souradeep Chakrabarti <schakrabarti@microsoft.com>
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D40279
---
sys/dev/hyperv/vmbus/vmbus.c | 28 ++++++----------------------
1 file changed, 6 insertions(+), 22 deletions(-)
diff --git a/sys/dev/hyperv/vmbus/vmbus.c b/sys/dev/hyperv/vmbus/vmbus.c
index ae4c466d98d9..cc37d84ff151 100644
--- a/sys/dev/hyperv/vmbus/vmbus.c
+++ b/sys/dev/hyperv/vmbus/vmbus.c
@@ -114,7 +114,7 @@ static uint32_t vmbus_get_vcpu_id_method(device_t bus,
device_t dev, int cpu);
static struct taskqueue *vmbus_get_eventtq_method(device_t, device_t,
int);
-#if defined(EARLY_AP_STARTUP) || defined(__aarch64__)
+#if defined(EARLY_AP_STARTUP)
static void vmbus_intrhook(void *);
#endif
@@ -1482,7 +1482,7 @@ vmbus_event_proc_dummy(struct vmbus_softc *sc __unused, int cpu __unused)
{
}
-#if defined(EARLY_AP_STARTUP) || defined(__aarch64__)
+#if defined(EARLY_AP_STARTUP)
static void
vmbus_intrhook(void *xsc)
@@ -1495,7 +1495,7 @@ vmbus_intrhook(void *xsc)
config_intrhook_disestablish(&sc->vmbus_intrhook);
}
-#endif /* EARLY_AP_STARTUP aarch64 */
+#endif /* EARLY_AP_STARTUP */
static int
vmbus_attach(device_t dev)
@@ -1511,22 +1511,13 @@ vmbus_attach(device_t dev)
*/
vmbus_sc->vmbus_event_proc = vmbus_event_proc_dummy;
-#if defined(EARLY_AP_STARTUP) || defined(__aarch64__)
+#if defined(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
- * cold set to zero, we just call the driver
- * initialization directly.
- */
- if (!cold)
- vmbus_doattach(vmbus_sc);
#endif /* EARLY_AP_STARTUP and aarch64 */
return (0);
@@ -1572,7 +1563,7 @@ vmbus_detach(device_t dev)
return (0);
}
-#if !defined(EARLY_AP_STARTUP) && !defined(__aarch64__)
+#if !defined(EARLY_AP_STARTUP)
static void
vmbus_sysinit(void *arg __unused)
@@ -1582,14 +1573,7 @@ vmbus_sysinit(void *arg __unused)
if (vm_guest != VM_GUEST_HV || sc == NULL)
return;
- /*
- * If the system has already booted and thread
- * scheduling is possible, as indicated by the
- * global cold set to zero, we just call the driver
- * initialization directly.
- */
- if (!cold)
- vmbus_doattach(sc);
+ vmbus_doattach(sc);
}
/*
* NOTE: