public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] KVM: Specify byte order for KVM_EXIT_MMIO
@ 2014-01-23 23:46 Christoffer Dall
  2014-01-24  0:01 ` Peter Maydell
  0 siblings, 1 reply; 9+ messages in thread
From: Christoffer Dall @ 2014-01-23 23:46 UTC (permalink / raw)
  To: kvm
  Cc: kvmarm, kvm-ppc, Christoffer Dall, Marc Zyngier, Peter Maydell,
	Alexander Graf

The KVM API documentation is not clear about the semantics of the data
field on the mmio struct on the kvm_run struct.

This has become problematic when supporting ARM guests on big-endian
host systems with guests of both endianness types, because it is unclear
how the data should be exported to user space.

This should not break with existing implementations as all supported
existing implementations of known user space applications (QEMU and
kvmtools for virtio) only support default endianness of the
architectures on the host side.

Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
---
 Documentation/virtual/kvm/api.txt | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
index 366bf4b..fb7c7e4 100644
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -2565,6 +2565,11 @@ executed a memory-mapped I/O instruction which could not be satisfied
 by kvm.  The 'data' member contains the written data if 'is_write' is
 true, and should be filled by application code otherwise.
 
+The 'data' member byte order is host kernel native endianness, regardless of
+the endianness of the guest, and represents the the value as it would go on the
+bus in real hardware.  The host kernel should always be able to do:
+<type> val = *((<type> *)mmio.data).
+
 NOTE: For KVM_EXIT_IO, KVM_EXIT_MMIO, KVM_EXIT_OSI, KVM_EXIT_DCR,
       KVM_EXIT_PAPR and KVM_EXIT_EPR the corresponding
 operations are complete (and guest state is consistent) only after userspace
-- 
1.8.5.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-01-24 19:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-23 23:46 [RFC PATCH] KVM: Specify byte order for KVM_EXIT_MMIO Christoffer Dall
2014-01-24  0:01 ` Peter Maydell
2014-01-24 13:09   ` Paolo Bonzini
2014-01-24 13:13     ` Alexander Graf
2014-01-24 15:23       ` Victor Kamensky
2014-01-24 15:32         ` Paolo Bonzini
2014-01-24 16:19           ` Victor Kamensky
2014-01-24 16:34         ` Victor Kamensky
2014-01-24 19:17       ` Victor Kamensky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox