summaryrefslogtreecommitdiff
path: root/memory.c
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2012-10-15 20:30:28 +0200
committerAvi Kivity <avi@redhat.com>2012-10-17 16:47:34 +0200
commit28f362be6e7f45ea9b7a57a08555c4c784f36198 (patch)
treed90570d400b00183167574cdc39f207e675207d7 /memory.c
parent6f4d6b09088ee161ff4be0e4db4e4c0962c79070 (diff)
downloadqemu-28f362be6e7f45ea9b7a57a08555c4c784f36198.tar.gz
qemu-28f362be6e7f45ea9b7a57a08555c4c784f36198.tar.bz2
qemu-28f362be6e7f45ea9b7a57a08555c4c784f36198.zip
memory: Make eventfd adhere to device endianness
Our memory API MMIO regions know the concept of device endianness. This is used to automatically swap endianness between devices and host CPU, depending on whether buses in between would swizzle the bits. The ioeventfd value comparison does not adhere to that semantic though. Probably because nobody has been running ioeventfd on a BE platform and the only device implementing ioeventfd right now is LE (PCI) based. So add swizzling to ioeventfd registration / deletion to make the rest of the code as consistent as possible. Thanks a lot to Michael Tsirkin to point me towards the right direction. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'memory.c')
-rw-r--r--memory.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/memory.c b/memory.c
index 4f3ade06dd..d2f2fd66fb 100644
--- a/memory.c
+++ b/memory.c
@@ -1217,6 +1217,7 @@ void memory_region_add_eventfd(MemoryRegion *mr,
};
unsigned i;
+ adjust_endianness(mr, &mrfd.data, size);
memory_region_transaction_begin();
for (i = 0; i < mr->ioeventfd_nb; ++i) {
if (memory_region_ioeventfd_before(mrfd, mr->ioeventfds[i])) {
@@ -1248,6 +1249,7 @@ void memory_region_del_eventfd(MemoryRegion *mr,
};
unsigned i;
+ adjust_endianness(mr, &mrfd.data, size);
memory_region_transaction_begin();
for (i = 0; i < mr->ioeventfd_nb; ++i) {
if (memory_region_ioeventfd_equal(mrfd, mr->ioeventfds[i])) {