From patchwork Mon Aug 6 12:27:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 143503 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp3228982ljj; Mon, 6 Aug 2018 05:27:51 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcn4Bac+2UzF1xLrsehbKEHiEucGuKtE+ouMu3ALXmNcwzwYHEPFkC7W7Ah/N6BEREhSXUV X-Received: by 2002:a17:902:3fa5:: with SMTP id a34-v6mr13999050pld.223.1533558471090; Mon, 06 Aug 2018 05:27:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533558471; cv=none; d=google.com; s=arc-20160816; b=e2u6mK4g2iFvoxRbtZNQIfHJWGdJQFTdAWHd3kd96tPmFVWqKzfvbD9zxStu+HGsUz M1QmdlXraqApWkCmGF4NgDcp+B8v0X4lDAHWa4t2cEMrxEzf5weJzf4Nl6/zyCBofJAy zMlplEnEBylOrizmmLQjiHR4ryfLaWBQB5M7DBCGETVnwnykUudQoWJNHX+l4xoAeQg2 18SwU8P1iOlog5MW/U6W2HQF1LNcLRXgaXEZjtob4IEfPPNwwm184rwo5pOPMbSo3ylI mXsEA2/c4MfP/s5P/5OrSw0xGkdtKXOaR6dE6NR15DMGSyUNg6V756jQngqSC4qkvf7h dJFA== 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=XlaY8HETNxVj6BR5TNsBmRwocVx2PS0UyCNO4lKhKtI=; b=bcCWFdJkJRoQoR467RdhoEt36BZ5dZu5CvyjuQlIUnvhauaTpGB84I2VL9RKabaWX+ jBSnc12kEWO3VGPHLBzYzvsntTjheltU1Ue03UDWQ1CR0GC70tWBKNVRCNta8ReLRgeP EXZbL3gWqe1dthQ3sDe/YkIppk9FOl48Im02QxM3+Ounz2D3D81TNkrFRsDTV5N9C+5C x5OXewWPQV3evFRo4oGT8YUEeWKelQBp8M9hjylK3Seb0H9NEsupYnQMSauImLDhaxYb rG+tZq/aFeAkGH+uBU+3alAgPfxHIcClxugfEpQxrKLLbXCmMJAQE+xholUiFp6XcZmM pwEQ== 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 z89-v6si13218163pfd.357.2018.08.06.05.27.50; Mon, 06 Aug 2018 05:27:51 -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 S1731066AbeHFOgl (ORCPT + 31 others); Mon, 6 Aug 2018 10:36:41 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:50771 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730783AbeHFOgl (ORCPT ); Mon, 6 Aug 2018 10:36:41 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 022D2D080B7C8; Mon, 6 Aug 2018 20:27:46 +0800 (CST) Received: from localhost (10.177.23.164) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.399.0; Mon, 6 Aug 2018 20:27:38 +0800 From: Zhen Lei To: Robin Murphy , Will Deacon , Joerg Roedel , linux-arm-kernel , iommu , linux-kernel CC: Zhen Lei , LinuxArm , Hanjun Guo , Libin Subject: [PATCH v4 1/5] iommu/arm-smmu-v3: fix the implementation of flush_iotlb_all hook Date: Mon, 6 Aug 2018 20:27:00 +0800 Message-ID: <1533558424-16748-2-git-send-email-thunder.leizhen@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.0 In-Reply-To: <1533558424-16748-1-git-send-email-thunder.leizhen@huawei.com> References: <1533558424-16748-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 Reviewed-by: Robin Murphy diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 4810f61..2f1304b 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,