Lines Matching refs:id
96 static unsigned int steal_context_smp(unsigned int id) in steal_context_smp() argument
106 mm = context_mm[id]; in steal_context_smp()
112 id++; in steal_context_smp()
113 if (id > LAST_CONTEXT) in steal_context_smp()
114 id = FIRST_CONTEXT; in steal_context_smp()
119 mm->context.id = MMU_NO_CONTEXT; in steal_context_smp()
130 __set_bit(id, stale_map[i]); in steal_context_smp()
134 return id; in steal_context_smp()
152 unsigned int id; in steal_all_contexts() local
154 for (id = FIRST_CONTEXT; id <= LAST_CONTEXT; id++) { in steal_all_contexts()
156 mm = context_mm[id]; in steal_all_contexts()
159 mm->context.id = MMU_NO_CONTEXT; in steal_all_contexts()
160 if (id != FIRST_CONTEXT) { in steal_all_contexts()
161 context_mm[id] = NULL; in steal_all_contexts()
162 __clear_bit(id, context_map); in steal_all_contexts()
165 __clear_bit(id, stale_map[cpu]); in steal_all_contexts()
181 static unsigned int steal_context_up(unsigned int id) in steal_context_up() argument
187 mm = context_mm[id]; in steal_context_up()
193 mm->context.id = MMU_NO_CONTEXT; in steal_context_up()
197 __clear_bit(id, stale_map[cpu]); in steal_context_up()
199 return id; in steal_context_up()
202 static void set_context(unsigned long id, pgd_t *pgd) in set_context() argument
216 mtspr(SPRN_M_CASID, id - 1); in set_context()
224 mtspr(SPRN_PID, id); in set_context()
232 unsigned int id; in switch_mmu_context() local
251 id = next->context.id; in switch_mmu_context()
252 if (likely(id != MMU_NO_CONTEXT)) in switch_mmu_context()
256 id = next_context; in switch_mmu_context()
257 if (id > LAST_CONTEXT) in switch_mmu_context()
258 id = FIRST_CONTEXT; in switch_mmu_context()
264 id = steal_context_smp(id); in switch_mmu_context()
265 if (id == MMU_NO_CONTEXT) in switch_mmu_context()
270 id = steal_all_contexts(); in switch_mmu_context()
272 id = steal_context_up(id); in switch_mmu_context()
278 while (__test_and_set_bit(id, map)) { in switch_mmu_context()
279 id = find_next_zero_bit(map, LAST_CONTEXT+1, id); in switch_mmu_context()
280 if (id > LAST_CONTEXT) in switch_mmu_context()
281 id = FIRST_CONTEXT; in switch_mmu_context()
284 next_context = id + 1; in switch_mmu_context()
285 context_mm[id] = next; in switch_mmu_context()
286 next->context.id = id; in switch_mmu_context()
293 if (IS_ENABLED(CONFIG_SMP) && test_bit(id, stale_map[cpu])) { in switch_mmu_context()
300 __clear_bit(id, stale_map[i]); in switch_mmu_context()
307 set_context(id, next->pgd); in switch_mmu_context()
323 if (mm->context.id == 0) in init_new_context()
325 mm->context.id = MMU_NO_CONTEXT; in init_new_context()
337 unsigned int id; in destroy_context() local
339 if (mm->context.id == MMU_NO_CONTEXT) in destroy_context()
345 id = mm->context.id; in destroy_context()
346 if (id != MMU_NO_CONTEXT) { in destroy_context()
347 __clear_bit(id, context_map); in destroy_context()
348 mm->context.id = MMU_NO_CONTEXT; in destroy_context()
349 context_mm[id] = NULL; in destroy_context()