Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp327108imm; Thu, 31 May 2018 00:48:02 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKXZXZ2Udux++1XmJdh+I+EH82eMZSFd3SrX1P8JSRDPzFyjPJuIbKkggrIETPRAZLXTjMa X-Received: by 2002:a63:69c4:: with SMTP id e187-v6mr4660657pgc.415.1527752882180; Thu, 31 May 2018 00:48:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527752882; cv=none; d=google.com; s=arc-20160816; b=WGkSernKife6lO1FfcvLUIktgFhrXFB3JNa26nsH7+zXhPulJJ0g1BmG1gxkYvHDCP rWS6zMAXQc3VI9RDX7MeYpgZ6c/fds6atwBJ5L1TB4Yj0aV5IOMCLJm8V7I4PLD0ltQ0 VKeFYvlc5aNEGiCzuxb/AmoTPkLOrSwghDxzDyzNPynpJBqk1q2BQj4B45ydIw8QjcKm TJ8JGDVZPuJAUgtbn2b8e98Z6lmXA6VAXNqIPuKgpEnnWChFQirmbys06i/gdiIyrq1H Dr8mIyIbP2Xh0vRhsFWDyQUqaVoEM7YmFk0xnOhOP1scKtFqcUTZ/RLTX7wnSUDyrOU6 irJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=I/2axhcNhjsdRlubO+OmbKAV1yFMjMZQpt9UX5MkvFk=; b=qX7PgXhz+I4q1WmrzOT3+qjRx+M3+w0oaGModSj7APxwO4C32KinPy6isBVzNbyFIL +d/j/kVShbY+MEQTCuQNC1Dalv6WLo753vVCKqtVoq+HTwdIaZL4XnR5o+UCI4sjK4zi D3gwyRZM5idahgCZEhjnbbTVt4hUJ1FymjoU24jhJmTjib+9GW1j9zz4U3wBeVfdw+6V 9oICZuOLkX/7OpXsfyQk6kdtu4StDhfhoEtK2lJP2J666T4UfM9bNlHmYyClIy4KIMpu Se9yrwHLDksI1TK4WCoRSbrN8hmPToer2i5HfjZjMrdI57P/8Tfy0JVirBFY7dF1mKW8 /aTQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z30-v6si35877340pfg.266.2018.05.31.00.47.48; Thu, 31 May 2018 00:48:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754060AbeEaHnn (ORCPT + 99 others); Thu, 31 May 2018 03:43:43 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:50135 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753934AbeEaHnk (ORCPT ); Thu, 31 May 2018 03:43:40 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id E572AACA537E2; Thu, 31 May 2018 15:43:36 +0800 (CST) Received: from localhost (10.177.23.164) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.382.0; Thu, 31 May 2018 15:43:32 +0800 From: Zhen Lei To: Robin Murphy , Will Deacon , Matthias Brugger , Rob Clark , Joerg Roedel , linux-mediatek , linux-arm-msm , linux-arm-kernel , iommu , linux-kernel CC: Zhen Lei , Hanjun Guo , Libin , Guozhu Li , "Xinwei Hu" Subject: [PATCH 2/7] iommu/arm-smmu-v3: fix the implementation of flush_iotlb_all hook Date: Thu, 31 May 2018 15:42:44 +0800 Message-ID: <1527752569-18020-3-git-send-email-thunder.leizhen@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.0 In-Reply-To: <1527752569-18020-1-git-send-email-thunder.leizhen@huawei.com> References: <1527752569-18020-1-git-send-email-thunder.leizhen@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.177.23.164] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org .flush_iotlb_all can not just wait for previous tlbi operations to be completed, but should also invalid all TLBs of the related domain. Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 1d64710..4402187 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -1770,6 +1770,14 @@ static int arm_smmu_map(struct iommu_domain *domain, unsigned long iova, return ops->unmap(ops, iova, size); } +static void arm_smmu_flush_iotlb_all(struct iommu_domain *domain) +{ + struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain); + + if (smmu_domain->smmu) + arm_smmu_tlb_inv_context(smmu_domain); +} + static void arm_smmu_iotlb_sync(struct iommu_domain *domain) { struct arm_smmu_device *smmu = to_smmu_domain(domain)->smmu; @@ -1998,7 +2006,7 @@ static void arm_smmu_put_resv_regions(struct device *dev, .map = arm_smmu_map, .unmap = arm_smmu_unmap, .map_sg = default_iommu_map_sg, - .flush_iotlb_all = arm_smmu_iotlb_sync, + .flush_iotlb_all = arm_smmu_flush_iotlb_all, .iotlb_sync = arm_smmu_iotlb_sync, .iova_to_phys = arm_smmu_iova_to_phys, .add_device = arm_smmu_add_device, -- 1.8.3