| .. | .. |
|---|
| 18 | 18 | static inline int init_new_context(struct task_struct *tsk, |
|---|
| 19 | 19 | struct mm_struct *mm) |
|---|
| 20 | 20 | { |
|---|
| 21 | + unsigned long asce_type, init_entry; |
|---|
| 22 | + |
|---|
| 21 | 23 | spin_lock_init(&mm->context.lock); |
|---|
| 22 | 24 | INIT_LIST_HEAD(&mm->context.pgtable_list); |
|---|
| 23 | 25 | INIT_LIST_HEAD(&mm->context.gmap_list); |
|---|
| 24 | 26 | cpumask_clear(&mm->context.cpu_attach_mask); |
|---|
| 25 | 27 | atomic_set(&mm->context.flush_count, 0); |
|---|
| 28 | + atomic_set(&mm->context.is_protected, 0); |
|---|
| 26 | 29 | mm->context.gmap_asce = 0; |
|---|
| 27 | 30 | mm->context.flush_mm = 0; |
|---|
| 28 | | - mm->context.compat_mm = test_thread_flag(TIF_31BIT); |
|---|
| 29 | 31 | #ifdef CONFIG_PGSTE |
|---|
| 30 | 32 | mm->context.alloc_pgste = page_table_allocate_pgste || |
|---|
| 31 | 33 | test_thread_flag(TIF_PGSTE) || |
|---|
| .. | .. |
|---|
| 36 | 38 | mm->context.allow_gmap_hpage_1m = 0; |
|---|
| 37 | 39 | #endif |
|---|
| 38 | 40 | switch (mm->context.asce_limit) { |
|---|
| 39 | | - case _REGION2_SIZE: |
|---|
| 41 | + default: |
|---|
| 40 | 42 | /* |
|---|
| 41 | | - * forked 3-level task, fall through to set new asce with new |
|---|
| 42 | | - * mm->pgd |
|---|
| 43 | + * context created by exec, the value of asce_limit can |
|---|
| 44 | + * only be zero in this case |
|---|
| 43 | 45 | */ |
|---|
| 44 | | - case 0: |
|---|
| 45 | | - /* context created by exec, set asce limit to 4TB */ |
|---|
| 46 | | - mm->context.asce_limit = STACK_TOP_MAX; |
|---|
| 47 | | - mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH | |
|---|
| 48 | | - _ASCE_USER_BITS | _ASCE_TYPE_REGION3; |
|---|
| 46 | + VM_BUG_ON(mm->context.asce_limit); |
|---|
| 47 | + /* continue as 3-level task */ |
|---|
| 48 | + mm->context.asce_limit = _REGION2_SIZE; |
|---|
| 49 | + fallthrough; |
|---|
| 50 | + case _REGION2_SIZE: |
|---|
| 51 | + /* forked 3-level task */ |
|---|
| 52 | + init_entry = _REGION3_ENTRY_EMPTY; |
|---|
| 53 | + asce_type = _ASCE_TYPE_REGION3; |
|---|
| 49 | 54 | break; |
|---|
| 50 | | - case -PAGE_SIZE: |
|---|
| 51 | | - /* forked 5-level task, set new asce with new_mm->pgd */ |
|---|
| 52 | | - mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH | |
|---|
| 53 | | - _ASCE_USER_BITS | _ASCE_TYPE_REGION1; |
|---|
| 55 | + case TASK_SIZE_MAX: |
|---|
| 56 | + /* forked 5-level task */ |
|---|
| 57 | + init_entry = _REGION1_ENTRY_EMPTY; |
|---|
| 58 | + asce_type = _ASCE_TYPE_REGION1; |
|---|
| 54 | 59 | break; |
|---|
| 55 | 60 | case _REGION1_SIZE: |
|---|
| 56 | | - /* forked 4-level task, set new asce with new mm->pgd */ |
|---|
| 57 | | - mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH | |
|---|
| 58 | | - _ASCE_USER_BITS | _ASCE_TYPE_REGION2; |
|---|
| 61 | + /* forked 4-level task */ |
|---|
| 62 | + init_entry = _REGION2_ENTRY_EMPTY; |
|---|
| 63 | + asce_type = _ASCE_TYPE_REGION2; |
|---|
| 59 | 64 | break; |
|---|
| 60 | | - case _REGION3_SIZE: |
|---|
| 61 | | - /* forked 2-level compat task, set new asce with new mm->pgd */ |
|---|
| 62 | | - mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH | |
|---|
| 63 | | - _ASCE_USER_BITS | _ASCE_TYPE_SEGMENT; |
|---|
| 64 | 65 | } |
|---|
| 65 | | - crst_table_init((unsigned long *) mm->pgd, pgd_entry_type(mm)); |
|---|
| 66 | + mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH | |
|---|
| 67 | + _ASCE_USER_BITS | asce_type; |
|---|
| 68 | + crst_table_init((unsigned long *) mm->pgd, init_entry); |
|---|
| 66 | 69 | return 0; |
|---|
| 67 | 70 | } |
|---|
| 68 | 71 | |
|---|