From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:39959) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RwYua-0002jG-Sy for qemu-devel@nongnu.org; Sun, 12 Feb 2012 07:52:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RwYuZ-0003nL-IL for qemu-devel@nongnu.org; Sun, 12 Feb 2012 07:52:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51776) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RwYuZ-0003nC-Ba for qemu-devel@nongnu.org; Sun, 12 Feb 2012 07:52:11 -0500 Date: Sun, 12 Feb 2012 14:52:03 +0200 From: "Michael S. Tsirkin" Message-ID: <20120212125202.GA23416@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH] docs: memory.txt document the endian field List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, stefanha@linux.vnet.ibm.com, jan.kiszka@siemens.com, rth@twiddle.net, blauwirbel@gmail.com, michael@walle.cc, avi@redhat.com, david@gibson.dropbear.id.au, afaerber@suse.de, areis@redhat.com This is an attempt to document the endian field in memory API. As this is a confusing topic, it's best to make the text as explicit as possible. Signed-off-by: Michael S. Tsirkin --- docs/memory.txt | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-) diff --git a/docs/memory.txt b/docs/memory.txt index 5bbee8e..ff92b52 100644 --- a/docs/memory.txt +++ b/docs/memory.txt @@ -170,3 +170,31 @@ various constraints can be supplied to control how these callbacks are called: - .old_portio and .old_mmio can be used to ease porting from code using cpu_register_io_memory() and register_ioport(). They should not be used in new code. +- .endianness; specifies the device endian-ness, which affects + the value parameter passed from guest to write and returned + to guest from read callbacks, as follows: + void write(void *opaque, target_phys_addr_t addr, + uint64_t value, unsigned size) + uint64_t read(void *opaque, target_phys_addr_t addr, + unsigned size) + Legal values are: + DEVICE_NATIVE_ENDIAN - Callbacks accept and return value in + host endian format. This makes it possible to do + math on values without type conversions. + Low size bytes in value are set, the rest are zero padded + on input and ignored on output. + DEVICE_LITTLE_ENDIAN - Callbacks accept and return value + in little endian format. This is appropriate + if you need to directly copy the data into device memory, + and the device programming interface is little endian + (true for most pci devices). + First size bytes in value are set, the rest are zero padded + on input and ignored on output. + DEVICE_BIG_ENDIAN - Callbacks accept and return value + in big endian format. + in little endian format. This is appropriate + if you need to directly copy the data into device memory, + and the device programming interface is big endian + (true e.g. for some system devices on big endian architectures). + Last size bytes in value are set, the rest are zero padded + on input and ignored on output. -- 1.7.9.111.gf3fb0