From: Paul Mundt <lethal@linux-sh.org>
To: Russell King <rmk+lkml@arm.linux.org.uk>
Cc: Linux Kernel List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Clean up asm/pgalloc.h include (sh)
Date: Tue, 20 Apr 2004 10:46:59 -0400 [thread overview]
Message-ID: <20040420144659.GE12390@linux-sh.org> (raw)
In-Reply-To: <E1BFYjS-00056J-TY@dyn-67.arm.linux.org.uk>
[-- Attachment #1: Type: text/plain, Size: 4208 bytes --]
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 */
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2004-04-20 14:47 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-18 22:17 [PATCH 1/2] Clean up asm/pgalloc.h include Russell King
2004-04-18 22:23 ` [PATCH 2/2] " Russell King
2004-04-18 22:48 ` [PATCH 3/2] " Russell King
2004-04-19 13:20 ` [PATCH] Clean up asm/pgalloc.h include (alpha) Russell King
2004-04-19 20:55 ` Ivan Kokshaysky
2004-04-19 13:20 ` [PATCH] Clean up asm/pgalloc.h include (arm26) Russell King
2004-04-19 13:20 ` [PATCH] Clean up asm/pgalloc.h include (cris) Russell King
2004-04-19 13:21 ` [PATCH] Clean up asm/pgalloc.h include (H8300) Russell King
2004-04-19 13:21 ` [PATCH] Clean up asm/pgalloc.h include (ia64) Russell King
2004-04-19 20:56 ` Alex Williamson
2004-04-19 13:21 ` [PATCH] Clean up asm/pgalloc.h include (m68k) Russell King
2004-04-19 16:18 ` Geert Uytterhoeven
2004-04-19 16:30 ` Russell King
2004-04-19 16:39 ` Geert Uytterhoeven
2004-04-19 16:38 ` Russell King
2004-04-19 13:21 ` [PATCH] Clean up asm/pgalloc.h include (m68knommu) Russell King
2004-04-19 13:21 ` [PATCH] Clean up asm/pgalloc.h include (mips) Russell King
2004-04-19 16:36 ` Ralf Baechle
2004-04-19 13:21 ` [PATCH] Clean up asm/pgalloc.h include (parisc) Russell King
2004-04-19 13:22 ` [PATCH] Clean up asm/pgalloc.h include (ppc) Russell King
2004-04-29 22:08 ` Tom Rini
2004-04-19 13:22 ` [PATCH] Clean up asm/pgalloc.h include (ppc64) Russell King
2004-04-19 13:22 ` [PATCH] Clean up asm/pgalloc.h include (s390) Russell King
2004-04-19 13:22 ` [PATCH] Clean up asm/pgalloc.h include (sh) Russell King
2004-04-20 14:46 ` Paul Mundt [this message]
2004-04-20 16:01 ` Hugh Dickins
2004-04-20 16:19 ` Paul Mundt
2004-04-19 13:22 ` [PATCH] Clean up asm/pgalloc.h include (sparc) Russell King
2004-04-19 13:23 ` [PATCH] Clean up asm/pgalloc.h include (sparc64) Russell King
2004-04-19 13:23 ` [PATCH] Clean up asm/pgalloc.h include (v850) Russell King
2004-04-19 13:23 ` [PATCH] Clean up asm/pgalloc.h include (x86_64) Russell King
2004-04-19 14:03 ` [discuss] " Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040420144659.GE12390@linux-sh.org \
--to=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rmk+lkml@arm.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox