linux/drivers/virtio/virtio_pci_common.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Virtio PCI driver - common functionality for all device versions
 *
 * This module allows virtio devices to be used over a virtual PCI device.
 * This can be used with QEMU based VMMs like KVM or Xen.
 *
 * Copyright IBM Corp. 2007
 * Copyright Red Hat, Inc. 2014
 *
 * Authors:
 *  Anthony Liguori  <[email protected]>
 *  Rusty Russell <[email protected]>
 *  Michael S. Tsirkin <[email protected]>
 */

#include "virtio_pci_common.h"

static bool force_legacy =;

#if IS_ENABLED(CONFIG_VIRTIO_PCI_LEGACY)
module_param(force_legacy, bool, 0444);
MODULE_PARM_DESC();
#endif

/* wait for pending irq handlers */
void vp_synchronize_vectors(struct virtio_device *vdev)
{}

/* the notify function used when creating a virt queue */
bool vp_notify(struct virtqueue *vq)
{}

/* Notify all slow path virtqueues on an interrupt. */
static void vp_vring_slow_path_interrupt(int irq,
					 struct virtio_pci_device *vp_dev)
{}

/* Handle a configuration change: Tell driver if it wants to know. */
static irqreturn_t vp_config_changed(int irq, void *opaque)
{}

/* Notify all virtqueues on an interrupt. */
static irqreturn_t vp_vring_interrupt(int irq, void *opaque)
{}

/* A small wrapper to also acknowledge the interrupt when it's handled.
 * I really need an EIO hook for the vring so I can ack the interrupt once we
 * know that we'll be handling the IRQ but before we invoke the callback since
 * the callback may notify the host which results in the host attempting to
 * raise an interrupt that we would then mask once we acknowledged the
 * interrupt. */
static irqreturn_t vp_interrupt(int irq, void *opaque)
{}

static int vp_request_msix_vectors(struct virtio_device *vdev, int nvectors,
				   bool per_vq_vectors, struct irq_affinity *desc)
{}

static bool vp_is_slow_path_vector(u16 msix_vec)
{}

static struct virtqueue *vp_setup_vq(struct virtio_device *vdev, unsigned int index,
				     void (*callback)(struct virtqueue *vq),
				     const char *name,
				     bool ctx,
				     u16 msix_vec,
				     struct virtio_pci_vq_info **p_info)
{}

static void vp_del_vq(struct virtqueue *vq)
{}

/* the config->del_vqs() implementation */
void vp_del_vqs(struct virtio_device *vdev)
{}

enum vp_vq_vector_policy {};

static struct virtqueue *
vp_find_one_vq_msix(struct virtio_device *vdev, int queue_idx,
		    vq_callback_t *callback, const char *name, bool ctx,
		    bool slow_path, int *allocated_vectors,
		    enum vp_vq_vector_policy vector_policy,
		    struct virtio_pci_vq_info **p_info)
{}

static int vp_find_vqs_msix(struct virtio_device *vdev, unsigned int nvqs,
			    struct virtqueue *vqs[],
			    struct virtqueue_info vqs_info[],
			    enum vp_vq_vector_policy vector_policy,
			    struct irq_affinity *desc)
{}

static int vp_find_vqs_intx(struct virtio_device *vdev, unsigned int nvqs,
			    struct virtqueue *vqs[],
			    struct virtqueue_info vqs_info[])
{}

/* the config->find_vqs() implementation */
int vp_find_vqs(struct virtio_device *vdev, unsigned int nvqs,
		struct virtqueue *vqs[], struct virtqueue_info vqs_info[],
		struct irq_affinity *desc)
{}

const char *vp_bus_name(struct virtio_device *vdev)
{}

/* Setup the affinity for a virtqueue:
 * - force the affinity for per vq vector
 * - OR over all affinities for shared MSI
 * - ignore the affinity request if we're using INTX
 */
int vp_set_vq_affinity(struct virtqueue *vq, const struct cpumask *cpu_mask)
{}

const struct cpumask *vp_get_vq_affinity(struct virtio_device *vdev, int index)
{}

#ifdef CONFIG_PM_SLEEP
static int virtio_pci_freeze(struct device *dev)
{}

static int virtio_pci_restore(struct device *dev)
{}

static bool vp_supports_pm_no_reset(struct device *dev)
{}

static int virtio_pci_suspend(struct device *dev)
{}

static int virtio_pci_resume(struct device *dev)
{}

static const struct dev_pm_ops virtio_pci_pm_ops =;
#endif


/* Qumranet donated their vendor ID for devices 0x1000 thru 0x10FF. */
static const struct pci_device_id virtio_pci_id_table[] =;

MODULE_DEVICE_TABLE(pci, virtio_pci_id_table);

static void virtio_pci_release_dev(struct device *_d)
{}

static int virtio_pci_probe(struct pci_dev *pci_dev,
			    const struct pci_device_id *id)
{}

static void virtio_pci_remove(struct pci_dev *pci_dev)
{}

static int virtio_pci_sriov_configure(struct pci_dev *pci_dev, int num_vfs)
{}

static struct pci_driver virtio_pci_driver =;

struct virtio_device *virtio_pci_vf_get_pf_dev(struct pci_dev *pdev)
{}

module_pci_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_VERSION();