linux/drivers/vfio/container.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2012 Red Hat, Inc.  All rights reserved.
 *
 * VFIO container (/dev/vfio/vfio)
 */
#include <linux/file.h>
#include <linux/slab.h>
#include <linux/fs.h>
#include <linux/capability.h>
#include <linux/iommu.h>
#include <linux/miscdevice.h>
#include <linux/vfio.h>
#include <uapi/linux/vfio.h>

#include "vfio.h"

struct vfio_container {};

static struct vfio {} vfio;

static void *vfio_noiommu_open(unsigned long arg)
{}

static void vfio_noiommu_release(void *iommu_data)
{}

static long vfio_noiommu_ioctl(void *iommu_data,
			       unsigned int cmd, unsigned long arg)
{}

static int vfio_noiommu_attach_group(void *iommu_data,
		struct iommu_group *iommu_group, enum vfio_group_type type)
{}

static void vfio_noiommu_detach_group(void *iommu_data,
				      struct iommu_group *iommu_group)
{}

static const struct vfio_iommu_driver_ops vfio_noiommu_ops =;

/*
 * Only noiommu containers can use vfio-noiommu and noiommu containers can only
 * use vfio-noiommu.
 */
static bool vfio_iommu_driver_allowed(struct vfio_container *container,
				      const struct vfio_iommu_driver *driver)
{}

/*
 * IOMMU driver registration
 */
int vfio_register_iommu_driver(const struct vfio_iommu_driver_ops *ops)
{}
EXPORT_SYMBOL_GPL();

void vfio_unregister_iommu_driver(const struct vfio_iommu_driver_ops *ops)
{}
EXPORT_SYMBOL_GPL();

/*
 * Container objects - containers are created when /dev/vfio/vfio is
 * opened, but their lifecycle extends until the last user is done, so
 * it's freed via kref.  Must support container/group/device being
 * closed in any order.
 */
static void vfio_container_release(struct kref *kref)
{}

static void vfio_container_get(struct vfio_container *container)
{}

static void vfio_container_put(struct vfio_container *container)
{}

void vfio_device_container_register(struct vfio_device *device)
{}

void vfio_device_container_unregister(struct vfio_device *device)
{}

static long
vfio_container_ioctl_check_extension(struct vfio_container *container,
				     unsigned long arg)
{}

/* hold write lock on container->group_lock */
static int __vfio_container_attach_groups(struct vfio_container *container,
					  struct vfio_iommu_driver *driver,
					  void *data)
{}

static long vfio_ioctl_set_iommu(struct vfio_container *container,
				 unsigned long arg)
{}

static long vfio_fops_unl_ioctl(struct file *filep,
				unsigned int cmd, unsigned long arg)
{}

static int vfio_fops_open(struct inode *inode, struct file *filep)
{}

static int vfio_fops_release(struct inode *inode, struct file *filep)
{}

static const struct file_operations vfio_fops =;

struct vfio_container *vfio_container_from_file(struct file *file)
{}

static struct miscdevice vfio_dev =;

int vfio_container_attach_group(struct vfio_container *container,
				struct vfio_group *group)
{}

void vfio_group_detach_container(struct vfio_group *group)
{}

int vfio_group_use_container(struct vfio_group *group)
{}

void vfio_group_unuse_container(struct vfio_group *group)
{}

int vfio_device_container_pin_pages(struct vfio_device *device,
				    dma_addr_t iova, int npage,
				    int prot, struct page **pages)
{}

void vfio_device_container_unpin_pages(struct vfio_device *device,
				       dma_addr_t iova, int npage)
{}

int vfio_device_container_dma_rw(struct vfio_device *device,
				 dma_addr_t iova, void *data,
				 size_t len, bool write)
{}

int __init vfio_container_init(void)
{}

void vfio_container_cleanup(void)
{}

MODULE_ALIAS_MISCDEV();
MODULE_ALIAS();