Re: [PATCH v2 0/3] KVM: Fix and clean up kvm_vcpu_map[_readonly]() usages
From: David Woodhouse
Date: Fri Apr 24 2026 - 06:31:16 EST
On Tue, 2026-04-07 at 17:11 -0700, Peter Fang wrote:
> 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.
Fred is already removing all the usage of kvm_vcpu_map() in nested VMX¹
and nested SVM probably wants the same treatment. And the PowerPC one
looks like it could just as easily operate on the userspace address?
Could we just kill kvm_vcpu_map() completely?
¹ https://lore.kernel.org/kvm/20260102142429.896101-1-griffoul@xxxxxxxxx/
Attachment:
smime.p7s
Description: S/MIME cryptographic signature