From patchwork Mon May 20 13:59:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhen Lei X-Patchwork-Id: 164651 Delivered-To: patch@linaro.org Received: by 2002:ac9:2a84:0:0:0:0:0 with SMTP id p4csp288337oca; Mon, 20 May 2019 07:01:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqx8Ksa2KIoCh+zeBlpeI9ctlSbmdLz210GM9nVy/nG4UuF2r+DCud1YWH7LvEUDJhpDPYXN X-Received: by 2002:a17:902:28c9:: with SMTP id f67mr56783149plb.190.1558360878877; Mon, 20 May 2019 07:01:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558360878; cv=none; d=google.com; s=arc-20160816; b=vYenuC2nxdB+IllsS8c+KfJJd0O0AIC7fOFoZDt93NsGfPaPzBC7fKgcFxr2aTPkVD tdnx41UTd1jUQV8SHBmRKsNgVaiKBKMfDhH4kFx1PzmBk3qedW1RiJw8kvmzeQKr2dfX Rx/itXuDciF/fFq85xdficI4K2WrAtG69HXC9T/iRfPP2TclpRej3l8yaXSsJsRJq+Gg l5HXKay1bFnsA5Mb129VFG3nCTDYC0rgXecCVMqTxvezup27pKGLDJyXOrOrCr0d3TbH R3rNB1j6SjbOYV/RelcYfilLt5TWAzVKR4d003eAtTtXYl7fWJru64AuMRX6TwHimXQb SrMQ== 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=vmKwx5i9HdKu1ZY24IoR7bSJJJRg+Tn9e8m11lRE5P8=; b=uURX53skQDD8liwJSzgsni5B5JNJpAOfsgY29ECdzrHmMHuDtBJJuhmkbP3S0xSHcF G9ly7Sod6k3TkFTqmQ9NJt0bHhNMnACo5Qtoo3guUYFVS5XHM+RLSig0I3mQdnU8BYnd JlY6vKfVK+n63ZlR1WasdYZp3rNdTlzvuc3xgiqKd8HgsMVJkaH8YAu5RqmHy/+57Qv8 5n1WGVsHKHcjuQIzPN80kVV9iGucBe8mp7OGQ0+JguSrSa7AGqFCg6uZ5DrLcS5XNYPe /u3iBkF/IqSgmM3l5KgO0YbBIWaktBoX7r/FV9MEWnVc7KvxCDsvPjPWoUo13kdoWvGb TR4A== 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 y5si17706365plk.366.2019.05.20.07.01.18; Mon, 20 May 2019 07:01:18 -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 S2391159AbfETOBR (ORCPT + 30 others); Mon, 20 May 2019 10:01:17 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:8225 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2391102AbfETOBP (ORCPT ); Mon, 20 May 2019 10:01:15 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id D28675BF3968B04EDCB7; Mon, 20 May 2019 22:01:12 +0800 (CST) Received: from HGHY1l002753561.china.huawei.com (10.177.23.164) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.439.0; Mon, 20 May 2019 22:01:04 +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 v7 0/1] iommu: enhance IOMMU dma mode build options Date: Mon, 20 May 2019 21:59:46 +0800 Message-ID: <20190520135947.14960-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 v6 --> v7: 1. Fix some text editing errors 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