From patchwork Wed Aug 15 01:28:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 144258 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp249605ljj; Tue, 14 Aug 2018 18:32:46 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwNzVhJOuGBflviscb62t9ZL7OIAE46849+95EYVgCWjPX5mulCTcH/vKiydDlc39JMn5SH X-Received: by 2002:a62:d085:: with SMTP id p127-v6mr25824026pfg.119.1534296766035; Tue, 14 Aug 2018 18:32:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534296766; cv=none; d=google.com; s=arc-20160816; b=HnuJBt4Vlf68sJKWZmMJ/3IBGDD+OivyQU4TOwch732KAeUBF6W5rHtL5JMCSloQU7 q6xecIqQwo0OfUBwkFAEt6hJaL6ps//KCX8FeU413ZJ/MbAFblrvBIlVod5jhIaIPDJ7 G4YsEr4wWiugXYw+PpMgXweprlw8Uinjl8ydIyTOuqOTpJc8SecPDp7UAQCCjLElsmOf /HUztxQd3U5bUL0bZUwgqZFDxHQvU5/t5Gbi9Y4yuRFDjauZZKUwmrXarJQbG8dcN9Gj 8E2HseO4AqQ6I/w2S8C0TWnWDrFlYEtiiH8nhahATJgtE0yuEIXnSxzidvkLindPc8QT o/Hg== 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=uwckzlGUE086/cPrL2vO0bQihYtJi0NA+b1kVGjDw+E=; b=uZ0K9dyd1q64HwWzMomhb4qhI1ebuVNx0KFeUwtt63Si1x4xbqqHLRxIfiPtbUenMX D6Wm2EnZlJXvIb/8pTfXuJ//JFjw+Swj3V4tWrMBFw4HNvsvbFjs8C5TvkAwkFP6S6xP VuimMkRba5Nx7AJat2Q41u2pJ5i0If4rtWbWQzyhIh+wpWTEhQiEx84fydPXk6PaBsQi eR0VwigkwKyaxmTGVZnHmwk/1jqL5UQUN6L//MgA8wkRQgPHwyh6/N2oSrs6IONcQzF4 y5tqBRrlvFlrLHyTX7k///LmZNp9Dph1eCXW1tcpvRHgGhGrD4d3wZAzpP6G5VsfNr52 U/9A== 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 j3-v6si21864914pgs.329.2018.08.14.18.32.45; Tue, 14 Aug 2018 18:32:46 -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 S1728368AbeHOEWf (ORCPT + 32 others); Wed, 15 Aug 2018 00:22:35 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:44799 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725847AbeHOEWe (ORCPT ); Wed, 15 Aug 2018 00:22:34 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id BBF06FC51CAB9; Wed, 15 Aug 2018 09:32:38 +0800 (CST) Received: from localhost (10.177.23.164) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.399.0; Wed, 15 Aug 2018 09:32:31 +0800 From: Zhen Lei To: Robin Murphy , Will Deacon , Joerg Roedel , linux-arm-kernel , iommu , linux-kernel CC: Zhen Lei , LinuxArm , Hanjun Guo , Libin , "John Garry" Subject: [PATCH v5 4/5] iommu/arm-smmu-v3: add support for non-strict mode Date: Wed, 15 Aug 2018 09:28:29 +0800 Message-ID: <1534296510-12888-5-git-send-email-thunder.leizhen@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.0 In-Reply-To: <1534296510-12888-1-git-send-email-thunder.leizhen@huawei.com> References: <1534296510-12888-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 | 5 +++++ 1 file changed, 5 insertions(+) -- 1.8.3 diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 4402187..61eb7ec 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 = true; + pgtbl_cfg.quirks |= IO_PGTABLE_QUIRK_NON_STRICT; + } + pgtbl_ops = alloc_io_pgtable_ops(fmt, &pgtbl_cfg, smmu_domain); if (!pgtbl_ops) return -ENOMEM;