Skip to content

Commit 61cbfff

Browse files
Dmitry Korotinpaulburton
authored andcommitted
MIPS: pte_special()/pte_mkspecial() support
Add support for pte_special() & pte_mkspecial(), replacing our previous stubs with functional implementations. Signed-off-by: Dmitry Korotin <dkorotin@wavecomp.com> [paul.burton@mips.com: - Fix for CONFIG_PHYS_ADDR_T_64BIT && CONFIG_CPU_MIPS32. - Rewrite commit message.] Signed-off-by: Paul Burton <paul.burton@mips.com> Cc: linux-mips@vger.kernel.org
1 parent a23c413 commit 61cbfff

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

arch/mips/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ config MIPS
8282
select RTC_LIB
8383
select SYSCTL_EXCEPTION_TRACE
8484
select VIRT_TO_BUS
85+
select ARCH_HAS_PTE_SPECIAL
8586

8687
menu "Machine selection"
8788

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ enum pgtable_bits {
5252
_PAGE_WRITE_SHIFT,
5353
_PAGE_ACCESSED_SHIFT,
5454
_PAGE_MODIFIED_SHIFT,
55+
_PAGE_SPECIAL_SHIFT,
5556
};
5657

5758
/*
@@ -78,6 +79,7 @@ enum pgtable_bits {
7879
_PAGE_WRITE_SHIFT,
7980
_PAGE_ACCESSED_SHIFT,
8081
_PAGE_MODIFIED_SHIFT,
82+
_PAGE_SPECIAL_SHIFT,
8183
};
8284

8385
#elif defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
@@ -90,6 +92,7 @@ enum pgtable_bits {
9092
_PAGE_WRITE_SHIFT,
9193
_PAGE_ACCESSED_SHIFT,
9294
_PAGE_MODIFIED_SHIFT,
95+
_PAGE_SPECIAL_SHIFT,
9396

9497
/* Used by TLB hardware (placed in EntryLo) */
9598
_PAGE_GLOBAL_SHIFT = 8,
@@ -113,6 +116,7 @@ enum pgtable_bits {
113116
#if defined(CONFIG_MIPS_HUGE_TLB_SUPPORT)
114117
_PAGE_HUGE_SHIFT,
115118
#endif
119+
_PAGE_SPECIAL_SHIFT,
116120

117121
/* Used by TLB hardware (placed in EntryLo*) */
118122
#if defined(CONFIG_CPU_HAS_RIXI)
@@ -135,6 +139,7 @@ enum pgtable_bits {
135139
#if defined(CONFIG_MIPS_HUGE_TLB_SUPPORT)
136140
# define _PAGE_HUGE (1 << _PAGE_HUGE_SHIFT)
137141
#endif
142+
#define _PAGE_SPECIAL (1 << _PAGE_SPECIAL_SHIFT)
138143

139144
/* Used by TLB hardware (placed in EntryLo*) */
140145
#if defined(CONFIG_XPA)

arch/mips/include/asm/pgtable.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ extern pgd_t swapper_pg_dir[];
277277
static inline int pte_write(pte_t pte) { return pte.pte_low & _PAGE_WRITE; }
278278
static inline int pte_dirty(pte_t pte) { return pte.pte_low & _PAGE_MODIFIED; }
279279
static inline int pte_young(pte_t pte) { return pte.pte_low & _PAGE_ACCESSED; }
280+
static inline int pte_special(pte_t pte) { return pte.pte_low & _PAGE_SPECIAL; }
280281

281282
static inline pte_t pte_wrprotect(pte_t pte)
282283
{
@@ -337,10 +338,17 @@ static inline pte_t pte_mkyoung(pte_t pte)
337338
}
338339
return pte;
339340
}
341+
342+
static inline pte_t pte_mkspecial(pte_t pte)
343+
{
344+
pte.pte_low |= _PAGE_SPECIAL;
345+
return pte;
346+
}
340347
#else
341348
static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; }
342349
static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_MODIFIED; }
343350
static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
351+
static inline int pte_special(pte_t pte) { return pte_val(pte) & _PAGE_SPECIAL; }
344352

345353
static inline pte_t pte_wrprotect(pte_t pte)
346354
{
@@ -384,6 +392,12 @@ static inline pte_t pte_mkyoung(pte_t pte)
384392
return pte;
385393
}
386394

395+
static inline pte_t pte_mkspecial(pte_t pte)
396+
{
397+
pte_val(pte) |= _PAGE_SPECIAL;
398+
return pte;
399+
}
400+
387401
#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
388402
static inline int pte_huge(pte_t pte) { return pte_val(pte) & _PAGE_HUGE; }
389403

@@ -394,8 +408,6 @@ static inline pte_t pte_mkhuge(pte_t pte)
394408
}
395409
#endif /* CONFIG_MIPS_HUGE_TLB_SUPPORT */
396410
#endif
397-
static inline int pte_special(pte_t pte) { return 0; }
398-
static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
399411

400412
/*
401413
* Macro to make mark a page protection value as "uncacheable". Note

0 commit comments

Comments
 (0)