From patchwork Thu May 31 07:42:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 137335 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp6278128lji; Thu, 31 May 2018 00:44:02 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLQXy1FG13QTBx2h5CT5rZ65Z1RtiNNWS/7YJzRux3/j0S5PrZnU7MSsrnAVICeolbvyC/P X-Received: by 2002:a62:aa18:: with SMTP id e24-v6mr5733627pff.107.1527752641965; Thu, 31 May 2018 00:44:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527752641; cv=none; d=google.com; s=arc-20160816; b=gTWrljcn2nSWw93uKWNQVZXHsjIwf6EOVx3S+7eSTe2VV4FeN3ukmA7ALgAgeqUOom w3pkxhMXTy+5nkaY2yxaD80wgHGXqyg9zPttXh403MrVDz9SHqvfEbF8KgIAJC1EvJcI WE80aLrTpni7g395IbvPuEOKfLeoJ7rVd3r8p29r5lVdiTYC18m33HnlwljK+zGdIVsb DK1UKU5PVmOrOdN4B7mlZzO96VRSxDyb6waNIzI+E1Jpn7jF3pUjfPRhiTHfyXgYW44s 7iRTbYgLDHTCIp55Nu/qWI/2IBgn3jTScgluMAAgD8tbbhhbC4542E3YyRTCk3ASTq3b 8dVg== 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=BZVIf6Mn+4Tswr/KHTsmOTpFMVpQb/Ax57Q7oMvGtmg=; b=VGpSe+7A6UhXdxRJZ6WkF7oIqNxBIOke7ALHNn2ierxSimm2e9hQ7dM77L4DUY6mZF 9+U+yf/JjnwHykhkoMdx1q7ekO9F7jgZpLGiukUoHDqVdD4hrHBNh9/yzOxIkvdpTt18 cfZKKyrV9oxgqVFIxcKsYBtxm8/Dbu6+eMHRz+ZRpumU+onDik8Ie2UMh7THjtO/PNwj YBoWoCf5GLZI5YoiC9sLalt/ip47+3JXB5aj0JQqcg97LoKcVdeKS8rUTOvDes4KZTn5 aeTc7j3xWkraCVFg8zAQuNKdeXH3nzbA9w0eaLndlKt39STd2TZ81FDsHRH1OvCvYwYe Noxg== 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 r11-v6si28682529pgp.235.2018.05.31.00.44.01; Thu, 31 May 2018 00:44:01 -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 S1754141AbeEaHoA (ORCPT + 30 others); Thu, 31 May 2018 03:44:00 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:8212 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754076AbeEaHn5 (ORCPT ); Thu, 31 May 2018 03:43:57 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 0844FEA061686; Thu, 31 May 2018 15:43:43 +0800 (CST) Received: from localhost (10.177.23.164) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.382.0; Thu, 31 May 2018 15:43:37 +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 7/7] iommu/arm-smmu-v3: add support for non-strict mode Date: Thu, 31 May 2018 15:42:49 +0800 Message-ID: <1527752569-18020-8-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 1. Add IOMMU_CAP_NON_STRICT capability. 2. Dynamic choose strict or non-strict mode base on the iommu domain type. Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 1.8.3 diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 59b3387..25bccbd 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -1440,6 +1440,8 @@ static bool arm_smmu_capable(enum iommu_cap cap) return true; case IOMMU_CAP_NOEXEC: return true; + case IOMMU_CAP_NON_STRICT: + return true; default: return false; } @@ -1767,7 +1769,7 @@ static int arm_smmu_map(struct iommu_domain *domain, unsigned long iova, if (!ops) return 0; - return ops->unmap(ops, iova, size, IOMMU_STRICT); + return ops->unmap(ops, iova, size, IOMMU_DOMAIN_IS_STRICT(domain)); } static void arm_smmu_flush_iotlb_all(struct iommu_domain *domain) @@ -1782,7 +1784,7 @@ static void arm_smmu_iotlb_sync(struct iommu_domain *domain) { struct arm_smmu_device *smmu = to_smmu_domain(domain)->smmu; - if (smmu) + if (smmu && IOMMU_DOMAIN_IS_STRICT(domain)) __arm_smmu_tlb_sync(smmu); }