hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/arch/powerpc/mm/copro_fault.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * CoProcessor (SPU/AFU) mm fault handler
34 *
....@@ -5,20 +6,6 @@
56 *
67 * Author: Arnd Bergmann <arndb@de.ibm.com>
78 * Author: Jeremy Kerr <jk@ozlabs.org>
8
- *
9
- * This program is free software; you can redistribute it and/or modify
10
- * it under the terms of the GNU General Public License as published by
11
- * the Free Software Foundation; either version 2, or (at your option)
12
- * any later version.
13
- *
14
- * This program is distributed in the hope that it will be useful,
15
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
- * GNU General Public License for more details.
18
- *
19
- * You should have received a copy of the GNU General Public License
20
- * along with this program; if not, write to the Free Software
21
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
229 */
2310 #include <linux/sched.h>
2411 #include <linux/mm.h>
....@@ -46,7 +33,7 @@
4633 if (mm->pgd == NULL)
4734 return -EFAULT;
4835
49
- down_read(&mm->mmap_sem);
36
+ mmap_read_lock(mm);
5037 ret = -EFAULT;
5138 vma = find_vma(mm, ea);
5239 if (!vma)
....@@ -77,7 +64,7 @@
7764 }
7865
7966 ret = 0;
80
- *flt = handle_mm_fault(vma, ea, is_write ? FAULT_FLAG_WRITE : 0);
67
+ *flt = handle_mm_fault(vma, ea, is_write ? FAULT_FLAG_WRITE : 0, NULL);
8168 if (unlikely(*flt & VM_FAULT_ERROR)) {
8269 if (*flt & VM_FAULT_OOM) {
8370 ret = -ENOMEM;
....@@ -89,13 +76,8 @@
8976 BUG();
9077 }
9178
92
- if (*flt & VM_FAULT_MAJOR)
93
- current->maj_flt++;
94
- else
95
- current->min_flt++;
96
-
9779 out_unlock:
98
- up_read(&mm->mmap_sem);
80
+ mmap_read_unlock(mm);
9981 return ret;
10082 }
10183 EXPORT_SYMBOL_GPL(copro_handle_mm_fault);
....@@ -105,7 +87,7 @@
10587 u64 vsid, vsidkey;
10688 int psize, ssize;
10789
108
- switch (REGION_ID(ea)) {
90
+ switch (get_region_id(ea)) {
10991 case USER_REGION_ID:
11092 pr_devel("%s: 0x%llx -- USER_REGION_ID\n", __func__, ea);
11193 if (mm == NULL)
....@@ -117,16 +99,20 @@
11799 break;
118100 case VMALLOC_REGION_ID:
119101 pr_devel("%s: 0x%llx -- VMALLOC_REGION_ID\n", __func__, ea);
120
- if (ea < VMALLOC_END)
121
- psize = mmu_vmalloc_psize;
122
- else
123
- psize = mmu_io_psize;
102
+ psize = mmu_vmalloc_psize;
124103 ssize = mmu_kernel_ssize;
125104 vsid = get_kernel_vsid(ea, mmu_kernel_ssize);
126105 vsidkey = SLB_VSID_KERNEL;
127106 break;
128
- case KERNEL_REGION_ID:
129
- pr_devel("%s: 0x%llx -- KERNEL_REGION_ID\n", __func__, ea);
107
+ case IO_REGION_ID:
108
+ pr_devel("%s: 0x%llx -- IO_REGION_ID\n", __func__, ea);
109
+ psize = mmu_io_psize;
110
+ ssize = mmu_kernel_ssize;
111
+ vsid = get_kernel_vsid(ea, mmu_kernel_ssize);
112
+ vsidkey = SLB_VSID_KERNEL;
113
+ break;
114
+ case LINEAR_MAP_REGION_ID:
115
+ pr_devel("%s: 0x%llx -- LINEAR_MAP_REGION_ID\n", __func__, ea);
130116 psize = mmu_linear_psize;
131117 ssize = mmu_kernel_ssize;
132118 vsid = get_kernel_vsid(ea, mmu_kernel_ssize);