]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/misc/sgi-gru/grufault.c
[IA64] Fix GRU compile error w/o CONFIG_HUGETLB_PAGE
[linux-2.6-omap-h63xx.git] / drivers / misc / sgi-gru / grufault.c
index 3d33015bbf31a18d2a6aca7c0a662788abc34b97..3ee698ad85997cf2f5c32b986689d7c07a0ed607 100644 (file)
@@ -214,12 +214,14 @@ static int non_atomic_pte_lookup(struct vm_area_struct *vma,
 }
 
 /*
- *
  * atomic_pte_lookup
  *
  * Convert a user virtual address to a physical address
  * Only supports Intel large pages (2MB only) on x86_64.
  *     ZZZ - hugepage support is incomplete
+ *
+ * NOTE: mmap_sem is already held on entry to this function. This
+ * guarantees existence of the page tables.
  */
 static int atomic_pte_lookup(struct vm_area_struct *vma, unsigned long vaddr,
        int write, unsigned long *paddr, int *pageshift)
@@ -229,9 +231,6 @@ static int atomic_pte_lookup(struct vm_area_struct *vma, unsigned long vaddr,
        pud_t *pudp;
        pte_t pte;
 
-       WARN_ON(irqs_disabled());               /* ZZZ debug */
-
-       local_irq_disable();
        pgdp = pgd_offset(vma->vm_mm, vaddr);
        if (unlikely(pgd_none(*pgdp)))
                goto err;
@@ -250,14 +249,16 @@ static int atomic_pte_lookup(struct vm_area_struct *vma, unsigned long vaddr,
 #endif
                pte = *pte_offset_kernel(pmdp, vaddr);
 
-       local_irq_enable();
-
        if (unlikely(!pte_present(pte) ||
                     (write && (!pte_write(pte) || !pte_dirty(pte)))))
                return 1;
 
        *paddr = pte_pfn(pte) << PAGE_SHIFT;
+#ifdef CONFIG_HUGETLB_PAGE
        *pageshift = is_vm_hugetlb_page(vma) ? HPAGE_SHIFT : PAGE_SHIFT;
+#else
+       *pageshift = PAGE_SHIFT;
+#endif
        return 0;
 
 err:
@@ -324,6 +325,7 @@ static int gru_try_dropin(struct gru_thread_state *gts,
         * Atomic lookup is faster & usually works even if called in non-atomic
         * context.
         */
+       rmb();  /* Must/check ms_range_active before loading PTEs */
        ret = atomic_pte_lookup(vma, vaddr, write, &paddr, &pageshift);
        if (ret) {
                if (!cb)
@@ -543,6 +545,7 @@ int gru_get_exception_detail(unsigned long arg)
                ucbnum = get_cb_number((void *)excdet.cb);
                cbrnum = thread_cbr_number(gts, ucbnum);
                cbe = get_cbe_by_index(gts->ts_gru, cbrnum);
+               prefetchw(cbe);         /* Harmless on hardware, required for emulator */
                excdet.opc = cbe->opccpy;
                excdet.exopc = cbe->exopccpy;
                excdet.ecause = cbe->ecause;