/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_VHOST_TYPES_H #define _LINUX_VHOST_TYPES_H /* Userspace interface for in-kernel virtio accelerators. */ /* vhost is used to reduce the number of system calls involved in virtio. * * Existing virtio net code is used in the guest without modification. * * This header includes interface used by userspace hypervisor for * device configuration. */ #include <linux/types.h> #include <linux/compiler.h> #include <linux/virtio_config.h> #include <linux/virtio_ring.h> struct vhost_vring_state { … }; struct vhost_vring_file { … }; struct vhost_vring_addr { … }; struct vhost_worker_state { … }; struct vhost_vring_worker { … }; /* no alignment requirement */ struct vhost_iotlb_msg { … }; #define VHOST_IOTLB_MSG … #define VHOST_IOTLB_MSG_V2 … struct vhost_msg { … }; struct vhost_msg_v2 { … }; struct vhost_memory_region { … }; /* All region addresses and sizes must be 4K aligned. */ #define VHOST_PAGE_SIZE … struct vhost_memory { … }; /* VHOST_SCSI specific definitions */ /* * Used by QEMU userspace to ensure a consistent vhost-scsi ABI. * * ABI Rev 0: July 2012 version starting point for v3.6-rc merge candidate + * RFC-v2 vhost-scsi userspace. Add GET_ABI_VERSION ioctl usage * ABI Rev 1: January 2013. Ignore vhost_tpgt field in struct vhost_scsi_target. * All the targets under vhost_wwpn can be seen and used by guset. */ #define VHOST_SCSI_ABI_VERSION … struct vhost_scsi_target { … }; /* VHOST_VDPA specific definitions */ struct vhost_vdpa_config { … }; /* vhost vdpa IOVA range * @first: First address that can be mapped by vhost-vDPA * @last: Last address that can be mapped by vhost-vDPA */ struct vhost_vdpa_iova_range { … }; /* Feature bits */ /* Log all write descriptors. Can be changed while device is active. */ #define VHOST_F_LOG_ALL … /* vhost-net should add virtio_net_hdr for RX, and strip for TX packets. */ #define VHOST_NET_F_VIRTIO_NET_HDR … /* Use message type V2 */ #define VHOST_BACKEND_F_IOTLB_MSG_V2 … /* IOTLB can accept batching hints */ #define VHOST_BACKEND_F_IOTLB_BATCH … /* IOTLB can accept address space identifier through V2 type of IOTLB * message */ #define VHOST_BACKEND_F_IOTLB_ASID … /* Device can be suspended */ #define VHOST_BACKEND_F_SUSPEND … /* Device can be resumed */ #define VHOST_BACKEND_F_RESUME … /* Device supports the driver enabling virtqueues both before and after * DRIVER_OK */ #define VHOST_BACKEND_F_ENABLE_AFTER_DRIVER_OK … /* Device may expose the virtqueue's descriptor area, driver area and * device area to a different group for ASID binding than where its * buffers may reside. Requires VHOST_BACKEND_F_IOTLB_ASID. */ #define VHOST_BACKEND_F_DESC_ASID … /* IOTLB don't flush memory mapping across device reset */ #define VHOST_BACKEND_F_IOTLB_PERSIST … #endif