aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2006-01-11 16:44:27 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-11 22:04:54 -0500
commitca8642f606ce22de23bae08a5044067f98de855b (patch)
tree143dd169cbba9d58629ca74d618cbfa41964c2f8 /arch
parentd25bf7e5fe73b5b6d2246ab0be08ae35d718456b (diff)
[PATCH] x86_64: Fix off by one in IOMMU check
Fix off by one when checking if the machine has enougn memory to need IOMMU This caused the IOMMUs to be needlessly enabled for mem=4G Based on a patch from Jon Mason Signed-off-by: jdmason@us.ibm.com Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86_64/kernel/aperture.c3
-rw-r--r--arch/x86_64/kernel/io_apic.c3
-rw-r--r--arch/x86_64/kernel/pci-gart.c2
-rw-r--r--arch/x86_64/mm/init.c2
4 files changed, 6 insertions, 4 deletions
diff --git a/arch/x86_64/kernel/aperture.c b/arch/x86_64/kernel/aperture.c
index c7f4fdd20f05..e4e2b7d01f89 100644
--- a/arch/x86_64/kernel/aperture.c
+++ b/arch/x86_64/kernel/aperture.c
@@ -23,6 +23,7 @@
23#include <asm/io.h> 23#include <asm/io.h>
24#include <asm/proto.h> 24#include <asm/proto.h>
25#include <asm/pci-direct.h> 25#include <asm/pci-direct.h>
26#include <asm/dma.h>
26 27
27int iommu_aperture; 28int iommu_aperture;
28int iommu_aperture_disabled __initdata = 0; 29int iommu_aperture_disabled __initdata = 0;
@@ -247,7 +248,7 @@ void __init iommu_hole_init(void)
247 /* Got the aperture from the AGP bridge */ 248 /* Got the aperture from the AGP bridge */
248 } else if (swiotlb && !valid_agp) { 249 } else if (swiotlb && !valid_agp) {
249 /* Do nothing */ 250 /* Do nothing */
250 } else if ((!no_iommu && end_pfn >= 0xffffffff>>PAGE_SHIFT) || 251 } else if ((!no_iommu && end_pfn >= MAX_DMA32_PFN) ||
251 force_iommu || 252 force_iommu ||
252 valid_agp || 253 valid_agp ||
253 fallback_aper_force) { 254 fallback_aper_force) {
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
index bdc589924b10..83ea86e0633a 100644
--- a/arch/x86_64/kernel/io_apic.c
+++ b/arch/x86_64/kernel/io_apic.c
@@ -37,6 +37,7 @@
37#include <asm/proto.h> 37#include <asm/proto.h>
38#include <asm/mach_apic.h> 38#include <asm/mach_apic.h>
39#include <asm/acpi.h> 39#include <asm/acpi.h>
40#include <asm/dma.h>
40 41
41#define __apicdebuginit __init 42#define __apicdebuginit __init
42 43
@@ -281,7 +282,7 @@ void __init check_ioapic(void)
281 switch (vendor) { 282 switch (vendor) {
282 case PCI_VENDOR_ID_VIA: 283 case PCI_VENDOR_ID_VIA:
283#ifdef CONFIG_GART_IOMMU 284#ifdef CONFIG_GART_IOMMU
284 if ((end_pfn >= (0xffffffff>>PAGE_SHIFT) || 285 if ((end_pfn > MAX_DMA32_PFN ||
285 force_iommu) && 286 force_iommu) &&
286 !iommu_aperture_allowed) { 287 !iommu_aperture_allowed) {
287 printk(KERN_INFO 288 printk(KERN_INFO
diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c
index 2b865c90b041..116e00f1bb7b 100644
--- a/arch/x86_64/kernel/pci-gart.c
+++ b/arch/x86_64/kernel/pci-gart.c
@@ -804,7 +804,7 @@ static int __init pci_iommu_init(void)
804 } 804 }
805 805
806 if (no_iommu || 806 if (no_iommu ||
807 (!force_iommu && end_pfn < 0xffffffff>>PAGE_SHIFT) || 807 (!force_iommu && (end_pfn-1) < 0xffffffff>>PAGE_SHIFT) ||
808 !iommu_aperture || 808 !iommu_aperture ||
809 (no_agp && init_k8_gatt(&info) < 0)) { 809 (no_agp && init_k8_gatt(&info) < 0)) {
810 printk(KERN_INFO "PCI-DMA: Disabling IOMMU.\n"); 810 printk(KERN_INFO "PCI-DMA: Disabling IOMMU.\n");
diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c
index 1faae5fc1c01..5337ca0ea7b9 100644
--- a/arch/x86_64/mm/init.c
+++ b/arch/x86_64/mm/init.c
@@ -424,7 +424,7 @@ void __init mem_init(void)
424 424
425#ifdef CONFIG_SWIOTLB 425#ifdef CONFIG_SWIOTLB
426 if (!iommu_aperture && 426 if (!iommu_aperture &&
427 (end_pfn >= 0xffffffff>>PAGE_SHIFT || force_iommu)) 427 ((end_pfn-1) >= 0xffffffff>>PAGE_SHIFT || force_iommu))
428 swiotlb = 1; 428 swiotlb = 1;
429 if (swiotlb) 429 if (swiotlb)
430 swiotlb_init(); 430 swiotlb_init();