linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v2 04/10] iommu/vt-d: Assume BIOS lies about ATSR for integrated gfx
       [not found] ` <1444772049.125804.62.camel@infradead.org>
@ 2015-10-14 21:35   ` David Woodhouse
  0 siblings, 0 replies; only message in thread
From: David Woodhouse @ 2015-10-14 21:35 UTC (permalink / raw)
  To: iommu, intel-gfx, Jesse Barnes; +Cc: linux-pci, Bjorn Helgaas

[-- Attachment #1: Type: text/plain, Size: 1403 bytes --]

On Tue, 2015-10-13 at 22:34 +0100, David Woodhouse wrote:
> If the device itself reports ATS in its PCIe capabilities, but the BIOS
> neglects to provide an ATSR structure to indicate that the root port can
> also cope, then assume the latter is lying.

Except, of course, that integrated devices aren't behind a root port. I
think this should fix it the correct way?

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 4f2eab6..70a031d 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -4280,14 +4280,17 @@ int dmar_find_matched_atsr_unit(struct pci_dev *dev)
 	dev = pci_physfn(dev);
 	for (bus = dev->bus; bus; bus = bus->parent) {
 		bridge = bus->self;
-		if (!bridge || !pci_is_pcie(bridge) ||
+		/* If it's an integrated device, allow ATS */
+		if (!bridge)
+			return 1;
+		/* Connected via non-PCIe: no ATS */
+		if (!pci_is_pcie(bridge) ||
 		    pci_pcie_type(bridge) == PCI_EXP_TYPE_PCI_BRIDGE)
 			return 0;
+		/* If we found the root port, look it up in the ATSR */
 		if (pci_pcie_type(bridge) == PCI_EXP_TYPE_ROOT_PORT)
 			break;
 	}
-	if (!bridge)
-		return 0;
 
 	rcu_read_lock();
 	list_for_each_entry_rcu(atsru, &dmar_atsr_units, list) {

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation


[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5691 bytes --]

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-10-14 21:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1444771787.125804.50.camel@infradead.org>
     [not found] ` <1444772049.125804.62.camel@infradead.org>
2015-10-14 21:35   ` [PATCH v2 04/10] iommu/vt-d: Assume BIOS lies about ATSR for integrated gfx David Woodhouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).