aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@redhat.com>2012-07-31 10:16:24 -0400
committerAlex Williamson <alex.williamson@redhat.com>2012-07-31 10:16:24 -0400
commit89e1f7d4c66d85f42c3d52ea3866eb10cadf6153 (patch)
tree6bea54ae5eaea48c17d309855d36d801259b64d1 /include/linux
parent73fa0d10d077d9521ee2dace2307ae2c9a965336 (diff)
vfio: Add PCI device driver
Add PCI device support for VFIO. PCI devices expose regions for accessing config space, I/O port space, and MMIO areas of the device. PCI config access is virtualized in the kernel, allowing us to ensure the integrity of the system, by preventing various accesses while reducing duplicate support across various userspace drivers. I/O port supports read/write access while MMIO also supports mmap of sufficiently sized regions. Support for INTx, MSI, and MSI-X interrupts are provided using eventfds to userspace. Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/vfio.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index acb046fd5b70..0a4f180a11d8 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -223,6 +223,7 @@ struct vfio_device_info {
223 __u32 argsz; 223 __u32 argsz;
224 __u32 flags; 224 __u32 flags;
225#define VFIO_DEVICE_FLAGS_RESET (1 << 0) /* Device supports reset */ 225#define VFIO_DEVICE_FLAGS_RESET (1 << 0) /* Device supports reset */
226#define VFIO_DEVICE_FLAGS_PCI (1 << 1) /* vfio-pci device */
226 __u32 num_regions; /* Max region index + 1 */ 227 __u32 num_regions; /* Max region index + 1 */
227 __u32 num_irqs; /* Max IRQ index + 1 */ 228 __u32 num_irqs; /* Max IRQ index + 1 */
228}; 229};
@@ -364,6 +365,31 @@ struct vfio_irq_set {
364 */ 365 */
365#define VFIO_DEVICE_RESET _IO(VFIO_TYPE, VFIO_BASE + 11) 366#define VFIO_DEVICE_RESET _IO(VFIO_TYPE, VFIO_BASE + 11)
366 367
368/*
369 * The VFIO-PCI bus driver makes use of the following fixed region and
370 * IRQ index mapping. Unimplemented regions return a size of zero.
371 * Unimplemented IRQ types return a count of zero.
372 */
373
374enum {
375 VFIO_PCI_BAR0_REGION_INDEX,
376 VFIO_PCI_BAR1_REGION_INDEX,
377 VFIO_PCI_BAR2_REGION_INDEX,
378 VFIO_PCI_BAR3_REGION_INDEX,
379 VFIO_PCI_BAR4_REGION_INDEX,
380 VFIO_PCI_BAR5_REGION_INDEX,
381 VFIO_PCI_ROM_REGION_INDEX,
382 VFIO_PCI_CONFIG_REGION_INDEX,
383 VFIO_PCI_NUM_REGIONS
384};
385
386enum {
387 VFIO_PCI_INTX_IRQ_INDEX,
388 VFIO_PCI_MSI_IRQ_INDEX,
389 VFIO_PCI_MSIX_IRQ_INDEX,
390 VFIO_PCI_NUM_IRQS
391};
392
367/* -------- API for Type1 VFIO IOMMU -------- */ 393/* -------- API for Type1 VFIO IOMMU -------- */
368 394
369/** 395/**