From: Ian Campbell Subject: Re: [PATCH] xen: arm: force guest memory accesses to cacheable when MMU is disabled Date: Wed, 8 Jan 2014 13:08:58 +0000 Message-ID: <1389186538.4883.63.camel@kazak.uk.xensource.com> References: <1389110537-14876-1-git-send-email-ian.campbell@citrix.com> <1389175483.12612.100.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini Cc: julien.grall@linaro.org, tim@xen.org, george.dunlap@citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Wed, 2014-01-08 at 12:43 +0000, Stefano Stabellini wrote: > On Wed, 8 Jan 2014, Ian Campbell wrote: > > On Tue, 2014-01-07 at 20:39 +0000, Stefano Stabellini wrote: > > > > diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c > > > > index 124cccf..104d228 100644 > > > > --- a/xen/arch/arm/domain.c > > > > +++ b/xen/arch/arm/domain.c > > > > @@ -219,6 +219,11 @@ static void ctxt_switch_to(struct vcpu *n) > > > > else > > > > hcr |= HCR_RW; > > > > > > > > + if ( n->arch.sctlr & SCTLR_M ) > > > > + hcr &= ~(HCR_TVM|HCR_DC); > > > > + else > > > > + hcr |= (HCR_TVM|HCR_DC); > > > > + > > > > WRITE_SYSREG(hcr, HCR_EL2); > > > > isb(); > > > > > > Is this actually needed? Shouldn't HCR be already correctly updated by > > > update_sctlr? > > > > Not if we are switching back and forth between two guests which are in > > different states. > > I didn't realize that HCR is not properly saved and restored during > context switch. Maybe it is worth doing that instead? If nothing else > for simplicity? Yes. We ended up here because originally the HCR content was completely static. I'm a little concerned about making this change for 4.4, mostly because I'd need to reliably track down the right places to initialise v->arch.hcr and the correct contents. Ian.