Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4365469imu; Mon, 12 Nov 2018 09:50:34 -0800 (PST) X-Google-Smtp-Source: AJdET5d86OKzH+hnH4WnXVMjuz/cuEd0hA2OZq52NlJoB7+Dby2V9LbB8YNGkWN4nZDz0Une80/3 X-Received: by 2002:a65:63d3:: with SMTP id n19mr1649936pgv.179.1542045033926; Mon, 12 Nov 2018 09:50:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542045033; cv=none; d=google.com; s=arc-20160816; b=Va1jZcn43gKJ7gwH0JD7wZ4Nh6AThtuGlQ41UjxzBMkuhNnb8+U7PkzuBrK8Uc5XHJ d3VzN48uAHi93z3xeOYBiJA0zl71dnqT2vZLQbq9RwfOqV5cBg2r4jCJ1zTupynm6sA3 DmGzCeHbK6vL8HXI07i6eqijp0bKuJaOig+3C8CquuZ00PRl/oLQb4dVtoRsbfDjc2Pi mEzFw+yTqZNVJN2QnakUnad386fq9RjytN6GBbR+sM0lS5lo2uioxuAUKE7heRKOcb2I IlunCH+j8sNNO+SKXR6NnbaOiv89WnpgwqIV72Th5vcNQ3cIPMS6lJOvUjU/gy8Tz3/n c6PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=v5o8Yf/THWfXM0V+sIOL4sLR11p4yU1QKmsAqnATmBo=; b=tNp1ZDMPsyZydu20n0s/pTtvIR5b6jU6naxzpd3e5hKsfOzuXjE0ege+N0lH4vmAxr D9vAYvaCURxC7MSs+yILOVtMtKL40t3B4o/AQrmd376E5GetYrbnn8Gs1WO8e7kqCcgi J9sJkKXRSRCVLLPwXWS4DTul6fD6kj6WvfMG7NcTXEcD9J6bCFuyj2tyFTLd3pj68+Og iAqiSlGilPsI0TPRsv37O8HL6NMSahsaJiLEz37j7pas7lqwAPQfYC7UdSBh6LhJFy3N WxRopTvxKTnxJYI33UpjxnYu5UzBlDhg0/NxWxwcLbiOsRE+VJ0DM9qgIz0T+CG5eJ9W sFoA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u64-v6si2983868pfu.277.2018.11.12.09.50.16; Mon, 12 Nov 2018 09:50:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730203AbeKMDnx (ORCPT + 99 others); Mon, 12 Nov 2018 22:43:53 -0500 Received: from mga12.intel.com ([192.55.52.136]:35021 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727354AbeKMDnx (ORCPT ); Mon, 12 Nov 2018 22:43:53 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Nov 2018 09:49:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,496,1534834800"; d="scan'208";a="91456544" Received: from araj-mobl1.jf.intel.com ([10.7.201.24]) by orsmga008.jf.intel.com with ESMTP; 12 Nov 2018 09:49:36 -0800 Date: Mon, 12 Nov 2018 09:49:36 -0800 From: "Raj, Ashok" To: Mika Westerberg Cc: iommu@lists.linux-foundation.org, Joerg Roedel , David Woodhouse , Lu Baolu , Bjorn Helgaas , "Rafael J. Wysocki" , Jacob jun Pan , Andreas Noever , Michael Jamet , Yehezkel Bernat , Lukas Wunner , Christian Kellner , Mario.Limonciello@dell.com, Anthony Wong , linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Ashok Raj Subject: Re: [PATCH 2/4] iommu/vt-d: Force IOMMU on for platform opt in hint Message-ID: <20181112174936.GB30341@araj-mobl1.jf.intel.com> References: <20181112160628.86620-1-mika.westerberg@linux.intel.com> <20181112160628.86620-3-mika.westerberg@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181112160628.86620-3-mika.westerberg@linux.intel.com> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 12, 2018 at 07:06:26PM +0300, Mika Westerberg wrote: > From: Lu Baolu > > Intel VT-d spec added a new DMA_CTRL_PLATFORM_OPT_IN_FLAG flag > in DMAR ACPI table for BIOS to report compliance about platform > initiated DMA restricted to RMRR ranges when transferring control > to the OS. The OS treats this as a hint that the IOMMU should be > enabled to prevent DMA attacks from possible malicious devices. > > A use of this flag is Kernel DMA protection for Thunderbolt[1] > which in practice means that IOMMU should be enabled for PCIe > devices connected to the Thunderbolt ports. With IOMMU enabled > for these devices, all DMA operations are limited in the range > reserved for it, thus the DMA attacks are prevented. All these > devices are enumerated in the PCI/PCIe module and marked with > an is_external flag. > > This forces IOMMU to be enabled if DMA_CTRL_PLATFORM_OPT_IN_FLAG > is set in DMAR ACPI table and there are PCIe devices marked as > is_external in the system. This can be turned off by adding > "intel_iommu=off" in the kernel command line, if any problems are > found. > > [1] https://docs.microsoft.com/en-us/windows/security/information-protection/kernel-dma-protection-for-thunderbolt > > Cc: Ashok Raj > Cc: Jacob Pan > Cc: Sohil Mehta > Signed-off-by: Lu Baolu > Signed-off-by: Mika Westerberg Looks good to me Reviewed-by: Ashok Raj > --- > drivers/iommu/dmar.c | 25 +++++++++++++++++ > drivers/iommu/intel-iommu.c | 55 +++++++++++++++++++++++++++++++++++-- > include/linux/dmar.h | 8 ++++++ > 3 files changed, 86 insertions(+), 2 deletions(-)