Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations
vfio.h File Reference
#include <linux/types.h>
#include <linux/ioctl.h>

Go to the source code of this file.

Data Structures

struct  vfio_group_status
 
struct  vfio_device_info
 
struct  vfio_region_info
 
struct  vfio_irq_info
 
struct  vfio_irq_set
 
struct  vfio_iommu_type1_info
 
struct  vfio_iommu_type1_dma_map
 
struct  vfio_iommu_type1_dma_unmap
 

Macros

#define VFIO_API_VERSION   0
 
#define VFIO_TYPE1_IOMMU   1
 
#define VFIO_TYPE   (';')
 
#define VFIO_BASE   100
 
#define VFIO_GET_API_VERSION   _IO(VFIO_TYPE, VFIO_BASE + 0)
 
#define VFIO_CHECK_EXTENSION   _IO(VFIO_TYPE, VFIO_BASE + 1)
 
#define VFIO_SET_IOMMU   _IO(VFIO_TYPE, VFIO_BASE + 2)
 
#define VFIO_GROUP_FLAGS_VIABLE   (1 << 0)
 
#define VFIO_GROUP_FLAGS_CONTAINER_SET   (1 << 1)
 
#define VFIO_GROUP_GET_STATUS   _IO(VFIO_TYPE, VFIO_BASE + 3)
 
#define VFIO_GROUP_SET_CONTAINER   _IO(VFIO_TYPE, VFIO_BASE + 4)
 
#define VFIO_GROUP_UNSET_CONTAINER   _IO(VFIO_TYPE, VFIO_BASE + 5)
 
#define VFIO_GROUP_GET_DEVICE_FD   _IO(VFIO_TYPE, VFIO_BASE + 6)
 
#define VFIO_DEVICE_FLAGS_RESET   (1 << 0) /* Device supports reset */
 
#define VFIO_DEVICE_FLAGS_PCI   (1 << 1) /* vfio-pci device */
 
#define VFIO_DEVICE_GET_INFO   _IO(VFIO_TYPE, VFIO_BASE + 7)
 
#define VFIO_REGION_INFO_FLAG_READ   (1 << 0) /* Region supports read */
 
#define VFIO_REGION_INFO_FLAG_WRITE   (1 << 1) /* Region supports write */
 
#define VFIO_REGION_INFO_FLAG_MMAP   (1 << 2) /* Region supports mmap */
 
#define VFIO_DEVICE_GET_REGION_INFO   _IO(VFIO_TYPE, VFIO_BASE + 8)
 
#define VFIO_IRQ_INFO_EVENTFD   (1 << 0)
 
#define VFIO_IRQ_INFO_MASKABLE   (1 << 1)
 
#define VFIO_IRQ_INFO_AUTOMASKED   (1 << 2)
 
#define VFIO_IRQ_INFO_NORESIZE   (1 << 3)
 
#define VFIO_DEVICE_GET_IRQ_INFO   _IO(VFIO_TYPE, VFIO_BASE + 9)
 
#define VFIO_IRQ_SET_DATA_NONE   (1 << 0) /* Data not present */
 
#define VFIO_IRQ_SET_DATA_BOOL   (1 << 1) /* Data is bool (u8) */
 
#define VFIO_IRQ_SET_DATA_EVENTFD   (1 << 2) /* Data is eventfd (s32) */
 
#define VFIO_IRQ_SET_ACTION_MASK   (1 << 3) /* Mask interrupt */
 
#define VFIO_IRQ_SET_ACTION_UNMASK   (1 << 4) /* Unmask interrupt */
 
#define VFIO_IRQ_SET_ACTION_TRIGGER   (1 << 5) /* Trigger interrupt */
 
#define VFIO_DEVICE_SET_IRQS   _IO(VFIO_TYPE, VFIO_BASE + 10)
 
#define VFIO_IRQ_SET_DATA_TYPE_MASK
 
#define VFIO_IRQ_SET_ACTION_TYPE_MASK
 
#define VFIO_DEVICE_RESET   _IO(VFIO_TYPE, VFIO_BASE + 11)
 
#define VFIO_IOMMU_INFO_PGSIZES   (1 << 0) /* supported page sizes info */
 
#define VFIO_IOMMU_GET_INFO   _IO(VFIO_TYPE, VFIO_BASE + 12)
 
#define VFIO_DMA_MAP_FLAG_READ   (1 << 0) /* readable from device */
 
#define VFIO_DMA_MAP_FLAG_WRITE   (1 << 1) /* writable from device */
 
#define VFIO_IOMMU_MAP_DMA   _IO(VFIO_TYPE, VFIO_BASE + 13)
 
#define VFIO_IOMMU_UNMAP_DMA   _IO(VFIO_TYPE, VFIO_BASE + 14)
 

Enumerations

