Received: from eggs.gnu.org ([140.186.70.92]:54806) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R7NCW-0001jx-De for qemu-devel@nongnu.org; Sat, 24 Sep 2011 04:03:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R7NCU-000239-RH for qemu-devel@nongnu.org; Sat, 24 Sep 2011 04:03:08 -0400 Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Alexander Graf In-Reply-To: Date: Sat, 24 Sep 2011 10:03:03 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <1CECB54D-1FED-4AC2-B86B-8082CCFE001F@suse.de> References: <1315989802-18753-1-git-send-email-agraf@suse.de> <1315989802-18753-25-git-send-email-agraf@suse.de> <14529F4D-D8AC-4097-8DF8-5F13EDCCC77F@suse.de> <4E7769D0.3090909@freescale.com> Subject: Re: [Qemu-devel] [PATCH 24/58] PPC: E500: Add PV spinning code List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: Scott Wood , Yoder Stuart-B08248 , qemu-ppc@nongnu.org, qemu-devel Developers , Aurelien Jarno On 24.09.2011, at 09:41, Blue Swirl wrote: > On Mon, Sep 19, 2011 at 4:12 PM, Scott Wood = wrote: >> On 09/19/2011 06:35 AM, Alexander Graf wrote: >>>=20 >>> On 17.09.2011, at 19:40, Blue Swirl wrote: >>>=20 >>>> On Sat, Sep 17, 2011 at 5:15 PM, Alexander Graf = wrote: >>>>>=20 >>>>> Am 17.09.2011 um 18:58 schrieb Blue Swirl : >>>>>=20 >>>>>> On Sparc32, there is no need for a PV device. The CPU is woken up = from >>>>>> halted state with an IPI. Maybe you could use this approach? >>>>>=20 >>>>> The way it's done here is defined by u-boot and now also nailed = down in the ePAPR architecture spec. While alternatives might be more = appealing, this is how guests work today :). >>>>=20 >>>> OK. I hoped that there were no implementations yet. The header (btw >>>> missing) should point to the spec. >>=20 >> The goal with the spin table stuff, suboptimal as it is, was = something >> that would work on any powerpc implementation. Other >> implementation-specific release mechanisms are allowed, and are >> indicated by a property in the cpu node, but only if the loader knows >> that the OS supports it. >>=20 >>> IIUC the spec that includes these bits is not finalized yet. It is = however in use on all u-boot versions for e500 that I'm aware of and the = method Linux uses to bring up secondary CPUs. >>=20 >> It's in ePAPR 1.0, which has been out for a while now. ePAPR 1.1 was >> just released which clarifies some things such as WIMG. >>=20 >>> Stuart / Scott, do you have any pointers to documentation where the = spinning is explained? >>=20 >> = https://www.power.org/resources/downloads/Power_ePAPR_APPROVED_v1.1.pdf >=20 > Chapter 5.5.2 describes the table. This is actually an interface > between OS and Open Firmware, obviously there can't be a real hardware > device that magically loads r3 etc. >=20 > The device method would break abstraction layers, it's much like > vmport stuff in x86. Using a hypercall would be a small improvement. > Instead it should be possible to implement a small boot ROM which puts > the secondary CPUs into managed halt state without spinning, then the > boot CPU could send an IPI to a halted CPU to wake them up based on > the spin table, just like real HW would do. On Sparc32 OpenBIOS this > is something like a few lines of ASM on both sides. That sounds pretty close to what I had implemented in v1. Back then the = only comment was to do it using this method from Scott. Maybe one day we = will get u-boot support. Then u-boot will spin on the CPU itself and = when that time comes, we can check if we can implement a prettier = version. Btw, we can't do the IPI method without exposing something to the guest = that u-boot would usually not expose. There simply is no event. All that = happens is a write to memory to tell the other CPU that it should wake = up. So while sending an IPI to the other CPU is the "clean" way to go, I = agree, we can either be compatible or "clean". And if I get the choice = I'm rather compatible. So we have the choice between having code inside the guest that spins, = maybe even only checks every x ms, by programming a timer, or we can try = to make an event out of the memory write. V1 was the former, v2 (this = one) is the latter. This version performs a lot better and is easier to = understand. Alex