upgrade to linux 2.6.10-1.12_FC2
[linux-2.6.git] / arch / ppc64 / mm / init.c
index e5fd948..cfbb89c 100644 (file)
@@ -113,6 +113,7 @@ void show_mem(void)
        printk("%ld pages shared\n", shared);
        printk("%ld pages swap cached\n", cached);
 }
+EXPORT_SYMBOL_GPL(show_mem);
 
 #ifdef CONFIG_PPC_ISERIES
 
@@ -478,12 +479,18 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
        int index;
        int err;
 
+#ifdef CONFIG_HUGETLB_PAGE
+       /* We leave htlb_segs as it was, but for a fork, we need to
+        * clear the huge_pgdir. */
+       mm->context.huge_pgdir = NULL;
+#endif
+
 again:
        if (!idr_pre_get(&mmu_context_idr, GFP_KERNEL))
                return -ENOMEM;
 
        spin_lock(&mmu_context_lock);
-       err = idr_get_new(&mmu_context_idr, NULL, &index);
+       err = idr_get_new_above(&mmu_context_idr, NULL, 1, &index);
        spin_unlock(&mmu_context_lock);
 
        if (err == -EAGAIN)
@@ -508,20 +515,9 @@ void destroy_context(struct mm_struct *mm)
        spin_unlock(&mmu_context_lock);
 
        mm->context.id = NO_CONTEXT;
-}
-
-static int __init mmu_context_init(void)
-{
-       int index;
-
-       /* Reserve the first (invalid) context*/
-       idr_pre_get(&mmu_context_idr, GFP_KERNEL);
-       idr_get_new(&mmu_context_idr, NULL, &index);
-       BUG_ON(0 != index);
 
-       return 0;
+       hugetlb_mm_free_pgd(mm);
 }
-arch_initcall(mmu_context_init);
 
 /*
  * Do very early mm setup.
@@ -594,6 +590,34 @@ int page_is_ram(unsigned long pfn)
 }
 EXPORT_SYMBOL(page_is_ram);
 
+unsigned long next_ram_page(unsigned long pfn)
+{
+       int i;
+       unsigned long paddr, base;
+       unsigned long best_base = (ULONG_MAX << PAGE_SHIFT);
+
+       pfn++;
+       paddr = (pfn << PAGE_SHIFT);
+                                                                                
+       for (i=0; i < lmb.memory.cnt; i++) {
+#ifdef CONFIG_MSCHUNKS
+               base = lmb.memory.region[i].physbase;
+#else
+               base = lmb.memory.region[i].base;
+#endif
+               if ((paddr >= base)
+                   && (paddr < (base + lmb.memory.region[i].size)))
+                       return (paddr >> PAGE_SHIFT);
+               if ((paddr < base) && (base < best_base))
+                       best_base = base;
+       }
+       if (best_base < (ULONG_MAX << PAGE_SHIFT))
+               return (best_base >> PAGE_SHIFT);
+       else
+               return ULONG_MAX;
+}
+EXPORT_SYMBOL_GPL(next_ram_page);
+
 /*
  * Initialize the bootmem system and give it all the memory we
  * have available.
@@ -886,14 +910,14 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long ea,
        local_irq_restore(flags);
 }
 
-void * reserve_phb_iospace(unsigned long size)
+void __iomem * reserve_phb_iospace(unsigned long size)
 {
-       void *virt_addr;
+       void __iomem *virt_addr;
                
        if (phbs_io_bot >= IMALLOC_BASE) 
                panic("reserve_phb_iospace(): phb io space overflow\n");
                        
-       virt_addr = (void *) phbs_io_bot;
+       virt_addr = (void __iomem *) phbs_io_bot;
        phbs_io_bot += size;
 
        return virt_addr;