enum  {
  VFIO_PCI_BAR0_REGION_INDEX, VFIO_PCI_BAR1_REGION_INDEX, VFIO_PCI_BAR2_REGION_INDEX, VFIO_PCI_BAR3_REGION_INDEX,
  VFIO_PCI_BAR4_REGION_INDEX, VFIO_PCI_BAR5_REGION_INDEX, VFIO_PCI_ROM_REGION_INDEX, VFIO_PCI_CONFIG_REGION_INDEX,
  VFIO_PCI_NUM_REGIONS
}
 
enum  { VFIO_PCI_INTX_IRQ_INDEX, VFIO_PCI_MSI_IRQ_INDEX, VFIO_PCI_MSIX_IRQ_INDEX, VFIO_PCI_NUM_IRQS }
 

Macro Definition Documentation

#define VFIO_API_VERSION   0

Definition at line 17 of file vfio.h.

#define VFIO_BASE   100

Definition at line 38 of file vfio.h.

#define VFIO_CHECK_EXTENSION   _IO(VFIO_TYPE, VFIO_BASE + 1)

VFIO_CHECK_EXTENSION - _IOW(VFIO_TYPE, VFIO_BASE + 1, __u32)

Check whether an extension is supported. Return: 0 if not supported, 1 (or some other positive integer) if supported. Availability: Always

Definition at line 60 of file vfio.h.

#define VFIO_DEVICE_FLAGS_PCI   (1 << 1) /* vfio-pci device */

Definition at line 149 of file vfio.h.

#define VFIO_DEVICE_FLAGS_RESET   (1 << 0) /* Device supports reset */

Definition at line 148 of file vfio.h.

#define VFIO_DEVICE_GET_INFO   _IO(VFIO_TYPE, VFIO_BASE + 7)

Definition at line 153 of file vfio.h.

#define VFIO_DEVICE_GET_IRQ_INFO   _IO(VFIO_TYPE, VFIO_BASE + 9)

Definition at line 222 of file vfio.h.

#define VFIO_DEVICE_GET_REGION_INFO   _IO(VFIO_TYPE, VFIO_BASE + 8)

Definition at line 178 of file vfio.h.

#define VFIO_DEVICE_RESET   _IO(VFIO_TYPE, VFIO_BASE + 11)

VFIO_DEVICE_RESET - _IO(VFIO_TYPE, VFIO_BASE + 11)

Reset a device.

Definition at line 289 of file vfio.h.

#define VFIO_DEVICE_SET_IRQS   _IO(VFIO_TYPE, VFIO_BASE + 10)

Definition at line 276 of file vfio.h.

#define VFIO_DMA_MAP_FLAG_READ   (1 << 0) /* readable from device */

Definition at line 344 of file vfio.h.

#define VFIO_DMA_MAP_FLAG_WRITE   (1 << 1) /* writable from device */

Definition at line 345 of file vfio.h.

#define VFIO_GET_API_VERSION   _IO(VFIO_TYPE, VFIO_BASE + 0)

VFIO_GET_API_VERSION - _IO(VFIO_TYPE, VFIO_BASE + 0)

Report the version of the VFIO API. This allows us to bump the entire API version should we later need to add or change features in incompatible ways. Return: VFIO_API_VERSION Availability: Always

Definition at line 51 of file vfio.h.

#define VFIO_GROUP_FLAGS_CONTAINER_SET   (1 << 1)

Definition at line 90 of file vfio.h.

#define VFIO_GROUP_FLAGS_VIABLE   (1 << 0)

Definition at line 89 of file vfio.h.

#define VFIO_GROUP_GET_DEVICE_FD   _IO(VFIO_TYPE, VFIO_BASE + 6)

VFIO_GROUP_GET_DEVICE_FD - _IOW(VFIO_TYPE, VFIO_BASE + 6, char)

Return a new file descriptor for the device object described by the provided string. The string should match a device listed in the devices subdirectory of the IOMMU group sysfs entry. The group containing the device must already be added to this context. Return: new file descriptor on success, -errno on failure. Availability: When attached to container

Definition at line 133 of file vfio.h.

#define VFIO_GROUP_GET_STATUS   _IO(VFIO_TYPE, VFIO_BASE + 3)

Definition at line 92 of file vfio.h.

#define VFIO_GROUP_SET_CONTAINER   _IO(VFIO_TYPE, VFIO_BASE + 4)

VFIO_GROUP_SET_CONTAINER - _IOW(VFIO_TYPE, VFIO_BASE + 4, __s32)

Set the container for the VFIO group to the open VFIO file descriptor provided. Groups may only belong to a single container. Containers may, at their discretion, support multiple groups. Only when a container is set are all of the interfaces of the VFIO file descriptor and the VFIO group file descriptor available to the user. Return: 0 on success, -errno on failure. Availability: Always

Definition at line 106 of file vfio.h.

#define VFIO_GROUP_UNSET_CONTAINER   _IO(VFIO_TYPE, VFIO_BASE + 5)

VFIO_GROUP_UNSET_CONTAINER - _IO(VFIO_TYPE, VFIO_BASE + 5)

