Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp2333633pxf; Sat, 27 Mar 2021 08:32:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmpbV2i6SjMlrOdKvakMKDooYaPRmVWlVifzLIXzOc4Ym696x6vXNZgRmJg9QRpqmBnsdb X-Received: by 2002:a17:906:74c4:: with SMTP id z4mr20913119ejl.512.1616859146991; Sat, 27 Mar 2021 08:32:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616859146; cv=none; d=google.com; s=arc-20160816; b=hgtKyUVOXvSRqq6hrsryD02XLMrEsqY0oSk/5aj32OUS8N1vnw18KpioAENaBCAxhD 2qlQXlD5mPggCzIzBMHfLuLKzf7F9/ofOKbHveJ4DWp8YXKrNYvrKONQI/WOUnieRQt/ LxUYNm8ertBkhIljbtDQpE2x6hAvMD8O7+uc8EvgsTQJ3vO2pj9plBMNC/gr/04aNkHo tH/k8R3kA4syVmX/eyBlbvs7DPUQ9pr4hN+NLN7/JNoxvO6AAy5bKjgQRc5D7g+q03+1 f+j+ZCbJALfMfwsruIDgWD9jrdD+kuYQBae2OoBW6MiHkYl/tlVI3PfPMCZxV/WLFDDA 9ZLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:dkim-signature:dkim-signature; bh=x2m3pCDfFJux8o5j+dJWq42C3lpC8BI/9Q73L1x239U=; b=XTVhl8ZoxtKJ8Y8AZMPIonzwEG8k/yXoJWSU2SDkZBIRs6oPs3Paanc+pdLXIHA9eU PSKexy9rgXDJhTFO010AZvruFBbh4VxBmcjiVjLN9xj6ha+qv4WKjtvGTyEPhCd+YonF UKgjpoLkS7AOfTNNWTpsSKiEhyAV8rrkVa/Cx4GIM+DbToE9PY1xXmp/w9QSQh64fHj2 wpYzEk6+CBBHHWSsmqBriY46xngq/m3qlYKL52IkN1sE0zS7vUVw1yObvnC0WRpsZVvl n96wPQHFOk2sDUvZHCsnKe88nvcD3rPSSwSGKp8ERujw6fYuQcHJnemnspv7jGa5qvxJ TqGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@svenpeter.dev header.s=fm1 header.b=UDIqOyXp; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="Qm1zA1/f"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=svenpeter.dev Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qu4si9161260ejb.219.2021.03.27.08.32.04; Sat, 27 Mar 2021 08:32:26 -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; dkim=pass header.i=@svenpeter.dev header.s=fm1 header.b=UDIqOyXp; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="Qm1zA1/f"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=svenpeter.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230176AbhC0PbJ (ORCPT + 99 others); Sat, 27 Mar 2021 11:31:09 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:55929 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230086AbhC0PbF (ORCPT ); Sat, 27 Mar 2021 11:31:05 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id DC64858043D; Sat, 27 Mar 2021 11:31:04 -0400 (EDT) Received: from imap21 ([10.202.2.71]) by compute3.internal (MEProxy); Sat, 27 Mar 2021 11:31:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=mime-version:message-id:in-reply-to:references:date:from:to :cc:subject:content-type; s=fm1; bh=x2m3pCDfFJux8o5j+dJWq42C3lpC 8BI/9Q73L1x239U=; b=UDIqOyXp4GWRmI2pzioG2zuL3bKG4h5t1oaqrMF+A9/U WD6G5vyt+h7rjWV/2rwtSLbM79Vc6xOB+j5gjjCrs5su1k2oL+8cfR/ZTns61zkY /ZgRT37gx/5oJkS578CTTr4NyZoB20uA0Pixc3tqyAEaRNWy+oFtztYFIzWZe+WV gZMIYrwa3xPb63OrvhNqjMn8AO4NetnpDRAIE/gx1ae8Y0VJbJUdRI0Wuf9v0MM0 7qby21vBt8sfsJ1HUeBUUYqYnp+ZpczL2CZrfHaifor5yodI6/JUM7iAW3YPo2tP mf5gEGpTAbMa9WFRQ/FgmLTJV7MNsF6Z5hrTanQmHg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=x2m3pC DfFJux8o5j+dJWq42C3lpC8BI/9Q73L1x239U=; b=Qm1zA1/fn0kTeXiwtso6EV aQkQ4AY2qawCC2OVtoUViubYu+WsOw1jQwFekQ8xdoF5uuCZdryL939THsvpPPzU 4rOR3Km4Mng0Iq+Ah9/Q10bk8RibabwJ0Sys1zcKzV6bdMnIEJ4TNDNqF+sOHcoI p6qNu/yWphfM6qoNqG/cKhLRIrlKOCvar1RjqtpS/tgLAfBgyaKS3DreVCoWKyjY eseRKUzeRP4tHuKd1o5v1/9OpTJU5Wq/9axhSQ9Lk9ZkMekn2FggipTDkym9eBmW 9RnEFvi5h71ATTWWJy6ftG2jq7msXnnLBGd+dIFfAuRtnxw65itdDxKZLyy7DTPw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudehgedgjeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdfuvhgv nhcurfgvthgvrhdfuceoshhvvghnsehsvhgvnhhpvghtvghrrdguvghvqeenucggtffrrg htthgvrhhnpefgieegieffuefhtedtjefgteejteefleefgfefgfdvvddtgffhffduhedv feekffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hsvhgvnhesshhvvghnphgvthgvrhdruggvvh X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 732A051C005E; Sat, 27 Mar 2021 11:31:02 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-273-g8500d2492d-fm-20210323.002-g8500d249 Mime-Version: 1.0 Message-Id: In-Reply-To: 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> <45faaadd-eda7-464f-96ff-7324f566669e@www.fastmail.com> Date: Sat, 27 Mar 2021 16:30:41 +0100 From: "Sven Peter" To: "Arnd Bergmann" Cc: "Robin Murphy" , "Mark Kettenis" , "Rob Herring" , "open list:IOMMU DRIVERS" , "Joerg Roedel" , "Will Deacon" , "Hector Martin" , "Marc Zyngier" , "Mohamed Mediouni" , "Stan Skowronek" , "Linux ARM" , "Linux Kernel Mailing List" , DTML Subject: Re: [PATCH 0/3] Apple M1 DART IOMMU driver Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 26, 2021, at 20:59, Arnd Bergmann wrote: > On Fri, Mar 26, 2021 at 6:51 PM Sven Peter wrote: > > dart-sio: 0021c000 fbde4000 (at least their Secure Enclave/TPM co-processor) > > Same here: > dart-sio { > vm-base = <0x0>; > vm-size = <0xfc000000>; > pio-vm-base = <0xfd000000>; > pio-vm-size = <0x2000000>; > pio-granularity = <0x1000000>; > } > > There are clearly two distinct ranges that split up the 4GB space again, > with a small hole of 16MB (==pio-granularity) at the end of each range. > > The "pio" name might indicate that this is a range of addresses that > can be programmed to point at I/O registers in another device, rather > than pointing to RAM. > > Arnd > Very interesting observation! Mark and I have discussed this a little bit further on IRC. Mark also successfully used the PCIe DARTs with a DMA window outside of the one specified by vm-base/vm-size in the ADT. I believe that the (pio-)vm-base/size properties merely specify the ranges their allocator uses and do not describe actual hardware limitations. Mark also suggested that they might reserve memory at the beginning to find bugs similar to how one might not allow to map memory at 0x0. I have also done a few more experiments and figured out that if I put the IOMMU into bypass mode (which doesn't seem to work for all IOMMUs/master combinations which is why I'll leave it out of this series for now until I figure out more details) I *can* use the full address space. I think the limitation is therefore imposed by the translation hardware inside the IOMMU and not by the bus/the interconnect. If that's correct I think the right place to enforce this is to just limit the aperture inside the DART driver to a 32bit address space whenever address translation is enabled. Thanks, Sven