From patchwork Sun Jun 10 11:07:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 138185 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2892687lji; Sun, 10 Jun 2018 04:08:45 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLdCKGcvf0yiDiQ6xebDN6+rZVv0WyIm/Xn2T3J9cUoB8raQb8pwnR/SlUR1xGdT+nfmYsq X-Received: by 2002:a63:7211:: with SMTP id n17-v6mr10818680pgc.94.1528628925355; Sun, 10 Jun 2018 04:08:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528628925; cv=none; d=google.com; s=arc-20160816; b=NQd7UcXSTJeCKnn29/k169einIwqom/ezS4Gts8WpEWORcePHa5TlH02zp6CjhoCAk E5W7b4Pc+tQalcfM6dOONWOdx+Vay+SLZppDuctipn6yxEMOpjBg1zMIol/6wt6UQ1F4 +oWFZi+NN6qgJg+2BI09XijOv1Y9hV2sHQDDflnlHzO4rIYpbmGL0GVuk5z/AIxC3h95 pgLIF0WPEm5xbhhpkjQxSBfi8RZ04gRqWHzn4ge1LqBzc56z9rK2HtNBQGcnQaO66Yhe ePn2tzSIEcVt0s58FbY+DTGcaeu7+T+mTTiEeKrfJjj1rJeJ6nL+y6hzMhZjMCkb4uXn cPaA== 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=Y2+p1O9jEqtldX4F8u9tfk07x9I2K98fNte2KfG2HT0=; b=y/WHq49AZE3WA3QK2RUieyhd5h3AhBt1ZuO7Y0kdGO8lplQUipT1ULMaVskYCpXTRI CgQmGRoFF7nmyUms/z5730sJh3qN52wrLxwWlAJZUfZYskk+G2OdhLRG3sxNz7MIM8M3 og3+Orby5/dbYTHsFSI+soX96k9nR3HM43Y16QcF5zlnJUgfkhfA1KgCGOCWXtoSAB7T voV3lG1C/DexaWYcn6OEojHGKh2J7aaPr4HA+SlDBUhfhqZZxB3L7UCUO4lQVK+NHoJq Y/ghbCh3UIsRLlpmDV9GwTiiNTm4iYxNZloAGWYfF+eMpkNmMsDRgbpDWADnRiaPNCbe U32Q== 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 v11-v6si60401056plp.25.2018.06.10.04.08.43; Sun, 10 Jun 2018 04:08:45 -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 S1753897AbeFJLIh (ORCPT + 30 others); Sun, 10 Jun 2018 07:08:37 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:35206 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753869AbeFJLIg (ORCPT ); Sun, 10 Jun 2018 07:08:36 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 72320B2132917; Sun, 10 Jun 2018 19:08:32 +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.382.0; Sun, 10 Jun 2018 19:08:26 +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 5/5] iommu/arm-smmu-v3: add support for non-strict mode Date: Sun, 10 Jun 2018 19:07:23 +0800 Message-ID: <1528628843-10280-6-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 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 4402187..4a198a0 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); + return ops->unmap(ops, iova | IOMMU_DOMAIN_STRICT_MODE(domain), size); } 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_STRICT_MODE(domain) == IOMMU_STRICT)) __arm_smmu_tlb_sync(smmu); }