PATCH
Ralf,
Sorry, one more update to the 36 bit patch. The only difference is that I removed the hunk that updates arch/mips/au1000/common/setup.c because I'll apply that part myself, and then make other updates to setup.c that would then conflict with the patch I sent you. This is the final version you can apply ;)
Pete
Index: arch/mips/mm/Makefile
===================================================================
RCS file: /home/cvs/linux/arch/mips/mm/Makefile,v
retrieving revision 1.68
mips/mm/Makefile +2 -1
@@ -41,10 +41,11 @@ obj-$(CONFIG_CPU_RM7000) += tlbex32-r4k.o obj-$(CONFIG_CPU_RM9000) += tlbex32-r4k.o obj-$(CONFIG_CPU_R10000) += tlbex32-r4k.o -obj-$(CONFIG_CPU_MIPS32) += tlbex32-r4k.o +obj-$(CONFIG_CPU_MIPS32) += tlbex32-mips32.o obj-$(CONFIG_CPU_MIPS64) += tlbex32-r4k.o obj-$(CONFIG_CPU_SB1) += tlbex32-r4k.o obj-$(CONFIG_CPU_TX39XX) += tlbex32-r3k.o +obj-$(CONFIG_64BIT_PHYS_ADDR) += remap.o endif ifdef CONFIG_MIPS64 obj-$(CONFIG_CPU_R4300) += tlb64-glue-r4k.o tlbex64-r4k.o
Index: arch/mips/mm/ioremap.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/mm/ioremap.c,v retrieving revision 1.19
mips/mm/ioremap.c +13 -1
@@ -97,6 +97,15 @@ }/* +* Allow physical addresses to be fixed up to help 36 bit peripherals. +*/ +phys_t __attribute__ ((weak)) +fixup_bigphys_addr (phys_t phys_addr,phys_t size) +{ +return phys_addr; +} + +/* * Generic mapping function (not visible outside): */
@@ -110,7 +119,7 @@* caller shouldn't need to know that small detail. */ -#define IS_LOW512 (addr) (!((phys_t)(addr) & ~0x1fffffffUL)) +#define IS_LOW512 (addr) (!((phys_t)(addr) & (phys_t) ~0x1fffffffULL))void *__ioremap (phys_t phys_addr,phys_t size,unsigned long flags) {
@@ -119,6 +128,8 @@phys_t last_addr;void * addr; + phys_addr =fixup_bigphys_addr (phys_addr, size); +/* Don't allow wraparound or zero size */ last_addr = phys_addr + size -1 ;if (!size || last_addr < phys_addr)
@@ -190,3 +201,4 @@EXPORT_SYMBOL (__ioremap);EXPORT_SYMBOL (__iounmap); +EXPORT_SYMBOL (fixup_bigphys_addr);
Index: arch/mips/mm/remap.c
===================================================================
RCS file: arch/mips/mm/remap.c
mips/mm/remap.c new file +115 -0
115 lines not on this page · raw message
Index: arch/mips/mm/tlb-r4k.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/mm/tlb-r4k.c,v retrieving revision 1.38
mips/mm/tlb-r4k.c +8 -2
@@ -255,8 +255,14 @@ idx =read_c0_index (); ptep =pte_offset_map (pmdp, address); -write_c0_entrylo0 (pte_val (*ptep++) >>6 ); -write_c0_entrylo1 (pte_val (*ptep) >>6 ); +#if defined(CONFIG_64BIT_PHYS_ADDR ) && defined(CONFIG_CPU_MIPS32 ) +write_c0_entrylo0 (ptep->pte_high); + ptep++; +write_c0_entrylo1 (ptep->pte_high); +#else +write_c0_entrylo0 (pte_val (*ptep++) >>6 ); +write_c0_entrylo1 (pte_val (*ptep) >>6 ); +#endif write_c0_entryhi (address | pid);mtc0_tlbw_hazard ();if (idx <0 )
Index: arch/mips/mm/tlbex32-mips32.S
===================================================================
RCS file: arch/mips/mm/tlbex32-mips32.S
mips/mm/tlbex32-mips32.S new file +325 -0
325 lines not on this page · raw message
Index: include/asm-mips/addrspace.h
===================================================================
RCS file: /home/cvs/linux/include/asm-mips/addrspace.h,v retrieving revision 1.13
asm-mips/addrspace.h +4 -0
@@ -80,7 +80,11 @@#define XKSSEG 0x4000000000000000#define XKPHYS 0x8000000000000000#define XKSEG 0xc000000000000000 +#if defined(CONFIG_64BIT_PHYS_ADDR ) && defined(CONFIG_CPU_MIPS32 ) +#define CKSEG0 0x80000000 +#else #define CKSEG0 0xffffffff80000000 +#endif #define CKSEG1 0xffffffffa0000000#define CKSSEG 0xffffffffc0000000#define CKSEG3 0xffffffffe0000000
Index: include/asm-mips/io.h
===================================================================
RCS file: /home/cvs/linux/include/asm-mips/io.h,v
retrieving revision 1.72
asm-mips/io.h +1 -1
@@ -171,7 +171,7 @@extern void *__ioremap (phys_t offset,phys_t size,unsigned long flags);extern void __iounmap (void *addr); -static inline void *__ioremap_mode (unsigned long offset,unsigned long size, +static inline void *__ioremap_mode (phys_t offset,unsigned long size,unsigned long flags) {if (cpu_has_64bit_addresses) {
Index: include/asm-mips/page.h
===================================================================
RCS file: /home/cvs/linux/include/asm-mips/page.h,v retrieving revision 1.44
asm-mips/page.h +10 -3
@@ -32,7 +32,7 @@#ifdef CONFIG_PAGE_SIZE_64KB #define PAGE_SHIFT 16#endif -#define PAGE_SIZE (1UL << PAGE_SHIFT) +#define PAGE_SIZE (1L << PAGE_SHIFT)#define PAGE_MASK (~(PAGE_SIZE-1))#ifdef __KERNEL__
@@ -75,15 +75,22 @@* These are used to make use of C type-checking.. */ #ifdef CONFIG_64BIT_PHYS_ADDR -typedef struct {unsigned long long pte; }pte_t ; +#ifdef CONFIG_CPU_MIPS32 +typedef struct {unsigned long pte_low, pte_high; }pte_t ; +#define pte_val (x) ((x).pte_low | ((unsigned long long)(x).pte_high << 32)) +#else +typedef struct {unsigned long long pte; }pte_t ; +#define pte_val (x) ((x).pte) +#endif #else typedef struct {unsigned long pte; }pte_t ; +#define pte_val (x) ((x).pte)#endif +typedef struct {unsigned long pmd; }pmd_t ;typedef struct {unsigned long pgd; }pgd_t ;typedef struct {unsigned long pgprot; }pgprot_t ; -#define pte_val (x) ((x).pte)#define pmd_val (x) ((x).pmd)#define pgd_val (x) ((x).pgd)#define pgprot_val (x) ((x).pgprot)
Index: include/asm-mips/pgtable-32.h
===================================================================
RCS file: /home/cvs/linux/include/asm-mips/pgtable-32.h,v retrieving revision 1.11
asm-mips/pgtable-32.h +22 -0
@@ -130,8 +130,21 @@static inline int pgd_present (pgd_t pgd) {return 1 ; }static inline void pgd_clear (pgd_t *pgdp) { } +#if defined(CONFIG_64BIT_PHYS_ADDR ) && defined(CONFIG_MIPS32 )#define pte_page (x) pfn_to_page(pte_pfn(x)) +#define pte_pfn (x) ((unsigned long)((x).pte_high >> 6)) +static inline pte_t +pfn_pte (unsigned long pfn,pgprot_t prot) +{ +pte_t pte; + pte.pte_high = (pfn <<6 ) | (pgprot_val (prot) &0x3f ); + pte.pte_low =pgprot_val (prot); +return pte; +} + +#else +#define pte_page (x) pfn_to_page(pte_pfn(x))#ifdef CONFIG_CPU_VR41XX #define pte_pfn (x) ((unsigned long)((x).pte >> (PAGE_SHIFT + 2)))
@@ -140,6 +153,7 @@#define pte_pfn (x) ((unsigned long)((x).pte >> PAGE_SHIFT))#define pfn_pte (pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))#endif +#endif /* defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_MIPS32) */ #define __pgd_offset (address) pgd_index(address)#define __pmd_offset (address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
@@ -207,11 +221,19 @@*/ #define PTE_FILE_MAX_BITS 27 +#if defined(CONFIG_64BIT_PHYS_ADDR ) && defined(CONFIG_MIPS32 ) +/* fixme */ +#define pte_to_pgoff (_pte) (((_pte).pte_high >> 6) + ((_pte).pte_high & 0x3f)) +#define pgoff_to_pte (off) \ + ((pte_t){(((off) & 0x3f) + ((off) << 6) + _PAGE_FILE)}) + +#else #define pte_to_pgoff (_pte) \ ((((_pte).pte >> 3) & 0x1f ) + (((_pte).pte >> 9) << 6 ))#define pgoff_to_pte (off) \ ((pte_t) { (((off) & 0x1f) << 3) + (((off) >> 6) << 9) + _PAGE_FILE }) +#endif #endif
Index: include/asm-mips/pgtable-bits.h
===================================================================
RCS file: /home/cvs/linux/include/asm-mips/pgtable-bits.h,v retrieving revision 1.9
asm-mips/pgtable-bits.h +30 -0
@@ -33,6 +33,31 @@* unpredictable things. The code (when it is written) to deal with * this problem will be in the update_mmu_cache() code for the r4k. */ +#if defined(CONFIG_CPU_MIPS32 ) && defined(CONFIG_64BIT_PHYS_ADDR ) + +#define _PAGE_PRESENT (1<<6)/* implemented in software */ +#define _PAGE_READ (1<<7)/* implemented in software */ +#define _PAGE_WRITE (1<<8)/* implemented in software */ +#define _PAGE_ACCESSED (1<<9)/* implemented in software */ +#define _PAGE_MODIFIED (1<<10)/* implemented in software */ +#define _PAGE_FILE (1<<10)/* set:pagecache unset:swap */ + +#define _PAGE_R4KBUG (1<<0)/* workaround for r4k bug */ +#define _PAGE_GLOBAL (1<<0) +#define _PAGE_VALID (1<<1) +#define _PAGE_SILENT_READ (1<<1)/* synonym */ +#define _PAGE_DIRTY (1<<2)/* The MIPS dirty bit */ +#define _PAGE_SILENT_WRITE (1<<2) +#define _CACHE_MASK (7<<3) + +/* MIPS32 defines only values 2 and 3. The rest are implementation +* dependent. +*/ +#define _CACHE_UNCACHED (2<<3) +#define _CACHE_CACHABLE_NONCOHERENT (3<<3) + +#else +#define _PAGE_PRESENT (1<<0)/* implemented in software */ #define _PAGE_READ (1<<1)/* implemented in software */ #define _PAGE_WRITE (1<<2)/* implemented in software */
@@ -97,6 +122,7 @@#endif #endif +#endif /* defined(CONFIG_CPU_MIPS32) && defined(CONFIG_64BIT_PHYS_ADDR) */ #define __READABLE (_PAGE_READ | _PAGE_SILENT_READ | _PAGE_ACCESSED)#define __WRITEABLE (_PAGE_WRITE | _PAGE_SILENT_WRITE | _PAGE_MODIFIED)
@@ -113,6 +139,10 @@#define PAGE_CACHABLE_DEFAULT _CACHE_CACHABLE_COW#endif +#if defined(CONFIG_CPU_MIPS32 ) && defined(CONFIG_64BIT_PHYS_ADDR ) +#define CONF_CM_DEFAULT (PAGE_CACHABLE_DEFAULT >> 3) +#else #define CONF_CM_DEFAULT (PAGE_CACHABLE_DEFAULT >> 9) +#endif #endif /* _ASM_PGTABLE_BITS_H */
Index: include/asm-mips/pgtable.h
===================================================================
RCS file: /home/cvs/linux/include/asm-mips/pgtable.h,v retrieving revision 1.97
asm-mips/pgtable.h +133 -0
174 lines not on this page · raw message
Quoted 5 lines · Pete Popov
diff -u -r1.13
addrspace.hasm-mips/addrspace.h +0
-0@@ -80,7 +80,11 @@#define XKSSEG 0x4000000000000000
asm-mips/addrspace.h line 90
Quoted 10 lines
asm-mips/addrspace.h +4
-0#define XKPHYS 0x8000000000000000#define XKSEG 0xc000000000000000 +#if defined(CONFIG_64BIT_PHYS_ADDR ) && defined(CONFIG_CPU_MIPS32 ) +#define CKSEG0 0x80000000 +#else #define CKSEG0 0xffffffff80000000 +#endif #define CKSEG1 0xffffffffa0000000#define CKSSEG 0xffffffffc0000000#define CKSEG3 0xffffffffe0000000
This looks suspicious, please explain.
Maciej
Quoted 13 lines · Maciej W. Rozycki
Quoted 10 lines · Pete Popov
diff -u -r1.13
addrspace.hasm-mips/addrspace.h +3
-0@@ -80,7 +80,11 @@#define XKSSEG 0x4000000000000000#define XKPHYS 0x8000000000000000#define XKSEG 0xc000000000000000 +#if defined(CONFIG_64BIT_PHYS_ADDR ) && defined(CONFIG_CPU_MIPS32 ) +#define CKSEG0 0x80000000 +#else
Quoted 8 lines
asm-mips/addrspace.h line 90
Quoted 5 lines
asm-mips/addrspace.h +1
-0#define CKSEG0 0xffffffff80000000 +#endif #define CKSEG1 0xffffffffa0000000#define CKSSEG 0xffffffffc0000000#define CKSEG3 0xffffffffe0000000This looks suspicious, please explain.
Clearly a buglet, carried over from 2.4. That section of the code wouldn't even be compiled, since CONFIG_MIPS64 is not defined. I'll remove that and send a new patch. Anything else you see that's suspicious :)?
Pete
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Pete Popov
ppopov> Clearly a buglet, carried over from 2.4. That section of the ppopov> code wouldn't even be compiled, since CONFIG_MIPS64 is not ppopov> defined. I'll remove that and send a new patch. Anything else ppopov> you see that's suspicious :)?
Hi. I wonder why following change is needed.
asm-mips/page.h line 38
Quoted 11 lines
asm-mips/page.h +1
-1@@ -32,7 +32,7 @@#ifdef CONFIG_PAGE_SIZE_64KB #define PAGE_SHIFT 16#endif -#define PAGE_SIZE (1UL << PAGE_SHIFT) +#define PAGE_SIZE (1L << PAGE_SHIFT)#define PAGE_MASK (~(PAGE_SIZE-1))#ifdef __KERNEL__
---
Atsushi Nemoto
Quoted 21 lines · Atsushi Nemoto
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Pete Popov
ppopov> Clearly a buglet, carried over from 2.4. That section of the ppopov> code wouldn't even be compiled, since
CONFIG_MIPS64is not ppopov> defined. I'll remove that and send a new patch. Anything else ppopov> you see that's suspicious :)?Hi. I wonder why following change is needed.
Quoted 10 lines
asm-mips/page.h +1
-1@@ -32,7 +32,7 @@#ifdef CONFIG_PAGE_SIZE_64KB #define PAGE_SHIFT 16#endif -#define PAGE_SIZE (1UL << PAGE_SHIFT) +#define PAGE_SIZE (1L << PAGE_SHIFT)#define PAGE_MASK (~(PAGE_SIZE-1))
Quoted 1 line
asm-mips/page.h line 38
Quoted 1 line
asm-mips/page.h +0
-0#ifdef __KERNEL__
It was related to some compiler problem I mentioned to Ralf sometime ago. Perhaps it's not needed anymore, I'll take a look.
Pete
Quoted 24 lines · Pete Popov
Quoted 22 lines · Atsushi Nemoto
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Pete Popov
ppopov> Clearly a buglet, carried over from 2.4. That section of the ppopov> code wouldn't even be compiled, since
CONFIG_MIPS64is not ppopov> defined. I'll remove that and send a new patch. Anything else ppopov> you see that's suspicious :)?Hi. I wonder why following change is needed.
Quoted 10 lines
asm-mips/page.h 19 Sep 2004 22:51:29 -0000 renamed from asm-mips/page.h 20 Aug 2004 12:02:18 -0000 1.44 +1
-1@@ -32,7 +32,7 @@ #ifdef CONFIG_PAGE_SIZE_64KB #define PAGE_SHIFT 16 #endif -#define PAGE_SIZE (1UL << PAGE_SHIFT) +#define PAGE_SIZE (1L << PAGE_SHIFT) #define PAGE_MASK (~(PAGE_SIZE-1))
Quoted 4 lines
Quoted 1 line
asm-mips/page.h 19 Sep 2004 22:51:29 -0000 line 38
Quoted 1 line
asm-mips/page.h 19 Sep 2004 22:51:29 -0000 renamed from asm-mips/page.h 20 Aug 2004 12:02:18 -0000 1.44 +0
-0#ifdef __KERNEL__It was related to some compiler problem I mentioned to Ralf sometime ago. Perhaps it's not needed anymore, I'll take a look.
Turns out the problem is with the #define PAGE_MASK, when (1UL << PAGE_SHIFT) is used for PAGE_SIZE. The correct fix is already in the PPC tree and it doesn't use PAGE_SIZE to define PAGE_MASK. From the PPC tree:
/*
* Subtle: this is an int (not an unsigned long) and so it
* gets extended to 64 bits the way [we] want (i.e. with 1s). -- paulus */
#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1))
I updated the patch and put a new version in my directory (v1.3). The diff is:
-#define PAGE_MASK (~(PAGE_SIZE-1))
+#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1))
I'll work on the remap_pfn_range after those bits get to kernel.org. That will clean up the patch nicely.
Pete
Quoted 11 lines · Maciej W. Rozycki
Quoted 9 lines · Pete Popov
diff -u -r1.13
addrspace.hasm-mips/addrspace.h +2
-0@@ -80,7 +80,11 @@#define XKSSEG 0x4000000000000000#define XKPHYS 0x8000000000000000#define XKSEG 0xc000000000000000 +#if defined(CONFIG_64BIT_PHYS_ADDR ) && defined(CONFIG_CPU_MIPS32 ) +#define CKSEG0 0x80000000
Quoted 8 lines
asm-mips/addrspace.h line 90
Quoted 6 lines
asm-mips/addrspace.h +2
-0+#else #define CKSEG0 0xffffffff80000000 +#endif #define CKSEG1 0xffffffffa0000000#define CKSSEG 0xffffffffc0000000#define CKSEG3 0xffffffffe0000000This looks suspicious, please explain.
Updated patch, minus above bug.
Index: arch/mips/mm/Makefile
===================================================================
RCS file: /home/cvs/linux/arch/mips/mm/Makefile,v
retrieving revision 1.68
mips/mm/Makefile +2 -1
@@ -41,10 +41,11 @@ obj-$(CONFIG_CPU_RM7000) += tlbex32-r4k.o obj-$(CONFIG_CPU_RM9000) += tlbex32-r4k.o obj-$(CONFIG_CPU_R10000) += tlbex32-r4k.o -obj-$(CONFIG_CPU_MIPS32) += tlbex32-r4k.o +obj-$(CONFIG_CPU_MIPS32) += tlbex32-mips32.o obj-$(CONFIG_CPU_MIPS64) += tlbex32-r4k.o obj-$(CONFIG_CPU_SB1) += tlbex32-r4k.o obj-$(CONFIG_CPU_TX39XX) += tlbex32-r3k.o +obj-$(CONFIG_64BIT_PHYS_ADDR) += remap.o endif ifdef CONFIG_MIPS64 obj-$(CONFIG_CPU_R4300) += tlb64-glue-r4k.o tlbex64-r4k.o
Index: arch/mips/mm/ioremap.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/mm/ioremap.c,v retrieving revision 1.19
mips/mm/ioremap.c +13 -1
@@ -97,6 +97,15 @@ }/* +* Allow physical addresses to be fixed up to help 36 bit peripherals. +*/ +phys_t __attribute__ ((weak)) +fixup_bigphys_addr (phys_t phys_addr,phys_t size) +{ +return phys_addr; +} + +/* * Generic mapping function (not visible outside): */
@@ -110,7 +119,7 @@* caller shouldn't need to know that small detail. */ -#define IS_LOW512 (addr) (!((phys_t)(addr) & ~0x1fffffffUL)) +#define IS_LOW512 (addr) (!((phys_t)(addr) & (phys_t) ~0x1fffffffULL))void *__ioremap (phys_t phys_addr,phys_t size,unsigned long flags) {
@@ -119,6 +128,8 @@phys_t last_addr;void * addr; + phys_addr =fixup_bigphys_addr (phys_addr, size); +/* Don't allow wraparound or zero size */ last_addr = phys_addr + size -1 ;if (!size || last_addr < phys_addr)
@@ -190,3 +201,4 @@EXPORT_SYMBOL (__ioremap);EXPORT_SYMBOL (__iounmap); +EXPORT_SYMBOL (fixup_bigphys_addr);
Index: arch/mips/mm/remap.c
===================================================================
RCS file: arch/mips/mm/remap.c
mips/mm/remap.c new file +115 -0
115 lines not on this page · raw message
Index: arch/mips/mm/tlb-r4k.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/mm/tlb-r4k.c,v retrieving revision 1.38
mips/mm/tlb-r4k.c +8 -2
@@ -255,8 +255,14 @@ idx =read_c0_index (); ptep =pte_offset_map (pmdp, address); -write_c0_entrylo0 (pte_val (*ptep++) >>6 ); -write_c0_entrylo1 (pte_val (*ptep) >>6 ); +#if defined(CONFIG_64BIT_PHYS_ADDR ) && defined(CONFIG_CPU_MIPS32 ) +write_c0_entrylo0 (ptep->pte_high); + ptep++; +write_c0_entrylo1 (ptep->pte_high); +#else +write_c0_entrylo0 (pte_val (*ptep++) >>6 ); +write_c0_entrylo1 (pte_val (*ptep) >>6 ); +#endif write_c0_entryhi (address | pid);mtc0_tlbw_hazard ();if (idx <0 )
Index: arch/mips/mm/tlbex32-mips32.S
===================================================================
RCS file: arch/mips/mm/tlbex32-mips32.S
mips/mm/tlbex32-mips32.S new file +325 -0
325 lines not on this page · raw message
Index: include/asm-mips/io.h
===================================================================
RCS file: /home/cvs/linux/include/asm-mips/io.h,v
retrieving revision 1.72
asm-mips/io.h +1 -1
@@ -171,7 +171,7 @@extern void *__ioremap (phys_t offset,phys_t size,unsigned long flags);extern void __iounmap (void *addr); -static inline void *__ioremap_mode (unsigned long offset,unsigned long size, +static inline void *__ioremap_mode (phys_t offset,unsigned long size,unsigned long flags) {if (cpu_has_64bit_addresses) {
Index: include/asm-mips/page.h
===================================================================
RCS file: /home/cvs/linux/include/asm-mips/page.h,v retrieving revision 1.44
asm-mips/page.h +10 -3
@@ -32,7 +32,7 @@#ifdef CONFIG_PAGE_SIZE_64KB #define PAGE_SHIFT 16#endif -#define PAGE_SIZE (1UL << PAGE_SHIFT) +#define PAGE_SIZE (1L << PAGE_SHIFT)#define PAGE_MASK (~(PAGE_SIZE-1))#ifdef __KERNEL__
@@ -75,15 +75,22 @@* These are used to make use of C type-checking.. */ #ifdef CONFIG_64BIT_PHYS_ADDR -typedef struct {unsigned long long pte; }pte_t ; +#ifdef CONFIG_CPU_MIPS32 +typedef struct {unsigned long pte_low, pte_high; }pte_t ; +#define pte_val (x) ((x).pte_low | ((unsigned long long)(x).pte_high << 32)) +#else +typedef struct {unsigned long long pte; }pte_t ; +#define pte_val (x) ((x).pte) +#endif #else typedef struct {unsigned long pte; }pte_t ; +#define pte_val (x) ((x).pte)#endif +typedef struct {unsigned long pmd; }pmd_t ;typedef struct {unsigned long pgd; }pgd_t ;typedef struct {unsigned long pgprot; }pgprot_t ; -#define pte_val (x) ((x).pte)#define pmd_val (x) ((x).pmd)#define pgd_val (x) ((x).pgd)#define pgprot_val (x) ((x).pgprot)
Index: include/asm-mips/pgtable-32.h
===================================================================
RCS file: /home/cvs/linux/include/asm-mips/pgtable-32.h,v retrieving revision 1.11
asm-mips/pgtable-32.h +22 -0
@@ -130,8 +130,21 @@static inline int pgd_present (pgd_t pgd) {return 1 ; }static inline void pgd_clear (pgd_t *pgdp) { } +#if defined(CONFIG_64BIT_PHYS_ADDR ) && defined(CONFIG_MIPS32 )#define pte_page (x) pfn_to_page(pte_pfn(x)) +#define pte_pfn (x) ((unsigned long)((x).pte_high >> 6)) +static inline pte_t +pfn_pte (unsigned long pfn,pgprot_t prot) +{ +pte_t pte; + pte.pte_high = (pfn <<6 ) | (pgprot_val (prot) &0x3f ); + pte.pte_low =pgprot_val (prot); +return pte; +} + +#else +#define pte_page (x) pfn_to_page(pte_pfn(x))#ifdef CONFIG_CPU_VR41XX #define pte_pfn (x) ((unsigned long)((x).pte >> (PAGE_SHIFT + 2)))
@@ -140,6 +153,7 @@#define pte_pfn (x) ((unsigned long)((x).pte >> PAGE_SHIFT))#define pfn_pte (pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))#endif +#endif /* defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_MIPS32) */ #define __pgd_offset (address) pgd_index(address)#define __pmd_offset (address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
@@ -207,11 +221,19 @@*/ #define PTE_FILE_MAX_BITS 27 +#if defined(CONFIG_64BIT_PHYS_ADDR ) && defined(CONFIG_MIPS32 ) +/* fixme */ +#define pte_to_pgoff (_pte) (((_pte).pte_high >> 6) + ((_pte).pte_high & 0x3f)) +#define pgoff_to_pte (off) \ + ((pte_t){(((off) & 0x3f) + ((off) << 6) + _PAGE_FILE)}) + +#else #define pte_to_pgoff (_pte) \ ((((_pte).pte >> 3) & 0x1f ) + (((_pte).pte >> 9) << 6 ))#define pgoff_to_pte (off) \ ((pte_t) { (((off) & 0x1f) << 3) + (((off) >> 6) << 9) + _PAGE_FILE }) +#endif #endif
Index: include/asm-mips/pgtable-bits.h
===================================================================
RCS file: /home/cvs/linux/include/asm-mips/pgtable-bits.h,v retrieving revision 1.9
asm-mips/pgtable-bits.h +30 -0
@@ -33,6 +33,31 @@* unpredictable things. The code (when it is written) to deal with * this problem will be in the update_mmu_cache() code for the r4k. */ +#if defined(CONFIG_CPU_MIPS32 ) && defined(CONFIG_64BIT_PHYS_ADDR ) + +#define _PAGE_PRESENT (1<<6)/* implemented in software */ +#define _PAGE_READ (1<<7)/* implemented in software */ +#define _PAGE_WRITE (1<<8)/* implemented in software */ +#define _PAGE_ACCESSED (1<<9)/* implemented in software */ +#define _PAGE_MODIFIED (1<<10)/* implemented in software */ +#define _PAGE_FILE (1<<10)/* set:pagecache unset:swap */ + +#define _PAGE_R4KBUG (1<<0)/* workaround for r4k bug */ +#define _PAGE_GLOBAL (1<<0) +#define _PAGE_VALID (1<<1) +#define _PAGE_SILENT_READ (1<<1)/* synonym */ +#define _PAGE_DIRTY (1<<2)/* The MIPS dirty bit */ +#define _PAGE_SILENT_WRITE (1<<2) +#define _CACHE_MASK (7<<3) + +/* MIPS32 defines only values 2 and 3. The rest are implementation +* dependent. +*/ +#define _CACHE_UNCACHED (2<<3) +#define _CACHE_CACHABLE_NONCOHERENT (3<<3) + +#else +#define _PAGE_PRESENT (1<<0)/* implemented in software */ #define _PAGE_READ (1<<1)/* implemented in software */ #define _PAGE_WRITE (1<<2)/* implemented in software */
@@ -97,6 +122,7 @@#endif #endif +#endif /* defined(CONFIG_CPU_MIPS32) && defined(CONFIG_64BIT_PHYS_ADDR) */ #define __READABLE (_PAGE_READ | _PAGE_SILENT_READ | _PAGE_ACCESSED)#define __WRITEABLE (_PAGE_WRITE | _PAGE_SILENT_WRITE | _PAGE_MODIFIED)
@@ -113,6 +139,10 @@#define PAGE_CACHABLE_DEFAULT _CACHE_CACHABLE_COW#endif +#if defined(CONFIG_CPU_MIPS32 ) && defined(CONFIG_64BIT_PHYS_ADDR ) +#define CONF_CM_DEFAULT (PAGE_CACHABLE_DEFAULT >> 3) +#else #define CONF_CM_DEFAULT (PAGE_CACHABLE_DEFAULT >> 9) +#endif #endif /* _ASM_PGTABLE_BITS_H */
Index: include/asm-mips/pgtable.h
===================================================================
RCS file: /home/cvs/linux/include/asm-mips/pgtable.h,v retrieving revision 1.97
asm-mips/pgtable.h +133 -0
174 lines not on this page · raw message
mips/mm/remap.c line 5
Quoted 11 lines
===================================================================
RCS file:arch/mips/mm/remap.c
diff -Narch/mips/mm/remap.cmips/mm/remap.c new file +5
-0@@ -0,0 +1,115 @@ +/* +* arch/mips/mm/remap.c +* +* A copy of mm/memory.c, with mods for 64 bit physical I/O addresses on +* 32 bit native word platforms.
This is horrible. Please submit any modifications you'll need over remap_page_pfn (as in -mm) that you still need and ensure they're portable.
Quoted 8 lines · Christoph Hellwig
Quoted 8 lines
===================================================================
RCS file:arch/mips/mm/remap.c
diff -Narch/mips/mm/remap.cmips/mm/remap.c new file +2
-0@@ -0,0 +1,115 @@ +/* +* arch/mips/mm/remap.c
Quoted 8 lines
mips/mm/remap.c line 5
Quoted 3 lines
mips/mm/remap.c new file +3
-0+* +* A copy of mm/memory.c, with mods for 64 bit physical I/O addresses on +* 32 bit native word platforms. This is horrible. Please submit any modifications you'll need over
remap_page_pfn(as in -mm) that you still need and ensure they're portable.
Using remap_page_pfn would simplify the patch but that's very recent and I didn't even know it made it in yet. Running MIPS on top of the -mm tree might be a problem though, I haven't tried. I'm not sure how up to date MIPS is in that tree so I might have to wait until the changes make it to kernel.org and then update the patch to remove remap.c and use remap_page_pfn instead.
Pete