X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=arch%2Fpowerpc%2Fsysdev%2Fdart_iommu.c;h=6232091cc72bcd87b8e6f69c9242257b770926e1;hb=bc02af93dd2bbddce1b55e0a493f833a1b7cf140;hp=6298264efe36110bdc8318001180d3d8eb751fba;hpb=70c07e02625ec46d0ffbfce1acef42d660803528;p=powerpc.git diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c index 6298264efe..6232091cc7 100644 --- a/arch/powerpc/sysdev/dart_iommu.c +++ b/arch/powerpc/sysdev/dart_iommu.c @@ -49,6 +49,7 @@ #include "dart.h" +extern int iommu_is_off; extern int iommu_force_on; /* Physical base address and size of the DART table */ @@ -194,8 +195,6 @@ static int dart_init(struct device_node *dart_node) * prefetching into invalid pages and corrupting data */ tmp = lmb_alloc(DART_PAGE_SIZE, DART_PAGE_SIZE); - if (!tmp) - panic("DART: Cannot allocate spare page!"); dart_emptyval = DARTMAP_VALID | ((tmp >> DART_PAGE_SHIFT) & DARTMAP_RPNMASK); @@ -247,7 +246,7 @@ static void iommu_table_dart_setup(void) iommu_table_dart.it_base = (unsigned long)dart_vbase; iommu_table_dart.it_index = 0; iommu_table_dart.it_blocksize = 1; - iommu_init_table(&iommu_table_dart); + iommu_init_table(&iommu_table_dart, -1); /* Reserve the last page of the DART to avoid possible prefetch * past the DART mapped area @@ -331,10 +330,17 @@ void iommu_init_early_dart(void) void __init alloc_dart_table(void) { - /* Only reserve DART space if machine has more than 2GB of RAM + /* Only reserve DART space if machine has more than 1GB of RAM * or if requested with iommu=on on cmdline. + * + * 1GB of RAM is picked as limit because some default devices + * (i.e. Airport Extreme) have 30 bit address range limits. */ - if (lmb_end_of_DRAM() <= 0x80000000ull && !iommu_force_on) + + if (iommu_is_off) + return; + + if (!iommu_force_on && lmb_end_of_DRAM() <= 0x40000000ull) return; /* 512 pages (2MB) is max DART tablesize. */