VFIO pull request fixes
cover VFIO pull request fixes
Bugs found by Paolo and Alexey. I'll include these in my next pull request. Thanks,
Alex
---
Alex Williamson (2):
vfio-pci: Add dummy PCI ROM write accessor
vfio-pci: Fix endian issues in vfio_pci_size_rom()
hw/misc/vfio.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
PATCH 1/2 vfio-pci: Add dummy PCI ROM write accessor
Just to be sure we don't jump off any NULL pointer cliffs.
Signed-off-by Alex Williamson <[email protected]>
Reported-by Paolo Bonzini <[email protected]>
--- hw/misc/vfio.c | 6 ++++++ 1 file changed, 6 insertions(+)
hw/misc/vfio.c +6 -0
@@ -1128,8 +1128,14 @@ static uint64_t vfio_rom_read(void *opaque, hwaddr addr, unsigned size)return val; } +static void vfio_rom_write (void *opaque,hwaddr addr, +uint64_t data,unsigned size) +{ +} +static const MemoryRegionOps vfio_rom_ops = { .read = vfio_rom_read, + .write = vfio_rom_write, .endianness =DEVICE_LITTLE_ENDIAN , };
PATCH 2/2 vfio-pci: Fix endian issues in vfio_pci_size_rom()
In reply to Alex WilliamsonVFIO is always little endian so do byte swapping of our mask on the way in and byte swapping of the size on the way out.
Signed-off-by Alex Williamson <[email protected]>
Reported-by Alexey Kardashevskiy <[email protected]>
--- hw/misc/vfio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/misc/vfio.c +2 -2
@@ -1141,7 +1141,7 @@ static const MemoryRegionOps vfio_rom_ops = {static void vfio_pci_size_rom (VFIODevice *vdev) { -uint32_t orig, size = (uint32_t )PCI_ROM_ADDRESS_MASK ; +uint32_t orig, size =cpu_to_le32 ((uint32_t )PCI_ROM_ADDRESS_MASK );off_t offset = vdev->config_offset +PCI_ROM_ADDRESS ;char name[32 ];
@@ -1163,7 +1163,7 @@ static void vfio_pci_size_rom(VFIODevice *vdev)return ; } - size = ~(size &PCI_ROM_ADDRESS_MASK ) +1 ; + size = ~(le32_to_cpu (size) &PCI_ROM_ADDRESS_MASK ) +1 ;if (!size) {return ;