From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cedric Le Goater Date: Wed, 08 Jan 2014 17:40:33 +0000 Subject: Re: [PATCH v5 3/6] KVM: PPC: Book3S: MMIO emulation support for little endian guests Message-Id: <52CD8D91.7010201@fr.ibm.com> List-Id: References: <1383672128-26795-1-git-send-email-clg@fr.ibm.com> <1383672128-26795-4-git-send-email-clg@fr.ibm.com> <08276663-4EB5-4912-9F90-803E88DE4D1A@suse.de> <52CD899C.20305@fr.ibm.com> <52CD8C11.9020000@suse.de> In-Reply-To: <52CD8C11.9020000@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Alexander Graf Cc: Paul Mackerras , kvm-ppc@vger.kernel.org, "kvm@vger.kernel.org mailing list" On 01/08/2014 06:34 PM, Alexander Graf wrote: >>> if (kvmppc_is_bigendian(vcpu)) { >>> /* Default endianness is "big endian". */ >>> is_bigendian = is_default_endian; >>> } else { >>> /* Default endianness is "little endian". */ >>> is_bigendian = !is_default_endian; >>> } >>> >>> and suddenly things become reasonably clear for everyone I'd hope. >> I think something like : >> >> + if (kvmppc_need_byteswap(vcpu)) >> + is_bigendian = !is_bigendian; >> + >> >> has a small footprint and is clear enough ? >> >> Thanks for the inputs, a (single) patch follows > > Not really. The argument means "use the normal endianness you would usually use for memory access". It doesn't mean little or big endian yet, as that's what we determine later. > > Keep in mind that gcc is really good at optimizing code like this, so please don't try to be smart with variable reusage or any of the likes. In assembly this will all look identical, but the C representation should be as self-documenting as possible. Arg. I should have waited a few minutes. No problem. I will resend with your "is_default_endian" proposal. Cheers, C.