From patchwork Wed Jan 13 21:19:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Myron Stowe X-Patchwork-Id: 72711 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o0DLK5mQ005380 for ; Wed, 13 Jan 2010 21:20:06 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755477Ab0AMVUF (ORCPT ); Wed, 13 Jan 2010 16:20:05 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755495Ab0AMVUF (ORCPT ); Wed, 13 Jan 2010 16:20:05 -0500 Received: from g5t0008.atlanta.hp.com ([15.192.0.45]:32074 "EHLO g5t0008.atlanta.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755477Ab0AMVUE (ORCPT ); Wed, 13 Jan 2010 16:20:04 -0500 Received: from g5t0029.atlanta.hp.com (g5t0029.atlanta.hp.com [16.228.8.141]) by g5t0008.atlanta.hp.com (Postfix) with ESMTP id 72FBF2423D; Wed, 13 Jan 2010 21:20:03 +0000 (UTC) Received: from ldl (ldl.fc.hp.com [15.11.146.30]) by g5t0029.atlanta.hp.com (Postfix) with ESMTP id 17C6B20015; Wed, 13 Jan 2010 21:19:48 +0000 (UTC) Received: from localhost (ldl.fc.hp.com [127.0.0.1]) by ldl (Postfix) with ESMTP id E52A2CF0017; Wed, 13 Jan 2010 14:19:47 -0700 (MST) Received: from ldl ([127.0.0.1]) by localhost (ldl.fc.hp.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cbD9HkErTqkv; Wed, 13 Jan 2010 14:19:47 -0700 (MST) Received: from eh.fc.hp.com (eh.fc.hp.com [15.11.146.105]) by ldl (Postfix) with ESMTP id D09B6CF0015; Wed, 13 Jan 2010 14:19:47 -0700 (MST) Received: from bob.kio (localhost [127.0.0.1]) by eh.fc.hp.com (Postfix) with ESMTP id 8D13C26191; Wed, 13 Jan 2010 14:19:47 -0700 (MST) Subject: [PATCH] PCI: Exclude VTBAR range from Local MMIOL if necessary To: jbarnes@virtuousgeek.org From: Myron Stowe Cc: linux-pci@vger.kernel.org, yinghai@kernel.org Date: Wed, 13 Jan 2010 14:19:47 -0700 Message-ID: <20100113211947.1690.81508.stgit@bob.kio> User-Agent: StGit/0.15 MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org diff --git a/arch/x86/pci/intel_bus.c b/arch/x86/pci/intel_bus.c index b7a55dc..f58136c 100644 --- a/arch/x86/pci/intel_bus.c +++ b/arch/x86/pci/intel_bus.c @@ -39,13 +39,16 @@ static inline void print_ioh_resources(struct pci_root_info *info) #define IOH_LMMIOH_LIMITU 0x118 #define IOH_LCFGBUS 0x11c +#define IOH_VTBAR 0x180 +#define IOH_VTSIZE 0x2000 /* Fixed HW size (not programmable) */ + static void __devinit pci_root_bus_res(struct pci_dev *dev) { u16 word; u32 dword; struct pci_root_info *info; u16 io_base, io_end; - u32 mmiol_base, mmiol_end; + u32 mmiol_base, mmiol_end, vtbar; u64 mmioh_base, mmioh_end; int bus_base, bus_end; @@ -72,6 +75,21 @@ static void __devinit pci_root_bus_res(struct pci_dev *dev) pci_read_config_dword(dev, IOH_LMMIOL, &dword); mmiol_base = (dword & 0xff00) << (24 - 8); mmiol_end = (dword & 0xff000000) | 0xffffff; + pci_read_config_dword(dev, IOH_VTBAR, &dword); + vtbar = dword & 0xfffffffe; + if (dword & 0x1 && + (mmiol_base < vtbar + IOH_VTSIZE - 1 && vtbar < mmiol_end)) { + /* remove VT-d DRDH from Local MMIOL window */ + if (vtbar <= mmiol_base) + mmiol_base = vtbar + IOH_VTSIZE; + else if (mmiol_end <= vtbar + IOH_VTSIZE - 1) + mmiol_end = vtbar; + else { + update_res(info, mmiol_base, vtbar - 1, + IORESOURCE_MEM, 0); + mmiol_base = vtbar + IOH_VTSIZE; + } + } update_res(info, mmiol_base, mmiol_end, IORESOURCE_MEM, 0); pci_read_config_dword(dev, IOH_LMMIOH, &dword);