From patchwork Thu May 30 03:48:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 165394 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp413416ili; Wed, 29 May 2019 20:49:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqwikJv92OuvOzInkl/ylBV7JOq1he77y5qcZxadmYLcBPdzHXwuh5aKEBU0Zg7nxtJLJQOX X-Received: by 2002:a62:d244:: with SMTP id c65mr1587869pfg.173.1559188190543; Wed, 29 May 2019 20:49:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559188190; cv=none; d=google.com; s=arc-20160816; b=PDbnRHyXXIDZGbvg5gp1Q0UMJgl1B5CJOlsRQmsY+7oexvZRNtkSMW9OBgMeL2QLSe 5VvTk7RWwWy95qpiMqcza0PMd6TDCFHv2iCpqdpj/fhsj2I0L+HZjOlQDPeAJ5/bisWn wZ/jZLMH1o2iSO/jS3ePOz0W3UKIJE7aH/cJhkUGvFdGpt/HNMGklij6COC9jDt7ej/s BK5ENL4+ZFl4EuWROW+SRH1AwFNTKrxDV/H5w+5f9S7afLtcVuZvPDhJ0c3FVh4LI9zt QnCNn1L3M166g72fYk3CaCauoskCDThPk+z17RjJHr++iaVvC7FrZgwWc+vkoeYkd0jM KUmg== 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=7XONKfTAc43NGqae20IqqC+fvcYa+mXypFBXy4pQ5qg=; b=SoSCgR24yURSHA3Rx1EDURys7Au20Do6Ukw73oS0669M3ZoORNpenvyrvsGZ8dNMmJ HV5u5Zz5bg5LXN3XK56wMiuEBSBATK4cXdZZvELq1xQcxowOLGpyTXmH3tEuFcs7RSjm B5oPA6QO6tc9i7kdSoQRR1DhNwkAcnDah+/bsTVlcRXaryiFVlorhrMcL6YjUsxxDSxd FMVkcHvBUxa/TzvjqI0l5hHjH+WoEtVD1EGQ7kIZraE6e0g+4hLo2XF4FJD5c8ZKnRwo 8g5HqJBDgPc7x8ydlxJg+jjBQUtird4d37JZPU9x9du7uymzRoD5DECsMdzBj7SgdRp7 PcLg== 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 i11si1945835plt.92.2019.05.29.20.49.50; Wed, 29 May 2019 20:49:50 -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 S1732281AbfE3Dtf (ORCPT + 30 others); Wed, 29 May 2019 23:49:35 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:18049 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387651AbfE3DtZ (ORCPT ); Wed, 29 May 2019 23:49:25 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id B27A09DAB0CAA2FD2FCF; Thu, 30 May 2019 11:49:22 +0800 (CST) Received: from HGHY4L002753561.china.huawei.com (10.133.215.186) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.439.0; Thu, 30 May 2019 11:49:16 +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 v8 4/7] powernv/iommu: add support for IOMMU default DMA mode build options Date: Thu, 30 May 2019 11:48:28 +0800 Message-ID: <20190530034831.4184-5-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20190530034831.4184-1-thunder.leizhen@huawei.com> References: <20190530034831.4184-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.133.215.186] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The default DMA mode is PASSTHROUGH on powernv, this patch make it can be set to STRICT at build time. It can be overridden by boot option. There is no functional change. Signed-off-by: Zhen Lei --- arch/powerpc/platforms/powernv/pci-ioda.c | 3 ++- drivers/iommu/Kconfig | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) -- 1.8.3 diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 126602b4e39972d..40208b9019be890 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c @@ -85,7 +85,8 @@ 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 pnv_iommu_bypass_disabled __read_mostly = + !IS_ENABLED(CONFIG_IOMMU_DEFAULT_PASSTHROUGH); static bool pci_reset_phbs __read_mostly; static int __init iommu_setup(char *str) diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index 9b48c2fc20e14d3..b5af859956c4fda 100644 --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig @@ -78,6 +78,7 @@ config IOMMU_DEBUGFS choice prompt "IOMMU default 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 @@ -98,6 +99,7 @@ config IOMMU_DEFAULT_PASSTHROUGH config IOMMU_DEFAULT_LAZY bool "lazy" + depends on !PPC_POWERNV help Support lazy mode, where for every IOMMU DMA unmap operation, the flush operation of IOTLB and the free operation of IOVA are deferred.