From patchwork Thu Jul 12 06:18:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 141786 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1131940ljj; Wed, 11 Jul 2018 23:19:22 -0700 (PDT) X-Google-Smtp-Source: AAOMgper0IdY6PLnt3y381Ia/16w28R44gQNTXcXtRUhOuf+9evefQpapIwFRXKYWtnMXiTpiktq X-Received: by 2002:a63:7847:: with SMTP id t68-v6mr855998pgc.329.1531376362799; Wed, 11 Jul 2018 23:19:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531376362; cv=none; d=google.com; s=arc-20160816; b=rM2D/rscVWn4KMz+TyHoAJFHQkE5ctZzy+qAhmXwdmqy6LtV0TBj+DDt0sItAmw3V6 2DBZRTC9u4U1bPb53mwT8pvV2g3NI/QybHpLkPZPgekOtjtGctSFMzrD54Iw1HIM1uZ5 hFY6u3ZDfHcYSkNtySiCuxW5qvVS6XH6xevPwwngYiJ5R7B0VOYde/4V9mRvRmZWP04I LXgbBP+g10CqSg7d6bvMM0ntLBQFJp0CceLe9my5qqSdi01TONdvamv4khnwr/VrMjp/ 4enbpxdf2aD51b1fNxG1wbbJyBAKR2W3UgggxWqce5MY9noP5HleB/0DjkmDSMBMC6GY xIlQ== 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=tdjFkUtW2LItdPFm5i1Igu18IbVB92ubQkbHbwH6xISqKi948Q9kfH2F1xp5+N9dyf VGjc6yC5oWsYYEKNPpLz5cs56dBnAHomsJkoqqzUKqFseWGgEiP/XYIjd7NnbG6SttAr BqkviHbJOwTg1rT3O/V8eZ4sAdHHJkYeqiGsgu+14zh6j1ciT9nLrt9Ak9jpEsVqDpxP y5tln6e0ckKDivEl5/8yn7NOozUzclG0po9vLNxTdGRnQjc2+8uYc+rMeHd9WdGkc4/m 3QYYRfpj7Jzsaft2UJtgFojp+dTSOLmSHRyLT4IPP9Yi4P+x/rZ9gR7UIG9HhVjDAbCT RcrQ== 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 j129-v6si21810955pfc.191.2018.07.11.23.19.22; Wed, 11 Jul 2018 23:19:22 -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 S1732347AbeGLG1Y (ORCPT + 27 others); Thu, 12 Jul 2018 02:27:24 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:9174 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732198AbeGLG1X (ORCPT ); Thu, 12 Jul 2018 02:27:23 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 8798CC2886F1C; Thu, 12 Jul 2018 14:19:06 +0800 (CST) Received: from localhost (10.177.23.164) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.382.0; Thu, 12 Jul 2018 14:19:00 +0800 From: Zhen Lei To: Jean-Philippe Brucker , Robin Murphy , Will Deacon , Joerg Roedel , linux-arm-kernel , iommu , linux-kernel CC: Zhen Lei Subject: [PATCH v3 1/6] iommu/arm-smmu-v3: fix the implementation of flush_iotlb_all hook Date: Thu, 12 Jul 2018 14:18:27 +0800 Message-ID: <1531376312-2192-2-git-send-email-thunder.leizhen@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.0 In-Reply-To: <1531376312-2192-1-git-send-email-thunder.leizhen@huawei.com> References: <1531376312-2192-1-git-send-email-thunder.leizhen@huawei.com> MIME-Version: 1.0 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(-) -- 1.8.3 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,