Re: [PATCH v9 6/6] KVM: arm64: Expose new KVM cap for cacheable PFNMAP
From: Jason Gunthorpe
Date: Fri Jul 04 2025 - 09:46:08 EST
On Sat, Jun 21, 2025 at 04:21:11AM +0000, ankita@xxxxxxxxxx wrote:
> From: Ankit Agrawal <ankita@xxxxxxxxxx>
>
> Introduce a new KVM capability to expose to the userspace whether
> cacheable mapping of PFNMAP is supported.
>
> The ability to safely do the cacheable mapping of PFNMAP is contingent
> on S2FWB and ARM64_HAS_CACHE_DIC. S2FWB allows KVM to avoid flushing
> the D cache, ARM64_HAS_CACHE_DIC allows KVM to avoid flushing the icache
> and turns icache_inval_pou() into a NOP. The cap would be false if
> those requirements are missing and is checked by making use of
> kvm_arch_supports_cacheable_pfnmap.
>
> This capability would allow userspace to discover the support.
> It could for instance be used by userspace to prevent live-migration
> across FWB and non-FWB hosts.
>
> CC: Catalin Marinas <catalin.marinas@xxxxxxx>
> CC: Jason Gunthorpe <jgg@xxxxxxxxxx>
> CC: Oliver Upton <oliver.upton@xxxxxxxxx>
> CC: David Hildenbrand <david@xxxxxxxxxx>
> Suggested-by: Marc Zyngier <maz@xxxxxxxxxx>
> Signed-off-by: Ankit Agrawal <ankita@xxxxxxxxxx>
> ---
> Documentation/virt/kvm/api.rst | 13 ++++++++++++-
> arch/arm64/kvm/arm.c | 7 +++++++
> include/uapi/linux/kvm.h | 1 +
> 3 files changed, 20 insertions(+), 1 deletion(-)
I don't know if any VMM will ever use this, but it looks OK
Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
Jason