Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F140127288
D6522.id16769.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D6522.id16769.diff
View Options
Index: sys/dev/hyperv/vmbus/hv_hv.c
===================================================================
--- sys/dev/hyperv/vmbus/hv_hv.c
+++ sys/dev/hyperv/vmbus/hv_hv.c
@@ -96,13 +96,6 @@
static u_int hyperv_pm_features;
static u_int hyperv_features3;
-/**
- * Globals
- */
-hv_vmbus_context hv_vmbus_g_context = {
- .syn_ic_initialized = FALSE,
-};
-
static struct timecounter hv_timecounter = {
hv_get_timecount, 0, ~0u, HV_NANOSECONDS_PER_SEC/100, "Hyper-V", HV_NANOSECONDS_PER_SEC/100
};
Index: sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
===================================================================
--- sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
+++ sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
@@ -68,8 +68,6 @@
struct vmbus_softc *vmbus_sc;
-static int vmbus_inited;
-
static char *vmbus_ids[] = { "VMBUS", NULL };
extern inthand_t IDTVEC(hv_vmbus_callback);
@@ -264,8 +262,6 @@
wrmsr(HV_X64_MSR_SCONTROL, sctrl.as_uint64_t);
- hv_vmbus_g_context.syn_ic_initialized = TRUE;
-
/*
* Set up the cpuid mapping from Hyper-V to FreeBSD.
* The array is indexed using FreeBSD cpuid.
@@ -280,9 +276,6 @@
hv_vmbus_synic_simp simp;
hv_vmbus_synic_siefp siefp;
- if (!hv_vmbus_g_context.syn_ic_initialized)
- return;
-
shared_sint.as_uint64_t = rdmsr(
HV_X64_MSR_SINT0 + HV_VMBUS_MESSAGE_SINT);
@@ -608,14 +601,12 @@
static int
vmbus_bus_init(void)
{
- struct vmbus_softc *sc;
+ struct vmbus_softc *sc = vmbus_get_softc();
int ret;
- if (vmbus_inited)
+ if (sc->vmbus_flags & VMBUS_FLAG_ATTACHED)
return (0);
-
- vmbus_inited = 1;
- sc = vmbus_get_softc();
+ sc->vmbus_flags |= VMBUS_FLAG_ATTACHED;
/*
* Allocate DMA stuffs.
@@ -631,10 +622,13 @@
if (ret != 0)
goto cleanup;
+ /*
+ * Setup SynIC.
+ */
if (bootverbose)
- printf("VMBUS: Calling smp_rendezvous, smp_started = %d\n",
- smp_started);
+ device_printf(sc->vmbus_dev, "smp_started = %d\n", smp_started);
smp_rendezvous(NULL, vmbus_synic_setup, NULL, NULL);
+ sc->vmbus_flags |= VMBUS_FLAG_SYNIC;
/*
* Connect to VMBus in the root partition
@@ -721,7 +715,10 @@
hv_vmbus_release_unattached_channels();
hv_vmbus_disconnect();
- smp_rendezvous(NULL, vmbus_synic_teardown, NULL, NULL);
+ if (sc->vmbus_flags & VMBUS_FLAG_SYNIC) {
+ sc->vmbus_flags &= ~VMBUS_FLAG_SYNIC;
+ smp_rendezvous(NULL, vmbus_synic_teardown, NULL, NULL);
+ }
vmbus_intr_teardown(sc);
vmbus_dma_free(sc);
Index: sys/dev/hyperv/vmbus/hv_vmbus_priv.h
===================================================================
--- sys/dev/hyperv/vmbus/hv_vmbus_priv.h
+++ sys/dev/hyperv/vmbus/hv_vmbus_priv.h
@@ -200,10 +200,6 @@
struct vmbus_message;
union vmbus_event_flags;
-typedef struct {
- hv_bool_uint8_t syn_ic_initialized;
-} hv_vmbus_context;
-
/*
* Define hypervisor message types
*/
@@ -635,7 +631,6 @@
* Global variables
*/
-extern hv_vmbus_context hv_vmbus_g_context;
extern hv_vmbus_connection hv_vmbus_g_connection;
extern u_int hyperv_features;
Index: sys/dev/hyperv/vmbus/vmbus_var.h
===================================================================
--- sys/dev/hyperv/vmbus/vmbus_var.h
+++ sys/dev/hyperv/vmbus/vmbus_var.h
@@ -55,8 +55,12 @@
/* Rarely used fields */
device_t vmbus_dev;
int vmbus_idtvec;
+ uint32_t vmbus_flags; /* see VMBUS_FLAG_ */
};
+#define VMBUS_FLAG_ATTACHED 0x0001 /* vmbus was attached */
+#define VMBUS_FLAG_SYNIC 0x0002 /* SynIC was setup */
+
extern struct vmbus_softc *vmbus_sc;
static __inline struct vmbus_softc *
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 21, 2:50 PM (8 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27114603
Default Alt Text
D6522.id16769.diff (3 KB)
Attached To
Mode
D6522: hyperv/vmbus: Move two global flags into vmbus softc
Attached
Detach File
Event Timeline
Log In to Comment