From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 16 Apr 2019 16:21:00 +0100 From: Will Deacon 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: quoted-printable In-Reply-To: <222946ee-adcc-1311-82a7-6afc9ffbc846@arm.com> Sender: linux-doc-owner@vger.kernel.org List-Archive: List-Post: 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 List-ID: 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) > > > +{ > > > +=A0=A0=A0 if (!str) > > > +=A0=A0=A0=A0=A0=A0=A0 goto fail; > > > + > > > +=A0=A0=A0 if (!strncmp(str, "passthrough", 11)) > > > +=A0=A0=A0=A0=A0=A0=A0 iommu_default_dma_mode =3D IOMMU_DMA_MODE_PASS= THROUGH; > > > +=A0=A0=A0 else if (!strncmp(str, "lazy", 4)) > > > +=A0=A0=A0=A0=A0=A0=A0 iommu_default_dma_mode =3D IOMMU_DMA_MODE_LAZY; > > > +=A0=A0=A0 else if (!strncmp(str, "strict", 6)) > > > +=A0=A0=A0=A0=A0=A0=A0 iommu_default_dma_mode =3D IOMMU_DMA_MODE_STRI= CT; > > > +=A0=A0=A0 else > > > +=A0=A0=A0=A0=A0=A0=A0 goto fail; > > > + > > > +=A0=A0=A0 pr_info("Force dma mode to be %d\n", iommu_default_dma_mod= e); > >=20 > > What happens if the cmdline option iommu.dma_mode is passed multiple > > times? We get mutliple - possibily conflicting - prints, right? >=20 > Indeed; we ended up removing such prints for the existing options here, > specifically because multiple messages seemed more likely to be confusing > than useful. >=20 > > 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? >=20 > As above I think it would be preferable to just keep using the existing > options anyway. The current behaviour works out as: >=20 > iommu.passthrough | Y | N > iommu.strict | x | Y N > ------------------|-------------|---------|-------- > MODE | PASSTHROUGH | STRICT | LAZY >=20 > 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