Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp5276923iob; Mon, 9 May 2022 12:34:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6DDqZezvKZm6Y94tWUtcz7OhT1VH8UlAAW7xVHsjuVd0gCchec9WF/pffXEf0T+zHknh0 X-Received: by 2002:ae9:dc45:0:b0:69f:c1f3:3328 with SMTP id q66-20020ae9dc45000000b0069fc1f33328mr13235437qkf.418.1652124855776; Mon, 09 May 2022 12:34:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652124855; cv=none; d=google.com; s=arc-20160816; b=mJUI89K/QefGZ4IVO5D+Kxsq107UsYsbNJguDi9TPx1SP1vtILHd2gNzMr/bW90HDu RvXISnpUgCp4UdnelbuOWRLmVxrnUA0CqlItDkb3bN1DObNMvea9oQphQcaShtJ6uDyY SuoUqcszSIiY5bCQyI/Om8d1ObFJAggMVn/ZckjKpZRQTd8VUhOl2ODflQL5eJmOas/j yHts1dv9OfdAOj2XE0/K1shiqqqfqdhSr0Z9Cibt/oj6qWud7B7C6h6Td+KSPM/Z58lU HtYWNgXbPzewHwu1nW3kqOpbXg/zFJRtIJq+J2lUXgrP1LNdIEPPnivDdowcgxOqx1/P Vhrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=AXv+sPsjvpomIYbdY5IKcRmV6/qhrBEel8OWnWZXQL4=; b=ws7eg/ShlRzvPv+A19+bJ3wTRcHUwRZkrmzB8veGKsDOC7vOXzpFWdkGS5JZMR7cXB 2Hymw/3e2Flqbc0iz/ggkAws+tZJU9ovq9Nr7swNqXMTXl16FUs/CNYJDJdh0lYhxAV+ 7tKcYz6G9f3Y5LHy9rEuyLoozesxLGkXsX1WFOblJ6KS3w1wBPChcqdeHBioll+4PiPX uA1HQR/qc5FcOoHwvXdOhGbb1pkQAWX2Zz7FY5Y+7QDeGY/4vowZMHXrWRYIFuwV5zq0 A7VOiun7NdxFhfL8Yz1ycz6izxsy5F/C+FkuAezJuSGPrntbmVJgxfG+ygsl1XD9zY7Q Wv+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=h2xt4MIT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id m21-20020a05622a119500b002f3bc52e8b4si8593876qtk.95.2022.05.09.12.34.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 12:34:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=h2xt4MIT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1F8D084A32; Mon, 9 May 2022 12:27:48 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240641AbiEITbb (ORCPT + 99 others); Mon, 9 May 2022 15:31:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240608AbiEITb2 (ORCPT ); Mon, 9 May 2022 15:31:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF5697C277; Mon, 9 May 2022 12:27:33 -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 ams.source.kernel.org (Postfix) with ESMTPS id 6A202B8190E; Mon, 9 May 2022 19:27:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BC31C385B8; Mon, 9 May 2022 19:27:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652124451; bh=LHhMugA56ra1E/f4M4s+HXIm7ikQL8aa6G58KTVtBz4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=h2xt4MIT0hq1byYBVWoaJFVZH1PqfmapTHYVbY4QF1GfBw0gWYpkJvffxYVJROp/w o5e5XlseTtAbyczalx8WZma7nau3776eEMiPnAb+aH7DGy0paSceaMMK2NgH7mDaq7 V6qTzsl90AZuCQCvlnnxzD8SWTPrbuwvdWXVVtFaMT3bvb+XpjRevOipjIyd5LJ+QM 5lmV1PyqZUkQhLRASuo/BMjBfrdnF6ogjqVZ5ErYdH/2BTdCsGCeE1sWNtQT8ooI2a 1MGt9OfEic40lzbwntnx56i0TY8f3A/Y94vuuNcULimj4Higp6KJ9f0rpfeGaAwk44 BUgdRk+a2pzvw== Received: by mail-pl1-f179.google.com with SMTP id j14so14800996plx.3; Mon, 09 May 2022 12:27:31 -0700 (PDT) X-Gm-Message-State: AOAM531f9bsYZJMpKqUmdf0NYCNlt6bO0bCfARm12OJf+46qQCGNjslO 06P5XsNNjEfQ5A6fiuh8/3Jh0fXWF5smmndZUQ== X-Received: by 2002:a17:902:9345:b0:15f:186b:e478 with SMTP id g5-20020a170902934500b0015f186be478mr4219682plp.117.1652124450742; Mon, 09 May 2022 12:27:30 -0700 (PDT) MIME-Version: 1.0 References: <35661036a7e4160850895f9b37f35408b6a29f2f.1652091160.git.robin.murphy@arm.com> In-Reply-To: <35661036a7e4160850895f9b37f35408b6a29f2f.1652091160.git.robin.murphy@arm.com> From: Rob Herring Date: Mon, 9 May 2022 14:27:19 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] iommu/dma: Explicitly sort PCI DMA windows To: Robin Murphy Cc: Joerg Roedel , Will Deacon , Bjorn Helgaas , Linux IOMMU , PCI , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 9, 2022 at 5:16 AM 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 > --- > > v2: Clean up now-unused local variable > > drivers/iommu/dma-iommu.c | 13 ++++++++++++- > drivers/pci/of.c | 8 +------- > 2 files changed, 13 insertions(+), 8 deletions(-) Reviewed-by: Rob Herring