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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94976C433F5 for ; Wed, 23 Mar 2022 09:49:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234663AbiCWJum (ORCPT ); Wed, 23 Mar 2022 05:50:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232578AbiCWJul (ORCPT ); Wed, 23 Mar 2022 05:50:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B5A720182 for ; Wed, 23 Mar 2022 02:49:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E376160B87 for ; Wed, 23 Mar 2022 09:49:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4AF95C340ED; Wed, 23 Mar 2022 09:49:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648028951; bh=4VQO87LsN3C7aIxtCY4P30XsNOmbPkENQiXxqekgQes=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=PGZLnsJgdClJtcu5wiJqnkSHycaiHr34n9/7lFxuGpXN8sXtXl0GPJ06H8LzAlut1 TUenp4Ir2wDjwNAbIn+KKD4gENOt+5g6l/Hr1lJiev5Q5fHL1NHmfiGpC652daKA9C 6anBMZrz1BW6vWsJRWwltzo5xL3CSFe1sSGNnAX3ZTPPfUtU8kX3SFcMxcGdopaRPP Z+50TNcr54w357TkPxvffU81oDn/m3R3VaCXZ3fwrikKZ+k2pm7tTsopf4cMBbzVwT ZuRnjSJNSZHcejGvh4otSdr/xE6yvZ8M50C2V6W/4iMFlEZndhZswoiWiF7O25KVnS wP3q5n3J4Qexw== Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nWxc5-00GStO-3I; Wed, 23 Mar 2022 09:49:09 +0000 Date: Wed, 23 Mar 2022 09:49:04 +0000 Message-ID: <874k3pxalr.wl-maz@kernel.org> From: Marc Zyngier To: Robin Murphy Cc: joro@8bytes.org, will@kernel.org, iommu@lists.linux-foundation.org, bhelgaas@google.com, linux-pci@vger.kernel.org, robh@kernel.org, dann.frazier@canonical.com Subject: Re: [PATCH] iommu/dma: Explicitly sort PCI DMA windows In-Reply-To: <65657c5370fa0161739ba094ea948afdfa711b8a.1647967875.git.robin.murphy@arm.com> References: <65657c5370fa0161739ba094ea948afdfa711b8a.1647967875.git.robin.murphy@arm.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: robin.murphy@arm.com, joro@8bytes.org, will@kernel.org, iommu@lists.linux-foundation.org, bhelgaas@google.com, linux-pci@vger.kernel.org, robh@kernel.org, dann.frazier@canonical.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On Tue, 22 Mar 2022 17:27:36 +0000, Robin Murphy wrote: > > Originally, creating the dma_ranges resource list in pre-sorted fashion > was the simplest and most efficient way to enforce the order required by > iova_reserve_pci_windows(). However since then at least one PCI host > driver is now re-sorting the list for its own probe-time processing, > which doesn't seem entirely unreasonable, so that basic assumption no > longer holds. Make iommu-dma robust and get the sort order it needs by > explicitly sorting, which means we can also save the effort at creation > time and just build the list in whatever natural order the DT had. > > Signed-off-by: Robin Murphy > --- > > Looking at this area off the back of the XGene thread[1] made me realise > that we need to do it anyway, regardless of whether it might also happen > to restore the previous XGene behaviour or not. Presumably nobody's > tried to use pcie-cadence-host behind an IOMMU yet... This definitely restores PCIe functionality on my Mustang (XGene-1). Hopefully dann can comment on whether this addresses his own issue, as his firmware is significantly different. Thanks, M. -- Without deviation from the norm, progress is not possible.