From patchwork Fri Oct 6 13:31:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 9989501 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 44F0B6020F for ; Fri, 6 Oct 2017 13:50:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2212D28DBC for ; Fri, 6 Oct 2017 13:50:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1691128DB8; Fri, 6 Oct 2017 13:50:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B9A2F28DC4 for ; Fri, 6 Oct 2017 13:50:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=J9WgswGAPGduIvObJhDXZk0sGOf7YR0srEWK1eIMuTM=; b=pcuzo5kI4UFU0s2QlzPIgeRSLv x5FS4Qvxdi2S5R9pIgdV6FRK4MdGbmPdNk6r6S8iazixQ2Z6km0biKDvhwY8b3e7bV8+47G8m5zc9 qNew7/07x5yo2FDrDNj0u0XrbsEcH+73L03DrSJLqLjpt0CB+zrnLgxYpveE+q6szHD8Yr6RkKLrP 1UWmkDC7U1Z48r990HhoZFNwqs6ApojhXZNfxucvorrb/hsAPFHN42vbNG+egCSCfQ748051L1+NK IKec++/KX+nh3M4cIExWTRL7JkUSheRNBXBpAsXHVF3w9NCbmYI6BanvTTYUN+8v9Tem6+f/aevX3 rYCAGlBQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e0T1Y-0003yS-JC; Fri, 06 Oct 2017 13:50:44 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e0SxJ-0007ar-R0 for linux-arm-kernel@bombadil.infradead.org; Fri, 06 Oct 2017 13:46:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=UKVdY7tSN2p47dGneLI7UAPH0DcjyPPfzIZAgSh158s=; b=0ReMgXj7Wq9BAswYJsmPsF0Ll rCh9OE8x3TiwG6xTtj6//MVqYKwti48ohjdaVmIsaOxCB8ojx6DeHowYi6ZZUefE0gCt7SLI7qTem /RZk0V6HhNgKeHcaT+hRrJBlhBc0D/u2TE7XuXQYypfQ9Pf4H+aslb1qmitfAhLPV+WZyJNslVuzk gLGWVdPURum47AU/bKlT/MTKgqNiemNWau8oC8bpt7Z4BDArlAdG38SJCCZhUeKdpAhKJ3oonlNkx te1redBr3pmoXpWzOAXnfbFvAGCbotEYMWOMxJqBFcFv0my4TXyftFiHOVTjiqANEPa/CzdoOok8X 1U0iCb7OQ==; Received: from foss.arm.com ([217.140.101.70]) by merlin.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e0SiO-0002GY-F9 for linux-arm-kernel@lists.infradead.org; Fri, 06 Oct 2017 13:31:02 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CAFF51688; Fri, 6 Oct 2017 06:30:35 -0700 (PDT) Received: from e106794-lin.cambridge.arm.com (e106794-lin.cambridge.arm.com [10.1.211.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id F0E263F578; Fri, 6 Oct 2017 06:30:30 -0700 (PDT) From: Jean-Philippe Brucker To: linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, devicetree@vger.kernel.org, iommu@lists.linux-foundation.org Subject: [RFCv2 PATCH 32/36] iommu/arm-smmu-v3: Hook ATC invalidation to process ops Date: Fri, 6 Oct 2017 14:31:59 +0100 Message-Id: <20171006133203.22803-33-jean-philippe.brucker@arm.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20171006133203.22803-1-jean-philippe.brucker@arm.com> References: <20171006133203.22803-1-jean-philippe.brucker@arm.com> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, xieyisheng1@huawei.com, gabriele.paoloni@huawei.com, catalin.marinas@arm.com, will.deacon@arm.com, okaya@codeaurora.org, yi.l.liu@intel.com, lorenzo.pieralisi@arm.com, ashok.raj@intel.com, tn@semihalf.com, joro@8bytes.org, rfranz@cavium.com, lenb@kernel.org, jacob.jun.pan@linux.intel.com, alex.williamson@redhat.com, robh+dt@kernel.org, thunder.leizhen@huawei.com, bhelgaas@google.com, dwmw2@infradead.org, liubo95@huawei.com, rjw@rjwysocki.net, robdclark@gmail.com, hanjun.guo@linaro.org, sudeep.holla@arm.com, robin.murphy@arm.com, nwatters@codeaurora.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The core calls us when a process is modified. Perform the required ATC invalidations. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm-smmu-v3.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index d03bec4d4b82..f591f1974228 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -2839,7 +2839,7 @@ static void arm_smmu_process_detach(struct iommu_domain *domain, arm_smmu_write_ctx_desc(smmu_domain, process->pasid, NULL); } - /* TODO: Invalidate ATC. */ + arm_smmu_atc_inv_master_all(master, process->pasid); /* TODO: Invalidate all mappings if last and not DVM. */ } @@ -2847,8 +2847,9 @@ static void arm_smmu_process_invalidate(struct iommu_domain *domain, struct iommu_process *process, unsigned long iova, size_t size) { + arm_smmu_atc_inv_domain(to_smmu_domain(domain), process->pasid, + iova, size); /* - * TODO: Invalidate ATC. * TODO: Invalidate mapping if not DVM */ } @@ -2871,7 +2872,7 @@ static void arm_smmu_process_exit(struct iommu_domain *domain, domain->process_exit(domain, master->dev, process->pasid, domain->process_exit_token); - /* TODO: inval ATC */ + arm_smmu_atc_inv_master_all(master, process->pasid); } spin_unlock(&smmu_domain->devices_lock);