public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] VFIO pull request fixes
@ 2013-10-04 19:18 Alex Williamson
  2013-10-04 19:18 ` [PATCH 1/2] vfio-pci: Add dummy PCI ROM write accessor Alex Williamson
  2013-10-04 19:18 ` [PATCH 2/2] vfio-pci: Fix endian issues in vfio_pci_size_rom() Alex Williamson
  0 siblings, 2 replies; 3+ messages in thread
From: Alex Williamson @ 2013-10-04 19:18 UTC (permalink / raw)
  To: alex.williamson; +Cc: aik, pbonzini, qemu-devel, kvm

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(-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] vfio-pci: Add dummy PCI ROM write accessor
  2013-10-04 19:18 [PATCH 0/2] VFIO pull request fixes Alex Williamson
@ 2013-10-04 19:18 ` Alex Williamson
  2013-10-04 19:18 ` [PATCH 2/2] vfio-pci: Fix endian issues in vfio_pci_size_rom() Alex Williamson
  1 sibling, 0 replies; 3+ messages in thread
From: Alex Williamson @ 2013-10-04 19:18 UTC (permalink / raw)
  To: alex.williamson; +Cc: aik, pbonzini, qemu-devel, kvm

Just to be sure we don't jump off any NULL pointer cliffs.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Reported-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/misc/vfio.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c
index 68e25bd..1fbc40b 100644
--- a/hw/misc/vfio.c
+++ b/hw/misc/vfio.c
@@ -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,
 };
 


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] vfio-pci: Fix endian issues in vfio_pci_size_rom()
  2013-10-04 19:18 [PATCH 0/2] VFIO pull request fixes Alex Williamson
  2013-10-04 19:18 ` [PATCH 1/2] vfio-pci: Add dummy PCI ROM write accessor Alex Williamson
@ 2013-10-04 19:18 ` Alex Williamson
  1 sibling, 0 replies; 3+ messages in thread
From: Alex Williamson @ 2013-10-04 19:18 UTC (permalink / raw)
  To: alex.williamson; +Cc: aik, pbonzini, qemu-devel, kvm

VFIO 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 <alex.williamson@redhat.com>
Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 hw/misc/vfio.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c
index 1fbc40b..a2d5283 100644
--- a/hw/misc/vfio.c
+++ b/hw/misc/vfio.c
@@ -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;


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-10-04 19:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-04 19:18 [PATCH 0/2] VFIO pull request fixes Alex Williamson
2013-10-04 19:18 ` [PATCH 1/2] vfio-pci: Add dummy PCI ROM write accessor Alex Williamson
2013-10-04 19:18 ` [PATCH 2/2] vfio-pci: Fix endian issues in vfio_pci_size_rom() Alex Williamson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox