From patchwork Tue Apr 19 16:56:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 8881911 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9F2FE9F1C1 for ; Tue, 19 Apr 2016 17:00:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 883E9202B8 for ; Tue, 19 Apr 2016 17:00:04 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3B94D202AE for ; Tue, 19 Apr 2016 17:00:03 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1asYz9-00030v-NF; Tue, 19 Apr 2016 16:58:47 +0000 Received: from mail-wm0-x230.google.com ([2a00:1450:400c:c09::230]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1asYxn-000142-Bc for linux-arm-kernel@lists.infradead.org; Tue, 19 Apr 2016 16:57:24 +0000 Received: by mail-wm0-x230.google.com with SMTP id n3so40539807wmn.0 for ; Tue, 19 Apr 2016 09:57:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NtdRfxm7RSDMFIjOV8uCYRCPg879ufyA6k4dj+t1im8=; b=i/9dmmckDi+MI0v3hDTVdzY3X0jTRJPtSZhu9A2IByBB77ICKn0a9NaKdI5SlJ/Ci8 q2oqixCTFtwSF7nd52UvnKIVHZ7gHpW594xvOHZlLr9zF2jFGLc6OOAbmp6RvJaN2NaM CoNVP4/QpZ+5TacLCwCvbhGA1y1MfPJx6DZ+c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NtdRfxm7RSDMFIjOV8uCYRCPg879ufyA6k4dj+t1im8=; b=H4SXGcxV2S/oc7SPmCkPYOYvtrvvSbS/sZFc61ywCMbXFycvrGvb5Wmwevd/wZjuiK 69dsDrI6sbff+YvYfUjQGpNIw8xoT8jjcIJ+YZiRZrrU1zU9VufdL7O6GgGTyX9V4brV hyBNxQuj1pNZ7C1FK3xH83HJRSZakAFrJJI0uMzoZ0roeUz1FhVLtpbn8H0Ur4vqoyYH AhC3V2jgfxxyl0ssNoQegOQhM9eM2Qg4Tf9nb9GAVzAeOpyJEbi6ZCnQOkYhjDuYesdc QyXusktjLMt05S3/GTgbvyVnRBUG4eoRWpBnQ79D9Tf/2IyIMuKv8IPbTuV/0ou8ENuP uDuQ== X-Gm-Message-State: AOPr4FUix+Y4ufwbRIZMB8EKwIHAnxNEs+Sf8WYdtk/Mr+x9RYcTCTz0P/W5tBRZtC35Pbw+ X-Received: by 10.28.61.8 with SMTP id k8mr4786460wma.7.1461085022764; Tue, 19 Apr 2016 09:57:02 -0700 (PDT) Received: from new-host-34.home (LMontsouris-657-1-37-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by smtp.gmail.com with ESMTPSA id x2sm1169329wjr.33.2016.04.19.09.57.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Apr 2016 09:57:01 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, robin.murphy@arm.com, alex.williamson@redhat.com, will.deacon@arm.com, joro@8bytes.org, tglx@linutronix.de, jason@lakedaemon.net, marc.zyngier@arm.com, christoffer.dall@linaro.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v7 10/10] iommu/arm-smmu: call iommu_free_reserved_iova_domain on domain destruction Date: Tue, 19 Apr 2016 16:56:34 +0000 Message-Id: <1461084994-2355-11-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1461084994-2355-1-git-send-email-eric.auger@linaro.org> References: <1461084994-2355-1-git-send-email-eric.auger@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160419_095723_617037_8A35BB68 X-CRM114-Status: GOOD ( 12.23 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: julien.grall@arm.com, patches@linaro.org, Jean-Philippe.Brucker@arm.com, p.fedin@samsung.com, linux-kernel@vger.kernel.org, Bharat.Bhushan@freescale.com, iommu@lists.linux-foundation.org, pranav.sawargaonkar@gmail.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When the domain gets destroyed, let's make sure all reserved iova resources get released. Choice is made to put that call in arm-smmu(-v3).c to do something similar to what was done for iommu_put_dma_cookie. Signed-off-by: Eric Auger --- v7: new --- drivers/iommu/arm-smmu-v3.c | 2 ++ drivers/iommu/arm-smmu.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index a077a35..afd0dac 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -1444,6 +1445,7 @@ static void arm_smmu_domain_free(struct iommu_domain *domain) struct arm_smmu_device *smmu = smmu_domain->smmu; iommu_put_dma_cookie(domain); + iommu_free_reserved_iova_domain(domain); free_io_pgtable_ops(smmu_domain->pgtbl_ops); /* Free the CD and ASID, if we allocated them */ diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 8cd7b8a..492339f 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -1009,6 +1010,7 @@ static void arm_smmu_domain_free(struct iommu_domain *domain) * already been detached. */ iommu_put_dma_cookie(domain); + iommu_free_reserved_iova_domain(domain); arm_smmu_destroy_domain_context(domain); kfree(smmu_domain); }