From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joerg Roedel Subject: Re: [PATCH v5 3/3] arm64: Hook up IOMMU dma_ops Date: Fri, 7 Aug 2015 10:55:17 +0200 Message-ID: <20150807085516.GW14980@8bytes.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Robin Murphy Cc: laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org, arnd-r2nGTMty4D4@public.gmane.org, catalin.marinas-5wv7dgnIgG8@public.gmane.org, will.deacon-5wv7dgnIgG8@public.gmane.org, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, djkurtz-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, thunder.leizhen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org, yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org, treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org List-Id: iommu@lists.linux-foundation.org On Fri, Jul 31, 2015 at 06:18:29PM +0100, Robin Murphy wrote: > +void arch_teardown_dma_ops(struct device *dev) > +{ > + struct iommu_domain *domain = iommu_get_domain_for_dev(dev); > + > + if (domain) { > + iommu_detach_device(domain, dev); > + if (domain->type & __IOMMU_DOMAIN_ARM64_IOVA) > + iommu_put_dma_cookie(domain); > + if (domain->type & __IOMMU_DOMAIN_ARM64) > + iommu_domain_free(domain); > + dev->archdata.dma_ops = NULL; > + } > +} When is this called? In case a device gets removed the IOMMU core and driver should take care of destroying the domain, at least when its a default-domain. This is part of the iommu-group handling. Joerg