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

From: Peter Fang

Date: Mon Apr 27 2026 - 04:06:19 EST


On Fri, Apr 24, 2026 at 11:27:03AM +0100, David Woodhouse wrote:
>
> 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?

Thanks David!

I think I'd need at least input from the maintainers on this but just by
code inspection, the kvm_vcpu_map() usage in sev.c seems a bit tricky.
Unmapping doesn't happen until right before switching to the guest, so
this might fall into the "keep the mapping around for a longer time"
category [1].

[1] https://lore.kernel.org/kvm/20211115165030.7422-8-dwmw2@xxxxxxxxxxxxx/

>
>
>
> ¹ https://lore.kernel.org/kvm/20260102142429.896101-1-griffoul@xxxxxxxxx/