Re: [PATCH v9 6/6] KVM: arm64: Expose new KVM cap for cacheable PFNMAP

David Hildenbrand
2025-07-04T14:33:20Z

On 04.07.25 15:44, Jason Gunthorpe wrote:
> On Sat, Jun 21, 2025 at 04:21:11AM +0000, ankita@nvidia.com wrote:
>> From: Ankit Agrawal <ankita@nvidia.com>
>>
>> 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@arm.com>
>> CC: Jason Gunthorpe <jgg@nvidia.com>
>> CC: Oliver Upton <oliver.upton@linux.dev>
>> CC: David Hildenbrand <david@redhat.com>
>> Suggested-by: Marc Zyngier <maz@kernel.org>
>> Signed-off-by: Ankit Agrawal <ankita@nvidia.com>
>> ---
>> 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

So, should we defer it to the point where we actually have a use case?

I mean, patch #4 could be simplified by modifying arm64 code in patch #5
only. No need for a common kvm_arch function etc.

--
Cheers,

David / dhildenb