Index: head/sys/dev/hyperv/vmbus/hv_channel.c =================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c +++ head/sys/dev/hyperv/vmbus/hv_channel.c @@ -343,8 +343,7 @@ /* * Allocate GPADL id. */ - gpadl = atomic_fetchadd_int( - &hv_vmbus_g_connection.next_gpadl_handle, 1); + gpadl = vmbus_gpadl_alloc(sc); *gpadl0 = gpadl; /* Index: head/sys/dev/hyperv/vmbus/hv_connection.c =================================================================== --- head/sys/dev/hyperv/vmbus/hv_connection.c +++ head/sys/dev/hyperv/vmbus/hv_connection.c @@ -47,8 +47,7 @@ * Globals */ hv_vmbus_connection hv_vmbus_g_connection = - { .connect_state = HV_DISCONNECTED, - .next_gpadl_handle = 0xE1E10, }; + { .connect_state = HV_DISCONNECTED }; /** * Send a connect request on the partition service connection Index: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h =================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h @@ -107,7 +107,6 @@ typedef struct { hv_vmbus_connect_state connect_state; - uint32_t next_gpadl_handle; /** * List of primary channels. Sub channels will be linked Index: head/sys/dev/hyperv/vmbus/vmbus.c =================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c +++ head/sys/dev/hyperv/vmbus/vmbus.c @@ -70,6 +70,8 @@ #include "acpi_if.h" #include "vmbus_if.h" +#define VMBUS_GPADL_START 0xe1e10 + struct vmbus_msghc { struct hypercall_postmsg_in *mh_inprm; struct hypercall_postmsg_in mh_inprm_save; @@ -372,6 +374,12 @@ wakeup(&mhc->mhc_active); } +uint32_t +vmbus_gpadl_alloc(struct vmbus_softc *sc) +{ + return atomic_fetchadd_int(&sc->vmbus_gpadl, 1); +} + static int vmbus_connect(struct vmbus_softc *sc, uint32_t version) { @@ -1121,6 +1129,7 @@ sc->vmbus_flags |= VMBUS_FLAG_ATTACHED; mtx_init(&sc->vmbus_scan_lock, "vmbus scan", NULL, MTX_DEF); + sc->vmbus_gpadl = VMBUS_GPADL_START; /* * Create context for "post message" Hypercalls Index: head/sys/dev/hyperv/vmbus/vmbus_var.h =================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h +++ head/sys/dev/hyperv/vmbus/vmbus_var.h @@ -86,6 +86,7 @@ int vmbus_idtvec; uint32_t vmbus_flags; /* see VMBUS_FLAG_ */ uint32_t vmbus_version; + uint32_t vmbus_gpadl; /* Shared memory for vmbus_{rx,tx}_evtflags */ void *vmbus_evtflags; @@ -148,4 +149,6 @@ void vmbus_scan_done(struct vmbus_softc *); void vmbus_scan_newchan(struct vmbus_softc *); +uint32_t vmbus_gpadl_alloc(struct vmbus_softc *); + #endif /* !_VMBUS_VAR_H_ */