Skip to content

Commit d2adba3

Browse files
kvaneeshmpe
authored andcommitted
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 <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent d9225ad commit d2adba3

File tree

5 files changed

+19
-17
lines changed

5 files changed

+19
-17
lines changed

arch/powerpc/include/asm/mmu_context.h

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,23 @@ extern long mm_iommu_ua_to_hpa(struct mm_iommu_table_group_mem_t *mem,
3333
extern long mm_iommu_mapped_inc(struct mm_iommu_table_group_mem_t *mem);
3434
extern void mm_iommu_mapped_dec(struct mm_iommu_table_group_mem_t *mem);
3535
#endif
36-
37-
extern void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next);
3836
extern void switch_slb(struct task_struct *tsk, struct mm_struct *mm);
3937
extern void set_context(unsigned long id, pgd_t *pgd);
4038

4139
#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+
4247
extern int __init_new_context(void);
4348
extern void __destroy_context(int context_id);
4449
static inline void mmu_context_init(void) { }
4550
#else
51+
extern void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next,
52+
struct task_struct *tsk);
4653
extern unsigned long __init_new_context(void);
4754
extern void __destroy_context(unsigned long context_id);
4855
extern void mmu_context_init(void);
@@ -88,17 +95,11 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
8895
if (cpu_has_feature(CPU_FTR_ALTIVEC))
8996
asm volatile ("dssall");
9097
#endif /* CONFIG_ALTIVEC */
91-
92-
/* The actual HW switching method differs between the various
93-
* sub architectures.
98+
/*
99+
* The actual HW switching method differs between the various
100+
* sub architectures. Out of line for now
94101
*/
95-
#ifdef CONFIG_PPC_STD_MMU_64
96-
switch_slb(tsk, next);
97-
#else
98-
/* Out of line for now */
99-
switch_mmu_context(prev, next);
100-
#endif
101-
102+
switch_mmu_context(prev, next, tsk);
102103
}
103104

104105
#define deactivate_mm(tsk,mm) do { } while (0)

arch/powerpc/kernel/swsusp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ void save_processor_state(void)
3131
void restore_processor_state(void)
3232
{
3333
#ifdef CONFIG_PPC32
34-
switch_mmu_context(current->active_mm, current->active_mm);
34+
switch_mmu_context(current->active_mm, current->active_mm, NULL);
3535
#endif
3636
}

arch/powerpc/mm/mmu_context_nohash.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,8 @@ static void context_check_map(void)
226226
static void context_check_map(void) { }
227227
#endif
228228

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)
230231
{
231232
unsigned int i, id, cpu = smp_processor_id();
232233
unsigned long *map;

drivers/cpufreq/pmac32-cpufreq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ static int pmu_set_cpu_speed(int low_speed)
298298
_set_L3CR(save_l3cr);
299299

300300
/* Restore userland MMU context */
301-
switch_mmu_context(NULL, current->active_mm);
301+
switch_mmu_context(NULL, current->active_mm, NULL);
302302

303303
#ifdef DEBUG_FREQ
304304
printk(KERN_DEBUG "HID1, after: %x\n", mfspr(SPRN_HID1));

drivers/macintosh/via-pmu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,7 +1851,7 @@ static int powerbook_sleep_grackle(void)
18511851
_set_L2CR(save_l2cr);
18521852

18531853
/* Restore userland MMU context */
1854-
switch_mmu_context(NULL, current->active_mm);
1854+
switch_mmu_context(NULL, current->active_mm, NULL);
18551855

18561856
/* Power things up */
18571857
pmu_unlock();
@@ -1940,7 +1940,7 @@ powerbook_sleep_Core99(void)
19401940
_set_L3CR(save_l3cr);
19411941

19421942
/* Restore userland MMU context */
1943-
switch_mmu_context(NULL, current->active_mm);
1943+
switch_mmu_context(NULL, current->active_mm, NULL);
19441944

19451945
/* Tell PMU we are ready */
19461946
pmu_unlock();

0 commit comments

Comments
 (0)