Skip to content

Commit d1af2ab

Browse files
committed
MIPS: Disable pte_special() for MIPS32 with RiXi
Commit 61cbfff ("MIPS: pte_special()/pte_mkspecial() support") added a _PAGE_SPECIAL bit to the pgprot bits of our PTEs. Unfortunately for MIPS32 configurations with RiXi support this pushed the number of pgprot bits to 13. Since the PFN field in EntryLo begins at bit 12 this results in us shifting the most significant bit of the physical address beyond the end of the PTE, leading any mapped access to a physical address above 2GB to incorrectly access an address 2GB lower than intended. For now, disable the pte_special() support for MIPS32 configurations that support RiXi. Fixes: 61cbfff ("MIPS: pte_special()/pte_mkspecial() support") Signed-off-by: Paul Burton <paul.burton@mips.com> Cc: Dmitry Korotin <dkorotin@wavecomp.com> Cc: linux-mips@vger.kernel.org
1 parent c4d48cf commit d1af2ab

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

‎arch/mips/Kconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ config MIPS
8484
select RTC_LIB
8585
select SYSCTL_EXCEPTION_TRACE
8686
select VIRT_TO_BUS
87-
select ARCH_HAS_PTE_SPECIAL
87+
select ARCH_HAS_PTE_SPECIAL if !(32BIT && CPU_HAS_RIXI)
8888

8989
menu "Machine selection"
9090

‎arch/mips/include/asm/pgtable-bits.h‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ enum pgtable_bits {
5252
_PAGE_WRITE_SHIFT,
5353
_PAGE_ACCESSED_SHIFT,
5454
_PAGE_MODIFIED_SHIFT,
55+
#if defined(CONFIG_ARCH_HAS_PTE_SPECIAL)
5556
_PAGE_SPECIAL_SHIFT,
57+
#endif
5658
};
5759

5860
/*
@@ -79,7 +81,9 @@ enum pgtable_bits {
7981
_PAGE_WRITE_SHIFT,
8082
_PAGE_ACCESSED_SHIFT,
8183
_PAGE_MODIFIED_SHIFT,
84+
#if defined(CONFIG_ARCH_HAS_PTE_SPECIAL)
8285
_PAGE_SPECIAL_SHIFT,
86+
#endif
8387
};
8488

8589
#elif defined(CONFIG_CPU_R3K_TLB)
@@ -92,7 +96,9 @@ enum pgtable_bits {
9296
_PAGE_WRITE_SHIFT,
9397
_PAGE_ACCESSED_SHIFT,
9498
_PAGE_MODIFIED_SHIFT,
99+
#if defined(CONFIG_ARCH_HAS_PTE_SPECIAL)
95100
_PAGE_SPECIAL_SHIFT,
101+
#endif
96102

97103
/* Used by TLB hardware (placed in EntryLo) */
98104
_PAGE_GLOBAL_SHIFT = 8,
@@ -116,7 +122,9 @@ enum pgtable_bits {
116122
#if defined(CONFIG_MIPS_HUGE_TLB_SUPPORT)
117123
_PAGE_HUGE_SHIFT,
118124
#endif
125+
#if defined(CONFIG_ARCH_HAS_PTE_SPECIAL)
119126
_PAGE_SPECIAL_SHIFT,
127+
#endif
120128

121129
/* Used by TLB hardware (placed in EntryLo*) */
122130
#if defined(CONFIG_CPU_HAS_RIXI)
@@ -139,7 +147,11 @@ enum pgtable_bits {
139147
#if defined(CONFIG_MIPS_HUGE_TLB_SUPPORT)
140148
# define _PAGE_HUGE (1 << _PAGE_HUGE_SHIFT)
141149
#endif
142-
#define _PAGE_SPECIAL (1 << _PAGE_SPECIAL_SHIFT)
150+
#if defined(CONFIG_ARCH_HAS_PTE_SPECIAL)
151+
# define _PAGE_SPECIAL (1 << _PAGE_SPECIAL_SHIFT)
152+
#else
153+
# define _PAGE_SPECIAL 0
154+
#endif
143155

144156
/* Used by TLB hardware (placed in EntryLo*) */
145157
#if defined(CONFIG_XPA)

0 commit comments

Comments
 (0)