From: Jason Gunthorpe <jgg@nvidia.com>
To: Lu Baolu <baolu.lu@linux.intel.com>
Cc: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
Kevin Tian <kevin.tian@intel.com>,
shangsong2@lenovo.com, Dave Jiang <dave.jiang@intel.com>,
jack.vogel@oracle.com, iommu@lists.linux.dev,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v3 1/1] iommu: Allow attaching static domains in iommu_attach_device_pasid()
Date: Thu, 24 Apr 2025 10:48:26 -0300 [thread overview]
Message-ID: <20250424134826.GQ1648741@nvidia.com> (raw)
In-Reply-To: <20250424034123.2311362-1-baolu.lu@linux.intel.com>
On Thu, Apr 24, 2025 at 11:41:23AM +0800, Lu Baolu wrote:
> The idxd driver attaches the default domain to a PASID of the device to
> perform kernel DMA using that PASID. The domain is attached to the
> device's PASID through iommu_attach_device_pasid(), which checks if the
> domain->owner matches the iommu_ops retrieved from the device. If they
> do not match, it returns a failure.
>
> if (ops != domain->owner || pasid == IOMMU_NO_PASID)
> return -EINVAL;
>
> The static identity domain implemented by the intel iommu driver doesn't
> specify the domain owner. Therefore, kernel DMA with PASID doesn't work
> for the idxd driver if the device translation mode is set to passthrough.
>
> Generally the owner field of static domains are not set because they are
> already part of iommu ops. Add a helper domain_iommu_ops_compatible()
> that checks if a domain is compatible with the device's iommu ops. This
> helper explicitly allows the static blocked and identity domains associated
> with the device's iommu_ops to be considered compatible.
>
> Fixes: 2031c469f816 ("iommu/vt-d: Add support for static identity domain")
> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220031
> Cc: stable@vger.kernel.org
> Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
> Link: https://lore.kernel.org/linux-iommu/20250422191554.GC1213339@ziepe.ca/
> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
> Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> Reviewed-by: Robin Murphy <robin.murphy@arm.com>
> ---
> drivers/iommu/iommu.c | 21 ++++++++++++++++++---
> 1 file changed, 18 insertions(+), 3 deletions(-)
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Jason
next prev parent reply other threads:[~2025-04-24 13:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-24 3:41 [PATCH v3 1/1] iommu: Allow attaching static domains in iommu_attach_device_pasid() Lu Baolu
2025-04-24 4:52 ` Tian, Kevin
2025-04-24 6:49 ` Vasant Hegde
2025-04-24 6:54 ` Baolu Lu
2025-04-24 13:48 ` Jason Gunthorpe [this message]
[not found] ` <4764ACC2-6D38-4CAE-8A6B-451AB3DAF3E0@oracle.com>
2025-04-24 22:40 ` Dave Jiang
[not found] ` <0A18D37F-7457-49CC-9D67-369A3A8C9E7E@oracle.com>
2025-04-24 23:15 ` Dave Jiang
[not found] ` <C85B4AA4-793D-45CA-915A-4C7F4FB4CA64@oracle.com>
2025-04-25 1:00 ` Dave Jiang
2025-04-28 11:24 ` Joerg Roedel
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=20250424134826.GQ1648741@nvidia.com \
--to=jgg@nvidia.com \
--cc=baolu.lu@linux.intel.com \
--cc=dave.jiang@intel.com \
--cc=iommu@lists.linux.dev \
--cc=jack.vogel@oracle.com \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=shangsong2@lenovo.com \
--cc=stable@vger.kernel.org \
--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