linux/drivers/xen/xen-pciback/pci_stub.c

/*
 * PCI Stub Driver - Grabs devices in backend to be exported later
 *
 * Ryan Wilson <[email protected]>
 * Chris Bookholt <[email protected]>
 */

#define pr_fmt(fmt)
#define dev_fmt

#include <linux/module.h>
#include <linux/init.h>
#include <linux/rwsem.h>
#include <linux/list.h>
#include <linux/spinlock.h>
#include <linux/kref.h>
#include <linux/pci.h>
#include <linux/wait.h>
#include <linux/sched.h>
#include <linux/atomic.h>
#include <xen/events.h>
#include <xen/pci.h>
#include <xen/xen.h>
#ifdef CONFIG_XEN_ACPI
#include <xen/acpi.h>
#endif
#include <asm/xen/hypervisor.h>
#include <xen/interface/physdev.h>
#include "pciback.h"
#include "conf_space.h"
#include "conf_space_quirks.h"

#define PCISTUB_DRIVER_NAME

static char *pci_devs_to_hide;
wait_queue_head_t xen_pcibk_aer_wait_queue;
/*Add sem for sync AER handling and xen_pcibk remove/reconfigue ops,
* We want to avoid in middle of AER ops, xen_pcibk devices is being removed
*/
static DECLARE_RWSEM(pcistub_sem);
module_param_named(hide, pci_devs_to_hide, charp, 0444);

struct pcistub_device_id {};
static LIST_HEAD(pcistub_device_ids);
static DEFINE_SPINLOCK(device_ids_lock);

struct pcistub_device {};

/* Access to pcistub_devices & seized_devices lists and the initialize_devices
 * flag must be locked with pcistub_devices_lock
 */
static DEFINE_SPINLOCK(pcistub_devices_lock);
static LIST_HEAD(pcistub_devices);

/* wait for device_initcall before initializing our devices
 * (see pcistub_init_devices_late)
 */
static int initialize_devices;
static LIST_HEAD(seized_devices);

static struct pcistub_device *pcistub_device_alloc(struct pci_dev *dev)
{}

static int pcistub_reset_device_state(struct pci_dev *dev)
{}

/* Don't call this directly as it's called by pcistub_device_put */
static void pcistub_device_release(struct kref *kref)
{}

static inline void pcistub_device_get(struct pcistub_device *psdev)
{}

static inline void pcistub_device_put(struct pcistub_device *psdev)
{}

static struct pcistub_device *pcistub_device_find_locked(int domain, int bus,
							 int slot, int func)
{}

static struct pcistub_device *pcistub_device_find(int domain, int bus,
						  int slot, int func)
{}

static struct pci_dev *pcistub_device_get_pci_dev(struct xen_pcibk_device *pdev,
						  struct pcistub_device *psdev)
{}

#ifdef CONFIG_XEN_ACPI
static int pcistub_get_gsi_from_sbdf(unsigned int sbdf)
{}
#endif

struct pci_dev *pcistub_get_pci_dev_by_slot(struct xen_pcibk_device *pdev,
					    int domain, int bus,
					    int slot, int func)
{}

struct pci_dev *pcistub_get_pci_dev(struct xen_pcibk_device *pdev,
				    struct pci_dev *dev)
{}

/*
 * Called when:
 *  - XenBus state has been reconfigure (pci unplug). See xen_pcibk_remove_device
 *  - XenBus state has been disconnected (guest shutdown). See xen_pcibk_xenbus_remove
 *  - 'echo BDF > unbind' on pciback module with no guest attached. See pcistub_remove
 *  - 'echo BDF > unbind' with a guest still using it. See pcistub_remove
 *
 *  As such we have to be careful.
 *
 *  To make this easier, the caller has to hold the device lock.
 */
void pcistub_put_pci_dev(struct pci_dev *dev)
{}

static int pcistub_match_one(struct pci_dev *dev,
			     struct pcistub_device_id *pdev_id)
{}

static int pcistub_match(struct pci_dev *dev)
{}

static int pcistub_init_device(struct pcistub_device *psdev)
{}

/*
 * Because some initialization still happens on
 * devices during fs_initcall, we need to defer
 * full initialization of our devices until
 * device_initcall.
 */
static int __init pcistub_init_devices_late(void)
{}

static void pcistub_device_id_add_list(struct pcistub_device_id *new,
				       int domain, int bus, unsigned int devfn)
{}

static int pcistub_seize(struct pci_dev *dev,
			 struct pcistub_device_id *pci_dev_id)
{}

/* Called when 'bind'. This means we must _NOT_ call pci_reset_function or
 * other functions that take the sysfs lock. */
static int pcistub_probe(struct pci_dev *dev, const struct pci_device_id *id)
{}

/* Called when 'unbind'. This means we must _NOT_ call pci_reset_function or
 * other functions that take the sysfs lock. */
static void pcistub_remove(struct pci_dev *dev)
{}

static const struct pci_device_id pcistub_ids[] =;

#define PCI_NODENAME_MAX
static void kill_domain_by_device(struct pcistub_device *psdev)
{}

