1 #ifndef VFIO_USER_PROTOCOL_H 2 #define VFIO_USER_PROTOCOL_H 3 4 /* 5 * vfio protocol over a UNIX socket. 6 * 7 * Copyright © 2018, 2021 Oracle and/or its affiliates. 8 * 9 * Each message has a standard header that describes the command 10 * being sent, which is almost always a VFIO ioctl(). 11 * 12 * The header may be followed by command-specific data, such as the 13 * region and offset info for read and write commands. 14 * 15 * SPDX-License-Identifier: GPL-2.0-or-later 16 */ 17 18 typedef struct { 19 uint16_t id; 20 uint16_t command; 21 uint32_t size; 22 uint32_t flags; 23 uint32_t error_reply; 24 } VFIOUserHdr; 25 26 /* VFIOUserHdr commands */ 27 enum vfio_user_command { 28 VFIO_USER_VERSION = 1, 29 VFIO_USER_DMA_MAP = 2, 30 VFIO_USER_DMA_UNMAP = 3, 31 VFIO_USER_DEVICE_GET_INFO = 4, 32 VFIO_USER_DEVICE_GET_REGION_INFO = 5, 33 VFIO_USER_DEVICE_GET_REGION_IO_FDS = 6, 34 VFIO_USER_DEVICE_GET_IRQ_INFO = 7, 35 VFIO_USER_DEVICE_SET_IRQS = 8, 36 VFIO_USER_REGION_READ = 9, 37 VFIO_USER_REGION_WRITE = 10, 38 VFIO_USER_DMA_READ = 11, 39 VFIO_USER_DMA_WRITE = 12, 40 VFIO_USER_DEVICE_RESET = 13, 41 VFIO_USER_DIRTY_PAGES = 14, 42 VFIO_USER_MAX, 43 }; 44 45 /* VFIOUserHdr flags */ 46 #define VFIO_USER_REQUEST 0x0 47 #define VFIO_USER_REPLY 0x1 48 #define VFIO_USER_TYPE 0xF 49 50 #define VFIO_USER_NO_REPLY 0x10 51 #define VFIO_USER_ERROR 0x20 52 53 #endif /* VFIO_USER_PROTOCOL_H */ 54