Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
d2cf909
Documentation
arch
alpha
arc
arm
arm64
avr32
blackfin
c6x
cris
frv
h8300
hexagon
ia64
m32r
m68k
metag
microblaze
mips
mn10300
nios2
openrisc
parisc
powerpc
boot
configs
crypto
include
kernel
kvm
lib
math-emu
mm
40x_mmu.c
44x_mmu.c
8xx_mmu.c
Makefile
copro_fault.c
dma-noncoherent.c
fault.c
fsl_booke_mmu.c
hash64_4k.c
hash64_64k.c
hash_low_32.S
hash_native_64.c
hash_utils_64.c
highmem.c
hugepage-hash64.c
hugetlbpage-book3e.c
hugetlbpage-hash64.c
hugetlbpage-radix.c
hugetlbpage.c
icswx.c
icswx.h
icswx_pid.c
init_32.c
init_64.c
mem.c
mmap.c
mmu_context_book3s64.c
mmu_context_hash32.c
mmu_context_iommu.c
mmu_context_nohash.c
mmu_decl.h
numa.c
pgtable-book3e.c
pgtable-book3s64.c
pgtable-hash64.c
pgtable-radix.c
pgtable.c
pgtable_32.c
pgtable_64.c
ppc_mmu_32.c
slb.c
slb_low.S
slice.c
subpage-prot.c
tlb-radix.c
tlb_hash32.c
tlb_hash64.c
tlb_low_64e.S
tlb_nohash.c
tlb_nohash_low.S
vphn.c
vphn.h
net
oprofile
perf
platforms
scripts
sysdev
xmon
Kconfig
Kconfig.debug
Makefile
relocs_check.sh
s390
score
sh
sparc
tile
um
unicore32
x86
xtensa
.gitignore
Kconfig
block
certs
crypto
drivers
firmware
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
REPORTING-BUGS
Breadcrumbs
linux
/
arch
/
powerpc
/
mm
/
copro_fault.c
Blame
Blame
Latest commit
History
History
157 lines (141 loc) · 3.95 KB
Breadcrumbs
linux
/
arch
/
powerpc
/
mm
/
copro_fault.c
Top
File metadata and controls
Code
Blame
157 lines (141 loc) · 3.95 KB
Raw
/* * CoProcessor (SPU/AFU) mm fault handler * * (C) Copyright IBM Deutschland Entwicklung GmbH 2007 * * Author: Arnd Bergmann <arndb@de.ibm.com> * Author: Jeremy Kerr <jk@ozlabs.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <linux/sched.h> #include <linux/mm.h> #include <linux/export.h> #include <asm/reg.h> #include <asm/copro.h> #include <asm/spu.h> #include <misc/cxl-base.h> /* * This ought to be kept in sync with the powerpc specific do_page_fault * function. Currently, there are a few corner cases that we haven't had * to handle fortunately. */ int copro_handle_mm_fault(struct mm_struct *mm, unsigned long ea, unsigned long dsisr, unsigned *flt) { struct vm_area_struct *vma; unsigned long is_write; int ret; if (mm == NULL) return -EFAULT; if (mm->pgd == NULL) return -EFAULT; down_read(&mm->mmap_sem); ret = -EFAULT; vma = find_vma(mm, ea); if (!vma) goto out_unlock; if (ea < vma->vm_start) { if (!(vma->vm_flags & VM_GROWSDOWN)) goto out_unlock; if (expand_stack(vma, ea)) goto out_unlock; } is_write = dsisr & DSISR_ISSTORE; if (is_write) { if (!(vma->vm_flags & VM_WRITE)) goto out_unlock; } else { if (!(vma->vm_flags & (VM_READ | VM_EXEC))) goto out_unlock; /* * protfault should only happen due to us * mapping a region readonly temporarily. PROT_NONE * is also covered by the VMA check above. */ WARN_ON_ONCE(dsisr & DSISR_PROTFAULT); } ret = 0; *flt = handle_mm_fault(vma, ea, is_write ? FAULT_FLAG_WRITE : 0); if (unlikely(*flt & VM_FAULT_ERROR)) { if (*flt & VM_FAULT_OOM) { ret = -ENOMEM; goto out_unlock; } else if (*flt & (VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV)) { ret = -EFAULT; goto out_unlock; } BUG(); } if (*flt & VM_FAULT_MAJOR) current->maj_flt++; else current->min_flt++; out_unlock: up_read(&mm->mmap_sem); return ret; } EXPORT_SYMBOL_GPL(copro_handle_mm_fault); int copro_calculate_slb(struct mm_struct *mm, u64 ea, struct copro_slb *slb) { u64 vsid, vsidkey; int psize, ssize; switch (REGION_ID(ea)) { case USER_REGION_ID: pr_devel("%s: 0x%llx -- USER_REGION_ID\n", __func__, ea); if (mm == NULL) return 1; psize = get_slice_psize(mm, ea); ssize = user_segment_size(ea); vsid = get_vsid(mm->context.id, ea, ssize); vsidkey = SLB_VSID_USER; break; case VMALLOC_REGION_ID: pr_devel("%s: 0x%llx -- VMALLOC_REGION_ID\n", __func__, ea); if (ea < VMALLOC_END) psize = mmu_vmalloc_psize; else psize = mmu_io_psize; ssize = mmu_kernel_ssize; vsid = get_kernel_vsid(ea, mmu_kernel_ssize); vsidkey = SLB_VSID_KERNEL; break; case KERNEL_REGION_ID: pr_devel("%s: 0x%llx -- KERNEL_REGION_ID\n", __func__, ea); psize = mmu_linear_psize; ssize = mmu_kernel_ssize; vsid = get_kernel_vsid(ea, mmu_kernel_ssize); vsidkey = SLB_VSID_KERNEL; break; default: pr_debug("%s: invalid region access at %016llx\n", __func__, ea); return 1; } vsid = (vsid << slb_vsid_shift(ssize)) | vsidkey; vsid |= mmu_psize_defs[psize].sllp | ((ssize == MMU_SEGSIZE_1T) ? SLB_VSID_B_1T : 0); slb->esid = (ea & (ssize == MMU_SEGSIZE_1T ? ESID_MASK_1T : ESID_MASK)) | SLB_ESID_V; slb->vsid = vsid; return 0; } EXPORT_SYMBOL_GPL(copro_calculate_slb); void copro_flush_all_slbs(struct mm_struct *mm) { #ifdef CONFIG_SPU_BASE spu_flush_all_slbs(mm); #endif cxl_slbia(mm); } EXPORT_SYMBOL_GPL(copro_flush_all_slbs);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
You can’t perform that action at this time.