Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1363276ybj; Tue, 5 May 2020 19:06:40 -0700 (PDT) X-Google-Smtp-Source: APiQypLt4z8coFpjwo8AeZ2N/enEXM/3JK+139Dy1OnUTjJAAT/OCcti80pMSACxc/xy58aNDEwG X-Received: by 2002:a50:b202:: with SMTP id o2mr4941121edd.251.1588730800392; Tue, 05 May 2020 19:06:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588730800; cv=none; d=google.com; s=arc-20160816; b=pfQz43lbzez/ydSyBijjA4gdOQBBLGmeWts0g48RJ2goUVGs8eI0pRZGhv1smu83Ob ez6S/z4VqFVX4y05WkzApiDRklM+PhF6Ot8WIr04g50uY/ydcL0VXu5gDiVd6pDXV4gp kNKMCW7dOmJwc4kaeUreNGxW11oFxfxlb1NkBQ0Cv+ELuRy/Km3vboDWIuNuGUR92g9A SqbO5mf912RxWmkglr/IT0wDLMnJtnBqlEPWnQJ4uOP0lgmWbuWI0iStlO2uSFGmKQzv qWKr36V+7KRiw8RI5c8Fldf+MTG0ALR51ym0n/HeCdJ/j/BaTXwNYmF2W64mnmTnMwoy waLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:ironport-sdr:ironport-sdr; bh=P1wBjuQwLKlrJu+Jq9wG+ZH0hCk9909nKLxjoTGAgbQ=; b=C9J84kXtIt9VvtVGwHw97CJLAGVoBaecT6TbKsvnFaMzI7gfHfwxpDh1aPBlY1WzpF 9CIashzRaUkO9T2FmYyZDR7ybkS1dzPaZWYwMLXGgIQeAyLLhZh4VHiLNez6NFIoMIqI xhfCWl8niV/JuCx+ue0s6l1pUufRVO+bGf3wfGSZRCgmZ7Q8vZxXv6MbDMg4kDAo4ST/ rYvh303mETMl/uOr3A1LoYUJX6/RZTSM7gM00kynHhYLmgP7oL+58SHcQhWvrToqzPZ8 w1yqIzosDmzEW7LflAYzBfUgnPVTAATAKOsALLU+s7ctbZbltdv9hdofqXG12ljguJAc KcsQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id l18si256393edf.202.2020.05.05.19.06.10; Tue, 05 May 2020 19:06:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1729934AbgEFCDS (ORCPT + 99 others); Tue, 5 May 2020 22:03:18 -0400 Received: from mga04.intel.com ([192.55.52.120]:39088 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727986AbgEFCDR (ORCPT ); Tue, 5 May 2020 22:03:17 -0400 IronPort-SDR: TO9/dagoMAQQNzbXNEMBCqSe5tGcC13VohdO6wQJvz9FdkLgt6kXjEJuZduMBNPt2fDsYIdWLS cm9eNsDsRndQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2020 19:03:16 -0700 IronPort-SDR: OzrgM26J/NKjfDhEtZZ/bBsbU6geUSDe/Gur30kfKqlLU7VTW+Q7oA7zGu4hdSGKbvLL5Vcnq1 xiPb9rci8nKQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,357,1583222400"; d="scan'208";a="369645047" Received: from allen-box.sh.intel.com ([10.239.159.139]) by fmsmga001.fm.intel.com with ESMTP; 05 May 2020 19:03:13 -0700 From: Lu Baolu To: Joerg Roedel Cc: ashok.raj@intel.com, jacob.jun.pan@linux.intel.com, kevin.tian@intel.com, Sai Praneeth Prakhya , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Daniel Drake , Derrick Jonathan , Jerry Snitselaar , Robin Murphy , Christoph Hellwig , Lu Baolu Subject: [PATCH v4 2/3] iommu/vt-d: Allow PCI sub-hierarchy to use DMA domain Date: Wed, 6 May 2020 09:59:46 +0800 Message-Id: <20200506015947.28662-3-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200506015947.28662-1-baolu.lu@linux.intel.com> References: <20200506015947.28662-1-baolu.lu@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Before commit fa954e6831789 ("iommu/vt-d: Delegate the dma domain to upper layer"), Intel IOMMU started off with all devices in the identity domain, and took them out later if it found they couldn't access all of memory. This required devices behind a PCI bridge to use a DMA domain at the beginning because all PCI devices behind the bridge use the same source-id in their transactions and the domain couldn't be changed at run-time. Intel IOMMU driver is now aligned with the default domain framework, there's no need to keep this requirement anymore. Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 16ba7add0f72..af309e8fa6f5 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -2857,31 +2857,6 @@ static int device_def_domain_type(struct device *dev) if ((iommu_identity_mapping & IDENTMAP_GFX) && IS_GFX_DEVICE(pdev)) return IOMMU_DOMAIN_IDENTITY; - - /* - * We want to start off with all devices in the 1:1 domain, and - * take them out later if we find they can't access all of memory. - * - * However, we can't do this for PCI devices behind bridges, - * because all PCI devices behind the same bridge will end up - * with the same source-id on their transactions. - * - * Practically speaking, we can't change things around for these - * devices at run-time, because we can't be sure there'll be no - * DMA transactions in flight for any of their siblings. - * - * So PCI devices (unless they're on the root bus) as well as - * their parent PCI-PCI or PCIe-PCI bridges must be left _out_ of - * the 1:1 domain, just in _case_ one of their siblings turns out - * not to be able to map all of memory. - */ - if (!pci_is_pcie(pdev)) { - if (!pci_is_root_bus(pdev->bus)) - return IOMMU_DOMAIN_DMA; - if (pdev->class >> 8 == PCI_CLASS_BRIDGE_PCI) - return IOMMU_DOMAIN_DMA; - } else if (pci_pcie_type(pdev) == PCI_EXP_TYPE_PCI_BRIDGE) - return IOMMU_DOMAIN_DMA; } return 0; -- 2.17.1