Commit f1b32486 authored by Nick Piggin's avatar Nick Piggin Committed by Linus Torvalds

[PATCH] introduce fallback header

Add a temporary "fallback" header so architectures can run with the 4level
patgetables patch without modification. All architectures should be
converted to use the folding headers (include/asm-generic/pgtable-nop?d.h)
as soon as possible, and the fallback header removed.

Make all architectures include the fallback header, except i386, because that
architecture has earlier been converted to use pgtable-nopmd.h under the 3
level system, which is not compatible with the fallback header.
Signed-off-by: default avatarNick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 31382a8d
#ifndef _ALPHA_PGTABLE_H
#define _ALPHA_PGTABLE_H
#include <asm-generic/4level-fixup.h>
/*
* This file contains the functions and defines necessary to modify and use
* the Alpha page table tree.
......
......@@ -10,6 +10,8 @@
#ifndef _ASMARM_PGTABLE_H
#define _ASMARM_PGTABLE_H
#include <asm-generic/4level-fixup.h>
#include <asm/memory.h>
#include <asm/proc-fns.h>
#include <asm/arch/vmalloc.h>
......
......@@ -11,6 +11,8 @@
#ifndef _ASMARM_PGTABLE_H
#define _ASMARM_PGTABLE_H
#include <asm-generic/4level-fixup.h>
#include <linux/config.h>
#include <asm/memory.h>
......
......@@ -5,6 +5,8 @@
#ifndef _CRIS_PGTABLE_H
#define _CRIS_PGTABLE_H
#include <asm-generic/4level-fixup.h>
#ifndef __ASSEMBLY__
#include <linux/config.h>
#include <linux/sched.h>
......
#ifndef _4LEVEL_FIXUP_H
#define _4LEVEL_FIXUP_H
#define __ARCH_HAS_4LEVEL_HACK
#define PUD_SIZE PGDIR_SIZE
#define PUD_MASK PGDIR_MASK
#define PTRS_PER_PUD 1
#define pud_t pgd_t
#define pmd_alloc(mm, pud, address) \
({ pmd_t *ret; \
if (pgd_none(*pud)) \
ret = __pmd_alloc(mm, pud, address); \
else \
ret = pmd_offset(pud, address); \
ret; \
})
#define pud_alloc(mm, pgd, address) (pgd)
#define pud_offset(pgd, start) (pgd)
#define pud_none(pud) 0
#define pud_bad(pud) 0
#define pud_present(pud) 1
#define pud_ERROR(pud) do { } while (0)
#define pud_clear(pud) do { } while (0)
#undef pud_free_tlb
#define pud_free_tlb(tlb, x) do { } while (0)
#define pud_free(x) do { } while (0)
#define __pud_free_tlb(tlb, x) do { } while (0)
#endif
......@@ -141,11 +141,13 @@ static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page)
__pte_free_tlb(tlb, ptep); \
} while (0)
#ifndef __ARCH_HAS_4LEVEL_HACK
#define pud_free_tlb(tlb, pudp) \
do { \
tlb->need_flush = 1; \
__pud_free_tlb(tlb, pudp); \
} while (0)
#endif
#define pmd_free_tlb(tlb, pmdp) \
do { \
......
#ifndef _H8300_PGTABLE_H
#define _H8300_PGTABLE_H
#include <asm-generic/4level-fixup.h>
#include <linux/config.h>
#include <linux/slab.h>
#include <asm/processor.h>
......
#ifndef _ASM_IA64_PGTABLE_H
#define _ASM_IA64_PGTABLE_H
#include <asm-generic/4level-fixup.h>
/*
* This file contains the functions and defines necessary to modify and use
* the IA-64 page table tree.
......
#ifndef _ASM_M32R_PGTABLE_H
#define _ASM_M32R_PGTABLE_H
#include <asm-generic/4level-fixup.h>
/* $Id$ */
/*
......
#ifndef _M68K_PGTABLE_H
#define _M68K_PGTABLE_H
#include <asm-generic/4level-fixup.h>
#include <linux/config.h>
#include <asm/setup.h>
......
#ifndef _M68KNOMMU_PGTABLE_H
#define _M68KNOMMU_PGTABLE_H
#include <asm-generic/4level-fixup.h>
/*
* (C) Copyright 2000-2002, Greg Ungerer <gerg@snapgear.com>
*/
......
......@@ -8,6 +8,8 @@
#ifndef _ASM_PGTABLE_H
#define _ASM_PGTABLE_H
#include <asm-generic/4level-fixup.h>
#include <linux/config.h>
#ifdef CONFIG_MIPS32
#include <asm/pgtable-32.h>
......
#ifndef _PARISC_PGTABLE_H
#define _PARISC_PGTABLE_H
#include <asm-generic/4level-fixup.h>
#include <linux/config.h>
#include <asm/fixmap.h>
......
......@@ -2,6 +2,8 @@
#ifndef _PPC_PGTABLE_H
#define _PPC_PGTABLE_H
#include <asm-generic/4level-fixup.h>
#include <linux/config.h>
#ifndef __ASSEMBLY__
......
#ifndef _PPC64_PGTABLE_H
#define _PPC64_PGTABLE_H
#include <asm-generic/4level-fixup.h>
/*
* This file contains the functions and defines necessary to modify and use
* the ppc64 hashed page table.
......
......@@ -13,6 +13,8 @@
#ifndef _ASM_S390_PGTABLE_H
#define _ASM_S390_PGTABLE_H
#include <asm-generic/4level-fixup.h>
/*
* The Linux memory management assumes a three-level page table setup. For
* s390 31 bit we "fold" the mid level into the top-level page table, so
......
#ifndef __ASM_SH_PGTABLE_H
#define __ASM_SH_PGTABLE_H
#include <asm-generic/4level-fixup.h>
/*
* Copyright (C) 1999 Niibe Yutaka
* Copyright (C) 2002, 2003, 2004 Paul Mundt
......
#ifndef __ASM_SH64_PGTABLE_H
#define __ASM_SH64_PGTABLE_H
#include <asm-generic/4level-fixup.h>
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
......
......@@ -9,6 +9,8 @@
* Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
*/
#include <asm-generic/4level-fixup.h>
#include <linux/config.h>
#include <linux/spinlock.h>
#include <linux/swap.h>
......
......@@ -12,6 +12,8 @@
* the SpitFire page tables.
*/
#include <asm-generic/4level-fixup.h>
#include <linux/config.h>
#include <asm/spitfire.h>
#include <asm/asi.h>
......
......@@ -7,6 +7,8 @@
#ifndef __UM_PGTABLE_H
#define __UM_PGTABLE_H
#include <asm-generic/4level-fixup.h>
#include "linux/sched.h"
#include "asm/processor.h"
#include "asm/page.h"
......
#ifndef __V850_PGTABLE_H__
#define __V850_PGTABLE_H__
#include <asm-generic/4level-fixup.h>
#include <linux/config.h>
#include <asm/page.h>
......
#ifndef _X86_64_PGTABLE_H
#define _X86_64_PGTABLE_H
#include <asm-generic/4level-fixup.h>
/*
* This file contains the functions and defines necessary to modify and use
* the x86-64 page table tree.
......
......@@ -631,6 +631,11 @@ extern void remove_shrinker(struct shrinker *shrinker);
* the inlining and the symmetry break with pte_alloc_map() that does all
* of this out-of-line.
*/
/*
* The following ifdef needed to get the 4level-fixup.h header to work.
* Remove it when 4level-fixup.h has been removed.
*/
#ifndef __ARCH_HAS_4LEVEL_HACK
static inline pud_t *pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address)
{
if (pgd_none(*pgd))
......@@ -644,6 +649,7 @@ static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long a
return __pmd_alloc(mm, pud, address);
return pmd_offset(pud, address);
}
#endif
extern void free_area_init(unsigned long * zones_size);
extern void free_area_init_node(int nid, pg_data_t *pgdat,
......
......@@ -1940,6 +1940,7 @@ int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct * vma,
return VM_FAULT_OOM;
}
#ifndef __ARCH_HAS_4LEVEL_HACK
#if (PTRS_PER_PGD > 1)
/*
* Allocate page upper directory.
......@@ -2007,6 +2008,30 @@ pmd_t fastcall *__pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long addr
return pmd_offset(pud, address);
}
#endif
#else
pmd_t fastcall *__pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address)
{
pmd_t *new;
spin_unlock(&mm->page_table_lock);
new = pmd_alloc_one(mm, address);
spin_lock(&mm->page_table_lock);
if (!new)
return NULL;
/*
* Because we dropped the lock, we should re-check the
* entry, as somebody else could have populated it..
*/
if (pgd_present(*pud)) {
pmd_free(new);
goto out;
}
pgd_populate(mm, pud, new);
out:
return pmd_offset(pud, address);
}
#endif
int make_pages_present(unsigned long addr, unsigned long end)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment