Lines Matching +full:4 +full:- +full:channel

1 /* SPDX-License-Identifier: GPL-2.0-only */
27 #include <asm/hyperv-tlfs.h>
48 * gva: |-- 64k --|-- 64k --| ... |
49 * gpa: | 4k | 4k | ... | 4k | 4k | 4k | ... | 4k |
53 * gpadl: | 4k | 4k | ... | 4k | 4k | 4k | ... | 4k | ... |
59 * gva: |-- 64k --|-- 64k --| ... |-- 64k --|-- 64k --| ... |
60 * gpa: | 4k | .. | 4k | 4k | ... | 4k | ... | 4k | .. | 4k | .. | ... |
68 * gpadl: | 4k | 4k | ... | ... | 4k | 4k | ... |
69 * index: 0 1 2 ... 16 ... n-15 n-14 n-13 ... 2n-30
76 /* Single-page buffer */
83 /* Multiple-page buffer */
92 * Multiple-page buffer array; the pfn array is variable size:
123 * WS2012/Win8 and later versions of Hyper-V implement interrupt
125 * is set by the host on the host->guest ring buffer, and by the
126 * guest on the guest->host ring buffer.
130 * the feature bit in the guest->host ring buffer, the guest is
132 * 1) It will set the pending_send_sz field in the guest->host ring
134 * 2) It will read the pending_send_sz field in the host->guest
137 * Similarly, if the host sets the feature bit in the host->guest
139 * 1) It will set the pending_send_sz field in the host->guest ring
141 * 2) It will read the pending_send_sz field in the guest->host
158 u8 reserved2[PAGE_SIZE - 68];
167 /* Calculate the proper size of a ringbuffer, it must be page-aligned */
195 dsize = rbi->ring_datasize; in hv_get_bytes_to_read()
196 read_loc = rbi->ring_buffer->read_index; in hv_get_bytes_to_read()
197 write_loc = READ_ONCE(rbi->ring_buffer->write_index); in hv_get_bytes_to_read()
199 read = write_loc >= read_loc ? (write_loc - read_loc) : in hv_get_bytes_to_read()
200 (dsize - read_loc) + write_loc; in hv_get_bytes_to_read()
209 dsize = rbi->ring_datasize; in hv_get_bytes_to_write()
210 read_loc = READ_ONCE(rbi->ring_buffer->read_index); in hv_get_bytes_to_write()
211 write_loc = rbi->ring_buffer->write_index; in hv_get_bytes_to_write()
213 write = write_loc >= read_loc ? dsize - (write_loc - read_loc) : in hv_get_bytes_to_write()
214 read_loc - write_loc; in hv_get_bytes_to_write()
225 rbi->ring_size_div10_reciprocal); in hv_get_avail_to_write_percent()
234 * 2 . 4 (Windows 8, WS2012)
236 * 4 . 0 (Windows 10)
237 * 4 . 1 (Windows 10 RS3)
250 #define VERSION_WIN8 ((2 << 16) | (4))
252 #define VERSION_WIN10 ((4 << 16) | (0))
253 #define VERSION_WIN10_V4_1 ((4 << 16) | (1))
266 /* The size of the user defined data buffer for non-pipe offers. */
273 * At the center of the Channel Management library is the Channel Offer. This
290 /* Non-pipes: The user has MAX_USER_DEFINED_BYTES bytes. */
298 * is implemented on top of standard user-defined data. Pipe
309 * primary channel and a value of non-zero means a sub-channel.
320 #define VMBUS_CHANNEL_SERVER_SUPPORTS_GPADLS 4
398 u32 reserved; /* for alignment to a 8-byte boundary */
402 * This is the format for a GPA-Direct packet, which contains a set of GPA
433 ((struct vmpacket_descriptor)__packet)->offset8 * 8)
436 ((((struct vmpacket_descriptor)__packet)->len8 - \
437 ((struct vmpacket_descriptor)__packet)->offset8) * 8)
440 (((struct IMPACT)__packet)->type)
468 CHANNELMSG_ALLOFFERS_DELIVERED = 4,
492 /* Hyper-V supports about 2048 channels, and the RELIDs start with 1. */
512 /* Offer Channel parameters */
529 * associated bit in the channel bitmap while sending the
546 * Request Offer -- no parameters, SynIC message contains the partition ID
547 * Set Snoop -- no parameters, SynIC message contains the partition ID
548 * Clear Snoop -- no parameters, SynIC message contains the partition ID
549 * All Offers Delivered -- no parameters, SynIC message contains the partition
551 * Flush Client -- no parameters, SynIC message contains the partition ID
554 /* Open Channel parameters */
558 /* Identifies the specific VMBus channel that is being opened. */
561 /* ID making a particular open request at a channel offer unique. */
564 /* GPADL for the channel's ring buffer. */
571 * Prior to win8, incoming channel interrupts would only
584 /* User-specific data to be passed along to the server endpoint. */
588 /* Open Channel Result parameters */
596 /* Modify Channel Result parameters */
603 /* Close channel parameters; */
609 /* Channel Message GPADL */
618 * follow-up packet that contains more.
676 /* Hyper-V socket: guest's connect()-ing to host */
683 /* Modify Channel parameters, cf. vmbus_send_modifychannel() */
701 * field in the host-returned Version Response Message.
716 * Represents each channel msg on the vmbus connection This is a
717 * variable-size data structure depending on the msg type itself
740 * The channel message that goes out on the "wire".
794 #define VMBUS_RQST_ERROR (U64_MAX - 1)
796 /* NetVSC-specific */
797 #define VMBUS_RQST_ID_NO_RESPONSE (U64_MAX - 2)
798 /* StorVSC-specific */
799 #define VMBUS_RQST_INIT (U64_MAX - 2)
800 #define VMBUS_RQST_RESET (U64_MAX - 3)
833 bool rescind_ref; /* got rescind msg, got channel reference */
864 /* Channel callback's invoked in softirq context */
869 void (*change_target_cpu_callback)(struct vmbus_channel *channel,
873 * Synchronize channel scheduling and channel removal; see the inline
879 * A channel can be marked for one of three modes of reading:
880 * BATCHED - callback called from taslket and should read
881 * channel until empty. Interrupts from the host
883 * DIRECT - callback called from tasklet (softirq).
884 * ISR - callback called in interrupt context and must
886 * Host interrupts are disabled and must be re-enabled
903 * Prior to win8, incoming channel interrupts would only be
909 * Support for sub-channels. For high performance devices,
910 * it will be useful to have multiple sub-channels to support
912 * The support for sub-channels is implemented as an extension
914 * The initial offer is considered the primary channel and this
915 * offer message will indicate if the host supports sub-channels.
916 * The guest is free to ask for sub-channels to be offered and can
917 * open these sub-channels as a normal "primary" channel. However,
918 * all sub-channels will have the same type and instance guids as the
919 * primary channel. Requests sent on a given channel will result in a
920 * response on the same channel.
924 * Sub-channel creation callback. This callback will be called in
925 * process context when a sub-channel offer is received from the host.
926 * The guest can open the sub-channel in the context of this callback.
931 * Channel rescind callback. Some channels (the hvsock ones), need to
934 void (*chn_rescind_callback)(struct vmbus_channel *channel);
937 * All Sub-channels of a primary channel are linked here.
941 * The primary channel this sub-channel belongs to.
942 * This will be NULL for the primary channel.
946 * Support per-channel state for use by vmbus drivers.
951 * Defer freeing channel until after all cpu's have
957 * For sysfs per-channel properties.
963 * etc,), Hyper-V has a mechanism to enhance the throughput
968 * of time is the monitor latency - currently around 100 usecs. This
971 * A) Making the host more efficient - each time it wakes up,
978 * latency. Furthermore, since the channel is shared for both
981 * time. To fix this issue, permit tagging the channel as being
991 * particular, in situations where the channel's device_obj has
998 * from the single-threaded vmbus_connection.work_queue to
1022 /* enabling/disabling fuzz testing on the channel (default is false)*/
1037 u64 (*next_request_id_callback)(struct vmbus_channel *channel, u64 rqst_addr);
1039 u64 (*request_addr_callback)(struct vmbus_channel *channel, u64 rqst_id);
1045 /* The max size of a packet on this channel */
1049 #define lock_requestor(channel, flags) \ argument
1051 struct vmbus_requestor *rqstor = &(channel)->requestor; \
1053 spin_lock_irqsave(&rqstor->req_lock, flags); \
1056 static __always_inline void unlock_requestor(struct vmbus_channel *channel, in unlock_requestor() argument
1059 struct vmbus_requestor *rqstor = &channel->requestor; in unlock_requestor()
1061 spin_unlock_irqrestore(&rqstor->req_lock, flags); in unlock_requestor()
1064 u64 vmbus_next_request_id(struct vmbus_channel *channel, u64 rqst_addr);
1065 u64 __vmbus_request_addr_match(struct vmbus_channel *channel, u64 trans_id,
1067 u64 vmbus_request_addr_match(struct vmbus_channel *channel, u64 trans_id,
1069 u64 vmbus_request_addr(struct vmbus_channel *channel, u64 trans_id);
1073 return !!(o->offer.chn_flags & VMBUS_CHANNEL_TLNPI_PROVIDER_OFFER); in is_hvsock_offer()
1078 return is_hvsock_offer(&c->offermsg); in is_hvsock_channel()
1083 return c->offermsg.offer.sub_channel_index != 0; in is_sub_channel()
1089 c->callback_mode = mode; in set_channel_read_mode()
1094 c->per_channel_state = s; in set_per_channel_state()
1099 return c->per_channel_state; in get_per_channel_state()
1108 spin_lock_irqsave(&c->outbound.ring_lock, flags); in set_channel_pending_send_size()
1109 ++c->out_full_total; in set_channel_pending_send_size()
1111 if (!c->out_full_flag) { in set_channel_pending_send_size()
1112 ++c->out_full_first; in set_channel_pending_send_size()
1113 c->out_full_flag = true; in set_channel_pending_send_size()
1115 spin_unlock_irqrestore(&c->outbound.ring_lock, flags); in set_channel_pending_send_size()
1117 c->out_full_flag = false; in set_channel_pending_send_size()
1120 c->outbound.ring_buffer->pending_send_sz = size; in set_channel_pending_send_size()
1128 * APIs for managing sub-channels.
1134 void vmbus_set_chn_rescind_callback(struct vmbus_channel *channel,
1173 int vmbus_alloc_ring(struct vmbus_channel *channel,
1175 void vmbus_free_ring(struct vmbus_channel *channel);
1177 int vmbus_connect_ring(struct vmbus_channel *channel,
1180 int vmbus_disconnect_ring(struct vmbus_channel *channel);
1182 extern int vmbus_open(struct vmbus_channel *channel,
1190 extern void vmbus_close(struct vmbus_channel *channel);
1192 extern int vmbus_sendpacket_getid(struct vmbus_channel *channel,
1199 extern int vmbus_sendpacket(struct vmbus_channel *channel,
1206 extern int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel,
1213 extern int vmbus_sendpacket_mpb_desc(struct vmbus_channel *channel,
1220 extern int vmbus_establish_gpadl(struct vmbus_channel *channel,
1225 extern int vmbus_teardown_gpadl(struct vmbus_channel *channel,
1228 void vmbus_reset_channel_cb(struct vmbus_channel *channel);
1230 extern int vmbus_recvpacket(struct vmbus_channel *channel,
1236 extern int vmbus_recvpacket_raw(struct vmbus_channel *channel,
1251 * channel flag, actually doesn't mean a synthetic device because the
1255 * However, to facilitate the notification of new-offer/rescind-offer
1301 struct vmbus_channel *channel; member
1324 dev_set_drvdata(&dev->device, data); in hv_set_drvdata()
1329 return dev_get_drvdata(&dev->device); in hv_get_drvdata()
1352 void vmbus_hvsock_device_unregister(struct vmbus_channel *channel);
1361 * GUID definitions of various offer types - services offered to the guest.
1366 * {f8615163-df3e-46c5-913f-f2d2f965ed0e}
1374 * {32412632-86cb-44a2-9b5c-50d1417354f5}
1382 * {ba6163d9-04a1-4d29-b605-72e2ffb1dc7f}
1390 * {0e0b6031-5213-4934-818b-38d90ced39db}
1398 * {9527E630-D0AE-497b-ADCE-E80AB0175CAF}
1406 * {57164f39-9115-4e78-ab55-382f3bd5422d}
1414 * {a9a0f4e7-5a45-4d96-b827-8a841e8c03e6}
1422 * {525074dc-8985-46e2-8057-a307dc18a502}
1430 * {cfa8b69e-5b4a-4cc0-b98b-8ba1a1f3f95a}
1438 * {f912ad6d-2b17-48ea-bd65-f927a61c7684}
1452 * {DA0A7802-E377-4aac-8E77-0558EB1073F8}
1460 * {2f9bcc4a-0069-4af3-b76b-6fd0be528cda}
1468 * {34D14BE3-DEE4-41c8-9AE7-6B174977C192}
1477 * {8c2eaf3d-32a7-4b09-ab99-bd1f1c86b501}
1485 * {44C4F61D-4444-4400-9D52-802E27EDE19F}
1493 * Linux doesn't support these 4 devices: the first two are for
1497 * {f8e65716-3cb3-4a06-9a60-1889c5cccab5}
1498 * {3375baf4-9e15-4b30-b765-67acb10d607b}
1499 * {276aacf4-ac15-426c-98dd-7521ad3f01fe}
1500 * {c376c1c3-d276-48d2-90a9-c04748072c60}
1520 * Common header for Hyper-V ICs
1527 #define ICMSGTYPE_TIMESYNC 4
1533 #define ICMSGHDRFLAG_RESPONSE 4
1544 void *channel; member
1629 struct vmbus_channel *channel; member
1644 void hv_process_channel_removal(struct vmbus_channel *channel);
1646 void vmbus_setevent(struct vmbus_channel *channel);
1655 int vmbus_send_modifychannel(struct vmbus_channel *channel, u32 target_vp);
1656 void vmbus_set_event(struct vmbus_channel *channel);
1662 return ring_info->ring_buffer->buffer; in hv_get_ring_buffer()
1670 rbi->ring_buffer->interrupt_mask = 1; in hv_begin_read()
1677 * Re-enable host callback and return number of outstanding bytes
1682 rbi->ring_buffer->interrupt_mask = 0; in hv_end_read()
1696 * An API to support in-place processing of incoming VMBUS packets.
1702 return (void *)((unsigned long)desc + (desc->offset8 << 3)); in hv_pkt_data()
1708 return (desc->len8 << 3) - (desc->offset8 << 3); in hv_pkt_datalen()
1714 return desc->len8 << 3; in hv_pkt_len()
1718 hv_pkt_iter_first(struct vmbus_channel *channel);
1721 __hv_pkt_iter_next(struct vmbus_channel *channel,
1724 void hv_pkt_iter_close(struct vmbus_channel *channel);
1727 hv_pkt_iter_next(struct vmbus_channel *channel, in hv_pkt_iter_next() argument
1732 nxt = __hv_pkt_iter_next(channel, pkt); in hv_pkt_iter_next()
1734 hv_pkt_iter_close(channel); in hv_pkt_iter_next()
1739 #define foreach_vmbus_pkt(pkt, channel) \ argument
1740 for (pkt = hv_pkt_iter_first(channel); pkt; \
1741 pkt = hv_pkt_iter_next(channel, pkt))
1744 * Interface for passing data between SR-IOV PF and VF drivers. The VF driver
1787 #define HVPFN_UP(x) (((x) + HV_HYP_PAGE_SIZE-1) >> HV_HYP_PAGE_SHIFT)