linux/drivers/vfio/group.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * VFIO core
 *
 * Copyright (C) 2012 Red Hat, Inc.  All rights reserved.
 *     Author: Alex Williamson <[email protected]>
 *
 * Derived from original vfio:
 * Copyright 2010 Cisco Systems, Inc.  All rights reserved.
 * Author: Tom Lyon, [email protected]
 */

#include <linux/vfio.h>
#include <linux/iommufd.h>
#include <linux/anon_inodes.h>
#include "vfio.h"

static struct vfio {} vfio;

static struct vfio_device *vfio_device_get_from_name(struct vfio_group *group,
						     char *buf)
{}

/*
 * VFIO Group fd, /dev/vfio/$GROUP
 */
static bool vfio_group_has_iommu(struct vfio_group *group)
{}

/*
 * VFIO_GROUP_UNSET_CONTAINER should fail if there are other users or
 * if there was no container to unset.  Since the ioctl is called on
 * the group, we know that still exists, therefore the only valid
 * transition here is 1->0.
 */
static int vfio_group_ioctl_unset_container(struct vfio_group *group)
{}

static int vfio_group_ioctl_set_container(struct vfio_group *group,
					  int __user *arg)
{}

static void vfio_device_group_get_kvm_safe(struct vfio_device *device)
{}

static int vfio_df_group_open(struct vfio_device_file *df)
{}

void vfio_df_group_close(struct vfio_device_file *df)
{}

static struct file *vfio_device_open_file(struct vfio_device *device)
{}

static int vfio_group_ioctl_get_device_fd(struct vfio_group *group,
					  char __user *arg)
{}

static int vfio_group_ioctl_get_status(struct vfio_group *group,
				       struct vfio_group_status __user *arg)
{}

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

int vfio_device_block_group(struct vfio_device *device)
{}

void vfio_device_unblock_group(struct vfio_device *device)
{}

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

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

static const struct file_operations vfio_group_fops =;

/*
 * Group objects - create, release, get, put, search
 */
static struct vfio_group *
vfio_group_find_from_iommu(struct iommu_group *iommu_group)
{}

static void vfio_group_release(struct device *dev)
{}

static struct vfio_group *vfio_group_alloc(struct iommu_group *iommu_group,
					   enum vfio_group_type type)
{}

static struct vfio_group *vfio_create_group(struct iommu_group *iommu_group,
		enum vfio_group_type type)
{}

static struct vfio_group *vfio_noiommu_group_alloc(struct device *dev,
		enum vfio_group_type type)
{}

static bool vfio_group_has_device(struct vfio_group *group, struct device *dev)
{}

static struct vfio_group *vfio_group_find_or_alloc(struct device *dev)
{}

int vfio_device_set_group(struct vfio_device *device,
			  enum vfio_group_type type)
{}

void vfio_device_remove_group(struct vfio_device *device)
{}

void vfio_device_group_register(struct vfio_device *device)
{}

void vfio_device_group_unregister(struct vfio_device *device)
{}

int vfio_device_group_use_iommu(struct vfio_device *device)
{}

void vfio_device_group_unuse_iommu(struct vfio_device *device)
{}

bool vfio_device_has_container(struct vfio_device *device)
{}

struct vfio_group *vfio_group_from_file(struct file *file)
{}

/**
 * vfio_file_iommu_group - Return the struct iommu_group for the vfio group file
 * @file: VFIO group file
 *
 * The returned iommu_group is valid as long as a ref is held on the file. This
 * returns a reference on the group. This function is deprecated, only the SPAPR
 * path in kvm should call it.
 */
struct iommu_group *vfio_file_iommu_group(struct file *file)
{}
EXPORT_SYMBOL_GPL();

/**
 * vfio_file_is_group - True if the file is a vfio group file
 * @file: VFIO group file
 */
bool vfio_file_is_group(struct file *file)
{}
EXPORT_SYMBOL_GPL();

bool vfio_group_enforced_coherent(struct vfio_group *group)
{}

void vfio_group_set_kvm(struct vfio_group *group, struct kvm *kvm)
{}

/**
 * vfio_file_has_dev - True if the VFIO file is a handle for device
 * @file: VFIO file to check
 * @device: Device that must be part of the file
 *
 * Returns true if given file has permission to manipulate the given device.
 */
bool vfio_file_has_dev(struct file *file, struct vfio_device *device)
{}
EXPORT_SYMBOL_GPL();

static char *vfio_devnode(const struct device *dev, umode_t *mode)
{}

int __init vfio_group_init(void)
{}

void vfio_group_cleanup(void)
{}