public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Mundt <lethal@linux-sh.org>
To: "David S. Miller" <davem@davemloft.net>
Cc: Russell King <rmk@arm.linux.org.uk>, linux-arch@vger.kernel.org
Subject: Re: Changing  update_mmu_cache()
Date: Sun, 27 Feb 2005 20:55:37 +0200	[thread overview]
Message-ID: <20050227185537.GB32383@linux-sh.org> (raw)
In-Reply-To: <20050225170905.4d98d934.davem@davemloft.net>

[-- Attachment #1: Type: text/plain, Size: 3128 bytes --]

On Fri, Feb 25, 2005 at 05:09:05PM -0800, David S. Miller wrote:
> I also enhanced SH platform so that the cache-sh4.c code no
> longer calculates the physical address by hand for flush_cache_page(),
> it's there now via pfn << PAGE_SHIFT.
> 
Looks good, thanks. flush_icache_user_range() needed one minor change:

--- orig/arch/sh/mm/cache-sh4.c
+++ mod/arch/sh/mm/cache-sh4.c
@@ -377,6 +357,6 @@
 void flush_icache_user_range(struct vm_area_struct *vma,
 			     struct page *page, unsigned long addr, int len)
 {
-	__flush_cache_page(vma, addr, PHYSADDR(page_address(page)));
+	flush_cache_page(vma, addr, page_to_pfn(page));
 }
 
> I'll push this off to Linus when 2.6.12 opens up.  If folks could
> build test this against current 2.6.x and report any failures that
> need fixing, I would appreciate that.
> 
You missed fs/binfmt_elf.c, this gets it working..

===== fs/binfmt_elf.c 1.102 vs edited =====
--- 1.102/fs/binfmt_elf.c	2005-02-06 13:29:02 +02:00
+++ edited/fs/binfmt_elf.c	2005-02-27 20:31:54 +02:00
@@ -1584,7 +1584,7 @@
 					DUMP_SEEK (file->f_pos + PAGE_SIZE);
 				} else {
 					void *kaddr;
-					flush_cache_page(vma, addr);
+					flush_cache_page(vma, addr, page_to_pfn(page));
 					kaddr = kmap(page);
 					if ((size += PAGE_SIZE) > limit ||
 					    !dump_write(file, kaddr,


On another note, for sh64 we don't need to actually keep
sh64_dcache_purge_virt_page() around for anything after this change..
flush_cache_page() was the only user of it anyways, so it makes more
sense to just have it call sh64_dcache_purge_phy_page() directly.

Here's a patch for arch/sh64/mm/cache.c that you can use in-place of the
one you have now, builds and boots.

--- orig/arch/sh64/mm/cache.c
+++ mod/arch/sh64/mm/cache.c
@@ -584,31 +584,6 @@
 	}
 }
 
-static void sh64_dcache_purge_virt_page(struct mm_struct *mm, unsigned long eaddr)
-{
-	unsigned long phys;
-	pgd_t *pgd;
-	pmd_t *pmd;
-	pte_t *pte;
-	pte_t entry;
-
-	pgd = pgd_offset(mm, eaddr);
-	pmd = pmd_offset(pgd, eaddr);
-
-	if (pmd_none(*pmd) || pmd_bad(*pmd))
-		return;
-
-	pte = pte_offset_kernel(pmd, eaddr);
-	entry = *pte;
-
-	if (pte_none(entry) || !pte_present(entry))
-		return;
-
-	phys = pte_val(entry) & PAGE_MASK;
-
-	sh64_dcache_purge_phy_page(phys);
-}
-
 static void sh64_dcache_purge_user_page(struct mm_struct *mm, unsigned long eaddr)
 {
 	pgd_t *pgd;
@@ -915,7 +890,7 @@
 
 /****************************************************************************/
 
-void flush_cache_page(struct vm_area_struct *vma, unsigned long eaddr)
+void flush_cache_page(struct vm_area_struct *vma, unsigned long eaddr, unsigned long pfn)
 {
 	/* Invalidate any entries in either cache for the vma within the user
 	   address space vma->vm_mm for the page starting at virtual address
@@ -926,7 +901,7 @@
 	   Note(1), this is called with mm->page_table_lock held.
 	   */
 
-	sh64_dcache_purge_virt_page(vma->vm_mm, eaddr);
+	sh64_dcache_purge_phy_page(pfn << PAGE_SHIFT);
 
 	if (vma->vm_flags & VM_EXEC) {
 		sh64_icache_inv_user_page(vma, eaddr);

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2005-02-27 18:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-22  4:53 Changing update_mmu_cache() Benjamin Herrenschmidt
2005-02-22  5:43 ` David S. Miller
2005-02-22  9:07 ` Russell King
2005-02-22 18:08   ` David S. Miller
2005-02-25 20:15     ` Russell King
2005-02-25 21:43       ` Andrew Morton
2005-02-25 21:46         ` William Lee Irwin III
2005-02-25 22:48         ` Russell King
2005-02-25 22:59           ` William Lee Irwin III
2005-02-25 23:07           ` Andrew Morton
2005-02-26  1:09       ` David S. Miller
2005-02-27 18:55         ` Paul Mundt [this message]
2005-02-28  4:12           ` David S. Miller
2005-02-28  9:18             ` Paul Mundt
2005-03-06  5:15               ` David S. Miller
2005-02-27 19:27         ` Russell King
2005-02-26  1:10       ` Benjamin Herrenschmidt
2005-02-22 20:51   ` Benjamin Herrenschmidt
2005-02-23  5:35 ` Changing update_mmu_cache() or set_pte() ? Benjamin Herrenschmidt
2005-02-23  5:47   ` Benjamin Herrenschmidt

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=20050227185537.GB32383@linux-sh.org \
    --to=lethal@linux-sh.org \
    --cc=davem@davemloft.net \
    --cc=linux-arch@vger.kernel.org \
    --cc=rmk@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