From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC259C433E0 for ; Fri, 26 Mar 2021 16:10:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A59B361A27 for ; Fri, 26 Mar 2021 16:10:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230343AbhCZQJx (ORCPT ); Fri, 26 Mar 2021 12:09:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:35642 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229945AbhCZQJe (ORCPT ); Fri, 26 Mar 2021 12:09:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A607761A26; Fri, 26 Mar 2021 16:09:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616774973; bh=3/Hwt+1yo2BE6llfw3ccgcVv3CP6bjLi789k3A1nvJM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=pFDHUbIWX0XQ2bffCr3Ni+c/thTO8WyCrkV2Xa99Tsz7QUERvF/83/ddOlUFO+/cv LPkEP93MLXWF+R9dW3gubMBAG4MwTC4nVNMcw15071cUA5O5nr373Pg94WkrN5yMbU yMTAjHlY9e8JXqsA1u5TNC5XcMSmWIfpKXSlynsORnnup5U3yALbuysdspV8N1FpRN NlYrc/9JetjKSxjexDQRyf8xo9OiTfhAW9vaXRwHmgMxTK4b9Bn2g9biuiytpLkxaC bvaoP793Hlm/wbn6wR6N3/Evl6I6q/gAgVF5HeqbYhMM2L4xZx0GQYBptg0OJAP7DA KJ0jjvAShuBnQ== Received: by mail-oi1-f178.google.com with SMTP id x207so6201764oif.1; Fri, 26 Mar 2021 09:09:33 -0700 (PDT) X-Gm-Message-State: AOAM533xPdSslg4n0Pndkm8m4QbaPtteLA96fUTCmVyNRAjpekLYpTj6 PD2tk/TCQBurck7V3nBt/UtssvRyzDmqZCg406w= X-Google-Smtp-Source: ABdhPJzbtKWXDRaV1Cue/5KoUdiom8nvmS77pXZB0AAzADNPV10yiYUw9jZFMqTVgfMq1yfLJ7qTG1dwaVRF/NWkIGw= X-Received: by 2002:a05:6808:3d9:: with SMTP id o25mr10383952oie.4.1616774972941; Fri, 26 Mar 2021 09:09:32 -0700 (PDT) MIME-Version: 1.0 References: <20210320151903.60759-1-sven@svenpeter.dev> <20210323205346.GA1283560@robh.at.kernel.org> <43685c67-6d9c-4e72-b320-0462c2273bf0@www.fastmail.com> In-Reply-To: From: Arnd Bergmann Date: Fri, 26 Mar 2021 17:09:17 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 0/3] Apple M1 DART IOMMU driver To: Mark Kettenis Cc: sven@svenpeter.dev, Rob Herring , "open list:IOMMU DRIVERS" , Joerg Roedel , Will Deacon , Robin Murphy , Hector Martin , Marc Zyngier , Mohamed Mediouni , Stan Skowronek , Linux ARM , Linux Kernel Mailing List , DTML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 26, 2021 at 4:59 PM Mark Kettenis wrote: > > > From: Arnd Bergmann > > Date: Thu, 25 Mar 2021 22:41:09 +0100 > > > > On Thu, Mar 25, 2021 at 8:53 AM Sven Peter wrote: > > > On Tue, Mar 23, 2021, at 21:53, Rob Herring wrote: > > > > > > I'm probably just confused or maybe the documentation is outdated but I don't > > > see how I could specify "this device can only use DMA addresses from > > > 0x00100000...0x3ff00000 but can map these via the iommu to any physical > > > address" using 'dma-ranges'. > > > > It sounds like this is a holdover from the original powerpc iommu, > > which also had a limited set of virtual addresses in the iommu. > > > > I would think it's sufficient to describe it in the iommu itself, > > since the limitation is more "addresses coming into the iommu must > > be this range" than "this device must use that address range for > > talking to the iommu". > > > > If the addresses are allocated by the iommu driver, and each iommu > > only has one DMA master attached to it, having a simple range > > property in the iommu node should do the trick here. If there might > > be multiple devices on the same iommu but with different address > > ranges (which I don't think is the case), then it could be part of > > the reference to the iommu. > > The ADT has properties on the iommu node that describe the adresses it > accepts for translation ("vm-base" and "vm-size"). So I think we can > safely assume that the same limits apply to all DMA masters that are > attached to it. We don't know if the range limit is baked into the > silicon or whether it is related to how the firmware sets things up. > Having the properties on the iommu node makes it easy for m1n1 to > update the properties with the right values if necessary. Ok. > 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. I'm not following here. Do you mean the bus address used for bypass is different from the upstream address that gets programmed into the iommu when it is active? Arnd