summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2023-09-19 12:34:57 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2023-09-19 12:34:57 +0000
commitd1ba1622eef8f4a92f65aed60fe81a314e14e98f (patch)
tree593e7e57ca2d2f8940b56a95ed5f14a0c3c0459d /sys/dev
parentaa02726aa01dba85fc1761c0a8c2ba05747215ce (diff)
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
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/drm/i915/gvt/gtt.c5
1 files changed, 4 insertions, 1 deletions
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,