KVM: Provide refcounted page as output field in struct kvm_follow_pfn
authorSean Christopherson <seanjc@google.com>
Thu, 10 Oct 2024 18:23:29 +0000 (11:23 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 25 Oct 2024 16:57:59 +0000 (12:57 -0400)
commit3dd48ecfac7fdbcba397a6378ab93c3a9b3cb802
tree106d106422b982af1314fc0dcee374d59a71dc08
parent12fac89950996e556a99eb16f0359307ed4c2566
KVM: Provide refcounted page as output field in struct kvm_follow_pfn

Add kvm_follow_pfn.refcounted_page as an output for the "to pfn" APIs to
"return" the struct page that is associated with the returned pfn (if KVM
acquired a reference to the page).  This will eventually allow removing
KVM's hacky kvm_pfn_to_refcounted_page() code, which is error prone and
can't detect pfns that are valid, but aren't (currently) refcounted.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-ID: <20241010182427.1434605-28-seanjc@google.com>
virt/kvm/kvm_main.c
virt/kvm/kvm_mm.h