Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1016133rdb; Fri, 1 Dec 2023 05:08:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IHywQFIL16tqT1C2aXWgVak4Eq7YxsivCKfyE5blDfqZc0fDc5UqTAO94W7nYLncldQJt0w X-Received: by 2002:a17:90b:3b43:b0:285:8e8a:cd1c with SMTP id ot3-20020a17090b3b4300b002858e8acd1cmr23027042pjb.44.1701436091124; Fri, 01 Dec 2023 05:08:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701436091; cv=none; d=google.com; s=arc-20160816; b=JPBR0U3N9S5Xe6bxWvbjdJdrIQN5PZ6luc34aYHPYzSp7XHBjWbauuVArlhD6UgzKs ktCz7bZxSMd57gy25FoTEvU5oTLpDs4og4wPxHZ0KYvbQuE1BHWLThvCG0YRnyYIG+Gv Ab+qHKejsp6KdePcrlnzHFXFpzFmiJh9L8wkjq/4+xXMwVthi/SqYJzMC12ynbMcz4zI WfX9uOGkm/GyYkUHOlyr9mXIHqs9deSmBmAzr5zhslXHKgtdV7tabcn4smNHaKFhHqOn 4/2mhKeqg7HQ3Sqqonah3MdjmPCvlpLNng73lcgCBQtX76YXkTxsi6G4oz+uoCQZQb/V JXXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=XgwryJ6J1EdB2kz65DIdcuCe0tiGI1fBXrbhHyyO0kc=; fh=RYmQmhZp1odAkCiRhzFLy3/I2u9mMNQcpWNqp1nRw6E=; b=W5KNfgon3Jh1cYcK117qc+TPcwgZp0aIATCoVEcmbIS7anzgX6PEXPxFuO1nCPbV+p 5I24ObIRi3oY9lV565Cp/2zc7yS/Nf6ID1XunnCqPXCK2eCwO0Zey/Eu77sdclxjkehL Hobrsms9aZK5VGmTHB5Lb4xv42YWDFRAbyJG6QEoFcjDi57T5Q8NB4HcWJwcCB1ez8HJ NjqUaiJ+lUknRnkZRoNrtEAvM9i2pSrChZ0cEEAshoExebvGvvQS/X09R4RQEG9qNqld XNy1fQsf/eTPKr1OMH0qVh72Vo292sUgSYUt7W7qjAZY4KIKqOYOLyQ/EFwGOhqzeJ+N sxuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id lr10-20020a17090b4b8a00b002859a8aee84si3407344pjb.172.2023.12.01.05.07.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 05:08:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 383C2836D605; Fri, 1 Dec 2023 05:07:56 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378921AbjLANHi (ORCPT + 99 others); Fri, 1 Dec 2023 08:07:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378858AbjLANHh (ORCPT ); Fri, 1 Dec 2023 08:07:37 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8E44310D; Fri, 1 Dec 2023 05:07:42 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9229F1007; Fri, 1 Dec 2023 05:08:28 -0800 (PST) Received: from [10.1.196.40] (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3165C3F73F; Fri, 1 Dec 2023 05:07:38 -0800 (PST) Message-ID: Date: Fri, 1 Dec 2023 13:07:36 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 0/7] dma-mapping: Clean up arch_setup_dma_ops() Content-Language: en-GB To: Jason Gunthorpe Cc: Joerg Roedel , Christoph Hellwig , Vineet Gupta , Russell King , Catalin Marinas , Will Deacon , Huacai Chen , WANG Xuerui , Thomas Bogendoerfer , Paul Walmsley , Palmer Dabbelt , Albert Ou , Lorenzo Pieralisi , Hanjun Guo , Sudeep Holla , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Suravee Suthikulpanit , David Woodhouse , Lu Baolu , Niklas Schnelle , Matthew Rosato , Gerald Schaefer , Jean-Philippe Brucker , Rob Herring , Frank Rowand , Marek Szyprowski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, iommu@lists.linux.dev, devicetree@vger.kernel.org References: <20231129203642.GO1312390@ziepe.ca> From: Robin Murphy In-Reply-To: <20231129203642.GO1312390@ziepe.ca> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 01 Dec 2023 05:07:56 -0800 (PST) On 29/11/2023 8:36 pm, Jason Gunthorpe wrote: > On Wed, Nov 29, 2023 at 05:42:57PM +0000, Robin Murphy wrote: >> Hi all, >> >> Prompted by Jason's proposal[1], here's a first step towards truly >> unpicking the dma_configure vs. IOMMU mess. As I commented before, we >> have an awful lot of accumulated cruft and technical debt here making >> things more complicated than they need to be, and we already have hacks >> on top of hacks trying to work around it, so polishing those hacks even >> further is really not a desirable direction of travel. And I do know >> they're hacks, because I wrote most of them and still remember enough of >> the context of the time ;) > > I quite like this, I was also looking at getting rid of those other > parameters. > > I wanted to take smaller steps because it is all pretty hairy. > > One thing that still concerns me is if the FW data restricts the valid > IOVA window that really should be reflected into the reserved ranges > and not just dumped into the struct device for use by the DMA API. > > Or, perhaps, viof/iommufd should be using the struct device data to > generate some additional reserved ranges? > > Either way, I would like to see the dma_iommu and the rest of the > subsystem agree on what the valid IOVA ranges actually are. Note that there is some intentional divergence where iommu-dma reserves IOVAs matching PCI outbound windows because it knows it wants to avoid clashing with potential peer-to-peer addresses and doesn't want to have to get into the details of ACS redirect etc., but we don't expose those as generic reserved regions because they're firmly a property of the PCI host bridge, not of the IOMMU group (and more practically, because we did do so briefly and it made QEMU unhappy). I think there may also have been some degree of conclusion that it's not the IOMMU API's place to get in the way of other domain users trying to do weird P2P stuff if they really want to. Another issue is that the generic dma_range_map strictly represents device-specific constraints which may not always be desirable or appropriate to apply to a whole group. There wasn't really a conscious decision as such, but it kind of works out as why we still only consider PCI's bridge->dma_ranges (which comes from the same underlying data), since we can at least assume every device behind a bridge accesses memory through that bridge and so inherits its restrictions. However I don't recall any conscious decision for inbound windows to only be considered for DMA domain reservations rather than for proper reserved regions - pretty sure that's just a case of that code being added in the place where it seemed to fit best at the time (because hey it's more host bridge windows and we already have a thing for host bridge windows...) Thanks, Robin.