Remove the group from the attached container. This is the opposite of the SET_CONTAINER call and returns the group to an initial state. All device file descriptors must be released prior to calling this interface. When removing the last group from a container, the IOMMU will be disabled and all state lost, effectively also returning the VFIO file descriptor to an initial state. Return: 0 on success, -errno on failure. Availability: When attached to container

Definition at line 121 of file vfio.h.

#define VFIO_IOMMU_GET_INFO   _IO(VFIO_TYPE, VFIO_BASE + 12)

Definition at line 333 of file vfio.h.

#define VFIO_IOMMU_INFO_PGSIZES   (1 << 0) /* supported page sizes info */

Definition at line 329 of file vfio.h.

#define VFIO_IOMMU_MAP_DMA   _IO(VFIO_TYPE, VFIO_BASE + 13)

Definition at line 351 of file vfio.h.

#define VFIO_IOMMU_UNMAP_DMA   _IO(VFIO_TYPE, VFIO_BASE + 14)

Definition at line 366 of file vfio.h.

#define VFIO_IRQ_INFO_AUTOMASKED   (1 << 2)

Definition at line 217 of file vfio.h.

#define VFIO_IRQ_INFO_EVENTFD   (1 << 0)

Definition at line 215 of file vfio.h.

#define VFIO_IRQ_INFO_MASKABLE   (1 << 1)

Definition at line 216 of file vfio.h.

#define VFIO_IRQ_INFO_NORESIZE   (1 << 3)

Definition at line 218 of file vfio.h.

#define VFIO_IRQ_SET_ACTION_MASK   (1 << 3) /* Mask interrupt */

Definition at line 268 of file vfio.h.

#define VFIO_IRQ_SET_ACTION_TRIGGER   (1 << 5) /* Trigger interrupt */

Definition at line 270 of file vfio.h.

#define VFIO_IRQ_SET_ACTION_TYPE_MASK
Value:
VFIO_IRQ_SET_ACTION_UNMASK | \
VFIO_IRQ_SET_ACTION_TRIGGER)

Definition at line 281 of file vfio.h.

#define VFIO_IRQ_SET_ACTION_UNMASK   (1 << 4) /* Unmask interrupt */

Definition at line 269 of file vfio.h.

#define VFIO_IRQ_SET_DATA_BOOL   (1 << 1) /* Data is bool (u8) */

Definition at line 266 of file vfio.h.

#define VFIO_IRQ_SET_DATA_EVENTFD   (1 << 2) /* Data is eventfd (s32) */

Definition at line 267 of file vfio.h.

#define VFIO_IRQ_SET_DATA_NONE   (1 << 0) /* Data not present */

Definition at line 265 of file vfio.h.

#define VFIO_IRQ_SET_DATA_TYPE_MASK
Value:
VFIO_IRQ_SET_DATA_BOOL | \
VFIO_IRQ_SET_DATA_EVENTFD)

Definition at line 278 of file vfio.h.

#define VFIO_REGION_INFO_FLAG_MMAP   (1 << 2) /* Region supports mmap */

Definition at line 172 of file vfio.h.

#define VFIO_REGION_INFO_FLAG_READ   (1 << 0) /* Region supports read */

Definition at line 170 of file vfio.h.

#define VFIO_REGION_INFO_FLAG_WRITE   (1 << 1) /* Region supports write */

Definition at line 171 of file vfio.h.

#define VFIO_SET_IOMMU   _IO(VFIO_TYPE, VFIO_BASE + 2)

VFIO_SET_IOMMU - _IOW(VFIO_TYPE, VFIO_BASE + 2, __s32)

Set the iommu to the given type. The type must be supported by an iommu driver as verified by calling CHECK_EXTENSION using the same type. A group must be set to this file descriptor before this ioctl is available. The IOMMU interfaces enabled by this call are specific to the value set. Return: 0 on success, -errno on failure Availability: When VFIO group attached

Definition at line 73 of file vfio.h.

#define VFIO_TYPE   (';')

Definition at line 37 of file vfio.h.

#define VFIO_TYPE1_IOMMU   1

Definition at line 24 of file vfio.h.

Enumeration Type Documentation

anonymous enum
Enumerator:
VFIO_PCI_BAR0_REGION_INDEX 
VFIO_PCI_BAR1_REGION_INDEX 
VFIO_PCI_BAR2_REGION_INDEX 
VFIO_PCI_BAR3_REGION_INDEX 
VFIO_PCI_BAR4_REGION_INDEX 
VFIO_PCI_BAR5_REGION_INDEX 
VFIO_PCI_ROM_REGION_INDEX 
VFIO_PCI_CONFIG_REGION_INDEX 
VFIO_PCI_NUM_REGIONS 

Definition at line 297 of file vfio.h.

anonymous enum
Enumerator:
VFIO_PCI_INTX_IRQ_INDEX 
VFIO_PCI_MSI_IRQ_INDEX 
VFIO_PCI_MSIX_IRQ_INDEX 
VFIO_PCI_NUM_IRQS 

Definition at line 309 of file vfio.h.