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: pgpaGl92QQCEN.pgp
Description: PGP signature

Reply via email to