Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2670486pxp; Tue, 22 Mar 2022 03:46:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyx8DxsyoIRjHH/8zTdDnLetxk3gnKCWMhJ4rpLA2sZiieLKRnUtBOm6o+nghZuJ78FbEr9 X-Received: by 2002:a17:90b:33c4:b0:1c6:8598:d4bf with SMTP id lk4-20020a17090b33c400b001c68598d4bfmr4244271pjb.81.1647945999181; Tue, 22 Mar 2022 03:46:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647945999; cv=none; d=google.com; s=arc-20160816; b=yaF8QGXzP0rHFUN8IRkm7035xJxQwWyxq5eraD1a3sJ4aIhbXdnoJfLM/6JDLn4IEm P8E1kojzbwf6WHY7/pYFkwvfsPUntYnfyiNTjNNJ7IaxtibPngPLrfy1PgMeiS5Bv05F VMbXR+e9cVnHpcP8Koj8IftO1CHZsqraZfvqRGtxTJAFKn/Q2k0jyEosLGU3HIEip4Gz VX+NFwi/oXnnOjeV87/oEfCjwB7tTXqUDz8kqJV8tHXrudVk36wBuQLn4OCrr1x3C79X z4GH0hGf7Bb7B/fENcO5Br9fz6tHznx5wJxwXnolMONHSWcdUK4vrgmHFVO64NCyGum5 lvDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=f4dc7cS5VUH9L1fgOY139udnnSViezauEL/sJVGyhoo=; b=knWV7vlAUNG8t6Qi1U++Au4Xv0nhG2ghoFh+6JvqPWY+NlHpcE0VsWVqW5viQwsUfg RytNbAKrV0S4NUWEi/BN5yY2EGuZVYZ/IAkhYrLh6zLcMD7UJFcXWKbvA2jm8aQBbYXX 5qlX1h1G8XVGFYwtIJe5UDl9XLxyKZ+08akWBOU4DtIaImAiWtGIzVYstm9dmnytJI/a pDNnfjTEhjqKkJA7OT1dz2g9FZqE/gqe6pUwE/Zz87F0doIpa8OCSHFYpGGkOn5hFJsc XzE5CseymrIe9vyzQ7pYOC1Hbc8VI1QXB116XbEI0C3ZmV6d7RmyoU0m1XaxruVy5Ytu HB/g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j18-20020a170903025200b00153b2d1665fsi2127300plh.615.2022.03.22.03.46.24; Tue, 22 Mar 2022 03:46:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232390AbiCVJSE (ORCPT + 99 others); Tue, 22 Mar 2022 05:18:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232502AbiCVJR4 (ORCPT ); Tue, 22 Mar 2022 05:17:56 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EAE427FD7; Tue, 22 Mar 2022 02:16:30 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id 6556268AFE; Tue, 22 Mar 2022 10:16:26 +0100 (CET) Date: Tue, 22 Mar 2022 10:16:26 +0100 From: Christoph Hellwig To: Robin Murphy Cc: joro@8bytes.org, baolu.lu@linux.intel.com, andreas.noever@gmail.com, michael.jamet@intel.com, mika.westerberg@linux.intel.com, YehezkelShB@gmail.com, iommu@lists.linux-foundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, mario.limonciello@amd.com, hch@lst.de Subject: Re: [PATCH v2 2/2] thunderbolt: Make iommu_dma_protection more accurate Message-ID: <20220322091626.GB27069@lst.de> References: <0dd14883930c9f55ace22162e23765a37d91a057.1647624084.git.robin.murphy@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0dd14883930c9f55ace22162e23765a37d91a057.1647624084.git.robin.murphy@arm.com> User-Agent: Mutt/1.5.17 (2007-11-01) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Fri, Mar 18, 2022 at 05:42:58PM +0000, Robin Murphy wrote: > Between me trying to get rid of iommu_present() and Mario wanting to > support the AMD equivalent of DMAR_PLATFORM_OPT_IN, scrutiny has shown > that the iommu_dma_protection attribute is being far too optimistic. > Even if an IOMMU might be present for some PCI segment in the system, > that doesn't necessarily mean it provides translation for the device(s) > we care about. Furthermore, all that DMAR_PLATFORM_OPT_IN really does > is tell us that memory was protected before the kernel was loaded, and > prevent the user from disabling the intel-iommu driver entirely. While > that lets us assume kernel integrity, what matters for actual runtime > DMA protection is whether we trust individual devices, based on the > "external facing" property that we expect firmware to describe for > Thunderbolt ports. > > It's proven challenging to determine the appropriate ports accurately > given the variety of possible topologies, so while still not getting a > perfect answer, by putting enough faith in firmware we can at least get > a good bit closer. If we can see that any device near a Thunderbolt NHI > has all the requisites for Kernel DMA Protection, chances are that it > *is* a relevant port, but moreover that implies that firmware is playing > the game overall, so we'll use that to assume that all Thunderbolt ports > should be correctly marked and thus will end up fully protected. > > CC: Mario Limonciello > Signed-off-by: Robin Murphy Looks sensible to me: Acked-by: Christoph Hellwig