Commit 14af5d38 authored by Tvrtko Ursulin's avatar Tvrtko Ursulin

Merge tag 'gvt-fixes-2022-11-11' of https://github.com/intel/gvt-linux into drm-intel-fixes

gvt-fixes-2022-11-11

- kvm reference fix from Sean
Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
From: Zhenyu Wang <zhenyuw@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221111090208.GQ30028@zhen-hp.sh.intel.com
parents ebbaa439 3c9fd44b
...@@ -664,8 +664,6 @@ static int intel_vgpu_open_device(struct vfio_device *vfio_dev) ...@@ -664,8 +664,6 @@ static int intel_vgpu_open_device(struct vfio_device *vfio_dev)
return -ESRCH; return -ESRCH;
} }
kvm_get_kvm(vgpu->vfio_device.kvm);
if (__kvmgt_vgpu_exist(vgpu)) if (__kvmgt_vgpu_exist(vgpu))
return -EEXIST; return -EEXIST;
...@@ -676,6 +674,7 @@ static int intel_vgpu_open_device(struct vfio_device *vfio_dev) ...@@ -676,6 +674,7 @@ static int intel_vgpu_open_device(struct vfio_device *vfio_dev)
vgpu->track_node.track_write = kvmgt_page_track_write; vgpu->track_node.track_write = kvmgt_page_track_write;
vgpu->track_node.track_flush_slot = kvmgt_page_track_flush_slot; vgpu->track_node.track_flush_slot = kvmgt_page_track_flush_slot;
kvm_get_kvm(vgpu->vfio_device.kvm);
kvm_page_track_register_notifier(vgpu->vfio_device.kvm, kvm_page_track_register_notifier(vgpu->vfio_device.kvm,
&vgpu->track_node); &vgpu->track_node);
...@@ -715,15 +714,14 @@ static void intel_vgpu_close_device(struct vfio_device *vfio_dev) ...@@ -715,15 +714,14 @@ static void intel_vgpu_close_device(struct vfio_device *vfio_dev)
kvm_page_track_unregister_notifier(vgpu->vfio_device.kvm, kvm_page_track_unregister_notifier(vgpu->vfio_device.kvm,
&vgpu->track_node); &vgpu->track_node);
kvm_put_kvm(vgpu->vfio_device.kvm);
kvmgt_protect_table_destroy(vgpu); kvmgt_protect_table_destroy(vgpu);
gvt_cache_destroy(vgpu); gvt_cache_destroy(vgpu);
intel_vgpu_release_msi_eventfd_ctx(vgpu); intel_vgpu_release_msi_eventfd_ctx(vgpu);
vgpu->attached = false; vgpu->attached = false;
if (vgpu->vfio_device.kvm)
kvm_put_kvm(vgpu->vfio_device.kvm);
} }
static u64 intel_vgpu_get_bar_addr(struct intel_vgpu *vgpu, int bar) static u64 intel_vgpu_get_bar_addr(struct intel_vgpu *vgpu, int bar)
......
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