Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp926195pxb; Wed, 6 Apr 2022 04:29:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPDQkhEIJpU54EFAHRLhfE8KAd3B8UGgVAVMVk73xZw9+C5GTjnDg2CpsiObKNcm6bWh2a X-Received: by 2002:a17:90b:4a83:b0:1c6:f037:bc73 with SMTP id lp3-20020a17090b4a8300b001c6f037bc73mr9504510pjb.44.1649244596808; Wed, 06 Apr 2022 04:29:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649244596; cv=none; d=google.com; s=arc-20160816; b=iL7IUCPvqX+v+t2DE8tx3sAvvwqS8hFGFnZDOxcvxSaeR6ESyaR+/2fN5L2cpzZ47j 4YlAMptxyTogvSBx5TvV3dYhl2qPWD6nWijcJGPv6nauvN3nVRqHeCShd+Z2rzbHA9cA QMwJTlmR2KJ+O9Nrf3Z/OAl1Yb209DxbOIjjJMtvRDYCUZ9Qi6ql27rL6e2m8iCd0BPN DbKJQvb4EreFbwEeLNCj8HVtZD7fLVK2yrpBPO6mp+OTmjvm+MLj3A6DKDJJIaAbkisG I0DzxIphDl2OMzXWbsfYJIY3S/Uy8Sl2PBKjiB3vXKuWqBkhOzVr4wflIU47j09/fbDT VqdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=E+EerGIERU8sd6STIJnnIejSM+etkTFrs3RAsRDO240=; b=uitIhGehQp8TVZ5EVYepUXafyAEzgbs+zsk2LlPm7sZiA3WhiL0lykwOK26MHlGQNN Ce+1f/jkgBWCawfDMZh6E4Ep/Hu9p4SR0bYTehtaP96M//toVMxLA5mI1WedfWEeauUR 5dg4qI1YlOxifJUOLxUtuDWgYTzyAjdOpjR0AjtTkFMtyVmMxqzqQACM1vrYfqLqKdJa 4tHTNiPYpvZ97dJC5tGEjCSwCCXYEnyTY8VgHpplXrFuuk0cNId2xCi0MAidcBhP8fzT rLBTjqSGzy37I7elIn8o/EY6qwGQcYnGW+j5Oefu25YLK3jzS7R9m5OQQwvKRlIJybKG 92pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BROFxVoa; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id f1-20020a655501000000b003816043ee95si15082427pgr.138.2022.04.06.04.29.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 04:29:56 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BROFxVoa; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3BDA65FFD4C; Wed, 6 Apr 2022 02:51:40 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377703AbiDEV3Q (ORCPT + 99 others); Tue, 5 Apr 2022 17:29:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379485AbiDENNo (ORCPT ); Tue, 5 Apr 2022 09:13:44 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4577D10782B; Tue, 5 Apr 2022 05:15:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649160956; x=1680696956; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=eLlXIWgzT4jg7igfmDa9mpSj+r1W/DMEJ9zt2e+BDk4=; b=BROFxVoaMdJ9K3TW78g89ECva9COhsR+KZdSIpNuB+CplyS31FqpO7KS f+Zm8dbgsvviWO1GUchRhbsi/1kokykUjP1y4U/EyTtDEw42dYU75wCu3 3X5Ptdp6q1WLlWcrqBe32i5YI1H9KD68oIkJLwql2cLkbqBSRi8mKkK6b 0nPcCcdUzoSG91pJYUKZu161QQ24tTkQX3sZC+RlsRxN/PZKY9fh7QPq0 IVsopk/QFZ/K/+32GBkMd1ifAu9XYmQE9/ioSSCBc+yzhWPhx500Ml1cR NMAMur2fpbInQJex6lxim03Np6JG9U1SrmDYabBz4JwP8nZf9+TN1ntpT g==; X-IronPort-AV: E=McAfee;i="6200,9189,10307"; a="248249151" X-IronPort-AV: E=Sophos;i="5.90,236,1643702400"; d="scan'208";a="248249151" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Apr 2022 05:15:55 -0700 X-IronPort-AV: E=Sophos;i="5.90,236,1643702400"; d="scan'208";a="505260917" Received: from lahna.fi.intel.com (HELO lahna) ([10.237.72.162]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Apr 2022 05:15:51 -0700 Received: by lahna (sSMTP sendmail emulation); Tue, 05 Apr 2022 15:09:07 +0300 Date: Tue, 5 Apr 2022 15:09:07 +0300 From: Mika Westerberg To: Robin Murphy Cc: joro@8bytes.org, baolu.lu@linux.intel.com, andreas.noever@gmail.com, michael.jamet@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 v3 3/4] thunderbolt: Make iommu_dma_protection more accurate Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Tue, Apr 05, 2022 at 11:41:03AM +0100, 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 > Reviewed-by: Christoph Hellwig > Signed-off-by: Robin Murphy Acked-by: Mika Westerberg