Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1208993imm; Wed, 11 Jul 2018 20:12:18 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeieS3HsfIOSb119j1U+m82DLcZyWu/HvME5tOgrT90yI6Fzw5+B1ivJXbFtzRvfUdyPXVq X-Received: by 2002:a63:c312:: with SMTP id c18-v6mr434433pgd.449.1531365138459; Wed, 11 Jul 2018 20:12:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531365138; cv=none; d=google.com; s=arc-20160816; b=ajy786/m9UpqD638VVJazZX5XBbv8DFyLVFJOJvc30Qms3JEjPNnhjtMYXSSDCIilF sVMkCPW7xO5cBbslGcXbGGCC9aa33086nBGxFmMtAWU+RGHX08ytCyuQ64pGEiUnfTDy aT5MSrctj1cbRD7TcerldFlhQ5b5Jkt2EEfckYe61ixU8UZzOOfj5wg2TkHtQBB9SfnH 4byBAl+7pKSXVDKYYmd1VN8e3NwI3prcJTvbBnFWZBI0t2YqOPs/pTJAOchkHcLGAhxq enD1YKLKjNM7kpmP+lktvcPXMz7FRX29G3jLktYYgVeMLKOGcIXqIOjgoa4a7jyLemBd Kyvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-id:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :arc-authentication-results; bh=yKT092ed+vaAznOen5NDJs51eVjzwApGkpKyhzCgCMA=; b=IvjviYh87bYc99PoAtb3FmXgWPyIJLDZmYumMbhjFj2ZqB8x8jdwg3eeUv3Lnk9kgt cRbL4L1alMPQzDO0rO+YMgdeCGz9sQGc7Ly6JTSXRpi0uQ4dS/VjUVSjQ59h6B1xm/q0 6TCHi8lbfX4rf2FOm9CPPZFry1Y8p49y33k7RaqePb4S5lNOlJBHuEL3HEHuPoxO1LkW ZU6xI/KxCiqWESQ6nMKFLgoIfB94W2G88wL73m3ubr7QKzk+Wd0qG3G8zbALll2bygHe ALoOeexsc9XBQe8eH7G+Fr0CAm3NMPnqrHtAZfTumco+eEo7BTquZ0TpvkYyjdvqfzlo ggxA== 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 n3-v6si20739810pld.146.2018.07.11.20.12.03; Wed, 11 Jul 2018 20:12: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 S2387750AbeGLCMN convert rfc822-to-8bit (ORCPT + 99 others); Wed, 11 Jul 2018 22:12:13 -0400 Received: from mx01.hxt-semitech.com.96.203.223.in-addr.arpa ([223.203.96.7]:40921 "EHLO barracuda.hxt-semitech.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1732852AbeGLCMM (ORCPT ); Wed, 11 Jul 2018 22:12:12 -0400 X-ASG-Debug-ID: 1531361090-093b7e2c7c6d2e0001-xx1T2L Received: from HXTBJIDCEMVIW02.hxtcorp.net (localhost [10.128.0.15]) by barracuda.hxt-semitech.com with ESMTP id OCdklDFaBdefsBzV (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 12 Jul 2018 10:04:50 +0800 (CST) X-Barracuda-Envelope-From: shunyong.yang@hxt-semitech.com Received: from HXTBJIDCEMVIW01.hxtcorp.net (10.128.0.14) by HXTBJIDCEMVIW02.hxtcorp.net (10.128.0.15) with Microsoft SMTP Server (TLS) id 15.0.847.32; Thu, 12 Jul 2018 10:04:42 +0800 Received: from HXTBJIDCEMVIW01.hxtcorp.net ([fe80::f451:a443:c0b5:87d1]) by HXTBJIDCEMVIW01.hxtcorp.net ([fe80::f451:a443:c0b5:87d1%12]) with mapi id 15.00.0847.030; Thu, 12 Jul 2018 10:04:42 +0800 From: "Yang, Shunyong" To: "joro@8bytes.org" , "olof@lixom.net" CC: "linux-kernel@vger.kernel.org" , "iommu@lists.linux-foundation.org" Subject: Re: [PATCH 1/2] iommu: Add config option to set passthrough as default Thread-Topic: [PATCH 1/2] iommu: Add config option to set passthrough as default X-ASG-Orig-Subj: Re: [PATCH 1/2] iommu: Add config option to set passthrough as default Thread-Index: AQHUGVos72k0FiF+U0exr2V+rYPox6SKUI0A Date: Thu, 12 Jul 2018 02:04:41 +0000 Message-ID: <1531361076.3757.5.camel@hxt-semitech.com> References: <20180711205936.18614-1-olof@lixom.net> In-Reply-To: <20180711205936.18614-1-olof@lixom.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.64.6.32] Content-Type: text/plain; charset="iso-8859-15" Content-ID: <2EE053A278DDBF47A54CBBFD73706F5C@hxt-semitech.com> Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Barracuda-Connect: localhost[10.128.0.15] X-Barracuda-Start-Time: 1531361090 X-Barracuda-Encrypted: ECDHE-RSA-AES256-SHA X-Barracuda-URL: https://192.168.50.101:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at hxt-semitech.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Bayes: INNOCENT GLOBAL 0.5027 1.0000 0.7500 X-Barracuda-Spam-Score: 0.75 X-Barracuda-Spam-Status: No, SCORE=0.75 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.53461 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Olof, Tired of changing command line. I like this patch. Thanks. Shunyong.? On Wed, 2018-07-11 at 13:59 -0700, Olof Johansson wrote: > This allows the default behavior to be controlled by a kernel config > option instead of changing the commandline for the kernel to include > "iommu.passthrough=on" on machines where this is desired. > > Signed-off-by: Olof Johansson > --- > ?drivers/iommu/Kconfig | 10 ++++++++++ > ?drivers/iommu/iommu.c |??4 ++++ > ?2 files changed, 14 insertions(+) > > diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig > index 689ffe538370..a9bb1a5b5e43 100644 > --- a/drivers/iommu/Kconfig > +++ b/drivers/iommu/Kconfig > @@ -60,6 +60,16 @@ config IOMMU_IO_PGTABLE_ARMV7S_SELFTEST > ? > ?endmenu > ? > +config IOMMU_DEFAULT_PASSTHROUGH > + bool "IOMMU passthrough by default" > + depends on IOMMU_API > +????????help > + ??Enable passthrough by default (removing the need to pass > in > + ??iommu.passthrough=on through command line). If this is > enabled, > + ??you can still disable with iommu.passthrough=off > + > + ??If unsure, say N here. > + > ?config IOMMU_IOVA > ? tristate > ? > diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c > index 63b37563db7e..ab8fc54467e0 100644 > --- a/drivers/iommu/iommu.c > +++ b/drivers/iommu/iommu.c > @@ -36,7 +36,11 @@ > ? > ?static struct kset *iommu_group_kset; > ?static DEFINE_IDA(iommu_group_ida); > +#ifdef CONFIG_IOMMU_DEFAULT_PASSTHROUGH > +static unsigned int iommu_def_domain_type = IOMMU_DOMAIN_IDENTITY; > +#else > ?static unsigned int iommu_def_domain_type = IOMMU_DOMAIN_DMA; > +#endif > ? > ?struct iommu_callback_data { > ? const struct iommu_ops *ops;