]> git.hungrycats.org Git - linux/commitdiff
[PATCH] ppc64: DART iommu allocation fix
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 29 Sep 2004 07:09:21 +0000 (00:09 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Wed, 29 Sep 2004 07:09:21 +0000 (00:09 -0700)
The current code allocating the DART has a couple of bugs, first
it's called on all machines including the ones who have no DART
(oops), and then it tries to access the device-tree using the
"of_chosen" pointer before it was initialized.

The enclosed patch fixes these.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/ppc64/kernel/pmac_setup.c
arch/ppc64/kernel/prom.c
arch/ppc64/kernel/setup.c
arch/ppc64/kernel/u3_iommu.c

index 36617b773f95a0db4c9701d1a41d1de834962915..3d1de0f9bf83b51e7b1d0c564b8781a54ba6b9e0 100644 (file)
@@ -447,6 +447,14 @@ static int __init pmac_probe(int platform)
        if (platform != PLATFORM_POWERMAC)
                return 0;
 
+       /*
+        * On U3, the DART (iommu) must be allocated now since it
+        * has an impact on htab_initialize (due to the large page it
+        * occupies having to be broken up so the DART itself is not
+        * part of the cacheable linar mapping
+        */
+       alloc_u3_dart_table();
+
        return 1;
 }
 
index c855cf137a118a793e26a34208f168f4e8f033e9..f121ffbc206936ae597a0462f0b45b4729c3baad 100644 (file)
@@ -83,6 +83,7 @@ extern unsigned long klimit;
 static int __initdata dt_root_addr_cells;
 static int __initdata dt_root_size_cells;
 static int __initdata iommu_is_off;
+int __initdata iommu_force_on;
 typedef u32 cell_t;
 
 #if 0
@@ -876,9 +877,11 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
                return 0;
        systemcfg->platform = *prop;
 
-       /* check if iommu is forced off */
+       /* check if iommu is forced on or off */
        if (get_flat_dt_prop(node, "linux,iommu-off", NULL) != NULL)
                iommu_is_off = 1;
+       if (get_flat_dt_prop(node, "linux,iommu-force-on", NULL) != NULL)
+               iommu_force_on = 1;
 
 #ifdef CONFIG_PPC_PSERIES
        /* To help early debugging via the front panel, we retreive a minimal
index e895274e4a41ea074cc560d4e42393499a28448e..b5cc9ca1cda733d84629228db965e34a38578c77 100644 (file)
@@ -406,16 +406,6 @@ void __init early_setup(unsigned long dt_ptr)
 
        DBG("Found, Initializing memory management...\n");
 
-#ifdef CONFIG_U3_DART
-       /*
-        * On U3, the DART (iommu) must be allocated now since it
-        * has an impact on htab_initialize (due to the large page it
-        * occupies having to be broken up so the DART itself is not
-        * part of the cacheable linar mapping
-        */
-       alloc_u3_dart_table();
-#endif /* CONFIG_U3_DART */
-
        /*
         * Initialize stab / SLB management
         */
index a35324afa1c656742e8d02ac983d3045aef2e8be..2bb0b39f6674c0403ab012bf50f73a7049b913be 100644 (file)
@@ -47,6 +47,7 @@
 
 #include "pci.h"
 
+extern int iommu_force_on;
 
 /* physical base of DART registers */
 #define DART_BASE        0xf8033000UL
@@ -305,8 +306,7 @@ void __init alloc_u3_dart_table(void)
        /* Only reserve DART space if machine has more than 2GB of RAM
         * or if requested with iommu=on on cmdline.
         */
-       if (lmb_end_of_DRAM() <= 0x80000000ull &&
-           get_property(of_chosen, "linux,iommu-force-on", NULL) == NULL)
+       if (lmb_end_of_DRAM() <= 0x80000000ull && !iommu_force_on)
                return;
 
        /* 512 pages (2MB) is max DART tablesize. */