From patchwork Thu Apr 18 13:57:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhen Lei X-Patchwork-Id: 162502 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp779693jan; Thu, 18 Apr 2019 07:00:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqxwQS+aBxMW9zmKYV5Tbt0HOmd6LiIezaqsHf9PZ783B/G4qBX7chzm+CerxPYwfNGz+9e7 X-Received: by 2002:a62:12c8:: with SMTP id 69mr96850758pfs.184.1555596008363; Thu, 18 Apr 2019 07:00:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555596008; cv=none; d=google.com; s=arc-20160816; b=F5flxgbaIbVgijXeRx2+/wSYTg4SjfoPDTQ6qqijNXwp5nX+othtkuxQ8+f3nNulm1 jvLFzpWCpNbUCyCYIfyy1GDkUpFZMiihssiDUcS//c/x8C/4nmJFj/NzxFumP+0oQBCs kBYN5mRfbRsbs9VMp9egiAg2nuihto8SHz5en0liTZpelVVVf0sUltczMXYKLlWIj28y nW88/OXr3Xb0rsJcQY68bhEJberDAqM/+62+vIzc4LdNZVMPMekPVTWqZ975s9YfZlxI ta7OHzu5E++QHeyVhkfC5wLPckQcRWAmuzAlc28ZDOdrlNeTSgAi/sZWbKYTePRzRihB vPQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=4AEuKprCBRQpVnzPRcVUjw76ODf+LfiGOTSZaARHMMQ=; b=la8xIEhlZBSJuzR6YcSgd+je9VSctKSTlzKhAhJVEAyGLHVjbd/A07yrYr+mZLO81T h233LMLUgsBYuEHdT6Cvd6pOiu3EcLPnYWGKU6LZjJPLCHPlb736qZz1gi2fd+3t/3mn sFU6b+jkdVi10JMfEU9QHEf8I7j5Z7lcjIcxk1OJLwVfrbRKhHuPH72KMQB+vAiINfLD 8TxudWXfsrUTvl6K+ljVFkQuk2RqO+Bv/2u98h7Mnm6pvbFcxdVNE7J3CXQUVDxZMRz9 SwXbO0PzGY70Q8uQqJ/LpyMtG0jiQhPNugOQmYICADzSJlhGNiPpQLDpc7nxXK9aYHjb lXXQ== 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 q137si1950782pgq.58.2019.04.18.07.00.08; Thu, 18 Apr 2019 07:00:08 -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 S2389152AbfDROAG (ORCPT + 30 others); Thu, 18 Apr 2019 10:00:06 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:35408 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729331AbfDROAG (ORCPT ); Thu, 18 Apr 2019 10:00:06 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 88937F67DDE42C3BF8C7; Thu, 18 Apr 2019 22:00:02 +0800 (CST) Received: from HGHY1l002753561.china.huawei.com (10.177.23.164) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.408.0; Thu, 18 Apr 2019 21:59:56 +0800 From: Zhen Lei To: Jean-Philippe Brucker , John Garry , Robin Murphy , Will Deacon , Joerg Roedel , Jonathan Corbet , linux-doc , Sebastian Ott , Gerald Schaefer , "Martin Schwidefsky" , Heiko Carstens , Benjamin Herrenschmidt , Paul Mackerras , "Michael Ellerman" , Tony Luck , Fenghua Yu , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , David Woodhouse , iommu , linux-kernel , linux-s390 , linuxppc-dev , x86 , linux-ia64 CC: Zhen Lei , Hanjun Guo Subject: [PATCH v6 0/1] iommu: enhance IOMMU dma mode build options Date: Thu, 18 Apr 2019 21:57:00 +0800 Message-ID: <20190418135701.24668-1-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.19.2.windows.1 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 v5 --> v6: 1. give up adding boot option iommu.dma_mode v4 --> v5: As Hanjun and Thomas Gleixner's suggestion: 1. Keep the old ARCH specific boot options no change. 2. Keep build option CONFIG_IOMMU_DEFAULT_PASSTHROUGH no change. v4: As Robin Murphy's suggestion: "It's also not necessarily obvious to the user how this interacts with IOMMU_DEFAULT_PASSTHROUGH, so if we really do go down this route, maybe it would be better to refactor the whole lot into a single selection of something like IOMMU_DEFAULT_MODE anyway." In this version, I tried to normalize the IOMMU dma mode boot options for all ARCHs. When IOMMU is enabled, there are 3 dma modes: paasthrough(bypass), lazy(mapping but defer the IOTLB invalidation), strict. But currently each ARCHs defined their private boot options, different with each other. For example, to enable/disable "passthrough", ARM64 use iommu.passthrough=1/0, X86 use iommu=pt/nopt, PPC/POWERNV use iommu=nobypass. Zhen Lei (1): iommu: enhance IOMMU dma mode build options arch/ia64/kernel/pci-dma.c | 2 +- arch/powerpc/platforms/powernv/pci-ioda.c | 3 ++- arch/s390/pci/pci_dma.c | 2 +- arch/x86/kernel/pci-dma.c | 7 ++--- drivers/iommu/Kconfig | 44 ++++++++++++++++++++++++++----- drivers/iommu/amd_iommu_init.c | 3 ++- drivers/iommu/intel-iommu.c | 2 +- drivers/iommu/iommu.c | 3 ++- 8 files changed, 48 insertions(+), 18 deletions(-) -- 1.8.3