[PATCH v2 0/3] KVM: Fix and clean up kvm_vcpu_map[_readonly]() usages

Peter Fang peter.fang at intel.com
Wed Apr 8 10:11:27 AEST 2026


kvm_vcpu_map() and kvm_vcpu_map_readonly() are declared to take a gpa_t
in kvm_host.h when they're supposed to take a gfn_t. First fix the
function prototypes, and then refactor them to correctly take a gpa_t,
reducing boilerplate gpa->gfn conversions at all call sites.

No actual harm has been done yet as all of the call sites are correctly
passing in a gfn.

No functional change intended. All changes are compile-tested on x86 and
ppc, which are the current users of these APIs.

---

v1 -> v2:
  - Rebased on top of latest kvm.git#master
  - As suggested by Yosry, refactor the APIs to reduce boilerplate code
    at call sites

v1: https://lore.kernel.org/kvm/20260325092001.613025-1-peter.fang@intel.com/

Peter Fang (3):
  KVM: Fix kvm_vcpu_map[_readonly]() function prototypes
  KVM: Move page mapping/unmapping APIs in kvm_host.h
  KVM: Take gpa_t in kvm_vcpu_map[_readonly]()

 arch/powerpc/kvm/book3s_pr.c |  2 +-
 arch/x86/kvm/svm/nested.c    |  4 ++--
 arch/x86/kvm/svm/sev.c       |  2 +-
 arch/x86/kvm/svm/svm.c       |  8 +++----
 arch/x86/kvm/vmx/nested.c    | 11 ++++-----
 include/linux/kvm_host.h     | 46 ++++++++++++++++++------------------
 6 files changed, 36 insertions(+), 37 deletions(-)


base-commit: df83746075778958954aa0460cca55f4b3fc9c02
-- 
2.53.0



More information about the Linuxppc-dev mailing list