From patchwork Tue Apr 9 12:53:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 161975 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4908174jan; Tue, 9 Apr 2019 05:54:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqzgg0TC1GAulHU7+B7jI+XMs0MkbOJtnpuTCCV+cyB7qJHHIw+uu5fhYH+vZ7YjOQF13ESU X-Received: by 2002:aa7:9089:: with SMTP id i9mr37104478pfa.115.1554814456865; Tue, 09 Apr 2019 05:54:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554814456; cv=none; d=google.com; s=arc-20160816; b=ahNXziRUPo2Pl19PUKiZaH/6f3aGR3igveQWhyUAwgiV1/HXmx3amFwLrVPAqR1wsK 7ibQUVRtyViutd/yhDVqAN6bWTzPwb3JJ+wz2v3/NxHwDi6k9k96EulfQLZpzlvxRgR1 D6kETw788bKsW6Z9AMMriGfr1aIYzJdVqvWHimcWyPAfX+CWuk0l/aAb8ayZ81l+mAvy xApdyFqYk4MS0eFkzUOxWmuj3D+IRk3ytYhSS90KNY0jL+43R5Q2imcnbPWdv/cjOrMH +7xaEwjW+NzvhfVYrEScFPru5L95NKlAtcOjcS07z90jmZ869m5UxXpqiQ6fKXBv3w0Y PzjQ== 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=n1q457puWuBZRYvjmLADMe3CN538XLiqKj5TW0WjeD0=; b=gK9vGZeuAsZCGra9d5GAwhzZX6FN69TpOElwj3c6yGnQhtxPZi+BBl7/UMr/7YjceY nSHExA6soJyo6XkEeU8aElf7DQx9phG+xJnMg5ZevDr6iZr0tFdOHEFsQtCsmbHik1CL yykeQ00TunHcAGwx1F6wFtdpy80xj1rCdWis1fkVltBAewpfODvrYROgjq2sH60z6Q6B xSO4vILqpXQsr1/ZQOHsGLubTn77aDN1YaRE6zmOpx1slLfGL+wusf+tmGG25Nf4CBAX cbF+yw/n/uJldUww4McsLFjMTtQQITgqLOT3p8QZZ1f9NcoGIcjtZ6iRhT+Cc+bwcSzS S7wA== 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 o11si28474903pgv.13.2019.04.09.05.54.16; Tue, 09 Apr 2019 05:54:16 -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 S1727250AbfDIMyP (ORCPT + 31 others); Tue, 9 Apr 2019 08:54:15 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:44306 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726112AbfDIMyO (ORCPT ); Tue, 9 Apr 2019 08:54:14 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 3EDFBC03F55BB5BE4CE8; Tue, 9 Apr 2019 20:54:10 +0800 (CST) Received: from HGHY1l002753561.china.huawei.com (10.177.23.164) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.408.0; Tue, 9 Apr 2019 20:54:00 +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 v5 0/6] add generic boot option for IOMMU dma mode Date: Tue, 9 Apr 2019 20:53:02 +0800 Message-ID: <20190409125308.18304-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 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 (6): iommu: add generic boot option iommu.dma_mode iommu: add build options corresponding to iommu.dma_mode iommu: add iommu_default_dma_mode_get/set() helper s390/pci: add support for generic boot option iommu.dma_mode powernv/iommu: add support for generic boot option iommu.dma_mode x86/iommu: add support for generic boot option iommu.dma_mode Documentation/admin-guide/kernel-parameters.txt | 19 +++++++ arch/ia64/include/asm/iommu.h | 2 - arch/ia64/kernel/pci-dma.c | 2 - arch/powerpc/platforms/powernv/pci-ioda.c | 5 +- arch/s390/pci/pci_dma.c | 14 ++--- arch/x86/include/asm/iommu.h | 1 - arch/x86/kernel/pci-dma.c | 35 ++++++------ drivers/iommu/Kconfig | 45 ++++++++++++--- drivers/iommu/amd_iommu.c | 10 ++-- drivers/iommu/amd_iommu_init.c | 4 +- drivers/iommu/amd_iommu_types.h | 6 -- drivers/iommu/intel-iommu.c | 9 ++- drivers/iommu/iommu.c | 73 ++++++++++++++++++++----- include/linux/iommu.h | 23 ++++++++ 14 files changed, 176 insertions(+), 72 deletions(-) -- 1.8.3