From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Mackerras Subject: Re: [PATCH v2 3/3] KVM: PPC: Book3S: MMIO emulation support for little endian guests Date: Wed, 6 Nov 2013 16:55:37 +1100 Message-ID: <20131106055537.GH14842@drongo> References: <1381241531-27940-4-git-send-email-clg@fr.ibm.com> <20131008233123.GB17420@iris.ozlabs.ibm.com> <5F0A1154-D417-454C-A3CD-59AEF7EF0D97@suse.de> <20131009055920.GA10650@drongo> <20131010101607.GB9906@iris.ozlabs.ibm.com> <3404F831-6354-4C22-B06C-64628279CC1F@suse.de> <5278E472.5060604@fr.ibm.com> <84018BDE-858B-4F59-8AA0-9135CCFF4720@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Cedric Le Goater , "kvm-ppc@vger.kernel.org" , "kvm@vger.kernel.org mailing list" To: Alexander Graf Return-path: Received: from ozlabs.org ([203.10.76.45]:39118 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750803Ab3KFFz6 (ORCPT ); Wed, 6 Nov 2013 00:55:58 -0500 Content-Disposition: inline In-Reply-To: <84018BDE-858B-4F59-8AA0-9135CCFF4720@suse.de> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Nov 05, 2013 at 02:01:14PM +0100, Alexander Graf wrote: > > On 05.11.2013, at 13:28, Cedric Le Goater wrote: > > > +/* > > + * Compare endian order of host and guest to determine whether we need > > + * to byteswap or not > > + */ > > static inline bool kvmppc_need_byteswap(struct kvm_vcpu *vcpu) > > { > > - return vcpu->arch.shared->msr & MSR_LE; > > + return ((mfmsr() & (MSR_LE)) >> MSR_LE_LG) ^ > > mfmsr() is slow. Just use #ifdef __LITTLE_ENDIAN__. Or (MSR_KERNEL & MSR_LE). > > + /* if we are loading data from a guest which is in Split > > + * Little Endian mode, the byte order is reversed > > Only for data. Instructions are still non-reverse. You express this well in the code, but not in the comment. Well, his comment does say "if we are loading data", but I agree it's slightly ambiguous (the guest's instructions are our data). Paul.