From patchwork Tue Apr 9 12:53:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 161979 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4910788jan; Tue, 9 Apr 2019 05:57:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqzqIV71RZkTKV+MIFN5Va9rPqozAbWY55aWh1MPcV/9pSQ9ALi9gRMNm/C+WpR3RfaD1jvb X-Received: by 2002:a17:902:1c1:: with SMTP id b59mr19272094plb.182.1554814647323; Tue, 09 Apr 2019 05:57:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554814647; cv=none; d=google.com; s=arc-20160816; b=P3ibmhxd/U+kdzYY7nTQd7zKoVYqSEE3V5k1dsXKNKGlXyErsmoQ/TIlKJmcnuHdRQ 9zU00hQFIDyGYcS3ISEF1KTNB1qnPMlNJkSzpHbIhP+ufJ+qHM9IK6NdV34OzYFwvL0g p/CdaHlmgTtQLcKVWAHEfOG9oOoZ8VD42F3kc8yFuNTvJH8orsitThzHWL2b8VaCxyT8 O+L8kOcSgQMAvB0BIWCDSyuTlv4SxgGTsFenIyehFXdi0c4gL/Ay7ndp5kRl2b0nPa4O HIGJh3IJN6kpEo6SdoSwRpB0Wsqdri7kOJeSUrXzGNntcaL4B6JIu/dLvlpECsgBm/3M 7/Xg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=nUiOWUlNwn2ScYVtN5qGZNB60YmmFAtsrven/Q8H8bY=; b=L8uFDMbaemWqIWb9MoOLwAmveDdRyya90ItZ+2s/7ftxpkcscFHRds/UXeWQAiqtTw aWXOtpc+itq0TRgGOcc3Z8dMHBbcU3d0bO4MMhs0CpZoXgc/MKzyW/0Rb+qsh74mi05U q8/wGsOyBXLmlEkr3Qyk8Bmd1AzdMIDhobwCl1cs5dNktzd1Lr4VKwBPWrLBxuiFxeJL 6tz4CHSq4Z4awgi1RqIRYSdMe3uHXnCZJN0gfWakKmBu4ebCPHJm3Jyj8xOSqpQKnKYn NjQSKoJoENYcJBXIZw19HjTEfn8Ej8bYKS8I4kRPkPSEROUb+GSK3XK83UL1YUhmnVK8 dCaw== 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 p6si30601705pgp.459.2019.04.09.05.57.26; Tue, 09 Apr 2019 05:57:27 -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 S1727287AbfDIM5Z (ORCPT + 31 others); Tue, 9 Apr 2019 08:57:25 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:33406 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726129AbfDIM5Z (ORCPT ); Tue, 9 Apr 2019 08:57:25 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 5DE5FB99BA9AAAB34D1B; Tue, 9 Apr 2019 20:54:15 +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:07 +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 5/6] powernv/iommu: add support for generic boot option iommu.dma_mode Date: Tue, 9 Apr 2019 20:53:07 +0800 Message-ID: <20190409125308.18304-6-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.19.2.windows.1 In-Reply-To: <20190409125308.18304-1-thunder.leizhen@huawei.com> References: <20190409125308.18304-1-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 iommu=nobypass can be replaced with iommu.dma_mode=strict. Signed-off-by: Zhen Lei --- Documentation/admin-guide/kernel-parameters.txt | 2 +- arch/powerpc/platforms/powernv/pci-ioda.c | 5 ++--- drivers/iommu/Kconfig | 1 + 3 files changed, 4 insertions(+), 4 deletions(-) -- 1.8.3 diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index ab8e3c4798c0a2a..176f96032d9d62a 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -1815,7 +1815,7 @@ options(such as CONFIG_IOMMU_DEFAULT_PASSTHROUGH) to choose which mode to be used. Note: For historical reasons, ARM64/S390/PPC/X86 have - their specific options. Currently, only ARM64/S390 + their specific options. Currently, only ARM64/S390/PPC support this boot option, and hope other ARCHs to use this as generic boot option. passthrough diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 3ead4c237ed0ec9..8862885d866418f 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c @@ -85,7 +85,6 @@ void pe_level_printk(const struct pnv_ioda_pe *pe, const char *level, va_end(args); } -static bool pnv_iommu_bypass_disabled __read_mostly; static bool pci_reset_phbs __read_mostly; static int __init iommu_setup(char *str) @@ -95,7 +94,7 @@ static int __init iommu_setup(char *str) while (*str) { if (!strncmp(str, "nobypass", 8)) { - pnv_iommu_bypass_disabled = true; + iommu_default_dma_mode_set(IOMMU_DMA_MODE_STRICT); pr_info("PowerNV: IOMMU bypass window disabled.\n"); break; } @@ -2456,7 +2455,7 @@ static long pnv_pci_ioda2_setup_default_config(struct pnv_ioda_pe *pe) return rc; } - if (!pnv_iommu_bypass_disabled) + if (IOMMU_DMA_MODE_IS_PASSTHROUGH()) pnv_pci_ioda2_set_bypass(pe, true); return 0; diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index b7173b106cd816a..5dca666b22e6cd5 100644 --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig @@ -77,6 +77,7 @@ config IOMMU_DEBUGFS choice prompt "IOMMU dma mode" depends on IOMMU_API + default IOMMU_DEFAULT_PASSTHROUGH if (PPC_POWERNV && PCI) default IOMMU_DEFAULT_LAZY if S390_IOMMU default IOMMU_DEFAULT_STRICT help