Re: [RFC PATCH 02/12] KVM: x86/mmu: Add dedicated API to map guest_memfd pfn into TDP MMU
From: Sean Christopherson
Date: Thu Aug 28 2025 - 15:58:09 EST
On Thu, Aug 28, 2025, Rick P Edgecombe wrote:
> On Wed, 2025-08-27 at 19:40 -0500, Ira Weiny wrote:
> > > + .map_writable = true,
> >
> > Why is map_writable set? Doesn't this get translated into host_writable?
>
> I guess it's normally set only if it's a !KVM_MEM_READONLY slot for private
> faults memory.
map_writable can also be %false on read faults and the host userspace mapping
isn't writable.
> But that flag is invalid for gmem. So we should only have
> map_writable=true cases for tdx.
Yep. And not TDX specific, map_writable _must_ be true for write faults. The
reason there's two separate flags is so that KVM can opportunistically create a
writable mapping on read faults.