/* SPDX-License-Identifier: GPL-2.0-or-later */ #ifndef _DRIVERS_VIRTIO_VIRTIO_PCI_COMMON_H #define _DRIVERS_VIRTIO_VIRTIO_PCI_COMMON_H /* * Virtio PCI driver - APIs for 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 <aliguori@us.ibm.com> * Rusty Russell <rusty@rustcorp.com.au> * Michael S. Tsirkin <mst@redhat.com>
*/
/* Where to read and clear interrupt */
u8 __iomem *isr;
/* Lists of queues and potentially slow path queues * so we can dispatch IRQs.
*/
spinlock_t lock; struct list_head virtqueues; struct list_head slow_virtqueues;
/* Array of all virtqueues reported in the * PCI common config num_queues field
*/ struct virtio_pci_vq_info **vqs;
struct virtio_pci_admin_vq admin_vq;
/* MSI-X support */ int msix_enabled; int intx_enabled;
cpumask_var_t *msix_affinity_masks; /* Name strings for interrupts. This size should be enough,
* and I'm too lazy to allocate each name separately. */ char (*msix_names)[256]; /* Number of available vectors */ unsignedint msix_vectors; /* Vectors allocated, excluding per-vq vectors if any */ unsignedint msix_used_vectors;
/* Whether we have vector per vq */ bool per_vq_vectors;
/* Constants for MSI-X */ /* Use first vector for configuration changes, second and the rest for
* virtqueues Thus, we need at least 2 vectors for MSI. */ enum {
VP_MSIX_CONFIG_VECTOR = 0,
VP_MSIX_VQ_VECTOR = 1,
};
/* 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); /* the config->del_vqs() implementation */ void vp_del_vqs(struct virtio_device *vdev); /* the config->find_vqs() implementation */ int vp_find_vqs(struct virtio_device *vdev, unsignedint nvqs, struct virtqueue *vqs[], struct virtqueue_info vqs_info[], struct irq_affinity *desc); constchar *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, conststruct cpumask *cpu_mask);
conststruct cpumask *vp_get_vq_affinity(struct virtio_device *vdev, int index);
/* Unlike modern drivers which support hardware virtio devices, legacy drivers * assume software-based devices: e.g. they don't use proper memory barriers * on ARM, use big endian on PPC, etc. X86 drivers are mostly ok though, more * or less by chance. For now, only support legacy IO on X86.
*/ #ifdef CONFIG_VIRTIO_PCI_ADMIN_LEGACY #define VIRTIO_ADMIN_CMD_BITMAP (VIRTIO_LEGACY_ADMIN_CMD_BITMAP | \
VIRTIO_DEV_PARTS_ADMIN_CMD_BITMAP) #else #define VIRTIO_ADMIN_CMD_BITMAP VIRTIO_DEV_PARTS_ADMIN_CMD_BITMAP #endif
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.