From patchwork Mon Oct 15 18:30:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 191624 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2F9AD2C00BE for ; Tue, 16 Oct 2012 05:30:44 +1100 (EST) Received: from localhost ([::1]:39157 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TNpR4-00055g-9e for incoming@patchwork.ozlabs.org; Mon, 15 Oct 2012 14:30:42 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TNpQx-00054Z-34 for qemu-devel@nongnu.org; Mon, 15 Oct 2012 14:30:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TNpQv-0002SI-RI for qemu-devel@nongnu.org; Mon, 15 Oct 2012 14:30:35 -0400 Received: from cantor2.suse.de ([195.135.220.15]:51296 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TNpQv-0002Qo-KV; Mon, 15 Oct 2012 14:30:33 -0400 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id A220799430; Mon, 15 Oct 2012 20:30:31 +0200 (CEST) From: Alexander Graf To: qemu-devel qemu-devel Date: Mon, 15 Oct 2012 20:30:28 +0200 Message-Id: <1350325828-11577-1-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.6.0.2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 195.135.220.15 Cc: "qemu-ppc@nongnu.org List" , "Michael S. Tsirkin" Subject: [Qemu-devel] [PATCH] Memory-API: Make eventfd adhere to device endianness X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- memory.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/memory.c b/memory.c index 4f3ade0..d2f2fd6 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])) {