linux/drivers/dma/idxd/cdev.c

// SPDX-License-Identifier: GPL-2.0
/* Copyright(c) 2019 Intel Corporation. All rights rsvd. */
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/device.h>
#include <linux/sched/task.h>
#include <linux/io-64-nonatomic-lo-hi.h>
#include <linux/cdev.h>
#include <linux/fs.h>
#include <linux/poll.h>
#include <linux/iommu.h>
#include <linux/highmem.h>
#include <uapi/linux/idxd.h>
#include <linux/xarray.h>
#include "registers.h"
#include "idxd.h"

struct idxd_cdev_context {};

/*
 * Since user file names are global in DSA devices, define their ida's as
 * global to avoid conflict file names.
 */
static DEFINE_IDA(file_ida);
static DEFINE_MUTEX(ida_lock);

/*
 * ictx is an array based off of accelerator types. enum idxd_type
 * is used as index
 */
static struct idxd_cdev_context ictx[IDXD_TYPE_MAX] =;

struct idxd_user_context {};

static void idxd_cdev_evl_drain_pasid(struct idxd_wq *wq, u32 pasid);
static void idxd_xa_pasid_remove(struct idxd_user_context *ctx);

static inline struct idxd_user_context *dev_to_uctx(struct device *dev)
{}

static ssize_t cr_faults_show(struct device *dev, struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(cr_faults);

static ssize_t cr_fault_failures_show(struct device *dev,
				      struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(cr_fault_failures);

static ssize_t pid_show(struct device *dev, struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(pid);

static struct attribute *cdev_file_attributes[] =;

static umode_t cdev_file_attr_visible(struct kobject *kobj, struct attribute *a, int n)
{}

static const struct attribute_group cdev_file_attribute_group =;

static const struct attribute_group *cdev_file_attribute_groups[] =;

static void idxd_file_dev_release(struct device *dev)
{}

static const struct device_type idxd_cdev_file_type =;

static void idxd_cdev_dev_release(struct device *dev)
{}

static const struct device_type idxd_cdev_device_type =;

static inline struct idxd_cdev *inode_idxd_cdev(struct inode *inode)
{}

static inline struct idxd_wq *inode_wq(struct inode *inode)
{}

static void idxd_xa_pasid_remove(struct idxd_user_context *ctx)
{}

void idxd_user_counter_increment(struct idxd_wq *wq, u32 pasid, int index)
{}

static int idxd_cdev_open(struct inode *inode, struct file *filp)
{}

static void idxd_cdev_evl_drain_pasid(struct idxd_wq *wq, u32 pasid)
{}

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

static int check_vma(struct idxd_wq *wq, struct vm_area_struct *vma,
		     const char *func)
{}

static int idxd_cdev_mmap(struct file *filp, struct vm_area_struct *vma)
{}

static int idxd_submit_user_descriptor(struct idxd_user_context *ctx,
				       struct dsa_hw_desc __user *udesc)
{}

static ssize_t idxd_cdev_write(struct file *filp, const char __user *buf, size_t len,
			       loff_t *unused)
{}

static __poll_t idxd_cdev_poll(struct file *filp,
			       struct poll_table_struct *wait)
{}

static const struct file_operations idxd_cdev_fops =;

int idxd_cdev_get_major(struct idxd_device *idxd)
{}

int idxd_wq_add_cdev(struct idxd_wq *wq)
{}

void idxd_wq_del_cdev(struct idxd_wq *wq)
{}

static int idxd_user_drv_probe(struct idxd_dev *idxd_dev)
{}

static void idxd_user_drv_remove(struct idxd_dev *idxd_dev)
{}

static enum idxd_dev_type dev_types[] =;

struct idxd_device_driver idxd_user_drv =;
EXPORT_SYMBOL_GPL();

int idxd_cdev_register(void)
{}

void idxd_cdev_remove(void)
{}

/**
 * idxd_copy_cr - copy completion record to user address space found by wq and
 *		  PASID
 * @wq:		work queue
 * @pasid:	PASID
 * @addr:	user fault address to write
 * @cr:		completion record
 * @len:	number of bytes to copy
 *
 * This is called by a work that handles completion record fault.
 *
 * Return: number of bytes copied.
 */
int idxd_copy_cr(struct idxd_wq *wq, ioasid_t pasid, unsigned long addr,
		 void *cr, int len)
{}