On 23/02/12 15:50, Alexander Graf wrote: > On 02/23/2012 02:51 PM, Marc Zyngier wrote: >> VMID is a 8bit field in VTTBR, and the top bits are better left alone. >> >> Signed-off-by: Marc Zyngier<marc.zyngier at arm.com> >> --- >> arch/arm/kvm/arm.c | 2 +- >> 1 files changed, 1 insertions(+), 1 deletions(-) >> >> diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c >> index 8dc723d..b402cd5 100644 >> --- a/arch/arm/kvm/arm.c >> +++ b/arch/arm/kvm/arm.c >> @@ -361,7 +361,7 @@ static void update_vttbr(struct kvm *kvm) >> pgd_phys = virt_to_phys(kvm->arch.pgd); >> kvm->arch.vttbr = pgd_phys& ((1LLU<< 40) - 1) >> & ~((2<< VTTBR_X) - 1); >> - kvm->arch.vttbr |= kvm->arch.vmid<< 48; >> + kvm->arch.vttbr |= (kvm->arch.vmid& VMID_MASK)<< 48; > > Why would vmid ever be > VMID_MASK? Shouldn't the setter do the mask > already? Because vmid = ((vmid_generation << VMID_BITS) | hw_vmid). So by definition, vmid is always > VMID_MASK, and we only want to program hw_vmid into VTTBR. M. -- Jazz is not dead. It just smells funny...