~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/vfio.h

Version: ~ [ linux-5.4-rc3 ] ~ [ linux-5.3.6 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.79 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.149 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.196 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.196 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.75 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * VFIO API definition
  3  *
  4  * Copyright (C) 2012 Red Hat, Inc.  All rights reserved.
  5  *     Author: Alex Williamson <alex.williamson@redhat.com>
  6  *
  7  * This program is free software; you can redistribute it and/or modify
  8  * it under the terms of the GNU General Public License version 2 as
  9  * published by the Free Software Foundation.
 10  */
 11 #ifndef VFIO_H
 12 #define VFIO_H
 13 
 14 
 15 #include <linux/iommu.h>
 16 #include <linux/mm.h>
 17 #include <uapi/linux/vfio.h>
 18 
 19 /**
 20  * struct vfio_device_ops - VFIO bus driver device callbacks
 21  *
 22  * @open: Called when userspace creates new file descriptor for device
 23  * @release: Called when userspace releases file descriptor for device
 24  * @read: Perform read(2) on device file descriptor
 25  * @write: Perform write(2) on device file descriptor
 26  * @ioctl: Perform ioctl(2) on device file descriptor, supporting VFIO_DEVICE_*
 27  *         operations documented below
 28  * @mmap: Perform mmap(2) on a region of the device file descriptor
 29  */
 30 struct vfio_device_ops {
 31         char    *name;
 32         int     (*open)(void *device_data);
 33         void    (*release)(void *device_data);
 34         ssize_t (*read)(void *device_data, char __user *buf,
 35                         size_t count, loff_t *ppos);
 36         ssize_t (*write)(void *device_data, const char __user *buf,
 37                          size_t count, loff_t *size);
 38         long    (*ioctl)(void *device_data, unsigned int cmd,
 39                          unsigned long arg);
 40         int     (*mmap)(void *device_data, struct vm_area_struct *vma);
 41 };
 42 
 43 extern int vfio_add_group_dev(struct device *dev,
 44                               const struct vfio_device_ops *ops,
 45                               void *device_data);
 46 
 47 extern void *vfio_del_group_dev(struct device *dev);
 48 extern struct vfio_device *vfio_device_get_from_dev(struct device *dev);
 49 extern void vfio_device_put(struct vfio_device *device);
 50 extern void *vfio_device_data(struct vfio_device *device);
 51 
 52 /**
 53  * struct vfio_iommu_driver_ops - VFIO IOMMU driver callbacks
 54  */
 55 struct vfio_iommu_driver_ops {
 56         char            *name;
 57         struct module   *owner;
 58         void            *(*open)(unsigned long arg);
 59         void            (*release)(void *iommu_data);
 60         ssize_t         (*read)(void *iommu_data, char __user *buf,
 61                                 size_t count, loff_t *ppos);
 62         ssize_t         (*write)(void *iommu_data, const char __user *buf,
 63                                  size_t count, loff_t *size);
 64         long            (*ioctl)(void *iommu_data, unsigned int cmd,
 65                                  unsigned long arg);
 66         int             (*mmap)(void *iommu_data, struct vm_area_struct *vma);
 67         int             (*attach_group)(void *iommu_data,
 68                                         struct iommu_group *group);
 69         void            (*detach_group)(void *iommu_data,
 70                                         struct iommu_group *group);
 71 
 72 };
 73 
 74 extern int vfio_register_iommu_driver(const struct vfio_iommu_driver_ops *ops);
 75 
 76 extern void vfio_unregister_iommu_driver(
 77                                 const struct vfio_iommu_driver_ops *ops);
 78 
 79 /*
 80  * External user API
 81  */
 82 extern struct vfio_group *vfio_group_get_external_user(struct file *filep);
 83 extern void vfio_group_put_external_user(struct vfio_group *group);
 84 extern int vfio_external_user_iommu_id(struct vfio_group *group);
 85 
 86 #endif /* VFIO_H */
 87 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp