All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen/arm: ctxt_switch: Document the erratum #852523 related to Cortex A57
@ 2015-10-08 19:22 Julien Grall
  2015-10-09  9:22 ` Ian Campbell
  0 siblings, 1 reply; 4+ messages in thread
From: Julien Grall @ 2015-10-08 19:22 UTC (permalink / raw)
  To: xen-devel; +Cc: Julien Grall, ian.campbell, stefano.stabellini

When restoring the system register state for an AArch32 guest at EL2,
writes to DACR32_EL2 may not be correctly synchronised by Cortex-A57,
which can lead to the guest effectively running into unexpected domain
faults.

Thankfully, we don't hit this erratum in Xen. Nonetheless, document the
code to prevent any introduction of the erratum if the context switch
code is re-ordered.

Link: http://lists.xen.org/archives/html/xen-devel/2015-09/msg01746.html
Signed-off-by: Julien Grall <julien.grall@citrix.com>

---
    The erratum doc is still not updated so this patch is summary of the
    thread [1]. I hope I understood it correctly.

    [1] http://lists.xen.org/archives/html/xen-devel/2015-09/msg01746.html
---
 xen/arch/arm/domain.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 575745c..4349428 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -181,6 +181,12 @@ static void ctxt_switch_to(struct vcpu *n)
     WRITE_SYSREG(n->arch.ttbcr, TCR_EL1);
     WRITE_SYSREG64(n->arch.ttbr0, TTBR0_EL1);
     WRITE_SYSREG64(n->arch.ttbr1, TTBR1_EL1);
+
+    /*
+     * Erratum #852523: DACR32_EL2 must be restored before one of the
+     * following sysregs: SCTLR_EL1, TCR_EL1, TTBR0_EL1, TTBR1_EL1 or
+     * CONTEXTIDR_EL1.
+     */
     if ( is_32bit_domain(n->domain) )
         WRITE_SYSREG(n->arch.dacr, DACR32_EL2);
     WRITE_SYSREG64(n->arch.par, PAR_EL1);
@@ -198,6 +204,10 @@ static void ctxt_switch_to(struct vcpu *n)
     /* Control Registers */
     WRITE_SYSREG(n->arch.cpacr, CPACR_EL1);
 
+    /*
+     * This write to sysreg CONTEXTIDR_EL1 ensure we don't hit the erratum
+     * #852523. I.e DACR32_EL2 is not correctly synchronized.
+     */
     WRITE_SYSREG(n->arch.contextidr, CONTEXTIDR_EL1);
     WRITE_SYSREG(n->arch.tpidr_el0, TPIDR_EL0);
     WRITE_SYSREG(n->arch.tpidrro_el0, TPIDRRO_EL0);
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] xen/arm: ctxt_switch: Document the erratum #852523 related to Cortex A57
  2015-10-08 19:22 [PATCH] xen/arm: ctxt_switch: Document the erratum #852523 related to Cortex A57 Julien Grall
@ 2015-10-09  9:22 ` Ian Campbell
  2015-10-09 10:40   ` Julien Grall
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Campbell @ 2015-10-09  9:22 UTC (permalink / raw)
  To: Julien Grall, xen-devel; +Cc: stefano.stabellini

On Thu, 2015-10-08 at 20:22 +0100, Julien Grall wrote:
> When restoring the system register state for an AArch32 guest at EL2,
> writes to DACR32_EL2 may not be correctly synchronised by Cortex-A57,
> which can lead to the guest effectively running into unexpected domain
> faults.
> 
> Thankfully, we don't hit this erratum in Xen. Nonetheless, document the
> code to prevent any introduction of the erratum if the context switch
> code is re-ordered.
> 
> Link: http://lists.xen.org/archives/html/xen-devel/2015-09/msg01746.html
> Signed-off-by: Julien Grall <julien.grall@citrix.com>

Acked-by: Ian Campbell <ian.campbell@citrix.com>

nits:
>  
> +    /*
> +     * This write to sysreg CONTEXTIDR_EL1 ensure we don't hit the erratum

"ensures" and s/the //.

(fixable on commit)

Ian.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xen/arm: ctxt_switch: Document the erratum #852523 related to Cortex A57
  2015-10-09  9:22 ` Ian Campbell
@ 2015-10-09 10:40   ` Julien Grall
  2015-10-14 10:49     ` Ian Campbell
  0 siblings, 1 reply; 4+ messages in thread
From: Julien Grall @ 2015-10-09 10:40 UTC (permalink / raw)
  To: Ian Campbell, xen-devel; +Cc: stefano.stabellini

On 09/10/15 10:22, Ian Campbell wrote:
> On Thu, 2015-10-08 at 20:22 +0100, Julien Grall wrote:
>> When restoring the system register state for an AArch32 guest at EL2,
>> writes to DACR32_EL2 may not be correctly synchronised by Cortex-A57,
>> which can lead to the guest effectively running into unexpected domain
>> faults.
>>
>> Thankfully, we don't hit this erratum in Xen. Nonetheless, document the
>> code to prevent any introduction of the erratum if the context switch
>> code is re-ordered.
>>
>> Link: http://lists.xen.org/archives/html/xen-devel/2015-09/msg01746.html
>> Signed-off-by: Julien Grall <julien.grall@citrix.com>
> 
> Acked-by: Ian Campbell <ian.campbell@citrix.com>
> 
> nits:
>>  
>> +    /*
>> +     * This write to sysreg CONTEXTIDR_EL1 ensure we don't hit the erratum
> 
> "ensures" and s/the //.
> 
> (fixable on commit)

I'm fine if you fix it while committing.

Regards,

-- 
Julien Grall

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xen/arm: ctxt_switch: Document the erratum #852523 related to Cortex A57
  2015-10-09 10:40   ` Julien Grall
@ 2015-10-14 10:49     ` Ian Campbell
  0 siblings, 0 replies; 4+ messages in thread
From: Ian Campbell @ 2015-10-14 10:49 UTC (permalink / raw)
  To: Julien Grall, xen-devel; +Cc: stefano.stabellini

On Fri, 2015-10-09 at 11:40 +0100, Julien Grall wrote:
> On 09/10/15 10:22, Ian Campbell wrote:
> > On Thu, 2015-10-08 at 20:22 +0100, Julien Grall wrote:
> > > When restoring the system register state for an AArch32 guest at EL2,
> > > writes to DACR32_EL2 may not be correctly synchronised by Cortex-A57,
> > > which can lead to the guest effectively running into unexpected
> > > domain
> > > faults.
> > > 
> > > Thankfully, we don't hit this erratum in Xen. Nonetheless, document
> > > the
> > > code to prevent any introduction of the erratum if the context switch
> > > code is re-ordered.
> > > 
> > > Link: 
> > > http://lists.xen.org/archives/html/xen-devel/2015-09/msg01746.html
> > > Signed-off-by: Julien Grall <julien.grall@citrix.com>
> > 
> > Acked-by: Ian Campbell <ian.campbell@citrix.com>
> > 
> > nits:
> > >  
> > > +    /*
> > > +     * This write to sysreg CONTEXTIDR_EL1 ensure we don't hit the
> > > erratum
> > 
> > "ensures" and s/the //.
> > 
> > (fixable on commit)
> 
> I'm fine if you fix it while committing.

Done.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-10-14 10:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-08 19:22 [PATCH] xen/arm: ctxt_switch: Document the erratum #852523 related to Cortex A57 Julien Grall
2015-10-09  9:22 ` Ian Campbell
2015-10-09 10:40   ` Julien Grall
2015-10-14 10:49     ` Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.