lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070802133926.GI25771@rhun.ibm.com>
Date:	Thu, 2 Aug 2007 16:39:26 +0300
From:	Muli Ben-Yehuda <muli@...ibm.com>
To:	Andrew Morton <akpm@...l.org>
Cc:	Andi Kleen <ak@...e.de>,
	Linux-Kernel <linux-kernel@...r.kernel.org>,
	Jon Mason <jdmason@...il.com>,
	Murillo Fernandes Bernardes <bernarde@...ibm.com>,
	Muli Ben-Yehuda <muli@...ibm.com>
Subject: [PATCH x86-64] Calgary - Fix mis-handled PCI topology

Andrew, can you please push this Calgary bug-fix to 2.6.23 in your
next merge? it fixes a showstopper bug in the recently merged CalIOC2
support that hits machines with multiple levels of PCI-to-PCI bridges.

Thanks,
Muli
---
From: Murillo Fernandes Bernardes <bernarde@...ibm.com>
Subject: x86-64: Calgary - Fix mis-handled PCI topology

Current code assumed that devices were directly connected to a Calgary
bridge, as it tried to get the iommu table directly from the parent bus 
controller.

When we have another bridge between the Calgary/CalIOC2 bridge and the 
device we should look upwards until we get to the top (Calgary/CalIOC2 
bridge), where the iommu table resides.

Signed-off-by: Murillo Fernandes Bernardes <mfb@...ibm.com>
Signed-off-by: Muli Ben-Yehuda <muli@...ibm.com>

--
diff -ruN linux-2.6.23-rc1.orig/arch/x86_64/kernel/pci-calgary.c linux-2.6.23-rc1/arch/x86_64/kernel/pci-calgary.c
--- linux-2.6.23-rc1.orig/arch/x86_64/kernel/pci-calgary.c	2007-08-01 15:37:04.000000000 -0300
+++ linux-2.6.23-rc1/arch/x86_64/kernel/pci-calgary.c	2007-08-01 15:48:55.000000000 -0300
@@ -367,16 +367,15 @@
 
 	pdev = to_pci_dev(dev);
 
-	/* is the device behind a bridge? */
-	if (unlikely(pdev->bus->parent))
-		pbus = pdev->bus->parent;
-	else
-		pbus = pdev->bus;
+	pbus = pdev->bus;
+
+	/* is the device behind a bridge? Look for the root bus */
+	while (pbus->parent)
+		pbus = pbus->parent;
 
 	tbl = pci_iommu(pbus);
 
-	BUG_ON(pdev->bus->parent &&
-	       (tbl->it_busno != pdev->bus->parent->number));
+	BUG_ON(tbl && (tbl->it_busno != pbus->number));
 
 	return tbl;
 }





-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