]> err.no Git - linux-2.6/blobdiff - arch/x86/mm/pageattr.c
x86: add gbpages support to lookup_address
[linux-2.6] / arch / x86 / mm / pageattr.c
index 72880993af89bb9b23656e68e4e61f326d6cb5ac..143fbafc948ae25c9c8added4a1a7534c0521d9f 100644 (file)
@@ -119,7 +119,7 @@ static void cpa_flush_range(unsigned long start, int numpages, int cache)
                /*
                 * Only flush present addresses:
                 */
-               if (pte && pte_present(*pte))
+               if (pte && (pte_val(*pte) & _PAGE_PRESENT))
                        clflush_cache_range((void *) addr, PAGE_SIZE);
        }
 }
@@ -209,6 +209,11 @@ pte_t *lookup_address(unsigned long address, int *level)
        pud = pud_offset(pgd, address);
        if (pud_none(*pud))
                return NULL;
+
+       *level = PG_LEVEL_1G;
+       if (pud_large(*pud) || !pud_present(*pud))
+               return (pte_t *)pud;
+
        pmd = pmd_offset(pud, address);
        if (pmd_none(*pmd))
                return NULL;
@@ -356,10 +361,8 @@ static int split_large_page(pte_t *kpte, unsigned long address)
         * up for us already:
         */
        tmp = lookup_address(address, &level);
-       if (tmp != kpte) {
-               WARN_ON_ONCE(1);
+       if (tmp != kpte)
                goto out_unlock;
-       }
 
        address = __pa(address);
        addr = address & PMD_PAGE_MASK;