diff options
author | Sepherosa Ziehau <sephe@FreeBSD.org> | 2016-06-08 07:47:21 +0000 |
---|---|---|
committer | Sepherosa Ziehau <sephe@FreeBSD.org> | 2016-06-08 07:47:21 +0000 |
commit | 51a9a000ee201bd86a0e784b6a22498723035f77 (patch) | |
tree | 9ef6de6c0fbf21b6e1813db3bca01d565ff706bd | |
parent | 5c785643deb5b591019cac5f96c0c4c07851ca9c (diff) |
Notes
-rw-r--r-- | sys/dev/hyperv/vmbus/hv_channel.c | 12 | ||||
-rw-r--r-- | sys/dev/hyperv/vmbus/hv_connection.c | 8 | ||||
-rw-r--r-- | sys/dev/hyperv/vmbus/vmbus.c | 2 | ||||
-rw-r--r-- | sys/dev/hyperv/vmbus/vmbus_reg.h | 1 | ||||
-rw-r--r-- | sys/dev/hyperv/vmbus/vmbus_var.h | 2 |
5 files changed, 14 insertions, 11 deletions
diff --git a/sys/dev/hyperv/vmbus/hv_channel.c b/sys/dev/hyperv/vmbus/hv_channel.c index f3a23af521338..88ba7ca271c2a 100644 --- a/sys/dev/hyperv/vmbus/hv_channel.c +++ b/sys/dev/hyperv/vmbus/hv_channel.c @@ -37,12 +37,16 @@ __FBSDID("$FreeBSD$"); #include <sys/lock.h> #include <sys/mutex.h> #include <sys/sysctl.h> + +#include <machine/atomic.h> #include <machine/bus.h> + #include <vm/vm.h> #include <vm/vm_param.h> #include <vm/pmap.h> #include <dev/hyperv/vmbus/hv_vmbus_priv.h> +#include <dev/hyperv/vmbus/vmbus_reg.h> #include <dev/hyperv/vmbus/vmbus_var.h> static int vmbus_channel_create_gpadl_header( @@ -65,11 +69,11 @@ vmbus_channel_set_event(hv_vmbus_channel *channel) if (channel->offer_msg.monitor_allocated) { struct vmbus_softc *sc = vmbus_get_softc(); hv_vmbus_monitor_page *monitor_page; + uint32_t chanid = channel->offer_msg.child_rel_id; - /* Each uint32_t represents 32 channels */ - synch_set_bit((channel->offer_msg.child_rel_id & 31), - ((uint32_t *)sc->vmbus_tx_evtflags - + ((channel->offer_msg.child_rel_id >> 5)))); + atomic_set_long( + &sc->vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT], + 1UL << (chanid & VMBUS_EVTFLAG_MASK)); monitor_page = sc->vmbus_mnf2; synch_set_bit(channel->monitor_bit, diff --git a/sys/dev/hyperv/vmbus/hv_connection.c b/sys/dev/hyperv/vmbus/hv_connection.c index c1bf4a172248a..e4dcd1983313f 100644 --- a/sys/dev/hyperv/vmbus/hv_connection.c +++ b/sys/dev/hyperv/vmbus/hv_connection.c @@ -353,12 +353,10 @@ hv_vmbus_set_event(hv_vmbus_channel *channel) { struct vmbus_softc *sc = vmbus_get_softc(); int ret = 0; - uint32_t child_rel_id = channel->offer_msg.child_rel_id; + uint32_t chanid = channel->offer_msg.child_rel_id; - /* Each uint32_t represents 32 channels */ - - synch_set_bit(child_rel_id & 31, - (((uint32_t *)sc->vmbus_tx_evtflags + (child_rel_id >> 5)))); + atomic_set_long(&sc->vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT], + 1UL << (chanid & VMBUS_EVTFLAG_MASK)); ret = hv_vmbus_signal_event(channel->signal_event_param); return (ret); diff --git a/sys/dev/hyperv/vmbus/vmbus.c b/sys/dev/hyperv/vmbus/vmbus.c index 6fadee7a7c0f8..b5d1561819b99 100644 --- a/sys/dev/hyperv/vmbus/vmbus.c +++ b/sys/dev/hyperv/vmbus/vmbus.c @@ -340,7 +340,7 @@ vmbus_dma_alloc(struct vmbus_softc *sc) if (evtflags == NULL) return ENOMEM; sc->vmbus_rx_evtflags = (u_long *)evtflags; - sc->vmbus_tx_evtflags = evtflags + (PAGE_SIZE / 2); + sc->vmbus_tx_evtflags = (u_long *)(evtflags + (PAGE_SIZE / 2)); sc->vmbus_evtflags = evtflags; sc->vmbus_mnf1 = hyperv_dmamem_alloc(parent_dtag, PAGE_SIZE, 0, diff --git a/sys/dev/hyperv/vmbus/vmbus_reg.h b/sys/dev/hyperv/vmbus/vmbus_reg.h index 4be7f1b75e4ad..4be86142de506 100644 --- a/sys/dev/hyperv/vmbus/vmbus_reg.h +++ b/sys/dev/hyperv/vmbus/vmbus_reg.h @@ -66,6 +66,7 @@ CTASSERT(sizeof(struct vmbus_message) == VMBUS_MSG_SIZE); #define VMBUS_EVTFLAG_SHIFT 5 #endif #define VMBUS_EVTFLAG_LEN (1 << VMBUS_EVTFLAG_SHIFT) +#define VMBUS_EVTFLAG_MASK (VMBUS_EVTFLAG_LEN - 1) #define VMBUS_EVTFLAGS_SIZE 256 struct vmbus_evtflags { diff --git a/sys/dev/hyperv/vmbus/vmbus_var.h b/sys/dev/hyperv/vmbus/vmbus_var.h index 3f69d9ff865e3..70ac5ee4bdeb2 100644 --- a/sys/dev/hyperv/vmbus/vmbus_var.h +++ b/sys/dev/hyperv/vmbus/vmbus_var.h @@ -63,7 +63,7 @@ struct vmbus_pcpu_data { struct vmbus_softc { void (*vmbus_event_proc)(struct vmbus_softc *, int); - void *vmbus_tx_evtflags; + u_long *vmbus_tx_evtflags; /* event flags to host */ void *vmbus_mnf2; /* monitored by host */ |