return r;
 }
 
-static void kvm_unsync_page(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp)
+static void kvm_unsync_page(struct kvm *kvm, struct kvm_mmu_page *sp)
 {
        trace_kvm_mmu_unsync_page(sp);
-       ++vcpu->kvm->stat.mmu_unsync;
+       ++kvm->stat.mmu_unsync;
        sp->unsync = 1;
 
        kvm_mmu_mark_parents_unsync(sp);
  * were marked unsync (or if there is no shadow page), -EPERM if the SPTE must
  * be write-protected.
  */
-int mmu_try_to_unsync_pages(struct kvm_vcpu *vcpu, struct kvm_memory_slot *slot,
+int mmu_try_to_unsync_pages(struct kvm *kvm, struct kvm_memory_slot *slot,
                            gfn_t gfn, bool can_unsync, bool prefetch)
 {
        struct kvm_mmu_page *sp;
         * track machinery is used to write-protect upper-level shadow pages,
         * i.e. this guards the role.level == 4K assertion below!
         */
-       if (kvm_slot_page_track_is_active(vcpu->kvm, slot, gfn, KVM_PAGE_TRACK_WRITE))
+       if (kvm_slot_page_track_is_active(kvm, slot, gfn, KVM_PAGE_TRACK_WRITE))
                return -EPERM;
 
        /*
         * that case, KVM must complete emulation of the guest TLB flush before
         * allowing shadow pages to become unsync (writable by the guest).
         */
-       for_each_gfn_indirect_valid_sp(vcpu->kvm, sp, gfn) {
+       for_each_gfn_indirect_valid_sp(kvm, sp, gfn) {
                if (!can_unsync)
                        return -EPERM;
 
                 */
                if (!locked) {
                        locked = true;
-                       spin_lock(&vcpu->kvm->arch.mmu_unsync_pages_lock);
+                       spin_lock(&kvm->arch.mmu_unsync_pages_lock);
 
                        /*
                         * Recheck after taking the spinlock, a different vCPU
                }
 
                WARN_ON(sp->role.level != PG_LEVEL_4K);
-               kvm_unsync_page(vcpu, sp);
+               kvm_unsync_page(kvm, sp);
        }
        if (locked)
-               spin_unlock(&vcpu->kvm->arch.mmu_unsync_pages_lock);
+               spin_unlock(&kvm->arch.mmu_unsync_pages_lock);
 
        /*
         * We need to ensure that the marking of unsync pages is visible
 
        return kvm_x86_ops.cpu_dirty_log_size && sp->role.guest_mode;
 }
 
-int mmu_try_to_unsync_pages(struct kvm_vcpu *vcpu, struct kvm_memory_slot *slot,
+int mmu_try_to_unsync_pages(struct kvm *kvm, struct kvm_memory_slot *slot,
                            gfn_t gfn, bool can_unsync, bool prefetch);
 
 void kvm_mmu_gfn_disallow_lpage(const struct kvm_memory_slot *slot, gfn_t gfn);
 
                 * e.g. it's write-tracked (upper-level SPs) or has one or more
                 * shadow pages and unsync'ing pages is not allowed.
                 */
-               if (mmu_try_to_unsync_pages(vcpu, slot, gfn, can_unsync, prefetch)) {
+               if (mmu_try_to_unsync_pages(vcpu->kvm, slot, gfn, can_unsync, prefetch)) {
                        pgprintk("%s: found shadow page for %llx, marking ro\n",
                                 __func__, gfn);
                        wrprot = true;