All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
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
Subject: [Qemu-devel] [PATCH] docs: memory.txt document the endian field
Date: Sun, 12 Feb 2012 14:52:03 +0200	[thread overview]
Message-ID: <20120212125202.GA23416@redhat.com> (raw)

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 <mst@redhat.com>
---
 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

             reply	other threads:[~2012-02-12 12:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-12 12:52 Michael S. Tsirkin [this message]
2012-02-12 13:02 ` [Qemu-devel] [PATCH] docs: memory.txt document the endian field Avi Kivity
2012-02-12 13:47   ` Michael S. Tsirkin
2012-02-12 13:55     ` Avi Kivity
2012-02-12 15:06       ` Michael S. Tsirkin
2012-02-12 15:19         ` Avi Kivity
2012-02-12 18:20         ` Andreas Färber
2012-02-12 18:27           ` Michael S. Tsirkin

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=20120212125202.GA23416@redhat.com \
    --to=mst@redhat.com \
    --cc=afaerber@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=areis@redhat.com \
    --cc=avi@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=jan.kiszka@siemens.com \
    --cc=michael@walle.cc \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=stefanha@linux.vnet.ibm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.