On Tue, 20 Feb 2018, Julien Grall wrote:
> Hi Stefano,
> 
> On 19/02/18 21:58, Stefano Stabellini wrote:
> > On big.LITTLE systems not all cores have the same midr. Instead of
> > storing only one vpidr per domain, make it per vcpu and initialize it to
> > the value of the midr of the pcpu where the vcpu will run.
> > 
> > This way, assuming that the vcpu has been created with the right pcpu
> > affinity, the guest will be able to read the right vpidr value, matching
> > the one of the physical cpu.
> > 
> > Signed-off-by: Stefano Stabellini <sstabell...@kernel.org>
> > 
> > ---
> > 
> > - remove warning message
> > - make vpidr per vcpu
> > ---
> >   xen/arch/arm/domain.c        | 6 ++----
> >   xen/arch/arm/vcpreg.c        | 4 ++--
> >   xen/include/asm-arm/domain.h | 6 +++---
> >   3 files changed, 7 insertions(+), 9 deletions(-)
> > 
> > diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
> > index fb51415..41d5d25 100644
> > --- a/xen/arch/arm/domain.c
> > +++ b/xen/arch/arm/domain.c
> > @@ -180,7 +180,7 @@ static void ctxt_switch_to(struct vcpu *n)
> >         p2m_restore_state(n);
> >   -    WRITE_SYSREG32(n->domain->arch.vpidr, VPIDR_EL2);
> > +    WRITE_SYSREG32(n->arch.vpidr, VPIDR_EL2);
> 
> Do we really need to store the vpidr in struct vcpu? It would be simpler and
> more efficient (no memory access) to use directly read MDIR_EL1 and copy it to
> VPIDR_EL1.

I followed your suggestion to drop vpidr from struct vcpu and just read
MDIR_EL1 in ctxt_switch_to. In do_cp14_32 I replaced v->arch.vpidr with
current_cpu_data.midr.bits for simplicity.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to