Received: from eggs.gnu.org ([2001:4830:134:3::10]:37653) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cBNkD-0004fI-A6 for qemu-devel@nongnu.org; Mon, 28 Nov 2016 10:21:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cBNkA-0002dI-53 for qemu-devel@nongnu.org; Mon, 28 Nov 2016 10:21:25 -0500 Received: from 11.mo4.mail-out.ovh.net ([46.105.34.195]:59144) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cBNk9-0002YI-Tk for qemu-devel@nongnu.org; Mon, 28 Nov 2016 10:21:22 -0500 Received: from player750.ha.ovh.net (b7.ovh.net [213.186.33.57]) by mo4.mail-out.ovh.net (Postfix) with ESMTP id EFD7D1FC26 for ; Mon, 28 Nov 2016 16:21:18 +0100 (CET) References: <1471946352-20779-1-git-send-email-clg@kaod.org> From: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= Message-ID: Date: Mon, 28 Nov 2016 16:21:15 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] target-arm: Add VBAR support to ARM1176 CPUs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: QEMU Developers , qemu-arm On 11/28/2016 11:40 AM, Peter Maydell wrote: > On 24 November 2016 at 14:29, C=C3=A9dric Le Goater wrot= e: >> On 09/05/2016 04:39 PM, Peter Maydell wrote: >>> We implement VBAR in v7-without-EL3 even though architecturally >>> it should only exist in v7-with-EL3 because we have some >>> legacy board models which we implement as without-EL3 but >>> where the guest (Linux) assumes it's running on a with-EL3 >>> CPU in NS mode. I'd rather we stick to the architectural >>> definition for 1176 if we can rather than expanding the >>> "things we do which aren't architectural" set if there's >>> no legacy config that requires it. (If it is necessary >>> to define it for 1176 always then that's OK, I'd just >>> prefer not to unless we know we have to.) >> >> According to the ARM spec, 1176 is a v6 with a couple of >> extensions, among which v6k and TrustZone. So it has Secure >> and Non-Secure VBAR and MVBAR registers. >> >> Looking at : >> >> https://en.wikipedia.org/wiki/List_of_ARM_microarchitectures >> >> May be, we should instead introduce a new ARMv6Z architecture >> for the 1176 cpu which would represent a ARMv6 + TrustZone ? >> >> >> But I am a bit confused with this EL3 feature. 1176 does not >> have EL3 to my understanding (I am beyond my ARM skills there). >=20 > EL3 =3D=3D TrustZone's Monitor mode level of privilege. In > ARMv8 the privilege level model was tidied up a bit so it's > more cleanly arranged in levels EL0 (user) EL1 (kernel) > EL2 (hypervisor) EL3 (secure monitor), and the old 32-bit > setup can be expressed in terms of that (User being EL0, > the various Sys/Fiq/Irq/etc modes being EL1, Hyp at EL2 > and Mon at EL3). For QEMU we implemented TrustZone support > after the v8 spec was published, so we had the opportunity > to do it in a way that fit nicely with 64-bit TZ support. > So ARM_FEATURE_EL3 is our "does this CPU have TrustZone" > flag, in the same way that ARM_FEATURE_EL2 is "does it have > the Virtualization extensions". > > We also support 1176-without-TrustZone, which doesn't > exist in real hardware but which we have for backwards > compatibility with code that runs on our 1176 boards > which we implemented before we had TZ support in the > CPU implementation. Thanks for the explanation. It is clearer now. > What I'm suggesting is that we shoulld provide VBAR > only in the 1176-with-TZ CPUs, not in the 1176-no-TZ > CPUs, unless we must provide it for the latter as a > back-compat requirement. I don't for the back-compat requirement.=20 But I need to rework the patch to keep VBAR in any case=20 for the v7-without-EL3 CPUs and remove it for the 1176 CPUs=20 when 'has_el3' is not set. Thanks, C.=20 >> So why is it part of the feature list in arm1176_initfn ? >> Is that a way to define the MVBAR and SCR regs ? >=20 > The CPU object defaults to TZ-enabled, and then the > board model can disable it. (See for instance the > code in hw/arm/realview.c which sets the has_el3 property > on the CPU object to false.) >=20 > thanks > -- PMM >=20