Deleted Added
full compact
virtio.h (330449) virtio.h (336161)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2013 Chris Torek <torek @ torek net>
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

--- 11 unchanged lines hidden (view full) ---

20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2013 Chris Torek <torek @ torek net>
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

--- 11 unchanged lines hidden (view full) ---

20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $FreeBSD: stable/11/usr.sbin/bhyve/virtio.h 330449 2018-03-05 07:26:05Z eadler $
28 * $FreeBSD: stable/11/usr.sbin/bhyve/virtio.h 336161 2018-07-10 04:26:32Z araujo $
29 */
30
31#ifndef _VIRTIO_H_
32#define _VIRTIO_H_
33
34/*
35 * These are derived from several virtio specifications.
36 *

--- 144 unchanged lines hidden (view full) ---

181 * QNOTIFY is effectively write-only: when the guest writes a queue
182 * number to the register, the hypervisor should scan the specified
183 * virtqueue. (Reading QNOTIFY currently always gets 0).
184 */
185
186/*
187 * PFN register shift amount
188 */
29 */
30
31#ifndef _VIRTIO_H_
32#define _VIRTIO_H_
33
34/*
35 * These are derived from several virtio specifications.
36 *

--- 144 unchanged lines hidden (view full) ---

181 * QNOTIFY is effectively write-only: when the guest writes a queue
182 * number to the register, the hypervisor should scan the specified
183 * virtqueue. (Reading QNOTIFY currently always gets 0).
184 */
185
186/*
187 * PFN register shift amount
188 */
189#define VRING_PFN 12
189#define VRING_PFN 12
190
191/*
192 * Virtio device types
193 *
194 * XXX Should really be merged with <dev/virtio/virtio.h> defines
195 */
196#define VIRTIO_TYPE_NET 1
197#define VIRTIO_TYPE_BLOCK 2

--- 20 unchanged lines hidden (view full) ---

218 * PCI config space constants.
219 *
220 * If MSI-X is enabled, the ISR register is generally not used,
221 * and the configuration vector and queue vector appear at offsets
222 * 20 and 22 with the remaining configuration registers at 24.
223 * If MSI-X is not enabled, those two registers disappear and
224 * the remaining configuration registers start at offset 20.
225 */
190
191/*
192 * Virtio device types
193 *
194 * XXX Should really be merged with <dev/virtio/virtio.h> defines
195 */
196#define VIRTIO_TYPE_NET 1
197#define VIRTIO_TYPE_BLOCK 2

--- 20 unchanged lines hidden (view full) ---

218 * PCI config space constants.
219 *
220 * If MSI-X is enabled, the ISR register is generally not used,
221 * and the configuration vector and queue vector appear at offsets
222 * 20 and 22 with the remaining configuration registers at 24.
223 * If MSI-X is not enabled, those two registers disappear and
224 * the remaining configuration registers start at offset 20.
225 */
226#define VTCFG_R_HOSTCAP 0
227#define VTCFG_R_GUESTCAP 4
228#define VTCFG_R_PFN 8
229#define VTCFG_R_QNUM 12
230#define VTCFG_R_QSEL 14
231#define VTCFG_R_QNOTIFY 16
232#define VTCFG_R_STATUS 18
233#define VTCFG_R_ISR 19
234#define VTCFG_R_CFGVEC 20
235#define VTCFG_R_QVEC 22
236#define VTCFG_R_CFG0 20 /* No MSI-X */
237#define VTCFG_R_CFG1 24 /* With MSI-X */
238#define VTCFG_R_MSIX 20
226#define VTCFG_R_HOSTCAP 0
227#define VTCFG_R_GUESTCAP 4
228#define VTCFG_R_PFN 8
229#define VTCFG_R_QNUM 12
230#define VTCFG_R_QSEL 14
231#define VTCFG_R_QNOTIFY 16
232#define VTCFG_R_STATUS 18
233#define VTCFG_R_ISR 19
234#define VTCFG_R_CFGVEC 20
235#define VTCFG_R_QVEC 22
236#define VTCFG_R_CFG0 20 /* No MSI-X */
237#define VTCFG_R_CFG1 24 /* With MSI-X */
238#define VTCFG_R_MSIX 20
239
240/*
241 * Bits in VTCFG_R_STATUS. Guests need not actually set any of these,
242 * but a guest writing 0 to this register means "please reset".
243 */
244#define VTCFG_STATUS_ACK 0x01 /* guest OS has acknowledged dev */
245#define VTCFG_STATUS_DRIVER 0x02 /* guest OS driver is loaded */
246#define VTCFG_STATUS_DRIVER_OK 0x04 /* guest OS driver ready */
247#define VTCFG_STATUS_FAILED 0x80 /* guest has given up on this dev */
248
249/*
250 * Bits in VTCFG_R_ISR. These apply only if not using MSI-X.
251 *
252 * (We don't [yet?] ever use CONF_CHANGED.)
253 */
254#define VTCFG_ISR_QUEUES 0x01 /* re-scan queues */
255#define VTCFG_ISR_CONF_CHANGED 0x80 /* configuration changed */
256
239
240/*
241 * Bits in VTCFG_R_STATUS. Guests need not actually set any of these,
242 * but a guest writing 0 to this register means "please reset".
243 */
244#define VTCFG_STATUS_ACK 0x01 /* guest OS has acknowledged dev */
245#define VTCFG_STATUS_DRIVER 0x02 /* guest OS driver is loaded */
246#define VTCFG_STATUS_DRIVER_OK 0x04 /* guest OS driver ready */
247#define VTCFG_STATUS_FAILED 0x80 /* guest has given up on this dev */
248
249/*
250 * Bits in VTCFG_R_ISR. These apply only if not using MSI-X.
251 *
252 * (We don't [yet?] ever use CONF_CHANGED.)
253 */
254#define VTCFG_ISR_QUEUES 0x01 /* re-scan queues */
255#define VTCFG_ISR_CONF_CHANGED 0x80 /* configuration changed */
256
257#define VIRTIO_MSI_NO_VECTOR 0xFFFF
257#define VIRTIO_MSI_NO_VECTOR 0xFFFF
258
259/*
260 * Feature flags.
261 * Note: bits 0 through 23 are reserved to each device type.
262 */
263#define VIRTIO_F_NOTIFY_ON_EMPTY (1 << 24)
264#define VIRTIO_RING_F_INDIRECT_DESC (1 << 28)
265#define VIRTIO_RING_F_EVENT_IDX (1 << 29)

--- 202 unchanged lines hidden ---
258
259/*
260 * Feature flags.
261 * Note: bits 0 through 23 are reserved to each device type.
262 */
263#define VIRTIO_F_NOTIFY_ON_EMPTY (1 << 24)
264#define VIRTIO_RING_F_INDIRECT_DESC (1 << 28)
265#define VIRTIO_RING_F_EVENT_IDX (1 << 29)

--- 202 unchanged lines hidden ---