Commit e36b250e authored by Paolo Bonzini's avatar Paolo Bonzini

i915: kvmgt: the KVM mmu_lock is now an rwlock

Adjust the KVMGT page tracking callbacks.

Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
Cc: Zhi Wang <zhi.a.wang@intel.com>
Cc: intel-gvt-dev@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent a8ac864a
...@@ -1703,7 +1703,7 @@ static int kvmgt_page_track_add(unsigned long handle, u64 gfn) ...@@ -1703,7 +1703,7 @@ static int kvmgt_page_track_add(unsigned long handle, u64 gfn)
return -EINVAL; return -EINVAL;
} }
spin_lock(&kvm->mmu_lock); write_lock(&kvm->mmu_lock);
if (kvmgt_gfn_is_write_protected(info, gfn)) if (kvmgt_gfn_is_write_protected(info, gfn))
goto out; goto out;
...@@ -1712,7 +1712,7 @@ static int kvmgt_page_track_add(unsigned long handle, u64 gfn) ...@@ -1712,7 +1712,7 @@ static int kvmgt_page_track_add(unsigned long handle, u64 gfn)
kvmgt_protect_table_add(info, gfn); kvmgt_protect_table_add(info, gfn);
out: out:
spin_unlock(&kvm->mmu_lock); write_unlock(&kvm->mmu_lock);
srcu_read_unlock(&kvm->srcu, idx); srcu_read_unlock(&kvm->srcu, idx);
return 0; return 0;
} }
...@@ -1737,7 +1737,7 @@ static int kvmgt_page_track_remove(unsigned long handle, u64 gfn) ...@@ -1737,7 +1737,7 @@ static int kvmgt_page_track_remove(unsigned long handle, u64 gfn)
return -EINVAL; return -EINVAL;
} }
spin_lock(&kvm->mmu_lock); write_lock(&kvm->mmu_lock);
if (!kvmgt_gfn_is_write_protected(info, gfn)) if (!kvmgt_gfn_is_write_protected(info, gfn))
goto out; goto out;
...@@ -1746,7 +1746,7 @@ static int kvmgt_page_track_remove(unsigned long handle, u64 gfn) ...@@ -1746,7 +1746,7 @@ static int kvmgt_page_track_remove(unsigned long handle, u64 gfn)
kvmgt_protect_table_del(info, gfn); kvmgt_protect_table_del(info, gfn);
out: out:
spin_unlock(&kvm->mmu_lock); write_unlock(&kvm->mmu_lock);
srcu_read_unlock(&kvm->srcu, idx); srcu_read_unlock(&kvm->srcu, idx);
return 0; return 0;
} }
...@@ -1772,7 +1772,7 @@ static void kvmgt_page_track_flush_slot(struct kvm *kvm, ...@@ -1772,7 +1772,7 @@ static void kvmgt_page_track_flush_slot(struct kvm *kvm,
struct kvmgt_guest_info *info = container_of(node, struct kvmgt_guest_info *info = container_of(node,
struct kvmgt_guest_info, track_node); struct kvmgt_guest_info, track_node);
spin_lock(&kvm->mmu_lock); write_lock(&kvm->mmu_lock);
for (i = 0; i < slot->npages; i++) { for (i = 0; i < slot->npages; i++) {
gfn = slot->base_gfn + i; gfn = slot->base_gfn + i;
if (kvmgt_gfn_is_write_protected(info, gfn)) { if (kvmgt_gfn_is_write_protected(info, gfn)) {
...@@ -1781,7 +1781,7 @@ static void kvmgt_page_track_flush_slot(struct kvm *kvm, ...@@ -1781,7 +1781,7 @@ static void kvmgt_page_track_flush_slot(struct kvm *kvm,
kvmgt_protect_table_del(info, gfn); kvmgt_protect_table_del(info, gfn);
} }
} }
spin_unlock(&kvm->mmu_lock); write_unlock(&kvm->mmu_lock);
} }
static bool __kvmgt_vgpu_exist(struct intel_vgpu *vgpu, struct kvm *kvm) static bool __kvmgt_vgpu_exist(struct intel_vgpu *vgpu, struct kvm *kvm)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment