hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/arch/s390/include/asm/mmu_context.h
....@@ -18,14 +18,16 @@
1818 static inline int init_new_context(struct task_struct *tsk,
1919 struct mm_struct *mm)
2020 {
21
+ unsigned long asce_type, init_entry;
22
+
2123 spin_lock_init(&mm->context.lock);
2224 INIT_LIST_HEAD(&mm->context.pgtable_list);
2325 INIT_LIST_HEAD(&mm->context.gmap_list);
2426 cpumask_clear(&mm->context.cpu_attach_mask);
2527 atomic_set(&mm->context.flush_count, 0);
28
+ atomic_set(&mm->context.is_protected, 0);
2629 mm->context.gmap_asce = 0;
2730 mm->context.flush_mm = 0;
28
- mm->context.compat_mm = test_thread_flag(TIF_31BIT);
2931 #ifdef CONFIG_PGSTE
3032 mm->context.alloc_pgste = page_table_allocate_pgste ||
3133 test_thread_flag(TIF_PGSTE) ||
....@@ -36,33 +38,34 @@
3638 mm->context.allow_gmap_hpage_1m = 0;
3739 #endif
3840 switch (mm->context.asce_limit) {
39
- case _REGION2_SIZE:
41
+ default:
4042 /*
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
4345 */
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;
4954 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;
5459 break;
5560 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;
5964 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;
6465 }
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);
6669 return 0;
6770 }
6871