[PATCH 16/20] iommu/sun50i: Add an IOMMU_IDENTITIY_DOMAIN
Jason Gunthorpe
jgg at nvidia.com
Wed May 3 09:49:17 PDT 2023
On Wed, May 03, 2023 at 04:54:28PM +0100, Robin Murphy wrote:
>
> On 2023-05-01 19:03, Jason Gunthorpe wrote:
> > This brings back the ops->detach_dev() code that commit
> > 1b932ceddd19 ("iommu: Remove detach_dev callbacks") deleted and turns it
> > into an IDENTITY domain.
> >
> > Signed-off-by: Jason Gunthorpe <jgg at nvidia.com>
> > ---
> > drivers/iommu/sun50i-iommu.c | 21 +++++++++++++++++++++
> > 1 file changed, 21 insertions(+)
> >
> > diff --git a/drivers/iommu/sun50i-iommu.c b/drivers/iommu/sun50i-iommu.c
> > index 74c5cb93e90027..15fd62d360778f 100644
> > --- a/drivers/iommu/sun50i-iommu.c
> > +++ b/drivers/iommu/sun50i-iommu.c
> > @@ -772,6 +772,26 @@ static void sun50i_iommu_detach_device(struct iommu_domain *domain,
> > sun50i_iommu_detach_domain(iommu, sun50i_domain);
> > }
> > +static int sun50i_iommu_identity_attach(struct iommu_domain *identity_domain,
> > + struct device *dev)
> > +{
> > + struct sun50i_iommu *iommu = dev_iommu_priv_get(dev);
> > +
> > + if (iommu->domain == identity_domain || !iommu->domain)
>
> I don't think that first condition could ever be true.
Oh yes, this needs more work.. I folded sun50i_iommu_detach_device()
into sun50i_iommu_identity_attach() and made iommu->domain be set to
identity immediately after allocation. Now it can't be NULL
Thanks
Jason
More information about the Linux-mediatek
mailing list