From patchwork Sun Jun 10 11:07:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 138188 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2892910lji; Sun, 10 Jun 2018 04:09:02 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKdQuWykiz6HzZi21Uz0+usF3sM5BzE6jxi3deYbScp+0VH1DuHTScTkLvovWyjybNnZ8pJ X-Received: by 2002:a17:902:9309:: with SMTP id bc9-v6mr14159057plb.189.1528628942174; Sun, 10 Jun 2018 04:09:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528628942; cv=none; d=google.com; s=arc-20160816; b=BUGFmhRJPGfZIoxoSim2jwd2b5Th6YDY9IDXsxzFtfbcNYxA4xjVDMNWOW1hVROAH6 0CfjZQ1twEseojqB8HwW3QNWkpooEmc0RVWs5/3hUpEN3hFWV8owlyyww+jM8sCgKBxR xRDlE3cTn4SyLC5MijcEv5HQSaetFxVuEc9GgNTD3XrQX2qpQfX6aap6VjqVUJzQM1Kp Wff0xJDUvBQPSS1Izh8asK/e8K37JkyOo7J+g9U/TMZTQTIg9uE3+ad7xveXhaYLdwlf 1q3QJL7SsgZoL7LbVS/4GHm38g8/aRLe8ubKJQCa6zxQlzIO/tbbpcnrdc9xE7iQJa5p zSbA== 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=XWHJekgXKTwomeroRHwFoHrvrARwCiLtcyiQXCQWZDhnOChu1GrF4Hq85OwSPsCI90 xBtpt4w9yJFgO1mrPC4AZZdQ89icN91wBC3adGnAcEeKkdJQM6/TFVvDved8ZwVOCJ/k KL5zxFJqtRZnX2AZlbGse+IO46lX5e5JWcjr/w8rAU7H7eZKBbSfF3eopCL58zcCYwHD TjM0JnB9yWKai5/7W8wLFMDKKemBk3bt1qilX8cYKjsxy6qqp6v0tc9Q0OszP0dc7KHD oOtwUCY3EKSkiiOLr8ZJtlwK/MfJb7Gz63k/Ar7zyjjd1zeHbv54Dy8YitB0D/rM9miq WbqA== 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 q1-v6si26580971pgs.441.2018.06.10.04.09.01; Sun, 10 Jun 2018 04:09: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 S1753962AbeFJLI6 (ORCPT + 30 others); Sun, 10 Jun 2018 07:08:58 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:8656 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753944AbeFJLI4 (ORCPT ); Sun, 10 Jun 2018 07:08:56 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 98F985C7C3BC4; Sun, 10 Jun 2018 19:08:31 +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; Sun, 10 Jun 2018 19:08:23 +0800 From: Zhen Lei To: Robin Murphy , Will Deacon , Joerg Roedel , iommu , linux-kernel CC: Zhen Lei , Hanjun Guo , Libin , Guozhu Li , "Xinwei Hu" Subject: [PATCH v2 1/5] iommu/arm-smmu-v3: fix the implementation of flush_iotlb_all hook Date: Sun, 10 Jun 2018 19:07:19 +0800 Message-ID: <1528628843-10280-2-git-send-email-thunder.leizhen@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.0 In-Reply-To: <1528628843-10280-1-git-send-email-thunder.leizhen@huawei.com> References: <1528628843-10280-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,