From: Alex Williamson <alex.williamson@redhat.com>
To: anthony@codemonkey.ws
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>,
qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: [Qemu-devel] [PULL v2 8/8] vfio-pci: Fix endian issues in vfio_pci_size_rom()
Date: Thu, 10 Oct 2013 12:45:12 -0600 [thread overview]
Message-ID: <20131010184504.31667.53614.stgit@bling.home> (raw)
In-Reply-To: <20131010184122.31667.28382.stgit@bling.home>
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;
prev parent reply other threads:[~2013-10-10 18:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-10 18:43 [Qemu-devel] [PULL v2 0/8] VFIO updates for QEMU Alex Williamson
2013-10-10 18:43 ` [Qemu-devel] [PULL v2 1/8] vfio-pci: Add support for MSI affinity Alex Williamson
2013-10-10 18:44 ` [Qemu-devel] [PULL v2 2/8] vfio-pci: Test device reset capabilities Alex Williamson
2013-10-10 18:44 ` [Qemu-devel] [PULL v2 3/8] vfio-pci: Lazy PCI option ROM loading Alex Williamson
2013-10-10 18:44 ` [Qemu-devel] [PULL v2 4/8] vfio-pci: Cleanup error_reports Alex Williamson
2013-10-10 18:44 ` [Qemu-devel] [PULL v2 5/8] vfio-pci: Implement PCI hot reset Alex Williamson
2013-10-10 18:44 ` [Qemu-devel] [PULL v2 6/8] vfio: Fix debug output for int128 values Alex Williamson
2013-10-10 18:44 ` [Qemu-devel] [PULL v2 7/8] vfio-pci: Add dummy PCI ROM write accessor Alex Williamson
2013-10-10 18:45 ` Alex Williamson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131010184504.31667.53614.stgit@bling.home \
--to=alex.williamson@redhat.com \
--cc=aik@ozlabs.ru \
--cc=anthony@codemonkey.ws \
--cc=kvm@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).