Lines Matching +full:control +full:- +full:channel

1 .. SPDX-License-Identifier: GPL-2.0
5 VMBus is a software construct provided by Hyper-V to guest VMs. It
6 consists of a control path and common facilities used by synthetic
7 devices that Hyper-V presents to guest VMs. The control path is
11 and the synthetic device implementation that is part of Hyper-V, and
12 signaling primitives to allow Hyper-V and the guest to interrupt
17 establishes the VMBus control path with the Hyper-V host, then
21 Most synthetic devices offered by Hyper-V have a corresponding Linux
29 * PCI device pass-thru
34 * Key/Value Pair (KVP) exchange with Hyper-V
35 * Hyper-V online backup (a.k.a. VSS)
38 controller, synthetic NIC, and PCI pass-thru devices. Other
41 Hyper-V that are used only by Windows guests and for which Linux
44 Hyper-V uses the terms "VSP" and "VSC" in describing synthetic
45 devices. "VSP" refers to the Hyper-V code that implements a
53 --------------
55 between the VSP and the VSC. Channels are bi-directional and used
56 for passing messages. Most synthetic devices use a single channel,
60 Each channel consists of two ring buffers. These are classic ring
64 The "in" ring buffer is for messages from the Hyper-V host to the
66 the Hyper-V host. In Linux, the "in" and "out" designations are as
72 write indices and some control flags, followed by the memory for the
75 making up the ring is communicated to the Hyper-V host over the
76 VMBus control path as a GPA Descriptor List (GPADL). See function
84 ring buffer need not be concerned with ring buffer wrap-around.
89 directly in the ring without handling wrap-around.
92 passed to Hyper-V as a 4 Kbyte area. But the memory for the actual
96 Hyper-V. This case is handled by vmbus_establish_gpadl().
98 Hyper-V enforces a limit on the aggregate amount of guest memory
105 VMBus channel messages
106 ----------------------
107 All messages sent in a VMBus channel have a standard header that includes
120 responses. Some synthetic devices allow multiple requests to be in-
122 sending a request. Hyper-V sends back the same transactionID in the
125 Messages passed between the VSP and VSC are control messages. For
128 between the guest and the Hyper-V host, the actual data to be
129 transferred may be embedded with the control message, or it may be
130 specified as a separate data buffer that the Hyper-V host will
134 Hyper-V host to the guest contain the actual time value. When the
136 control message contains a list of GPAs that describe the data
140 Three functions exist to send VMBus channel messages:
142 1. vmbus_sendpacket(): Control-only messages and messages with
143 embedded data -- no GPAs
153 Historically, Linux guests have trusted Hyper-V to send well-formed
157 guest to not trust the hypervisor (AMD SEV-SNP, Intel TDX), trusting
158 the Hyper-V host is no longer a valid assumption. The drivers for
160 values read from memory that is shared with Hyper-V, which includes
163 temporary buffer that is not shared with Hyper-V. Validation is
164 performed in this temporary buffer without the risk of Hyper-V
169 --------------------------------------
170 Hyper-V provides each guest CPU with a synthetic interrupt controller
171 that is used by VMBus for host-guest communication. While each synic
174 the Hyper-V host and a guest CPU use that SINT.
176 The SINT is mapped to a single per-CPU architectural interrupt (i.e,
177 an 8-bit x86/x64 interrupt vector, or an arm64 PPI INTID). Because
179 they are best modeled in Linux as per-CPU interrupts. This model works
180 well on arm64 where a single per-CPU Linux IRQ is allocated for
182 "Hyper-V VMbus". Since x86/x64 lacks support for per-CPU IRQs, an x86
200 ----------------
204 ring buffer transitions from empty to non-empty. If the guest sends
208 execution for a few seconds to prevent a denial-of-service attack.
211 it sends a new message on the VMBus control path, or when a VMBus
212 channel "in" ring buffer transitions from empty to non-empty due to
213 the host inserting a new VMBus channel message. The control message stream
214 and each VMBus channel "in" ring buffer are separate logical interrupts
216 for channel interrupts by calling vmbus_chan_sched(), which looks at a synic
219 processed sequentially. When all channel interrupts have been processed,
221 control path.
223 The guest CPU that a VMBus channel will interrupt is selected by the
224 guest when the channel is created, and the host is informed of that
227 1. "Slow" devices that need only one VMBus channel. The devices
240 The assignment of VMBus channel interrupts to CPUs is done in the
245 The CPU that a VMBus channel will interrupt can be seen in
247 When running on later versions of Hyper-V, the CPU can be changed
248 by writing a new value to this sysfs entry. Because VMBus channel
250 or /proc/irq corresponding to individual VMBus channel interrupts.
253 VMBus channel interrupts assigned to it. Any such channel
255 described above. When no channel interrupts are assigned to the
258 The VMBus channel interrupt handling code is designed to work
260 CPU assigned to the channel. Specifically, the code does not use
261 CPU-based exclusion for correctness. In normal operation, Hyper-V
263 channel is being changed via sysfs, the guest doesn't know exactly
264 when Hyper-V will make the transition. The code must work correctly
265 even if there is a time lag before Hyper-V starts interrupting the
269 ------------------------------
270 Hyper-V and the Linux guest have a separate message-passing path
272 path does not use a VMBus channel. See vmbus_post_msg() and
276 Hyper-V VMBus mechanism. As part of establishing this connection,
277 the guest and Hyper-V agree on a VMBus protocol version they will
279 Hyper-V versions, and vice versa.
281 The guest then tells Hyper-V to "send offers". Hyper-V sends an
285 identified by a GUID. The offer message from Hyper-V contains
289 class ID. The ordering of offer messages can vary from boot-to-boot
292 because Hyper-V supports adding devices, such as synthetic NICs,
301 The device driver probe function opens the primary VMBus channel to
302 the corresponding VSP. It allocates guest memory for the channel
303 ring buffers and shares the ring buffer with the Hyper-V host by
308 setup messages via the primary channel. These messages may include
310 VSC and the VSP on the Hyper-V host. The setup messages may also
312 mis-named as "sub-channels" since they are functionally
313 equivalent to the primary channel once they are created.
318 The Hyper-V host can send a "rescind" message to the guest to
323 rescinded, neither Hyper-V nor Linux retains any state about
324 its previous existence. Such a device might be re-added later,