diff options
author | Jason Wang <jasowang@redhat.com> | 2021-01-04 14:54:46 +0800 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2021-02-23 07:52:57 -0500 |
commit | b5d58094508724970ed9b68cdeca01e8f5333e0e (patch) | |
tree | 985972045637afc26959be0cb2dda60217a52905 /drivers/virtio/virtio_pci_common.h | |
parent | 64f2087aaa2c2a504f637736f48e71da0cd4afe0 (diff) | |
download | linux-b5d58094508724970ed9b68cdeca01e8f5333e0e.tar.gz linux-b5d58094508724970ed9b68cdeca01e8f5333e0e.tar.bz2 linux-b5d58094508724970ed9b68cdeca01e8f5333e0e.zip |
virtio-pci: split out modern device
This patch splits out the virtio-pci modern device only attributes
into another structure. While at it, a dedicated probe method for
modern only attributes is introduced. This may help for split the
logic into a dedicated module.
Signed-off-by: Jason Wang <jasowang@redhat.com>
Link: https://lore.kernel.org/r/20210104065503.199631-3-jasowang@redhat.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/virtio/virtio_pci_common.h')
-rw-r--r-- | drivers/virtio/virtio_pci_common.h | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/drivers/virtio/virtio_pci_common.h b/drivers/virtio/virtio_pci_common.h index b2f0eb4067cb..f35ff5b6b467 100644 --- a/drivers/virtio/virtio_pci_common.h +++ b/drivers/virtio/virtio_pci_common.h @@ -39,22 +39,16 @@ struct virtio_pci_vq_info { unsigned msix_vector; }; -/* Our device structure */ -struct virtio_pci_device { - struct virtio_device vdev; +struct virtio_pci_modern_device { struct pci_dev *pci_dev; - /* In legacy mode, these two point to within ->legacy. */ - /* Where to read and clear interrupt */ - u8 __iomem *isr; - - /* 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; + /* Where to read and clear interrupt */ + u8 __iomem *isr; /* So we can sanity-check accesses. */ size_t notify_len; @@ -68,6 +62,19 @@ struct virtio_pci_device { int modern_bars; + struct virtio_device_id id; +}; + +/* Our device structure */ +struct virtio_pci_device { + struct virtio_device vdev; + struct pci_dev *pci_dev; + struct virtio_pci_modern_device mdev; + + /* In legacy mode, these two point to within ->legacy. */ + /* Where to read and clear interrupt */ + u8 __iomem *isr; + /* Legacy only field */ /* the IO mapping for the PCI config space */ void __iomem *ioaddr; |