From: Jason Gunthorpe via iommu <iommu@lists.linux-foundation.org>
To: Robin Murphy <robin.murphy@arm.com>
Cc: Kevin Tian <kevin.tian@intel.com>,
Qian Cai <quic_qiancai@quicinc.com>,
iommu@lists.linux-foundation.org, Will Deacon <will@kernel.org>
Subject: Re: [PATCH] iommu: iommu_group_claim_dma_owner() must always assign a domain
Date: Wed, 4 May 2022 15:20:12 -0300 [thread overview]
Message-ID: <20220504182012.GA88647@nvidia.com> (raw)
In-Reply-To: <b3e79abf-646b-fa98-5a4d-26fdf5e550a9@arm.com>
On Wed, May 04, 2022 at 04:29:24PM +0100, Robin Murphy wrote:
> On 2022-05-04 15:54, Jason Gunthorpe wrote:
> > On Wed, May 04, 2022 at 03:42:09PM +0100, Robin Murphy wrote:
> >
> > > > This fixes an oops with VFIO and SMMUv3 because VFIO will call
> > > > iommu_detach_group() and then immediately iommu_domain_free(), but
> > > > SMMUv3 has no way to know that the domain it is holding a pointer to
> > > > has been freed. Now the iommu_detach_group() will assign the blocking
> > > > domain and SMMUv3 will no longer hold a stale domain reference.
> > >
> > > Thanks for taking this on! I do like the overall structure and naming much
> > > more than my initial sketch :)
> >
> > Thanks, no problem!
> > > > /*
> > > > - * If the group has been claimed already, do not re-attach the default
> > > > - * domain.
> > > > + * A NULL domain means to call the detach_dev() op. New drivers should
> > > > + * use a IOMMU_DOMAIN_IDENTITY domain instead of a NULL default_domain
> > >
> > > Nit: IOMMU_DOMAIN_DMA is the baseline of default domain support, passthrough
> > > is more of an optional extra.
> >
> > Can you elaborate on this a bit more for the comment, I'm not sure I
> > understand all the historical stuff here.
>
> Well, the comment could effectively just be "New drivers should support
> default domains."
I made it this:
/*
* New drivers should support default domains and so the detach_dev() op
* will never be called. Otheriwse the NULL domain indicates the
* translation for the group should be set so it will work with the
* platform DMA ops.
*/
It also seems clear to me we should delete a bunch of detach_dev ops
from drivers?
I naively see that these drivers have the word IOMMU_DOMAIN_DMA in
them and also define detach_dev:
amd iommu
apple-dart
qcom_iommu
exynos-iommu
intel iommu
ipmmu-vmsa
mtk_iommu
rockchip-iommu
sprd-iommu
sun50i-iommu
These ones have IOMMU_DOMAIN_DMA but don't define detach_dev:
arm-smmuv3
arm-smmu
virtio-iommu
And I suppose these are the 'old' drivers:
fsl_pamu
omap-iommu
tegra-gart
tegra-smmu
I can get a patch for this as well, I think it will be clarifying to
remove this cruft.
Thanks
Jason
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
prev parent reply other threads:[~2022-05-04 18:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-04 0:11 [PATCH] iommu: iommu_group_claim_dma_owner() must always assign a domain Jason Gunthorpe via iommu
2022-05-04 8:22 ` Nicolin Chen via iommu
2022-05-04 11:57 ` Jason Gunthorpe via iommu
2022-05-04 11:48 ` Baolu Lu
2022-05-04 11:53 ` Jason Gunthorpe via iommu
2022-05-04 14:35 ` Baolu Lu
2022-05-04 14:38 ` Jason Gunthorpe via iommu
2022-05-04 14:55 ` Baolu Lu
2022-05-04 15:00 ` Jason Gunthorpe via iommu
2022-05-04 14:42 ` Robin Murphy
2022-05-04 14:54 ` Jason Gunthorpe via iommu
2022-05-04 15:29 ` Robin Murphy
2022-05-04 18:20 ` Jason Gunthorpe via iommu [this message]
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=20220504182012.GA88647@nvidia.com \
--to=iommu@lists.linux-foundation.org \
--cc=jgg@nvidia.com \
--cc=kevin.tian@intel.com \
--cc=quic_qiancai@quicinc.com \
--cc=robin.murphy@arm.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