From: Jason Gunthorpe <jgg@ziepe.ca>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: Wencheng Yang <east.moutain.yang@gmail.com>,
Joerg Roedel <joro@8bytes.org>,
Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
kvm@vger.kernel.org
Subject: Re: [PATCH v2] drviers/iommu/amd: support P2P access through IOMMU when SME is enabled
Date: Tue, 21 Jan 2025 16:47:58 -0400 [thread overview]
Message-ID: <20250121204758.GR674319@ziepe.ca> (raw)
In-Reply-To: <20250121083443.3984579a.alex.williamson@redhat.com>
On Tue, Jan 21, 2025 at 08:34:43AM -0700, Alex Williamson wrote:
> This description is unclear to me. As others have noted, we probably
> need to look at whether the flag should be automatically applied by the
> kernel. We certainly know in the vfio IOMMU layer whether we're
> mapping a page or a pfnmap.
It is not page or pfnmap.. When vfio is using follow_pte() it should
extract information from the PTE and then relay it to the IOMMU. The
iommu page table and the CPU page table should have the same PTE
flags.
So, a pte that is pgprot_cached() should be IOMMU_CACHE, otherwise
IOMMU_MMIO.
The encrypted bit in the PTE should be mapped to some new
IOMMU_ENCRYPTED.
I suspect AMD has created a troublesome issue that IOMMU_CACHE
conditionally implies encrypted depending on their platform features
(meaning cachable decrypted is impossible). Arguably a higher level
should be deciding this and the iommu page table code should simply
follow IOMMU_ENCRYPTED always.
That might be something for later, but I would note it :\
> In any case, we're in the process of phasing out the vfio type1
> IOMMU backend for iommufd, so whatever the implementation, and
> especially if there's a uapi component, it needs to be implemented
> in iommufd first.
Since iommufd won't be using follow_pte() it will have to get this
meta information from the FD, eg through DMABUf, and there is a huge
thread on how to go about doing that..
There should be no uapi component.
Jason
next prev parent reply other threads:[~2025-01-21 20:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-17 7:14 [PATCH v2] drviers/iommu/amd: support P2P access through IOMMU when SME is enabled Wencheng Yang
2025-01-17 13:44 ` Alex Williamson
2025-01-21 11:07 ` Wencheng Yang
2025-01-21 11:28 ` [PATCH v3 1/3] uapi/linux/vfio:Add VFIO_DMA_MAP_FLAG_MMIO flag Wencheng Yang
2025-01-21 11:28 ` [PATCH v3 2/3] vfio/vfio_iommu_type1:convert VFIO_DMA_MAP_FLAG_MMIO to IOMMU_MMIO flag Wencheng Yang
2025-01-21 11:28 ` [PATCH v3 3/3] iommu/amd:Clear encryption bit if the mapping is for device MMIO Wencheng Yang
2025-01-21 14:05 ` [PATCH v3 1/3] uapi/linux/vfio:Add VFIO_DMA_MAP_FLAG_MMIO flag Jason Gunthorpe
2025-01-21 15:34 ` [PATCH v2] drviers/iommu/amd: support P2P access through IOMMU when SME is enabled Alex Williamson
2025-01-21 20:47 ` Jason Gunthorpe [this message]
2025-01-20 13:59 ` Jason Gunthorpe
2025-01-21 9:27 ` Wencheng Yang
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=20250121204758.GR674319@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=alex.williamson@redhat.com \
--cc=east.moutain.yang@gmail.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=suravee.suthikulpanit@amd.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