diff options
author | Alex Williamson <alex.williamson@redhat.com> | 2018-02-06 11:08:25 -0700 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2018-02-06 11:08:25 -0700 |
commit | 04f336b05ff54f53234b391e444226d8c2481fb7 (patch) | |
tree | b0239c61212185f0326e59a08ef6ed06c777ddbe /hw/vfio/pci.c | |
parent | 3a286732d1563bdb440718d4e68137e06af785dd (diff) |
vfio/pci: Emulate BARs
The kernel provides similar emulation of PCI BAR register access to
QEMU, so up until now we've used that for things like BAR sizing and
storing the BAR address. However, if we intend to resize BARs or add
BARs that don't exist on the physical device, we need to switch to the
pure QEMU emulation of the BAR.
Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'hw/vfio/pci.c')
-rw-r--r-- | hw/vfio/pci.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 908b8dffca..9436ac5cc9 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -2777,6 +2777,8 @@ static void vfio_realize(PCIDevice *pdev, Error **errp) /* QEMU can choose to expose the ROM or not */ memset(vdev->emulated_config_bits + PCI_ROM_ADDRESS, 0xff, 4); + /* QEMU can also add or extend BARs */ + memset(vdev->emulated_config_bits + PCI_BASE_ADDRESS_0, 0xff, 6 * 4); /* * The PCI spec reserves vendor ID 0xffff as an invalid value. The |