mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-21 21:53:28 +07:00
8c194f3bd3
- VFIO platform bus driver support (Baptiste Reynal, Antonios Motakis, testing and review by Eric Auger) - Split VFIO irqfd support to separate module (Alex Williamson) - vfio-pci VGA arbiter client (Alex Williamson) - New vfio-pci.ids= module option (Alex Williamson) - vfio-pci D3 power state support for idle devices (Alex Williamson) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJVLXApAAoJECObm247sIsiw4cP/AzBLqBXlxeCLgWNRJ4F6Dwz PrjSK4xBRnPV/eMbIksWW6Wc6D4EaSUASMUUb1JLnF8roKWbRg2a5wdI4clrSYL0 mV8j4Uaw+9XkV0nWrVeiW0Yw8tu4pIQRvC6FiEJ6/pE9rHsP8wr8uzKzC7d4AvyJ tb/awTF4PN9rZVIs68sIJi0JJjFXHuUTCHx6ns/723F1FMRS8ONAxEvIyFJOqaYh DNDZs3UalstXYFHlV/0Zs/TqMXQJoSSOPkWx41P+kMsn00tKge88WAmybyQRjjoQ paFjz7ox3PETUolojCFS72kMPApBCRT2q2HXXrPV74/GY2Or2UV5F1qo4gUsclyh HqdE4OF9LcexCAOopc907Tped2SrHoiHpZu2aJWKJz+qEsejxgsAgnf1pxJikRQX Eu7LJxJcYlddREN60ONgCUvsRq9ayNopuIDqD47Zhic6e5y8ujPjjz1e4yin+oxI 5WxMzcEdeVKC72vg2abUTHBri+l3GEWcdHk6YeK4fe95g11+gSBga8XmufgmOcGJ VUl/umBQWzfxk0wHJtBLVIgleifs4sq+b5jxuXOboko8Z80q12zLlpcBXs8IX5Wa wgzFvPPg8Ecsw6goCEW1xkeHfMEWcmWhI8QEWCtoZfSYLKK5I/hpuCUZBSqWgPVE Wm2rcOkNBmqu2HpHBPPu =8g7y -----END PGP SIGNATURE----- Merge tag 'vfio-v4.1-rc1' of git://github.com/awilliam/linux-vfio Pull VFIO updates from Alex Williamson: - VFIO platform bus driver support (Baptiste Reynal, Antonios Motakis, testing and review by Eric Auger) - Split VFIO irqfd support to separate module (Alex Williamson) - vfio-pci VGA arbiter client (Alex Williamson) - New vfio-pci.ids= module option (Alex Williamson) - vfio-pci D3 power state support for idle devices (Alex Williamson) * tag 'vfio-v4.1-rc1' of git://github.com/awilliam/linux-vfio: (30 commits) vfio-pci: Fix use after free vfio-pci: Move idle devices to D3hot power state vfio-pci: Remove warning if try-reset fails vfio-pci: Allow PCI IDs to be specified as module options vfio-pci: Add VGA arbiter client vfio-pci: Add module option to disable VGA region access vgaarb: Stub vga_set_legacy_decoding() vfio: Split virqfd into a separate module for vfio bus drivers vfio: virqfd_lock can be static vfio: put off the allocation of "minor" in vfio_create_group vfio/platform: implement IRQ masking/unmasking via an eventfd vfio: initialize the virqfd workqueue in VFIO generic code vfio: move eventfd support code for VFIO_PCI to a separate file vfio: pass an opaque pointer on virqfd initialization vfio: add local lock for virqfd instead of depending on VFIO PCI vfio: virqfd: rename vfio_pci_virqfd_init and vfio_pci_virqfd_exit vfio: add a vfio_ prefix to virqfd_enable and virqfd_disable and export vfio/platform: support for level sensitive interrupts vfio/platform: trigger an interrupt via eventfd vfio/platform: initial interrupts support code ...
139 lines
4.2 KiB
C
139 lines
4.2 KiB
C
/*
|
|
* VFIO API definition
|
|
*
|
|
* Copyright (C) 2012 Red Hat, Inc. All rights reserved.
|
|
* Author: Alex Williamson <alex.williamson@redhat.com>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*/
|
|
#ifndef VFIO_H
|
|
#define VFIO_H
|
|
|
|
|
|
#include <linux/iommu.h>
|
|
#include <linux/mm.h>
|
|
#include <linux/workqueue.h>
|
|
#include <linux/poll.h>
|
|
#include <uapi/linux/vfio.h>
|
|
|
|
/**
|
|
* struct vfio_device_ops - VFIO bus driver device callbacks
|
|
*
|
|
* @open: Called when userspace creates new file descriptor for device
|
|
* @release: Called when userspace releases file descriptor for device
|
|
* @read: Perform read(2) on device file descriptor
|
|
* @write: Perform write(2) on device file descriptor
|
|
* @ioctl: Perform ioctl(2) on device file descriptor, supporting VFIO_DEVICE_*
|
|
* operations documented below
|
|
* @mmap: Perform mmap(2) on a region of the device file descriptor
|
|
* @request: Request for the bus driver to release the device
|
|
*/
|
|
struct vfio_device_ops {
|
|
char *name;
|
|
int (*open)(void *device_data);
|
|
void (*release)(void *device_data);
|
|
ssize_t (*read)(void *device_data, char __user *buf,
|
|
size_t count, loff_t *ppos);
|
|
ssize_t (*write)(void *device_data, const char __user *buf,
|
|
size_t count, loff_t *size);
|
|
long (*ioctl)(void *device_data, unsigned int cmd,
|
|
unsigned long arg);
|
|
int (*mmap)(void *device_data, struct vm_area_struct *vma);
|
|
void (*request)(void *device_data, unsigned int count);
|
|
};
|
|
|
|
extern int vfio_add_group_dev(struct device *dev,
|
|
const struct vfio_device_ops *ops,
|
|
void *device_data);
|
|
|
|
extern void *vfio_del_group_dev(struct device *dev);
|
|
extern struct vfio_device *vfio_device_get_from_dev(struct device *dev);
|
|
extern void vfio_device_put(struct vfio_device *device);
|
|
extern void *vfio_device_data(struct vfio_device *device);
|
|
|
|
/**
|
|
* struct vfio_iommu_driver_ops - VFIO IOMMU driver callbacks
|
|
*/
|
|
struct vfio_iommu_driver_ops {
|
|
char *name;
|
|
struct module *owner;
|
|
void *(*open)(unsigned long arg);
|
|
void (*release)(void *iommu_data);
|
|
ssize_t (*read)(void *iommu_data, char __user *buf,
|
|
size_t count, loff_t *ppos);
|
|
ssize_t (*write)(void *iommu_data, const char __user *buf,
|
|
size_t count, loff_t *size);
|
|
long (*ioctl)(void *iommu_data, unsigned int cmd,
|
|
unsigned long arg);
|
|
int (*mmap)(void *iommu_data, struct vm_area_struct *vma);
|
|
int (*attach_group)(void *iommu_data,
|
|
struct iommu_group *group);
|
|
void (*detach_group)(void *iommu_data,
|
|
struct iommu_group *group);
|
|
|
|
};
|
|
|
|
extern int vfio_register_iommu_driver(const struct vfio_iommu_driver_ops *ops);
|
|
|
|
extern void vfio_unregister_iommu_driver(
|
|
const struct vfio_iommu_driver_ops *ops);
|
|
|
|
/*
|
|
* External user API
|
|
*/
|
|
extern struct vfio_group *vfio_group_get_external_user(struct file *filep);
|
|
extern void vfio_group_put_external_user(struct vfio_group *group);
|
|
extern int vfio_external_user_iommu_id(struct vfio_group *group);
|
|
extern long vfio_external_check_extension(struct vfio_group *group,
|
|
unsigned long arg);
|
|
|
|
struct pci_dev;
|
|
#ifdef CONFIG_EEH
|
|
extern void vfio_spapr_pci_eeh_open(struct pci_dev *pdev);
|
|
extern void vfio_spapr_pci_eeh_release(struct pci_dev *pdev);
|
|
extern long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
|
|
unsigned int cmd,
|
|
unsigned long arg);
|
|
#else
|
|
static inline void vfio_spapr_pci_eeh_open(struct pci_dev *pdev)
|
|
{
|
|
}
|
|
|
|
static inline void vfio_spapr_pci_eeh_release(struct pci_dev *pdev)
|
|
{
|
|
}
|
|
|
|
static inline long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
|
|
unsigned int cmd,
|
|
unsigned long arg)
|
|
{
|
|
return -ENOTTY;
|
|
}
|
|
#endif /* CONFIG_EEH */
|
|
|
|
/*
|
|
* IRQfd - generic
|
|
*/
|
|
struct virqfd {
|
|
void *opaque;
|
|
struct eventfd_ctx *eventfd;
|
|
int (*handler)(void *, void *);
|
|
void (*thread)(void *, void *);
|
|
void *data;
|
|
struct work_struct inject;
|
|
wait_queue_t wait;
|
|
poll_table pt;
|
|
struct work_struct shutdown;
|
|
struct virqfd **pvirqfd;
|
|
};
|
|
|
|
extern int vfio_virqfd_enable(void *opaque,
|
|
int (*handler)(void *, void *),
|
|
void (*thread)(void *, void *),
|
|
void *data, struct virqfd **pvirqfd, int fd);
|
|
extern void vfio_virqfd_disable(struct virqfd **pvirqfd);
|
|
|
|
#endif /* VFIO_H */
|