Commit b58b133
iommu: Handle iommu faults for a bad iopf setup
The iommu_report_device_fault function was updated to return void while
assuming that drivers only need to call iommu_report_device_fault() for
reporting an iopf. This implementation causes following problems:
1. The drivers rely on the core code to call it's page_reponse,
however, when a fault is received and no fault capable domain is
attached / iopf_param is NULL, the ops->page_response is NOT called
causing the device to stall in case the fault type was PAGE_REQ.
2. The arm_smmu_v3 driver relies on the returned value to log errors
returning void from iommu_report_device_fault causes these events to
be missed while logging.
Modify the iommu_report_device_fault function to return -EINVAL for
cases where no fault capable domain is attached or iopf_param was NULL
and calls back to the driver (ops->page_response) in case the fault type
was IOMMU_FAULT_PAGE_REQ. The returned value can be used by the drivers
to log the fault/event as needed.
Reported-by: Kunkun Jiang <[email protected]>
Closes: https://lore.kernel.org/all/[email protected]/
Fixes: 3dfa64a ("iommu: Make iommu_report_device_fault() return void")
Signed-off-by: Jason Gunthorpe <[email protected]>
Signed-off-by: Pranjal Shrivastava <[email protected]>
Reviewed-by: Jason Gunthorpe <[email protected]>
Reviewed-by: Lu Baolu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Joerg Roedel <[email protected]>1 parent 47ac09b commit b58b133
File tree
3 files changed
+87
-41
lines changed- drivers/iommu
- arm/arm-smmu-v3
- include/linux
3 files changed
+87
-41
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1777 | 1777 | | |
1778 | 1778 | | |
1779 | 1779 | | |
1780 | | - | |
| 1780 | + | |
1781 | 1781 | | |
1782 | 1782 | | |
1783 | 1783 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 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 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
118 | 171 | | |
119 | 172 | | |
120 | 173 | | |
| |||
153 | 206 | | |
154 | 207 | | |
155 | 208 | | |
156 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
157 | 213 | | |
158 | | - | |
| 214 | + | |
159 | 215 | | |
| 216 | + | |
160 | 217 | | |
161 | 218 | | |
162 | 219 | | |
163 | 220 | | |
164 | 221 | | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
165 | 230 | | |
166 | 231 | | |
167 | | - | |
| 232 | + | |
168 | 233 | | |
169 | 234 | | |
170 | | - | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
171 | 238 | | |
172 | 239 | | |
173 | | - | |
| 240 | + | |
| 241 | + | |
174 | 242 | | |
175 | 243 | | |
176 | 244 | | |
| |||
185 | 253 | | |
186 | 254 | | |
187 | 255 | | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
| 256 | + | |
220 | 257 | | |
221 | 258 | | |
222 | 259 | | |
| |||
225 | 262 | | |
226 | 263 | | |
227 | 264 | | |
228 | | - | |
| 265 | + | |
229 | 266 | | |
230 | 267 | | |
231 | 268 | | |
| |||
235 | 272 | | |
236 | 273 | | |
237 | 274 | | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
238 | 283 | | |
239 | 284 | | |
240 | 285 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1563 | 1563 | | |
1564 | 1564 | | |
1565 | 1565 | | |
1566 | | - | |
| 1566 | + | |
1567 | 1567 | | |
1568 | 1568 | | |
1569 | 1569 | | |
| |||
1601 | 1601 | | |
1602 | 1602 | | |
1603 | 1603 | | |
1604 | | - | |
| 1604 | + | |
1605 | 1605 | | |
1606 | 1606 | | |
| 1607 | + | |
1607 | 1608 | | |
1608 | 1609 | | |
1609 | 1610 | | |
| |||
0 commit comments