Commit ed2a73db authored by Jason Wang's avatar Jason Wang Committed by Michael S. Tsirkin

virtio-pci-modern: introduce vp_modern_generation()

This patch introduces vp_modern_generation() to get device generation.
Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
Link: https://lore.kernel.org/r/20210104065503.199631-9-jasowang@redhat.comSigned-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent 0b017708
......@@ -289,15 +289,26 @@ static void vp_set(struct virtio_device *vdev, unsigned offset,
}
}
static u32 vp_generation(struct virtio_device *vdev)
/*
* vp_modern_generation - get the device genreation
* @mdev: the modern virtio-pci device
*
* Returns the genreation read from device
*/
static u32 vp_modern_generation(struct virtio_pci_modern_device *mdev)
{
struct virtio_pci_device *vp_dev = to_vp_device(vdev);
struct virtio_pci_modern_device *mdev = &vp_dev->mdev;
struct virtio_pci_common_cfg __iomem *cfg = mdev->common;
return vp_ioread8(&cfg->config_generation);
}
static u32 vp_generation(struct virtio_device *vdev)
{
struct virtio_pci_device *vp_dev = to_vp_device(vdev);
return vp_modern_generation(&vp_dev->mdev);
}
/*
* vp_modern_get_status - get the device status
* @mdev: the modern virtio-pci device
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment