From: Hollis B. <ho...@us...> - 2008-01-09 23:07:49
|
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 <ho...@us...> --- 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 |