Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3289560yba; Tue, 16 Apr 2019 08:23:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqztGOFAsxMVYVi9td5iB4soKSOHZCTkGfrCRNy7UIlhoT2OD6JBLUo8tRvikcjVVURkHNZM X-Received: by 2002:aa7:9296:: with SMTP id j22mr84698577pfa.140.1555428224733; Tue, 16 Apr 2019 08:23:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555428224; cv=none; d=google.com; s=arc-20160816; b=0dpgo21Lxa2STfJXMPxeJzOaw55m/P9iwK2AsXHSrp4c0vodk+ybZ02s/Imrl8DywE k6Y/MBFMB81jUYvU0ZueS71pzDVZi16Ti34YKN+XC4mKHF+YMPZuQQq0rpkAeIhKIIt2 4sUEPeaea2IfukNv89u9iWfqMJot4JaHRi/Ma8HvVlJ3zV46QCfZJT0XSL2vgMxxiM6e A5me1uoGMWOJz9AmImmMYM2jw+k2hUuc5YNsSLacTsas7d/54nDTqqkoITNrKSg9jXH/ KstJHvymNaUKzqNNqzStuucl26+mNSbm3IEbsXBZ3viFlFBFTjw4uBqf7f8qMPYlIUEy 02UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=o/aVMA/PGYZ47AW5d86sVSAPWgFg5ElyuaxTSV2UeSI=; b=yzsMaO5npp6K3s8qoJYipw+MbI7h4lRoKvtJIEy1GHGsH2Njfo/uo2G3mfXhv2e5wb 7dmqMs0HVad3Ydh0n6lCGpw87EfWmQ75UsgU1dSqAeQyCApLXattgeBLlT14gyPTSORZ CX1FyMDBCZbgvAI828X5cM/meYYFhh5HpqqOvKZlt3gqQ9p74eWCOvnhaid3QBuquWsx IipM+pq6V+8+2EnO3aI7tiNt3Xytbza+hTWa3Ae7QDWg5GKJsjGDg5hitBE+XXlw+ZmJ 255b+5gUEOsbcrEXaEHCcg0vWBnEEmgUkqL0chvFLMQCcmzwS5F5PkBwccyDbGergc1J Z11w== 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 t4si42977541pgu.544.2019.04.16.08.23.28; Tue, 16 Apr 2019 08:23:44 -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 S1729697AbfDPPVH (ORCPT + 99 others); Tue, 16 Apr 2019 11:21:07 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57710 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726645AbfDPPVH (ORCPT ); Tue, 16 Apr 2019 11:21:07 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E670680D; Tue, 16 Apr 2019 08:21:06 -0700 (PDT) Received: from fuggles.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7E3B23F59C; Tue, 16 Apr 2019 08:21:02 -0700 (PDT) Date: Tue, 16 Apr 2019 16:21:00 +0100 From: Will Deacon To: Robin Murphy Cc: John Garry , Zhen Lei , Jean-Philippe Brucker , 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 , Hanjun Guo Subject: Re: [PATCH v5 1/6] iommu: add generic boot option iommu.dma_mode Message-ID: <20190416152100.GB4187@fuggles.cambridge.arm.com> References: <20190409125308.18304-1-thunder.leizhen@huawei.com> <20190409125308.18304-2-thunder.leizhen@huawei.com> <010d3cbd-ef74-ad21-c735-0af8b18955e6@huawei.com> <222946ee-adcc-1311-82a7-6afc9ffbc846@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <222946ee-adcc-1311-82a7-6afc9ffbc846@arm.com> User-Agent: Mutt/1.11.1+86 (6f28e57d73f2) () Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 12, 2019 at 02:11:31PM +0100, Robin Murphy wrote: > On 12/04/2019 11:26, John Garry wrote: > > On 09/04/2019 13:53, Zhen Lei wrote: > > > +static int __init iommu_dma_mode_setup(char *str) > > > +{ > > > +??? if (!str) > > > +??????? goto fail; > > > + > > > +??? if (!strncmp(str, "passthrough", 11)) > > > +??????? iommu_default_dma_mode = IOMMU_DMA_MODE_PASSTHROUGH; > > > +??? else if (!strncmp(str, "lazy", 4)) > > > +??????? iommu_default_dma_mode = IOMMU_DMA_MODE_LAZY; > > > +??? else if (!strncmp(str, "strict", 6)) > > > +??????? iommu_default_dma_mode = IOMMU_DMA_MODE_STRICT; > > > +??? else > > > +??????? goto fail; > > > + > > > +??? pr_info("Force dma mode to be %d\n", iommu_default_dma_mode); > > > > What happens if the cmdline option iommu.dma_mode is passed multiple > > times? We get mutliple - possibily conflicting - prints, right? > > Indeed; we ended up removing such prints for the existing options here, > specifically because multiple messages seemed more likely to be confusing > than useful. > > > And do we need to have backwards compatibility, such that the setting > > for iommu.strict or iommu.passthrough trumps iommu.dma_mode, regardless > > of order? > > As above I think it would be preferable to just keep using the existing > options anyway. The current behaviour works out as: > > iommu.passthrough | Y | N > iommu.strict | x | Y N > ------------------|-------------|---------|-------- > MODE | PASSTHROUGH | STRICT | LAZY > > which seems intuitive enough that a specific dma_mode option doesn't add > much value, and would more likely just overcomplicate things for users as > well as our implementation. Agreed. We can't remove the existing options, and they do the job perfectly well so I don't see the need to add more options on top. Will