Re: [PATCH v3 1/1] KVM: arm64: Allow cacheable stage 2 mapping using VMA flags
From: Ankit Agrawal
Date: Tue Mar 11 2025 - 08:15:50 EST
Thanks Marc for the feedback.
> No, I'm concerned that a well established API (populating a memslot)
> works in some case and doesn't work in another without a clear
> indication of *why* we have this behaviour.
>
> To me, this indicates that userspace needs to buy in this new
> behaviour, and that behaviour needs to be advertised by a capability,
> which is in turn conditional on FWB.
Yes, that makes sense.
>>> Perhaps we can gracefully fall back to the default device mapping
>>> in such case? But that would cause VM to crash as soon as it makes some
>>> access violating DEVICE_nGnRE.
>
> Which would now be a regression...
>
> My take is that this cacheable PNFMAP contraption must only be exposed
> to a guest if FWB is available. We can't prevent someone to do an
> mmap() behind our back, but we can at least:
>
> - tell userspace whether this is supported
For my education, what is an accepted way to communicate this? Please let
me know if there are any relevant examples that you may be aware of.
I suppose just checking for FWB (for PFNMAP) and returning some sort of
an error on userspace mmap will not be enough of a hint here?
> - only handle the fault if userspace has bought in this mode
> - report the fault to userspace for it to fix things otherwise
>
> M.
>
> --
> Without deviation from the norm, progress is not possible.