From patchwork Thu May 31 07:42:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 137331 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp6277902lji; Thu, 31 May 2018 00:43:43 -0700 (PDT) X-Google-Smtp-Source: ADUXVKICll/cz8YjtxInavmHqvpb0FO6eqmikLe16D3YpEX3Y2LAgy3jy5U92IioqZrrjqA45bTk X-Received: by 2002:a63:42c4:: with SMTP id p187-v6mr4735670pga.345.1527752623611; Thu, 31 May 2018 00:43:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527752623; cv=none; d=google.com; s=arc-20160816; b=Vm1JxrwQ74RbPC5BTmXDcofYoAB4DjpgXs3ffFv8xJ/IDp9JVTWeZD6ThL5g7KuR5B 0wObyeIDXFec8GiaOFeNImr4QqCLBh2AjaojmHgTcft4qvp9N/0GhNeLd78HJcmx6y+Q a5yrY03RS3CS0gSXxvTT56++Jn3/0ZWCYmfy6utkch9/oymoQ6limjRIWpzKbG+ckcaD YPZsEFrZtbBcWjTjrSl8PyLBnaATcHTD0E7xbcdbNSb5YsQB4J6lY6hHReCpbedbHDn3 1WP5EK+IXkR9fidNZqgYz/C7xzYCe8pRPqNWJ3eNc8JQs4DF7x3oggXnBfkY5ctucKSZ sU0w== 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=r9IzxVWukjndYuflYvyJBvumueEB1gjXAdN83W5DIms=; b=eWadxWbMKOqjuAsOb493dW1dQCTaTnHN+UFlH43GoU4TzQPpF+g0PWRI89w5zZ7/3J PEdOc+3t6fu62ihNBUULzH5+80CqRA9FcfeDpwpr929IMvfuzwmhe3kyISMN2/50sNMD W49GUlxN69cMNsAhXRJJsfY8F+axshbyCnAQApO75oRRR6z/GRAuVg11TNf3HntepojR CptQIti4MrlxFC5L83gYgFSfQVedKYL/ZtKOZa2WJbeVONeSJuRo7rziylV+k/8aeSly nqjIX54LTiyGLfmPgoyjqGW88O4ri3TrIeWjOP9XdvoDplnxFBrFUMA4Cs6gP4JXWpts /zLQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 j11-v6si11664355pgn.129.2018.05.31.00.43.43; Thu, 31 May 2018 00:43:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754039AbeEaHnm (ORCPT + 13 others); Thu, 31 May 2018 03:43:42 -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 X-Originating-IP: [10.177.23.164] X-CFilter-Loop: Reflected Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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,