Messages in this thread Patch in this message | | | Date | Tue, 20 Apr 2004 10:46:59 -0400 | From | Paul Mundt <> | Subject | Re: [PATCH] Clean up asm/pgalloc.h include (sh) |
| |
On Mon, Apr 19, 2004 at 02:22:42PM +0100, Russell King wrote: > This patch is part of a larger patch aiming towards getting the > include of asm/pgtable.h out of linux/mm.h, so that asm/pgtable.h > can sanely get at things like mm_struct and friends. > > In the event that any of these files fails to build, chances are > you need to include some other header file rather than pgalloc.h. > Normally this is either asm/pgtable.h (unlikely), asm/cacheflush.h > or asm/tlbflush.h. > Failed to compile. sh has ptep_get_and_clear in asm/pgalloc.h.
This moves it out of the way, and your patch builds fine.
--- orig/arch/sh/mm/tlb-sh4.c +++ mod/arch/sh/mm/tlb-sh4.c @@ -24,7 +24,6 @@ #include <asm/system.h> #include <asm/io.h> #include <asm/uaccess.h> -#include <asm/pgalloc.h> #include <asm/hardirq.h> #include <asm/mmu_context.h> #include <asm/cacheflush.h> @@ -95,3 +94,24 @@ back_to_P1(); } +/* + * For SH-4, we have our own implementation for ptep_get_and_clear + */ +inline pte_t ptep_get_and_clear(pte_t *ptep) +{ + pte_t pte = *ptep; + + pte_clear(ptep); + if (!pte_not_present(pte)) { + struct page *page; + unsigned long pfn = pte_pfn(pte); + if (pfn_valid(pfn)) { + page = pfn_to_page(pfn); + if (!page->mapping + || list_empty(&page->mapping->i_mmap_shared)) + __clear_bit(PG_mapped, &page->flags); + } + } + return pte; +} + --- orig/include/asm-sh/pgtable.h +++ mod/include/asm-sh/pgtable.h @@ -268,16 +268,6 @@ #define pte_to_pgoff(pte) (pte_val(pte) >> 1) #define pgoff_to_pte(off) ((pte_t) { ((off) << 1) | _PAGE_FILE }) -/* - * Routines for update of PTE - * - * We just can use generic implementation, as SuperH has no SMP feature. - * (We needed atomic implementation for SMP) - * - */ - -#define pte_same(A,B) (pte_val(A) == pte_val(B)) - typedef pte_t *pte_addr_t; #endif /* !__ASSEMBLY__ */ @@ -295,12 +285,11 @@ extern unsigned int kobjsize(const void *objp); #endif /* !CONFIG_MMU */ -#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG -#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY +#ifdef CONFIG_CPU_SH4 #define __HAVE_ARCH_PTEP_GET_AND_CLEAR -#define __HAVE_ARCH_PTEP_SET_WRPROTECT -#define __HAVE_ARCH_PTEP_MKDIRTY -#define __HAVE_ARCH_PTE_SAME +extern inline pte_t ptep_get_and_clear(pte_t *ptep); +#endif + #include <asm-generic/pgtable.h> #endif /* __ASM_SH_PAGE_H */ --- orig/include/asm-sh/pgalloc.h +++ mod/include/asm-sh/pgalloc.h @@ -85,71 +85,12 @@ #define __pmd_free_tlb(tlb,x) do { } while (0) #define pgd_populate(mm, pmd, pte) BUG() -#if defined(CONFIG_CPU_SH4) -#define PG_mapped PG_arch_1 +#define check_pgt_cache() do { } while (0) -/* - * For SH-4, we have our own implementation for ptep_get_and_clear - */ -static inline pte_t ptep_get_and_clear(pte_t *ptep) -{ - pte_t pte = *ptep; +#ifdef CONFIG_CPU_SH4 +#define PG_mapped PG_arch_1 - pte_clear(ptep); - if (!pte_not_present(pte)) { - struct page *page; - unsigned long pfn = pte_pfn(pte); - if (pfn_valid(pfn)) { - page = pfn_to_page(pfn); - if (!page->mapping - || list_empty(&page->mapping->i_mmap_shared)) - __clear_bit(PG_mapped, &page->flags); - } - } - return pte; -} -#else -static inline pte_t ptep_get_and_clear(pte_t *ptep) -{ - pte_t pte = *ptep; - pte_clear(ptep); - return pte; -} +extern inline pte_t ptep_get_and_clear(pte_t *ptep); #endif -/* - * Following functions are same as generic ones. - */ -static inline int ptep_test_and_clear_young(pte_t *ptep) -{ - pte_t pte = *ptep; - if (!pte_young(pte)) - return 0; - set_pte(ptep, pte_mkold(pte)); - return 1; -} - -static inline int ptep_test_and_clear_dirty(pte_t *ptep) -{ - pte_t pte = *ptep; - if (!pte_dirty(pte)) - return 0; - set_pte(ptep, pte_mkclean(pte)); - return 1; -} - -static inline void ptep_set_wrprotect(pte_t *ptep) -{ - pte_t old_pte = *ptep; - set_pte(ptep, pte_wrprotect(old_pte)); -} - -static inline void ptep_mkdirty(pte_t *ptep) -{ - pte_t old_pte = *ptep; - set_pte(ptep, pte_mkdirty(old_pte)); -} - -#define check_pgt_cache() do { } while (0) - #endif /* __ASM_SH_PGALLOC_H */[unhandled content-type:application/pgp-signature] | |