|
@@ -27,28 +27,22 @@
|
|
#include <asm/tlbflush.h>
|
|
#include <asm/tlbflush.h>
|
|
#include <asm-generic/mm_hooks.h>
|
|
#include <asm-generic/mm_hooks.h>
|
|
|
|
|
|
|
|
+#define MMU_CONTEXT_TLBPID_NR 256
|
|
#define MMU_CONTEXT_TLBPID_MASK 0x000000ffUL
|
|
#define MMU_CONTEXT_TLBPID_MASK 0x000000ffUL
|
|
#define MMU_CONTEXT_VERSION_MASK 0xffffff00UL
|
|
#define MMU_CONTEXT_VERSION_MASK 0xffffff00UL
|
|
#define MMU_CONTEXT_FIRST_VERSION 0x00000100UL
|
|
#define MMU_CONTEXT_FIRST_VERSION 0x00000100UL
|
|
#define MMU_NO_CONTEXT 0x00000000UL
|
|
#define MMU_NO_CONTEXT 0x00000000UL
|
|
-
|
|
|
|
-extern unsigned long mmu_context_cache[NR_CPUS];
|
|
|
|
-#define mm_context(mm) (mm->context.tlbpid[smp_processor_id()])
|
|
|
|
|
|
+#define MMU_CONTEXT_TLBPID_LOCK_NR 0
|
|
|
|
|
|
#define enter_lazy_tlb(mm, tsk) do {} while (0)
|
|
#define enter_lazy_tlb(mm, tsk) do {} while (0)
|
|
|
|
|
|
-#ifdef CONFIG_SMP
|
|
|
|
-#define cpu_ran_vm(cpu, mm) \
|
|
|
|
- cpumask_set_cpu((cpu), mm_cpumask(mm))
|
|
|
|
-#define cpu_maybe_ran_vm(cpu, mm) \
|
|
|
|
- cpumask_test_and_set_cpu((cpu), mm_cpumask(mm))
|
|
|
|
-#else
|
|
|
|
-#define cpu_ran_vm(cpu, mm) do {} while (0)
|
|
|
|
-#define cpu_maybe_ran_vm(cpu, mm) true
|
|
|
|
-#endif /* CONFIG_SMP */
|
|
|
|
|
|
+#ifdef CONFIG_MN10300_TLB_USE_PIDR
|
|
|
|
+extern unsigned long mmu_context_cache[NR_CPUS];
|
|
|
|
+#define mm_context(mm) (mm->context.tlbpid[smp_processor_id()])
|
|
|
|
|
|
-/*
|
|
|
|
- * allocate an MMU context
|
|
|
|
|
|
+/**
|
|
|
|
+ * allocate_mmu_context - Allocate storage for the arch-specific MMU data
|
|
|
|
+ * @mm: The userspace VM context being set up
|
|
*/
|
|
*/
|
|
static inline unsigned long allocate_mmu_context(struct mm_struct *mm)
|
|
static inline unsigned long allocate_mmu_context(struct mm_struct *mm)
|
|
{
|
|
{
|
|
@@ -100,35 +94,42 @@ static inline int init_new_context(struct task_struct *tsk,
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-/*
|
|
|
|
- * destroy context related info for an mm_struct that is about to be put to
|
|
|
|
- * rest
|
|
|
|
- */
|
|
|
|
-#define destroy_context(mm) do { } while (0)
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
* after we have set current->mm to a new value, this activates the context for
|
|
* after we have set current->mm to a new value, this activates the context for
|
|
* the new mm so we see the new mappings.
|
|
* the new mm so we see the new mappings.
|
|
*/
|
|
*/
|
|
-static inline void activate_context(struct mm_struct *mm, int cpu)
|
|
|
|
|
|
+static inline void activate_context(struct mm_struct *mm)
|
|
{
|
|
{
|
|
PIDR = get_mmu_context(mm) & MMU_CONTEXT_TLBPID_MASK;
|
|
PIDR = get_mmu_context(mm) & MMU_CONTEXT_TLBPID_MASK;
|
|
}
|
|
}
|
|
|
|
+#else /* CONFIG_MN10300_TLB_USE_PIDR */
|
|
|
|
|
|
-/*
|
|
|
|
- * change between virtual memory sets
|
|
|
|
|
|
+#define init_new_context(tsk, mm) (0)
|
|
|
|
+#define activate_context(mm) local_flush_tlb()
|
|
|
|
+
|
|
|
|
+#endif /* CONFIG_MN10300_TLB_USE_PIDR */
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * destroy_context - Destroy mm context information
|
|
|
|
+ * @mm: The MM being destroyed.
|
|
|
|
+ *
|
|
|
|
+ * Destroy context related info for an mm_struct that is about to be put to
|
|
|
|
+ * rest
|
|
|
|
+ */
|
|
|
|
+#define destroy_context(mm) do {} while (0)
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * switch_mm - Change between userspace virtual memory contexts
|
|
|
|
+ * @prev: The outgoing MM context.
|
|
|
|
+ * @next: The incoming MM context.
|
|
|
|
+ * @tsk: The incoming task.
|
|
*/
|
|
*/
|
|
static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
|
|
static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
|
|
struct task_struct *tsk)
|
|
struct task_struct *tsk)
|
|
{
|
|
{
|
|
- int cpu = smp_processor_id();
|
|
|
|
-
|
|
|
|
if (prev != next) {
|
|
if (prev != next) {
|
|
- cpu_ran_vm(cpu, next);
|
|
|
|
- activate_context(next, cpu);
|
|
|
|
PTBR = (unsigned long) next->pgd;
|
|
PTBR = (unsigned long) next->pgd;
|
|
- } else if (!cpu_maybe_ran_vm(cpu, next)) {
|
|
|
|
- activate_context(next, cpu);
|
|
|
|
|
|
+ activate_context(next);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|