From patchwork Mon Jun 16 16:17:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 31989 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f197.google.com (mail-ie0-f197.google.com [209.85.223.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4E05621379 for ; Mon, 16 Jun 2014 16:20:11 +0000 (UTC) Received: by mail-ie0-f197.google.com with SMTP id lx4sf33723973iec.4 for ; Mon, 16 Jun 2014 09:20:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :list-archive:content-type:content-transfer-encoding; bh=e9/Rv8/FBFZCRRQIGY/Xl91fJZm2C40IG6V7F3PhFR8=; b=YjHCTBQLPZAHd7k0EUdLNw5Pvuup9K7IJZrn4Ao/DyvRoJr5Zv/W7bGU9n4+Xt1stw EVP8HoXMpLkgNdle/ALEJk0fupwR/MGQn19I+t43Cypw++TMW9bmduBdeKL9lQ9+7vVI CQ3WP9Xyz0SkbQhL0B7rW9yPhzTaCAfubGib4fQTs+EkajNUEpV9T1R19WdnBGrbpESc nIagkmAam0UacL2QKnkjfZ9FjZq5aXICzE8PF1D/o6d5ZwpsZCLAyS2+pJH8hcUZRTYg KGVA8XzXrPADhsO4x+jWzyD9gyP6hpVPV0IqGiYGa/onc/JyIcHUaRMVN95i1hz/hk0H TMlA== X-Gm-Message-State: ALoCoQlqvoQmgGN8UhUoJJdSG6s0J2NklxRUpf0C7Ok6hSZvko8qgSiFdE+GbP8JoJetqnX/zApe X-Received: by 10.182.51.228 with SMTP id n4mr1758510obo.28.1402935610877; Mon, 16 Jun 2014 09:20:10 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.24.181 with SMTP id 50ls4410214qgr.92.gmail; Mon, 16 Jun 2014 09:20:10 -0700 (PDT) X-Received: by 10.220.183.4 with SMTP id ce4mr896121vcb.54.1402935610776; Mon, 16 Jun 2014 09:20:10 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id or9si4282869vcb.81.2014.06.16.09.20.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Jun 2014 09:20:10 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id id10so5284114vcb.30 for ; Mon, 16 Jun 2014 09:20:10 -0700 (PDT) X-Received: by 10.58.220.230 with SMTP id pz6mr16782973vec.9.1402935610707; Mon, 16 Jun 2014 09:20:10 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.54.6 with SMTP id vs6csp146185vcb; Mon, 16 Jun 2014 09:20:10 -0700 (PDT) X-Received: by 10.140.102.163 with SMTP id w32mr6061364qge.97.1402935608544; Mon, 16 Jun 2014 09:20:08 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id x10si13814343qar.52.2014.06.16.09.20.08 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 16 Jun 2014 09:20:08 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WwZc9-0006o3-8Z; Mon, 16 Jun 2014 16:18:33 +0000 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: from [193.109.254.147:12960] by server-11.bemta-14.messagelabs.com id CB/8F-09902-7D81F935; Mon, 16 Jun 2014 16:18:31 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-4.tower-27.messagelabs.com!1402935510!11611152!1 X-Originating-IP: [74.125.82.171] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 5608 invoked from network); 16 Jun 2014 16:18:30 -0000 Received: from mail-we0-f171.google.com (HELO mail-we0-f171.google.com) (74.125.82.171) by server-4.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 16 Jun 2014 16:18:30 -0000 Received: by mail-we0-f171.google.com with SMTP id q58so5910128wes.2 for ; Mon, 16 Jun 2014 09:18:30 -0700 (PDT) X-Received: by 10.180.149.240 with SMTP id ud16mr29201952wib.3.1402935510377; Mon, 16 Jun 2014 09:18:30 -0700 (PDT) Received: from belegaer.uk.xensource.com ([185.25.64.249]) by mx.google.com with ESMTPSA id l45sm34836161eep.25.2014.06.16.09.18.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Jun 2014 09:18:29 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 16 Jun 2014 17:17:58 +0100 Message-Id: <1402935486-29136-12-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1402935486-29136-1-git-send-email-julien.grall@linaro.org> References: <1402935486-29136-1-git-send-email-julien.grall@linaro.org> Cc: stefano.stabellini@citrix.com, Julien Grall , tim@xen.org, ian.campbell@citrix.com, Jan Beulich Subject: [Xen-devel] [RFC 11/19] xen/passthrough: Call arch_iommu_domain_destroy before calling iommu_teardown X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: 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,