/* 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 * Rusty Russell * Michael S. Tsirkin */ #include #include #include #include #include #include #include #include struct virtio_pci_vq_info { /* the actual virtqueue */ struct virtqueue *vq; /* the list node for the virtqueues list */ struct list_head node; }; /* Our device structure */ struct virtio_pci_device { struct virtio_device vdev; struct pci_dev *pci_dev; /* Modern only fields */ /* The IO mapping for the PCI config space (non-legacy mode) */ struct virtio_pci_common_cfg __iomem *common; /* Device-specific data (non-legacy mode) */ void __iomem *device; /* Base of vq notifications (non-legacy mode). */ void __iomem *notify_base; /* So we can sanity-check accesses. */ u32 device_len; /* Multiply queue_notify_off by this value. (non-legacy mode). */ u32 notify_offset_multiplier; }; /* Convert a generic virtio device to our structure */ static inline struct virtio_pci_device *to_vp_device(struct virtio_device *vdev) { return container_of(vdev, struct virtio_pci_device, vdev); } int virtio_pci_modern_probe(struct virtio_pci_device *); #endif