Re: [PATCH v3 1/1] KVM: arm64: Allow cacheable stage 2 mapping using VMA flags

From: Jason Gunthorpe
Date: Mon Apr 07 2025 - 12:28:12 EST


On Mon, Apr 07, 2025 at 08:20:09AM -0700, Sean Christopherson wrote:
> On Mon, Mar 31, 2025, Jason Gunthorpe wrote:
> > On Wed, Mar 26, 2025 at 11:24:32AM -0700, Sean Christopherson wrote:
> > > > I don't know how you reconcile the lack of host mapping and cache
> > > > maintenance. The latter cannot take place without the former.
> > >
> > > I assume cache maintenance only requires _a_ mapping to the physical memory.
> > > With guest_memfd, KVM has the pfn (which happens to always be struct page memory
> > > today), and so can establish a VA=>PA mapping as needed.
> >
> > This is why we are forcing FWB in this work, because we don't have a
> > VA mapping and KVM doesn't have the code to create one on demand.
>
> I don't follow. As it exists today, guest_memfd doesn't touch the direct map,
> i.e. there's already a kernel mapping, KVM doesn't need to create one.

This is not about guest_memfd..

When ARM KVM copies a PTE from a VMA's PTE into the S2 it may find
that the physical address does not have a struct page, in which case
it assumes the worst that it is not in the kmap and cannot be cache
flushed.

Jason