/* For each aer recovery step error_detected, mmio_enabled, etc, front_end and
 * backend need to have cooperation. In xen_pcibk, those steps will do similar
 * jobs: send service request and waiting for front_end response.
*/
static pci_ers_result_t common_process(struct pcistub_device *psdev,
				       pci_channel_state_t state, int aer_cmd,
				       pci_ers_result_t result)
{}

/*
* xen_pcibk_slot_reset: it will send the slot_reset request to  pcifront in case
* of the device driver could provide this service, and then wait for pcifront
* ack.
* @dev: pointer to PCI devices
* return value is used by aer_core do_recovery policy
*/
static pci_ers_result_t xen_pcibk_slot_reset(struct pci_dev *dev)
{}


/*xen_pcibk_mmio_enabled: it will send the mmio_enabled request to  pcifront
* in case of the device driver could provide this service, and then wait
* for pcifront ack
* @dev: pointer to PCI devices
* return value is used by aer_core do_recovery policy
*/

static pci_ers_result_t xen_pcibk_mmio_enabled(struct pci_dev *dev)
{}

/*xen_pcibk_error_detected: it will send the error_detected request to  pcifront
* in case of the device driver could provide this service, and then wait
* for pcifront ack.
* @dev: pointer to PCI devices
* @error: the current PCI connection state
* return value is used by aer_core do_recovery policy
*/

static pci_ers_result_t xen_pcibk_error_detected(struct pci_dev *dev,
	pci_channel_state_t error)
{}

/*xen_pcibk_error_resume: it will send the error_resume request to  pcifront
* in case of the device driver could provide this service, and then wait
* for pcifront ack.
* @dev: pointer to PCI devices
*/

static void xen_pcibk_error_resume(struct pci_dev *dev)
{}

/*add xen_pcibk AER handling*/
static const struct pci_error_handlers xen_pcibk_error_handler =;

/*
 * Note: There is no MODULE_DEVICE_TABLE entry here because this isn't
 * for a normal device. I don't want it to be loaded automatically.
 */

static struct pci_driver xen_pcibk_pci_driver =;

static inline int str_to_slot(const char *buf, int *domain, int *bus,
			      int *slot, int *func)
{}

static inline int str_to_quirk(const char *buf, int *domain, int *bus, int
			       *slot, int *func, int *reg, int *size, int *mask)
{}

static int pcistub_device_id_add(int domain, int bus, int slot, int func)
{}

static int pcistub_device_id_remove(int domain, int bus, int slot, int func)
{}

static int pcistub_reg_add(int domain, int bus, int slot, int func,
			   unsigned int reg, unsigned int size,
			   unsigned int mask)
{}

static ssize_t new_slot_store(struct device_driver *drv, const char *buf,
			      size_t count)
{}
static DRIVER_ATTR_WO(new_slot);

static ssize_t remove_slot_store(struct device_driver *drv, const char *buf,
				 size_t count)
{}
static DRIVER_ATTR_WO(remove_slot);

static ssize_t slots_show(struct device_driver *drv, char *buf)
{}
static DRIVER_ATTR_RO(slots);

static ssize_t irq_handlers_show(struct device_driver *drv, char *buf)
{}
static DRIVER_ATTR_RO(irq_handlers);

static ssize_t irq_handler_state_store(struct device_driver *drv,
				       const char *buf, size_t count)
{}
static DRIVER_ATTR_WO(irq_handler_state);

static ssize_t quirks_store(struct device_driver *drv, const char *buf,
			    size_t count)
{}

static ssize_t quirks_show(struct device_driver *drv, char *buf)
{}
static DRIVER_ATTR_RW(quirks);

static ssize_t permissive_store(struct device_driver *drv, const char *buf,
				size_t count)
{}

static ssize_t permissive_show(struct device_driver *drv, char *buf)
{}
static DRIVER_ATTR_RW(permissive);

static ssize_t allow_interrupt_control_store(struct device_driver *drv,
					     const char *buf, size_t count)
{}

static ssize_t allow_interrupt_control_show(struct device_driver *drv,
					    char *buf)
{}
static DRIVER_ATTR_RW(allow_interrupt_control);

static void pcistub_exit(void)
{}

static int __init pcistub_init(void)
{}

#ifndef MODULE
/*
 * fs_initcall happens before device_initcall
 * so xen_pcibk *should* get called first (b/c we
 * want to suck up any device before other drivers
 * get a chance by being the first pci device
 * driver to register)
 */
fs_initcall(pcistub_init);
#endif

#ifdef CONFIG_PCI_IOV
static struct pcistub_device *find_vfs(const struct pci_dev *pdev)
{}

static int pci_stub_notifier(struct notifier_block *nb,
			     unsigned long action, void *data)
{}

static struct notifier_block pci_stub_nb =;
#endif

static int __init xen_pcibk_init(void)
{}

static void __exit xen_pcibk_cleanup(void)
{}

module_init();
module_exit(xen_pcibk_cleanup);

MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_ALIAS();