[PATCH] powerpc: Lower threshold for DART enablement to 1GB

Turn on the DART already at 1GB. This is needed because of crippled
devices in some systems, i.e. Airport Extreme cards, only supporting
30-bit DMA addresses.

Otherwise, users with between 1 and 2GB of memory will need to manually
enable it with iommu=force, and that's no good.

Some simple performance tests show that there's a slight impact of
enabling DART, but it's in the 1-3% range (kernel build with disk I/O
as well as over NFS).

iommu=off can still be used for those who don't want to deal with the
overhead (and don't need it for any devices).

Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>

authored by Olof Johansson and committed by Paul Mackerras 28897731 7daa411b

+11 -3
+1 -1
arch/powerpc/kernel/prom.c
··· 62 static int __initdata dt_root_size_cells; 63 64 #ifdef CONFIG_PPC64 65 - static int __initdata iommu_is_off; 66 int __initdata iommu_force_on; 67 unsigned long tce_alloc_start, tce_alloc_end; 68 #endif
··· 62 static int __initdata dt_root_size_cells; 63 64 #ifdef CONFIG_PPC64 65 + int __initdata iommu_is_off; 66 int __initdata iommu_force_on; 67 unsigned long tce_alloc_start, tce_alloc_end; 68 #endif
+10 -2
arch/powerpc/sysdev/dart_iommu.c
··· 49 50 #include "dart.h" 51 52 extern int iommu_force_on; 53 54 /* Physical base address and size of the DART table */ ··· 330 331 void __init alloc_dart_table(void) 332 { 333 - /* Only reserve DART space if machine has more than 2GB of RAM 334 * or if requested with iommu=on on cmdline. 335 */ 336 - if (lmb_end_of_DRAM() <= 0x80000000ull && !iommu_force_on) 337 return; 338 339 /* 512 pages (2MB) is max DART tablesize. */
··· 49 50 #include "dart.h" 51 52 + extern int iommu_is_off; 53 extern int iommu_force_on; 54 55 /* Physical base address and size of the DART table */ ··· 329 330 void __init alloc_dart_table(void) 331 { 332 + /* Only reserve DART space if machine has more than 1GB of RAM 333 * or if requested with iommu=on on cmdline. 334 + * 335 + * 1GB of RAM is picked as limit because some default devices 336 + * (i.e. Airport Extreme) have 30 bit address range limits. 337 */ 338 + 339 + if (iommu_is_off) 340 + return; 341 + 342 + if (!iommu_force_on && lmb_end_of_DRAM() <= 0x40000000ull) 343 return; 344 345 /* 512 pages (2MB) is max DART tablesize. */