diff options
author | Zenghui Yu <yuzenghui@huawei.com> | 2020-09-21 12:51:16 +0800 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2020-09-21 14:08:12 -0600 |
commit | 1c0f68252a6a8a793ff3352e3580664d18ec5955 (patch) | |
tree | 4972920a78c93715f454de45cbed0d4a2dd6051a /drivers/vfio/pci | |
parent | ba4f184e126b751d1bffad5897f263108befc780 (diff) | |
download | linux-stable-1c0f68252a6a8a793ff3352e3580664d18ec5955.tar.gz linux-stable-1c0f68252a6a8a793ff3352e3580664d18ec5955.tar.bz2 linux-stable-1c0f68252a6a8a793ff3352e3580664d18ec5955.zip |
vfio/pci: Don't regenerate vconfig for all BARs if !bardirty
Now we regenerate vconfig for all the BARs via vfio_bar_fixup(), every
time any offset of any of them are read. Though BARs aren't re-read
regularly, the regeneration can be avoided if no BARs had been written
since they were last read, in which case vdev->bardirty is false.
Let's return immediately in vfio_bar_fixup() if bardirty is false.
Suggested-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/vfio/pci')
-rw-r--r-- | drivers/vfio/pci/vfio_pci_config.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c index d98843feddce..5e02ba07e8e8 100644 --- a/drivers/vfio/pci/vfio_pci_config.c +++ b/drivers/vfio/pci/vfio_pci_config.c @@ -467,6 +467,9 @@ static void vfio_bar_fixup(struct vfio_pci_device *vdev) __le32 *vbar; u64 mask; + if (!vdev->bardirty) + return; + vbar = (__le32 *)&vdev->vconfig[PCI_BASE_ADDRESS_0]; for (i = 0; i < PCI_STD_NUM_BARS; i++, vbar++) { |