hv_channel.c (301583) | hv_channel.c (301588) |
---|---|
1/*- 2 * Copyright (c) 2009-2012,2016 Microsoft Corp. 3 * Copyright (c) 2012 NetApp Inc. 4 * Copyright (c) 2012 Citrix Inc. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 13 unchanged lines hidden (view full) --- 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2009-2012,2016 Microsoft Corp. 3 * Copyright (c) 2012 NetApp Inc. 4 * Copyright (c) 2012 Citrix Inc. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 13 unchanged lines hidden (view full) --- 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29#include <sys/cdefs.h> |
30__FBSDID("$FreeBSD: head/sys/dev/hyperv/vmbus/hv_channel.c 301583 2016-06-08 05:34:22Z sephe $"); | 30__FBSDID("$FreeBSD: head/sys/dev/hyperv/vmbus/hv_channel.c 301588 2016-06-08 07:47:21Z sephe $"); |
31 32#include <sys/param.h> 33#include <sys/kernel.h> 34#include <sys/malloc.h> 35#include <sys/systm.h> 36#include <sys/mbuf.h> 37#include <sys/lock.h> 38#include <sys/mutex.h> 39#include <sys/sysctl.h> | 31 32#include <sys/param.h> 33#include <sys/kernel.h> 34#include <sys/malloc.h> 35#include <sys/systm.h> 36#include <sys/mbuf.h> 37#include <sys/lock.h> 38#include <sys/mutex.h> 39#include <sys/sysctl.h> |
40 41#include <machine/atomic.h> |
|
40#include <machine/bus.h> | 42#include <machine/bus.h> |
43 |
|
41#include <vm/vm.h> 42#include <vm/vm_param.h> 43#include <vm/pmap.h> 44 45#include <dev/hyperv/vmbus/hv_vmbus_priv.h> | 44#include <vm/vm.h> 45#include <vm/vm_param.h> 46#include <vm/pmap.h> 47 48#include <dev/hyperv/vmbus/hv_vmbus_priv.h> |
49#include <dev/hyperv/vmbus/vmbus_reg.h> |
|
46#include <dev/hyperv/vmbus/vmbus_var.h> 47 48static int vmbus_channel_create_gpadl_header( 49 /* must be phys and virt contiguous*/ 50 void* contig_buffer, 51 /* page-size multiple */ 52 uint32_t size, 53 hv_vmbus_channel_msg_info** msg_info, --- 6 unchanged lines hidden (view full) --- 60 * @brief Trigger an event notification on the specified channel 61 */ 62static void 63vmbus_channel_set_event(hv_vmbus_channel *channel) 64{ 65 if (channel->offer_msg.monitor_allocated) { 66 struct vmbus_softc *sc = vmbus_get_softc(); 67 hv_vmbus_monitor_page *monitor_page; | 50#include <dev/hyperv/vmbus/vmbus_var.h> 51 52static int vmbus_channel_create_gpadl_header( 53 /* must be phys and virt contiguous*/ 54 void* contig_buffer, 55 /* page-size multiple */ 56 uint32_t size, 57 hv_vmbus_channel_msg_info** msg_info, --- 6 unchanged lines hidden (view full) --- 64 * @brief Trigger an event notification on the specified channel 65 */ 66static void 67vmbus_channel_set_event(hv_vmbus_channel *channel) 68{ 69 if (channel->offer_msg.monitor_allocated) { 70 struct vmbus_softc *sc = vmbus_get_softc(); 71 hv_vmbus_monitor_page *monitor_page; |
72 uint32_t chanid = channel->offer_msg.child_rel_id; |
|
68 | 73 |
69 /* Each uint32_t represents 32 channels */ 70 synch_set_bit((channel->offer_msg.child_rel_id & 31), 71 ((uint32_t *)sc->vmbus_tx_evtflags 72 + ((channel->offer_msg.child_rel_id >> 5)))); | 74 atomic_set_long( 75 &sc->vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT], 76 1UL << (chanid & VMBUS_EVTFLAG_MASK)); |
73 74 monitor_page = sc->vmbus_mnf2; 75 synch_set_bit(channel->monitor_bit, 76 (uint32_t *)&monitor_page-> 77 trigger_group[channel->monitor_group].u.pending); 78 } else { 79 hv_vmbus_set_event(channel); 80 } --- 950 unchanged lines hidden --- | 77 78 monitor_page = sc->vmbus_mnf2; 79 synch_set_bit(channel->monitor_bit, 80 (uint32_t *)&monitor_page-> 81 trigger_group[channel->monitor_group].u.pending); 82 } else { 83 hv_vmbus_set_event(channel); 84 } --- 950 unchanged lines hidden --- |