From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hollis Blanchard Subject: RFC: MMIO endianness flag Date: Wed, 09 Jan 2008 17:06:48 -0600 Message-ID: <1199920008.5637.48.camel@basalt> Reply-To: Hollis Blanchard Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-ppc-devel , kvm-devel To: Avi Kivity Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Add an "is_bigendian" flag to the kvm_run.mmio structure. This is needed for architectures that can make both little- and big-endian memory accesses. Signed-off-by: Hollis Blanchard --- PowerPC has different instructions for native and byte-reversed memory accesses, and some implementations can also can map individual pages as byte-reversed. Right now in the PowerPC KVM implementation the kernel detects byte-reversed MMIO from the guest and converts the data as appropriate so that userland only ever deals with big-endian data. That's fine and all, but I started thinking about supporting MMIO passthrough, in which userland wouldn't emulate an MMIO at all, but rather execute it on the real hardware (via mmap /dev/mem, for example). In that case, it's actually very important that the endianness of the access be preserved, since we need that information to access the real hardware. I don't think this patch has any serious x86 ABI implications, since current x86 code just ignores the flag. I guess x86 could continue to ignore it in the future, or it could explicitly zero the new flag. Comments? diff --git a/include/linux/kvm.h b/include/linux/kvm.h --- a/include/linux/kvm.h +++ b/include/linux/kvm.h @@ -123,6 +123,7 @@ struct kvm_run { __u8 data[8]; __u32 len; __u8 is_write; + __u8 is_bigendian; } mmio; /* KVM_EXIT_HYPERCALL */ struct { -- Hollis Blanchard IBM Linux Technology Center ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace