KVM: x86: revalidate steal time cache if MSR value changes
[linux-2.6-microblaze.git] / arch / x86 / kvm / x86.c
index 33560bf..0f3c2e0 100644 (file)
@@ -3414,6 +3414,7 @@ static void record_steal_time(struct kvm_vcpu *vcpu)
        struct gfn_to_hva_cache *ghc = &vcpu->arch.st.cache;
        struct kvm_steal_time __user *st;
        struct kvm_memslots *slots;
+       gpa_t gpa = vcpu->arch.st.msr_val & KVM_STEAL_VALID_BITS;
        u64 steal;
        u32 version;
 
@@ -3431,13 +3432,12 @@ static void record_steal_time(struct kvm_vcpu *vcpu)
        slots = kvm_memslots(vcpu->kvm);
 
        if (unlikely(slots->generation != ghc->generation ||
+                    gpa != ghc->gpa ||
                     kvm_is_error_hva(ghc->hva) || !ghc->memslot)) {
-               gfn_t gfn = vcpu->arch.st.msr_val & KVM_STEAL_VALID_BITS;
-
                /* We rely on the fact that it fits in a single page. */
                BUILD_BUG_ON((sizeof(*st) - 1) & KVM_STEAL_VALID_BITS);
 
-               if (kvm_gfn_to_hva_cache_init(vcpu->kvm, ghc, gfn, sizeof(*st)) ||
+               if (kvm_gfn_to_hva_cache_init(vcpu->kvm, ghc, gpa, sizeof(*st)) ||
                    kvm_is_error_hva(ghc->hva) || !ghc->memslot)
                        return;
        }