From: jsg Date: Tue, 19 Sep 2023 12:34:56 +0000 (+0000) Subject: drm/i915/gvt: Put the page reference obtained by KVM's gfn_to_pfn() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=5632c07a3087dc357ccaaff83fc7c2db555fd8e0;p=openbsd drm/i915/gvt: Put the page reference obtained by KVM's gfn_to_pfn() From Sean Christopherson 2b7510bb92c1fc19292801778e971cbb46e2499f in linux-6.1.y/6.1.54 708e49583d7da863898b25dafe4bcd799c414278 in mainline linux --- diff --git a/sys/dev/pci/drm/i915/gvt/gtt.c b/sys/dev/pci/drm/i915/gvt/gtt.c index 41c2bb49868..0bc3fe7fca8 100644 --- a/sys/dev/pci/drm/i915/gvt/gtt.c +++ b/sys/dev/pci/drm/i915/gvt/gtt.c @@ -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,