From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: [RFC 11/19] xen/passthrough: Call arch_iommu_domain_destroy before calling iommu_teardown Date: Mon, 16 Jun 2014 17:17:58 +0100 Message-ID: <1402935486-29136-12-git-send-email-julien.grall@linaro.org> References: <1402935486-29136-1-git-send-email-julien.grall@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WwZc7-0006mP-Vn for xen-devel@lists.xenproject.org; Mon, 16 Jun 2014 16:18:32 +0000 Received: by mail-we0-f171.google.com with SMTP id q58so5910128wes.2 for ; Mon, 16 Jun 2014 09:18:30 -0700 (PDT) In-Reply-To: <1402935486-29136-1-git-send-email-julien.grall@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: stefano.stabellini@citrix.com, Julien Grall , tim@xen.org, ian.campbell@citrix.com, Jan Beulich List-Id: xen-devel@lists.xenproject.org arch_iommu_domain_destroy contains specific architecture code. On x86, this code will clean up the ioport_list which is not used in both iommu (i.e AMD & x86) drivers. On ARM, the toolstack may not have deassign every device to the guest. Therefore, we have to go through the device list and removing them before asking the IOMMU drivers to release memory for this domain. This is done by iommu_dt_domain_destroy which is called by arch_iommu_domain_destroy. Signed-off-by: Julien Grall Cc: Jan Beulich --- xen/drivers/passthrough/iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c index 2e9b48d..d71ab03 100644 --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -219,10 +219,10 @@ void iommu_domain_destroy(struct domain *d) if ( !iommu_enabled || !hd->platform_ops ) return; + arch_iommu_domain_destroy(d); + if ( need_iommu(d) ) iommu_teardown(d); - - arch_iommu_domain_destroy(d); } int iommu_map_page(struct domain *d, unsigned long gfn, unsigned long mfn, -- 1.7.10.4