Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1596707pxf; Fri, 26 Mar 2021 10:28:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNHpDWPxrht7cfE+eC3BqdaECDd2nFowSj02yRBQ/5iRAC7GhvD3ysKKaV+PbhU68PKR09 X-Received: by 2002:a17:906:e84:: with SMTP id p4mr16422459ejf.248.1616779717160; Fri, 26 Mar 2021 10:28:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616779717; cv=none; d=google.com; s=arc-20160816; b=WKk0tVVxYhj/vimXkmBxNeLsMV400lpauVT7aYwBetmvj6sGxOjq5EW80h40vAxC6T TYRCeyz8/dEcM47wYH/DO8Qo2vuU/aeAtAvWtNjPW3jBLMqqN1t568E2hQAeQSqNA0No YG/s/In2JU+0xYtgpvFsf3tn0b8JII+oeI0VyZdGBCtCOWTJ4EX5Iyu6E0Pi26n/09DB N7+AEdTM50mVL8ti0ImyUVc6GKPgl9LBEayvuo8K0Ee9BXTcsyLzTnFKr8flZGTeVxU+ w3R58/SrgJiCXpIazEx7B0Did52oFl+liug+23lR9HSo0+UVeirvMUK0xJ3TtEPaL9/e YAMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:references:subject:in-reply-to:cc:to :from:date; bh=rT5QK0vVoWY+Nmk3UHt3vSuy8UeaSYvu/PyTxFGtnCc=; b=wLNoEXQu7ujSCAQGjsZVKJ7u1Z+Bmvkl+LkxAvNL+9OawvhDLMAxtk69Hp/vwAxuhY wYAUj4wgUgDRxvpedbyrH7wMwxlcTvWtR6ByEV0jL8A7guEWBvrs3qaAZXtgbkkR48Ks qOBr/MpNsU/c9ndA9Z7oTTfrm1BwRwwbPOn1iI9B2ek/VZb+/B34i/B+fVw5CsbFB4m6 Bt5JAO48Eo+D6ApOMERT+mi0fwE2t+1ceysOhcop9w1uNwmrVjd84/32IQJErgKEaKg6 tgpdUCn4LkDfDhL1Z/n8CrbDOmI13AAUjj6iLGhP9uM5Tc28AlCw+eyMjmSrVFAkCDZ9 /MEw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a8si7262183ejt.44.2021.03.26.10.28.14; Fri, 26 Mar 2021 10:28:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230142AbhCZR0p (ORCPT + 99 others); Fri, 26 Mar 2021 13:26:45 -0400 Received: from sibelius.xs4all.nl ([83.163.83.176]:62880 "EHLO sibelius.xs4all.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230226AbhCZR0V (ORCPT ); Fri, 26 Mar 2021 13:26:21 -0400 Received: from localhost (bloch.sibelius.xs4all.nl [local]) by bloch.sibelius.xs4all.nl (OpenSMTPD) with ESMTPA id b5900111; Fri, 26 Mar 2021 18:26:14 +0100 (CET) Date: Fri, 26 Mar 2021 18:26:14 +0100 (CET) From: Mark Kettenis To: Arnd Bergmann Cc: sven@svenpeter.dev, robh@kernel.org, iommu@lists.linux-foundation.org, joro@8bytes.org, will@kernel.org, robin.murphy@arm.com, marcan@marcan.st, maz@kernel.org, mohamed.mediouni@caramail.com, stan@corellium.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org In-Reply-To: (message from Arnd Bergmann on Fri, 26 Mar 2021 17:38:24 +0100) Subject: Re: [PATCH 0/3] Apple M1 DART IOMMU driver References: <20210320151903.60759-1-sven@svenpeter.dev> <20210323205346.GA1283560@robh.at.kernel.org> <43685c67-6d9c-4e72-b320-0462c2273bf0@www.fastmail.com> <9f06872d-f0ec-43c3-9b53-d144337100b3@www.fastmail.com> Message-ID: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Arnd Bergmann > Date: Fri, 26 Mar 2021 17:38:24 +0100 > > On Fri, Mar 26, 2021 at 5:10 PM Sven Peter wrote: > > On Fri, Mar 26, 2021, at 16:59, Mark Kettenis wrote: > > > Some of the DARTs provide a bypass facility. That code make using the > > > standard "dma-ranges" property tricky. That property would need to > > > contain the bypass address range. But that would mean that if the > > > DART driver needs to look at that property to figure out the address > > > range that supports translation it will need to be able to distinguish > > > between the translatable address range and the bypass address range. > > > > Do we understand if and why we even need to bypass certain streams? > > My guess is that this is a performance optimization. > > There are generally three reasons to want an iommu in the first place: > - Pass a device down to a guest or user process without giving > access to all of memory > - Avoid problems with limitations in the device, typically when it > only supports > 32-bit bus addressing, but the installed memory is larger than 4GB > - Protect kernel memory from broken drivers > > If you care about none of the above, but you do care about data transfer > speed, you are better off just leaving the IOMMU in bypass mode. > I don't think we have to support it if the IOMMU works reliably, but it's > something that users might want. Another reason might be that a device needs access to large amounts of physical memory at the same time and the 32-bit address space that the DART provides is too tight. In U-Boot I might want to use bypass where it works since there is no proper IOMMU support in U-Boot. Generally speaking, the goal is to keep the code size down in U-Boot. In OpenBSD I'll probably avoid bypass mode if I can. I haven't figured out how the bypass stuff really works. Corellium added support for it in their codebase when they added support for Thunderbolt, and some of the DARTs that seem to be related to Thunderbolt do indeed have a "bypass" property. But it is unclear to me how the different puzzle pieces fit together for Thunderbolt. Anyway, from my viewpoint having the information about the IOVA address space sit on the devices makes little sense. This information is needed by the DART driver, and there is no direct cnnection from the DART to the individual devices in the devicetree. The "iommus" property makes a connection in the opposite direction. Cheers, Mark