drm/i915/gvt: Put the page reference obtained by KVM's gfn_to_pfn()
authorjsg <jsg@openbsd.org>
Tue, 19 Sep 2023 12:34:56 +0000 (12:34 +0000)
committerjsg <jsg@openbsd.org>
Tue, 19 Sep 2023 12:34:56 +0000 (12:34 +0000)
From Sean Christopherson
2b7510bb92c1fc19292801778e971cbb46e2499f in linux-6.1.y/6.1.54
708e49583d7da863898b25dafe4bcd799c414278 in mainline linux

sys/dev/pci/drm/i915/gvt/gtt.c

index 41c2bb4..0bc3fe7 100644 (file)
@@ -1179,6 +1179,7 @@ static int is_2MB_gtt_possible(struct intel_vgpu *vgpu,
 {
        const struct intel_gvt_gtt_pte_ops *ops = vgpu->gvt->gtt.pte_ops;
        kvm_pfn_t pfn;
+       int ret;
 
        if (!HAS_PAGE_SIZES(vgpu->gvt->gt->i915, I915_GTT_PAGE_SIZE_2M))
                return 0;
@@ -1192,7 +1193,9 @@ static int is_2MB_gtt_possible(struct intel_vgpu *vgpu,
        if (!pfn_valid(pfn))
                return -EINVAL;
 
-       return PageTransHuge(pfn_to_page(pfn));
+       ret = PageTransHuge(pfn_to_page(pfn));
+       kvm_release_pfn_clean(pfn);
+       return ret;
 }
 
 static int split_2MB_gtt_entry(struct intel_vgpu *vgpu,