From patchwork Mon Aug 6 12:27:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 143507 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp3229128ljj; Mon, 6 Aug 2018 05:27:59 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeor9W1CJZJkk85gpLArcHgaCKy7wwZRTbxUAeE351UA21xLpRiQpQnpPYl/YnLuWZhfd8M X-Received: by 2002:a62:1089:: with SMTP id 9-v6mr16556156pfq.30.1533558478860; Mon, 06 Aug 2018 05:27:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533558478; cv=none; d=google.com; s=arc-20160816; b=cB9qWAO0yQwUuvM1GXaQPDXtO3uLKCtntrnibtuE5f2+Qo93yibYplbe0a/E+ZzJb4 DuqZPMaSLA9kJqBXqzw+1MJbVIJpCPe9nAIcDYA8ljon64I+nYgoKArh+AyrUTeg1TUR jVZxJZwVCMDfkcPM3TYOYGKuZn/dbzjocPTPI17nzpP+kK4SO3YyAfix6siXQrC5n66b IpO9sD670Eib2LgCvdmCWgUbNDtwdMOj1NrX3HR2UqHTFu++zvzHKCATmMlBssxkGwXg 1zo0fxjFWmMVa4Brb1FQozHUFIKF8ub2QBcX6OvN4spPufL6930GBHZv69T72WKo3nbg vndQ== 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=V5wBC7OwbUdJLlqlAKX+5zBBtd2MHVr10RHHl6423oQ=; b=t9sjkWfZIUHO9ciN1aIhzCxsHpEQ0wciPkoTn3722YFmL/nJkCds31J+jbJxPONAb1 a00xvWnECaMNMEFllUeEUp+hEPLcsshi1Bk+nu6BcgjgfHCyXhug+YpnYH5FinLekUsq k0sHrJKa3qvTIMtFeS3c2VQOn+1BtpdqD3qvcQ7lWLS8DqwxCPYXAIY7BB9v8dO38PVb QqlqeXwPy52i3qb6jPWA98va8JgtlJQ34FSiQFNozbRvUlJA1MLPZ/4uHT4v59B9vn9k 0OZPE7GNM9As24vJ2URKlwHRcu0U89gorjwslurItvmZ0uWVxNnht4SU2LG2FPVNRDKw TGqw== 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 4-v6si12562494pgn.90.2018.08.06.05.27.58; Mon, 06 Aug 2018 05:27:58 -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 S1732115AbeHFOgt (ORCPT + 31 others); Mon, 6 Aug 2018 10:36:49 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:10637 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731249AbeHFOgt (ORCPT ); Mon, 6 Aug 2018 10:36:49 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 46949A9309A02; Mon, 6 Aug 2018 20:27:48 +0800 (CST) Received: from localhost (10.177.23.164) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.399.0; Mon, 6 Aug 2018 20:27:43 +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 4/5] iommu/arm-smmu-v3: add support for non-strict mode Date: Mon, 6 Aug 2018 20:27:03 +0800 Message-ID: <1533558424-16748-5-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 Dynamically choose strict or non-strict mode for page table config based on the iommu domain type. Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -- 1.8.3 diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 2f1304b..904bc1e 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -1622,6 +1622,11 @@ static int arm_smmu_domain_finalise(struct iommu_domain *domain) if (smmu->features & ARM_SMMU_FEAT_COHERENCY) pgtbl_cfg.quirks = IO_PGTABLE_QUIRK_NO_DMA; + if (domain->type == IOMMU_DOMAIN_DMA) { + domain->non_strict = 1; + pgtbl_cfg.quirks |= IO_PGTABLE_QUIRK_NON_STRICT; + } + pgtbl_ops = alloc_io_pgtable_ops(fmt, &pgtbl_cfg, smmu_domain); if (!pgtbl_ops) return -ENOMEM; @@ -1782,7 +1787,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 && !domain->non_strict) __arm_smmu_tlb_sync(smmu); }