mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fixes for 2.6.1-rc2-mm1 on PPC
@ 2004-01-21 23:20 Paul Mackerras
  2004-01-21 23:28 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Mackerras @ 2004-01-21 23:20 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel

Andrew,

This patch is needed to get 2.6.1-rc2-mm1 to compile and work on PPC.
It looks like Ingo (or someone) made changes to the discontiguous file
mapping stuff for x86 and didn't make the corresponding changes for
other archs, so this patch makes the changes for PPC.  I'll do PPC64
as well shortly.  The second part fixes up an update_mmu_cache call
which was incorrect.

Regards,
Paul.

diff -urN linux-2.6.1-rc2-mm1/include/asm-ppc/mman.h test-mm/linux-2.6.1-rc2-mm1/include/asm-ppc/mman.h
--- linux-2.6.1-rc2-mm1/include/asm-ppc/mman.h	2004-01-21 22:25:10.000000000 +1100
+++ test-mm/linux-2.6.1-rc2-mm1/include/asm-ppc/mman.h	2004-01-22 09:42:21.879803984 +1100
@@ -23,6 +23,7 @@
 #define MAP_EXECUTABLE	0x1000		/* mark it as an executable */
 #define MAP_POPULATE	0x8000		/* populate (prefault) pagetables */
 #define MAP_NONBLOCK	0x10000		/* do not block on IO */
+#define MAP_INHERIT	0x20000		/* inherit prot of underlying vma */
 
 #define MS_ASYNC	1		/* sync memory asynchronously */
 #define MS_INVALIDATE	2		/* invalidate the caches */
diff -urN linux-2.6.1-rc2-mm1/include/asm-ppc/pgtable.h test-mm/linux-2.6.1-rc2-mm1/include/asm-ppc/pgtable.h
--- linux-2.6.1-rc2-mm1/include/asm-ppc/pgtable.h	2004-01-21 22:23:20.000000000 +1100
+++ test-mm/linux-2.6.1-rc2-mm1/include/asm-ppc/pgtable.h	2004-01-22 09:41:32.526306856 +1100
@@ -264,8 +264,8 @@
 /* Definitions for 60x, 740/750, etc. */
 #define _PAGE_PRESENT	0x001	/* software: pte contains a translation */
 #define _PAGE_HASHPTE	0x002	/* hash_page has made an HPTE for this pte */
-#define _PAGE_FILE	0x004	/* when !present: nonlinear file mapping */
 #define _PAGE_USER	0x004	/* usermode access allowed */
+#define _PAGE_FILE	0x008	/* when !present: nonlinear file mapping */
 #define _PAGE_GUARDED	0x008	/* G: prohibit speculative access */
 #define _PAGE_COHERENT	0x010	/* M: enforce memory coherence (SMP systems) */
 #define _PAGE_NO_CACHE	0x020	/* I: cache inhibit */
@@ -616,9 +616,16 @@
 #define __swp_entry_to_pte(x)		((pte_t) { (x).val << 3 })
 
 /* Encode and decode a nonlinear file mapping entry */
-#define PTE_FILE_MAX_BITS	29
-#define pte_to_pgoff(pte)	(pte_val(pte) >> 3)
-#define pgoff_to_pte(off)	((pte_t) { ((off) << 3) | _PAGE_FILE })
+#define PTE_FILE_MAX_BITS	27
+#define pte_to_pgoff(pte)	(((pte_val(pte) & ~0x7ff) >> 5)		\
+				 | ((pte_val(pte) & 0x3f0) >> 4))
+#define pte_to_pgprot(pte)	\
+__pgprot((pte_val(pte) & (_PAGE_USER|_PAGE_RW|_PAGE_PRESENT)) | _PAGE_ACCESSED)
+
+#define pgoff_prot_to_pte(off, prot)					\
+	((pte_t) { (((off) << 5) & ~0x7ff) | (((off) << 4) & 0x3f0)	\
+		   | (pgprot_val(prot) & (_PAGE_USER|_PAGE_RW))		\
+		   | _PAGE_FILE })
 
 /* CONFIG_APUS */
 /* For virtual address to physical address conversion */
diff -urN linux-2.6.1-rc2-mm1/mm/filemap.c test-mm/linux-2.6.1-rc2-mm1/mm/filemap.c
--- linux-2.6.1-rc2-mm1/mm/filemap.c	2004-01-21 22:25:46.000000000 +1100
+++ test-mm/linux-2.6.1-rc2-mm1/mm/filemap.c	2004-01-22 10:15:36.735539816 +1100
@@ -40,6 +40,7 @@
 
 #include <asm/uaccess.h>
 #include <asm/mman.h>
+#include <asm/tlbflush.h>
 
 /*
  * Shared mappings implemented 30.11.1994. It's not fully working yet,
@@ -1483,7 +1484,7 @@
 				flush_icache_page(vma, *tmp);
 				set_pte(pte, mk_pte(*tmp, prot));
 				pte_chain = page_add_rmap(*tmp, pte, pte_chain);
-				update_mmu_cache(vma, addr, *pte_val);
+				update_mmu_cache(vma, addr, *pte);
 
 				tmp++;
 				nr_pages--;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] fixes for 2.6.1-rc2-mm1 on PPC
  2004-01-21 23:20 [PATCH] fixes for 2.6.1-rc2-mm1 on PPC Paul Mackerras
@ 2004-01-21 23:28 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2004-01-21 23:28 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linux-kernel

Paul Mackerras <paulus@samba.org> wrote:
>
> Andrew,
> 
> This patch is needed to get 2.6.1-rc2-mm1 to compile and work on PPC.
> It looks like Ingo (or someone) made changes to the discontiguous file
> mapping stuff for x86 and didn't make the corresponding changes for
> other archs, so this patch makes the changes for PPC.

Sweet, thanks.  I subsequently dropped those patches due to crashiness in
one of them.  But I see a new version in my inbox.

> I'll do PPC64 as well shortly.

Also much appreciated.  Breaking everything !x86 distresses me.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-01-21 23:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-21 23:20 [PATCH] fixes for 2.6.1-rc2-mm1 on PPC Paul Mackerras
2004-01-21 23:28 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome