From: Xu Yilun <yilun.xu@linux.intel.com>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Sean Christopherson <seanjc@google.com>,
Ackerley Tng <ackerleytng@google.com>,
Alexey Kardashevskiy <aik@amd.com>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
Kevin Tian <kevin.tian@intel.com>, Joerg Roedel <joro@8bytes.org>,
Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Steve Sistare <steven.sistare@oracle.com>,
Nicolin Chen <nicolinc@nvidia.com>,
iommu@lists.linux.dev, linux-coco@lists.linux.dev,
Dan Williams <dan.j.williams@intel.com>,
Santosh Shukla <santosh.shukla@amd.com>,
"Pratik R . Sampat" <prsampat@amd.com>,
Fuad Tabba <tabba@google.com>,
"Aneesh Kumar K . V" <aneesh.kumar@kernel.org>,
michael.roth@amd.com, vannapurve@google.com
Subject: Re: [RFC PATCH kernel] iommufd: Allow mapping from KVM's guest_memfd
Date: Sat, 28 Feb 2026 12:14:25 +0800 [thread overview]
Message-ID: <aaJroUzTZXZfbRAl@yilunxu-OptiPlex-7050> (raw)
In-Reply-To: <20260227131815.GG44359@ziepe.ca>
On Fri, Feb 27, 2026 at 09:18:15AM -0400, Jason Gunthorpe wrote:
> On Fri, Feb 27, 2026 at 06:35:44PM +0800, Xu Yilun wrote:
>
> > Will cause host machine check and host restart, same as host CPU
> > accessing encrypted memory. Intel TDX has no lower level privilege
> > protection table so the wrong accessing will actually impact the
> > memory encryption engine.
>
> Blah, of course it does.
>
> So Intel needs a two step synchronization to wipe the IOPTEs before
> any shared private conversions and restore the right ones after.
Mainly about shared IOPTE (for both T=0 table & T=1 table): "unmap
before conversion to private" & "map after conversion to shared"
I see there are already some consideration in QEMU to support in-place
conversion + shared passthrough [*], using uptr, but seems that's
exactly what you are objecting to.
[*]: https://lore.kernel.org/all/18f64464-2ead-42d4-aeaa-f781020dca05@intel.com/
For Intel, T=1 private IOPTE reuses S-EPT, this is the real CC business
and the correctness is managed by KVM & firmware, no notification
needed.
Further more, I think "unmap shared IOPTE before conversion to private"
may be the only concern to ensure kernel safety, other steps could be
fully left to userspace. Hope the downgrading from "remap" to
"invalidate" simplifies the notification.
>
> AMD needs a nasty HW synchronization with RMP changes, but otherwise
> wants to map the entire physical space.
>
> ARM doesn't care much, I think it could safely do either approach?
>
> These are very different behaviors so I would expect that userspace
> needs to signal which of the two it wants.
>
> It feels like we need a fairly complex dedicated synchronization logic
> in iommufd coupled to the shared/private machinery in guestmemfd
>
> Not really sure how to implement the Intel version right now, it is
> sort of like a nasty version of SVA..
>
> Jason
next prev parent reply other threads:[~2026-02-28 4:34 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-25 7:52 [RFC PATCH kernel] iommufd: Allow mapping from KVM's guest_memfd Alexey Kardashevskiy
2026-02-25 13:55 ` Sean Christopherson
2026-02-26 6:47 ` Alexey Kardashevskiy
2026-02-26 19:27 ` Jason Gunthorpe
2026-02-27 11:03 ` Xu Yilun
2026-02-26 8:19 ` Ackerley Tng
2026-02-26 19:07 ` Jason Gunthorpe
2026-02-26 22:40 ` Sean Christopherson
2026-02-27 0:21 ` Jason Gunthorpe
2026-02-27 0:28 ` Sean Christopherson
2026-02-27 1:09 ` Jason Gunthorpe
2026-02-27 10:35 ` Xu Yilun
2026-02-27 13:18 ` Jason Gunthorpe
2026-02-28 4:14 ` Xu Yilun [this message]
2026-02-28 18:29 ` Jason Gunthorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aaJroUzTZXZfbRAl@yilunxu-OptiPlex-7050 \
--to=yilun.xu@linux.intel.com \
--cc=ackerleytng@google.com \
--cc=aik@amd.com \
--cc=aneesh.kumar@kernel.org \
--cc=dan.j.williams@intel.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@ziepe.ca \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-coco@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.roth@amd.com \
--cc=nicolinc@nvidia.com \
--cc=pbonzini@redhat.com \
--cc=prsampat@amd.com \
--cc=robin.murphy@arm.com \
--cc=santosh.shukla@amd.com \
--cc=seanjc@google.com \
--cc=steven.sistare@oracle.com \
--cc=tabba@google.com \
--cc=vannapurve@google.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox