Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S939380AbXHIMnc (ORCPT ); Thu, 9 Aug 2007 08:43:32 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S939636AbXHIMle (ORCPT ); Thu, 9 Aug 2007 08:41:34 -0400 Received: from cantor.suse.de ([195.135.220.2]:50881 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S939626AbXHIMlb (ORCPT ); Thu, 9 Aug 2007 08:41:31 -0400 From: Andi Kleen References: <20070809241.425881000@suse.de> In-Reply-To: <20070809241.425881000@suse.de> To: bernarde@br.ibm.com, patches@x86-64.org, linux-kernel@vger.kernel.org Subject: [PATCH] [2/12] x86_64: Calgary - Fix mis-handled PCI topology Message-Id: <20070809124129.9471514F3A@wotan.suse.de> Date: Thu, 9 Aug 2007 14:41:29 +0200 (CEST) Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1697 Lines: 51 From: Murillo Fernandes Bernardes 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 Signed-off-by: Muli Ben-Yehuda Signed-off-by: Andi Kleen arch/x86_64/kernel/pci-calgary.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) Index: linux/arch/x86_64/kernel/pci-calgary.c =================================================================== --- linux.orig/arch/x86_64/kernel/pci-calgary.c +++ linux/arch/x86_64/kernel/pci-calgary.c @@ -367,16 +367,15 @@ static inline struct iommu_table *find_i 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/