Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/mm: Abstraction for switch_mmu_context()

How we switch MMU context differs between hash and radix. For hash we
need to switch the SLB details and for radix we need to switch the PID
SPR.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

authored by

Aneesh Kumar K.V and committed by
Michael Ellerman
d2adba3f d9225ad9

+19 -17
+13 -12
arch/powerpc/include/asm/mmu_context.h
··· 33 33 extern long mm_iommu_mapped_inc(struct mm_iommu_table_group_mem_t *mem); 34 34 extern void mm_iommu_mapped_dec(struct mm_iommu_table_group_mem_t *mem); 35 35 #endif 36 - 37 - extern void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next); 38 36 extern void switch_slb(struct task_struct *tsk, struct mm_struct *mm); 39 37 extern void set_context(unsigned long id, pgd_t *pgd); 40 38 41 39 #ifdef CONFIG_PPC_BOOK3S_64 40 + static inline void switch_mmu_context(struct mm_struct *prev, 41 + struct mm_struct *next, 42 + struct task_struct *tsk) 43 + { 44 + return switch_slb(tsk, next); 45 + } 46 + 42 47 extern int __init_new_context(void); 43 48 extern void __destroy_context(int context_id); 44 49 static inline void mmu_context_init(void) { } 45 50 #else 51 + extern void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next, 52 + struct task_struct *tsk); 46 53 extern unsigned long __init_new_context(void); 47 54 extern void __destroy_context(unsigned long context_id); 48 55 extern void mmu_context_init(void); ··· 95 88 if (cpu_has_feature(CPU_FTR_ALTIVEC)) 96 89 asm volatile ("dssall"); 97 90 #endif /* CONFIG_ALTIVEC */ 98 - 99 - /* The actual HW switching method differs between the various 100 - * sub architectures. 91 + /* 92 + * The actual HW switching method differs between the various 93 + * sub architectures. Out of line for now 101 94 */ 102 - #ifdef CONFIG_PPC_STD_MMU_64 103 - switch_slb(tsk, next); 104 - #else 105 - /* Out of line for now */ 106 - switch_mmu_context(prev, next); 107 - #endif 108 - 95 + switch_mmu_context(prev, next, tsk); 109 96 } 110 97 111 98 #define deactivate_mm(tsk,mm) do { } while (0)
+1 -1
arch/powerpc/kernel/swsusp.c
··· 31 31 void restore_processor_state(void) 32 32 { 33 33 #ifdef CONFIG_PPC32 34 - switch_mmu_context(current->active_mm, current->active_mm); 34 + switch_mmu_context(current->active_mm, current->active_mm, NULL); 35 35 #endif 36 36 }
+2 -1
arch/powerpc/mm/mmu_context_nohash.c
··· 226 226 static void context_check_map(void) { } 227 227 #endif 228 228 229 - void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next) 229 + void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next, 230 + struct task_struct *tsk) 230 231 { 231 232 unsigned int i, id, cpu = smp_processor_id(); 232 233 unsigned long *map;
+1 -1
drivers/cpufreq/pmac32-cpufreq.c
··· 298 298 _set_L3CR(save_l3cr); 299 299 300 300 /* Restore userland MMU context */ 301 - switch_mmu_context(NULL, current->active_mm); 301 + switch_mmu_context(NULL, current->active_mm, NULL); 302 302 303 303 #ifdef DEBUG_FREQ 304 304 printk(KERN_DEBUG "HID1, after: %x\n", mfspr(SPRN_HID1));
+2 -2
drivers/macintosh/via-pmu.c
··· 1851 1851 _set_L2CR(save_l2cr); 1852 1852 1853 1853 /* Restore userland MMU context */ 1854 - switch_mmu_context(NULL, current->active_mm); 1854 + switch_mmu_context(NULL, current->active_mm, NULL); 1855 1855 1856 1856 /* Power things up */ 1857 1857 pmu_unlock(); ··· 1940 1940 _set_L3CR(save_l3cr); 1941 1941 1942 1942 /* Restore userland MMU context */ 1943 - switch_mmu_context(NULL, current->active_mm); 1943 + switch_mmu_context(NULL, current->active_mm, NULL); 1944 1944 1945 1945 /* Tell PMU we are ready */ 1946 1946 pmu_unlock();