On 15/05/12 22:03, Christoffer Dall wrote: > On Mon, May 14, 2012 at 9:04 AM, Marc Zyngier <marc.zyngier at arm.com> wrote: >> The ACTLR is implementation dependant, and better left untouched >> by the guest. >> >> Trap the access by ignoring writes, and let reads return the host >> view of the ACTLR, adjusted to reflect whether the guest is SMP >> or not. >> >> Signed-off-by: Marc Zyngier <marc.zyngier at arm.com> >> --- >> arch/arm/include/asm/kvm_arm.h | 2 +- >> arch/arm/kvm/emulate.c | 24 ++++++++++++++++++++++++ >> 2 files changed, 25 insertions(+), 1 deletions(-) >> >> diff --git a/arch/arm/include/asm/kvm_arm.h b/arch/arm/include/asm/kvm_arm.h >> index 29f3a36..b9e4197 100644 >> --- a/arch/arm/include/asm/kvm_arm.h >> +++ b/arch/arm/include/asm/kvm_arm.h >> @@ -49,7 +49,7 @@ >> #define HCR_SWIO (1 << 1) >> #define HCR_VM 1 >> #define HCR_GUEST_MASK (HCR_TSC | HCR_TWI | HCR_VM | HCR_BSU_IS | HCR_FB | \ >> - HCR_AMO | HCR_IMO | HCR_FMO | HCR_SWIO) >> + HCR_TAC | HCR_AMO | HCR_IMO | HCR_FMO | HCR_SWIO) >> #define HCR_VIRT_EXCP_MASK (HCR_VA | HCR_VI | HCR_VF) >> >> /* Hyp System Control Register (HSCTLR) bits */ >> diff --git a/arch/arm/kvm/emulate.c b/arch/arm/kvm/emulate.c >> index e356d1c..6eaa97d 100644 >> --- a/arch/arm/kvm/emulate.c >> +++ b/arch/arm/kvm/emulate.c >> @@ -238,6 +238,23 @@ static bool read_l2ctlr(struct kvm_vcpu *vcpu, >> return true; >> } >> >> +static bool read_actlr(struct kvm_vcpu *vcpu, >> + const struct coproc_params *p, >> + unsigned long arg) >> +{ >> + u32 actlr; >> + >> + asm volatile("mrc p15, 0, %0, c1, c0, 1\n" : "=r" (actlr)); >> + /* Make the SMP bit consistent with the guest configuration */ >> + if (atomic_read(&vcpu->kvm->online_vcpus) > 1) >> + actlr |= 1U << 6; > > should we not check the MIDR here since it's implementation defined? > (refer to Russel's "Check the cpuid we're being asked to emulate" > patch) Indeed, that's a very good point. I'll respin that patch. Thanks, M. -- Jazz is not dead. It just smells funny...