提交 9e68018c 编写于 作者: L lingmingqiang 提交者: Xie XiuQi

Revert Kernel Warpdrive part:SPIMDEV, which depends on VFIO/VFIO_MDEV.

driver inclusion
category: bugfix
bugzilla: NA
CVE: NA

This reverts commit 6b546eb4c02210d7bc77aa64025cc6c84e5f1b30.

Feature or Bugfix: Bugfix
Signed-off-by: Nlingmingqiang <lingmingqiang@huawei.com>
Reviewed-by: Nhucheng.hu <hucheng.hu@huawei.com>
Reviewed-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 74cf87f1
...@@ -47,5 +47,4 @@ menuconfig VFIO_NOIOMMU ...@@ -47,5 +47,4 @@ menuconfig VFIO_NOIOMMU
source "drivers/vfio/pci/Kconfig" source "drivers/vfio/pci/Kconfig"
source "drivers/vfio/platform/Kconfig" source "drivers/vfio/platform/Kconfig"
source "drivers/vfio/mdev/Kconfig" source "drivers/vfio/mdev/Kconfig"
source "drivers/vfio/spimdev/Kconfig"
source "virt/lib/Kconfig" source "virt/lib/Kconfig"
...@@ -9,4 +9,3 @@ obj-$(CONFIG_VFIO_SPAPR_EEH) += vfio_spapr_eeh.o ...@@ -9,4 +9,3 @@ obj-$(CONFIG_VFIO_SPAPR_EEH) += vfio_spapr_eeh.o
obj-$(CONFIG_VFIO_PCI) += pci/ obj-$(CONFIG_VFIO_PCI) += pci/
obj-$(CONFIG_VFIO_PLATFORM) += platform/ obj-$(CONFIG_VFIO_PLATFORM) += platform/
obj-$(CONFIG_VFIO_MDEV) += mdev/ obj-$(CONFIG_VFIO_MDEV) += mdev/
obj-$(CONFIG_VFIO_SPIMDEV) += spimdev/
config VFIO_SPIMDEV
tristate "Support for Share Parent IOMMU MDEV"
depends on VFIO_MDEV_DEVICE
default no
help
Support for VFIO Share Parent IOMMU MDEV, which enable the kernel to
support for the light weight hardware accelerator framework, WrapDrive.
To compile this as a module, choose M here: the module will be called
spimdev.
# SPDX-License-Identifier: GPL-2.0
spimdev-y := spimdev.o
obj-$(CONFIG_VFIO_SPIMDEV) += vfio_spimdev.o
此差异已折叠。
/* SPDX-License-Identifier: GPL-2.0+ */
#ifndef __VFIO_SPIMDEV_H
#define __VFIO_SPIMDEV_H
#include <linux/device.h>
#include <linux/iommu.h>
#include <linux/mdev.h>
#include <linux/vfio.h>
#include <uapi/linux/vfio_spimdev.h>
struct vfio_spimdev_queue;
struct vfio_spimdev;
/**
* struct vfio_spimdev_ops - WD device operations
* @get_queue: get a queue from the device according to algorithm
* @put_queue: free a queue to the device
* @is_q_updated: check whether the task is finished
* @mask_notify: mask the task irq of queue
* @mmap: mmap addresses of queue to user space
* @reset: reset the WD device
* @reset_queue: reset the queue
* @ioctl: ioctl for user space users of the queue
* @get_available_instances: get numbers of the queue remained
*/
struct vfio_spimdev_ops {
int (*get_queue)(struct vfio_spimdev *spimdev, const char *alg,
struct vfio_spimdev_queue **q);
int (*put_queue)(struct vfio_spimdev_queue *q);
int (*is_q_updated)(struct vfio_spimdev_queue *q);
void (*mask_notify)(struct vfio_spimdev_queue *q, int event_mask);
int (*mmap)(struct vfio_spimdev_queue *q, struct vm_area_struct *vma);
int (*reset)(struct vfio_spimdev *spimdev);
int (*reset_queue)(struct vfio_spimdev_queue *q);
long (*ioctl)(struct vfio_spimdev_queue *q, unsigned int cmd,
unsigned long arg);
int (*get_available_instances)(struct vfio_spimdev *spimdev);
};
struct vfio_spimdev_queue {
struct mutex mutex;
struct vfio_spimdev *spimdev;
int qid;
__u32 flags;
void *priv;
const char *alg;
wait_queue_head_t wait;
struct mdev_device *mdev;
int fd;
int container;
#ifdef CONFIG_IOMMU_SVA
int pasid;
#endif
};
/**
* struct vfio_spimdev - Warpdrive device description
* @name: device name
* @status: device status
* @ref: referrence count
* @owner: module owner
* @ops: wd device operations
* @dev: its kernel device
* @cls_dev: its class device
* @is_vf: denotes wether it is virtual function
* @iommu_type: iommu type of hardware
* @dev_id: device ID
* @priv: driver private data
* @mstate: for the mdev state
* @node_id: socket ID
* @priority: priority while being selected, also can be set by users
* @latency: latency while doing acceleration
* @throughput: throughput while doing acceleration
* @flags: device attributions
* @api_ver: API version of WD
* @mdev_fops: mediated device's parent operations
*/
struct vfio_spimdev {
const char *name;
int status;
atomic_t ref;
struct module *owner;
const struct vfio_spimdev_ops *ops;
struct device *dev;
struct device cls_dev;
bool is_vf;
u32 iommu_type;
u32 dma_flag;
u32 node_id;
u32 priority;
u32 dev_id;
void *priv;
void *mstate;
int flags;
const char *api_ver;
struct mdev_parent_ops mdev_fops;
};
int vfio_spimdev_register(struct vfio_spimdev *spimdev);
void vfio_spimdev_unregister(struct vfio_spimdev *spimdev);
void vfio_spimdev_wake_up(struct vfio_spimdev_queue *q);
int vfio_spimdev_is_spimdev(struct device *dev);
struct vfio_spimdev *vfio_spimdev_pdev_spimdev(struct device *dev);
struct vfio_spimdev *mdev_spimdev(struct mdev_device *mdev);
extern struct mdev_type_attribute mdev_type_attr_type;
extern struct mdev_type_attribute mdev_type_attr_device_api;
extern struct mdev_type_attribute mdev_type_attr_available_instances;
extern struct device_attribute dev_attr_pid;
#define VFIO_SPIMDEV_MAX_TYPES (32)
/* VFIO_SPIMDEV queue attribution flags */
/* Different queue support the same algorithm */
#define VFIO_SPIMDEV_SAME_ALG_QFLG (1 << 0)
/* Different queue only support different algorithm */
#define VFIO_SPIMDEV_DIFF_ALG_QFLG (1 << 1)
#define _VFIO_SPIMDEV_REGION(vm_pgoff) (vm_pgoff & 0xf)
#endif
/* SPDX-License-Identifier: GPL-2.0+ */
#ifndef _UAPIVFIO_SPIMDEV_H
#define _UAPIVFIO_SPIMDEV_H
#include <linux/ioctl.h>
#define VFIO_SPIMDEV_CLASS_NAME "spimdev"
/* Device ATTRs in parent dev SYSFS DIR */
#define VFIO_SPIMDEV_PDEV_ATTRS_GRP "spimdev_para"
/* Device ATTRs in parent dev SYSFS DIR */
#define VFIO_SPIMDEV_MDEV_ATTRS_GRP "spi_attr"
/* Parent device attributes */
#define SPIMDEV_IOMMU_TYPE "iommu_type"
#define SPIMDEV_DMA_FLAG "dma_flag"
#define SPIMDEV_NODE_ID "node_id"
#define SPIMDEV_MDEV_GET "mdev_get"
/* For getting node distance of current process */
#define SPIMDEV_NUMA_DISTANCE "numa_distance"
/* Maximum length of algorithm name string */
#define VFIO_SPIMDEV_ALG_NAME_SIZE 64
/* A new VFIO IOMMU type for spimdev while support no-iommu. This is
* VFIO MDEV driver's NOIOMMU mode cannot be used by us. Or I think
* there is a bug in it while MDEV is compatible with VFIO_NOIOMMU.
* So, we need this IOMMU type currently.
*/
#define VFIO_SPIMDEV_IOMMU 64
/* the bits used in SPIMDEV_DMA_FLAG attributes */
#define VFIO_SPIMDEV_DMA_INVALID 0
#define VFIO_SPIMDEV_DMA_SINGLE_PROC_MAP 1
#define VFIO_SPIMDEV_DMA_MULTI_PROC_MAP 2
#define VFIO_SPIMDEV_DMA_SVM 4
#define VFIO_SPIMDEV_DMA_SVM_NO_FAULT 8
#define VFIO_SPIMDEV_DMA_PHY 16
#define VFIO_SPIMDEV_DMA_SGL 32
#define VFIO_SPIMDEV_CMD_GET_Q _IO('W', 1)
#endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册