Skip to contentSkip to conversation

MIPS: mm: Use scratch for PGD when !CONFIG_MIPS_PGD_C0_CONTEXT

PATCH New Jayachandran C 1 participant 1 message Sep 25, 2013 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: mm: Use scratch for PGD when !CONFIG_MIPS_PGD_C0_CONTEXT

Allow usage of scratch register for current pgd even when MIPS_PGD_C0_CONTEXT is not configured. MIPS_PGD_C0_CONTEXT is set for 64r2 platforms to indicate availability of Xcontext for saving cpuid, thus freeing Context to be used for saving PGD. This option was also tied to using a scratch register for storing PGD.

This commit will allow usage of scratch register to store the current pgd if one can be allocated for the platform, even when MIPS_PGD_C0_CONTEXT is not set. The cpuid will be kept in the CP0 Context register in this case.

The code to store the current pgd for the TLB miss handler is now generated in all cases. When scratch register is available, the PGD is also stored in the scratch register.

---
This is an update to the patch https://patchwork.linux-mips.org/patch/5709/
which takes care of the issue reported by Hauke
http://www.linux-mips.org/archives/linux-mips/2013-09/msg00216.html.
I have also added in the changes to revert 774b617 "MIPS: tlbex: Guard tlbmiss_handler_setup_pgd to this patch" to this so that all the changes related to this patch are in one place.

Ralf: Can you please drop the two patches

7c4b2a0 MIPS: mm: Use scratch for PGD when !CONFIG_MIPS_PGD_C0_CONTEXT 788ff47 Revert "MIPS: tlbex: Guard tlbmiss_handler_setup_pgd"

from upstream-sfr and apply this one.

 arch/mips/include/asm/mmu_context.h |    6 +--
 arch/mips/mm/tlb-funcs.S            |    2 -
 arch/mips/mm/tlbex.c                |   90 ++++++++++++++++++++++-------------
 3 files changed, 58 insertions(+), 40 deletions(-)
arch/mips/include/asm/mmu_context.h +1 -5
index ab8e260..e277bba 100644
@@ -24,14 +24,13 @@
 #endif /* SMTC */
 #include <asm-generic/mm_hooks.h>
 
-#ifdef CONFIG_MIPS_PGD_C0_CONTEXT
-
 #define TLBMISS_HANDLER_SETUP_PGD(pgd)					\
 do {									\
 	extern void tlbmiss_handler_setup_pgd(unsigned long);		\
 	tlbmiss_handler_setup_pgd((unsigned long)(pgd));		\
 } while (0)
 
+#ifdef CONFIG_MIPS_PGD_C0_CONTEXT
 #define TLBMISS_HANDLER_SETUP()						\
 	do {								\
 		TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir);		\
@@ -48,9 +47,6 @@ do {									\
  */
 extern unsigned long pgd_current[];
 
-#define TLBMISS_HANDLER_SETUP_PGD(pgd) \
-	pgd_current[smp_processor_id()] = (unsigned long)(pgd)
-
 #define TLBMISS_HANDLER_SETUP()						\
 	write_c0_context((unsigned long) smp_processor_id() <<		\
 						SMP_CPUID_REGSHIFT);	\
arch/mips/mm/tlb-funcs.S +0 -2
index 79bca31..30a494d 100644
@@ -16,12 +16,10 @@
 
 #define FASTPATH_SIZE	128
 
-#ifdef CONFIG_MIPS_PGD_C0_CONTEXT
 LEAF(tlbmiss_handler_setup_pgd)
 	.space		16 * 4
 END(tlbmiss_handler_setup_pgd)
 EXPORT(tlbmiss_handler_setup_pgd_end)
-#endif
 
 LEAF(handle_tlbm)
 	.space		FASTPATH_SIZE * 4
arch/mips/mm/tlbex.c +57 -33

171 lines not on this page · raw message

Signature · 1 line
1.7.9.5