From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH 2/3] xen/arm: Use p2m_restore_state in construct_dom0 Date: Fri, 28 Mar 2014 13:26:28 +0000 Message-ID: <53357884.2020504@linaro.org> References: <1395243819-30380-1-git-send-email-julien.grall@linaro.org> <1395243819-30380-3-git-send-email-julien.grall@linaro.org> <1395420636.25521.23.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WTWnp-0001JN-5f for xen-devel@lists.xenproject.org; Fri, 28 Mar 2014 13:26:33 +0000 Received: by mail-ee0-f52.google.com with SMTP id e49so4070011eek.11 for ; Fri, 28 Mar 2014 06:26:31 -0700 (PDT) In-Reply-To: <1395420636.25521.23.camel@kazak.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: xen-devel@lists.xenproject.org, tim@xen.org, Fu Wei , stefano.stabellini@citrix.com List-Id: xen-devel@lists.xenproject.org On 03/21/2014 04:50 PM, Ian Campbell wrote: > On Wed, 2014-03-19 at 15:43 +0000, Julien Grall wrote: >> The address translation functions used while building dom0 rely on certain EL1 >> state being configured. In particular they are subject to the behaviour of >> SCTLR_EL1.M (stage 1 MMU enabled). >> >> The Xen (and Linux) boot protocol require that the kernel be entered with the >> MMU disabled but they don't say anything explicitly about exception levels >> other than the one which is active when entering the kernels. Arguably the >> protocol could be said to apply to all exception levels but in any case we >> should cope with this and setup the EL1 state as necessary. >> >> Fu Wei discovered this when booting Xen from grub.efi over UEFI, it's not >> clear whether grub or UEFI is responsible for leaving stage 1 MMU enabled. >> >> Use directly the newly created function p2m_restore_state to retrieve a >> correct EL1 state to translate an address. >> >> Signed-off-by: Julien Grall >> Reported-by: Fu Wei > > Acked-by: Ian Campbell > > I think this will leave some initial dom0 vcpu state in the idle vcpu > (my patch had the same issue), but I think that is tolerable. It might > just be worth clearing HCR_VM and perhaps VTTBR (more worried about the > VMID than the base address) when scheduling an idle vcpu. I think it's already the case when idle VPCU are scheduled. We don't change the VTTBR so it keeps the one used by the previous running VCPU. -- Julien Grall