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 93E42C433EF for ; Thu, 17 Mar 2022 06:30:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229995AbiCQGbq (ORCPT ); Thu, 17 Mar 2022 02:31:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229965AbiCQGbf (ORCPT ); Thu, 17 Mar 2022 02:31:35 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCFF99F3BC; Wed, 16 Mar 2022 23:30:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1647498616; x=1679034616; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=+EitQhRNu6NXwpeAYT82YbKRTfk60BrW2G0bXEc4/dM=; b=hR6bS457FRlHdvbERexGJO4WsnkoQj/mCtSsnbNWIEd9Nn+U13BBGc8S MOUXf/l0pg15B9zGGSAgcxUqpRkKi7DcoxFYZfq6+ZEnUcvw55G/p9oJN XDeAXnceek9z56HOkPutT4xENHLi4Zbk0Kf8ShgeHxvBjeRYRaEUpKKgN ty3zNqjKQ2BC4fQ7WenhjdYHV9GV4JxR7FRJhIUPmfsS0BTIj5bdsf/QI alVjy6NSoLBduQpFtS6fgVwWHE+e+SzEQe3ZSNwIZdMdZr7QeQm87yqdU GR3QVOzft+BTAifYNfZS3gG5tidEaYuGU3v9szvEWJwOfE2T30FKug/19 g==; X-IronPort-AV: E=McAfee;i="6200,9189,10288"; a="320005909" X-IronPort-AV: E=Sophos;i="5.90,188,1643702400"; d="scan'208";a="320005909" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Mar 2022 23:30:16 -0700 X-IronPort-AV: E=Sophos;i="5.90,188,1643702400"; d="scan'208";a="714916184" Received: from lahna.fi.intel.com (HELO lahna) ([10.237.72.162]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Mar 2022 23:30:13 -0700 Received: by lahna (sSMTP sendmail emulation); Thu, 17 Mar 2022 08:30:10 +0200 Date: Thu, 17 Mar 2022 08:30:10 +0200 From: Mika Westerberg To: "Limonciello, Mario" Cc: Robin Murphy , "michael.jamet@intel.com" , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "YehezkelShB@gmail.com" , "iommu@lists.linux-foundation.org" , "andreas.noever@gmail.com" , "hch@lst.de" Subject: Re: [PATCH] thunderbolt: Stop using iommu_present() Message-ID: References: <16852eb2-98bb-6337-741f-8c2f06418b08@arm.com> <3bb6a2f8-005b-587a-7d7a-7a9a5391ec05@arm.com> <5ef1c30a-1740-00cc-ad16-4b1c1b02fca4@arm.com> 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mario, On Wed, Mar 16, 2022 at 06:34:51PM +0000, Limonciello, Mario wrote: > > Might it be reasonable for the Thunderbolt core to check early on if any > > tunnelled ports are not marked as external facing, and if so just tell > > the user that iommu_dma_protection is off the table and anything they > > authorise is at their own risk? > > > > Robin. > > How about in iommu_dma_protection_show to just check that all the device > links to the NHI are marked as untrusted? Actually this does not work either because we have pre-USB4 systems out there that are using firmware based connection manager and do not set the "device links" (as it is only needed for USB4 software based connection manager systems). So only thing we can use is the ->external_facing (and ->untrusted) as those exists in all these systems (well assuming the BIOS provided them but this is Microsoft requirement in the same way with the DMAR bit). [For those who are not familiar with the connection manager, it is the software or firmware that actually creates the tunnels over the Thunderbolt/USB4 fabric. In Intel systems up to Alder Lake it used to be firmware based, and from Alder Lake and beyond it is software based meaning that the Linux Thunderbolt driver creates the tunnels. Apple systems have been software based from the beginnning.]