From: Alexander Graf Subject: Re: [PATCH v2 3/3] KVM: PPC: Book3S: MMIO emulation support for little endian guests Date: Wed, 9 Oct 2013 10:29:53 +0200 Message-ID: References: <1381241531-27940-1-git-send-email-clg@fr.ibm.com> <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> Mime-Version: 1.0 (1.0) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8BIT Cc: =?utf-8?Q?C=C3=A9dric_Le_Goater?= , "kvm-ppc@vger.kernel.org" , "kvm@vger.kernel.org mailing list" To: Paul Mackerras Return-path: In-Reply-To: <20131009055920.GA10650@drongo> Sender: kvm-ppc-owner@vger.kernel.org List-Id: kvm.vger.kernel.org Am 09.10.2013 um 07:59 schrieb Paul Mackerras : > On Wed, Oct 09, 2013 at 01:46:29AM +0200, Alexander Graf wrote: >> >> >> Am 09.10.2013 um 01:31 schrieb Paul Mackerras : >> >>> True, until we get to POWER8 with its split little-endian support, >>> where instructions and data can have different endianness... >> >> How exactly does that work? > > They added an extra MSR bit called SLE which enables the split-endian > mode. It's bit 5 (IBM numbering). For backwards compatibility, the > LE bit controls instruction endianness, and data endianness depends on > LE ^ SLE, that is, with SLE = 0 things work as before. With SLE=1 and > LE=0 you get little-endian data and big-endian instructions, and vice > versa with SLE=1 and LE=1. So ld32 should only honor LE and get_last_inst only looks at SLE and swaps even the vcpu cached version if it's set, no? Alex > > There is also a user accessible "mtsle" instruction that sets the > value of the SLE bit. This enables programs to flip their data > endianness back and forth quickly, so it's usable for short > instruction sequences, without the need to generate instructions of > the opposite endianness. > > Paul.