Commit 3a04446
iommu/amd: Reorder attach device code
[ Upstream commit 0b13649 ]
Ideally in attach device path, it should take dev_data lock before
making changes to device data including IOPF enablement. So far dev_data
was using spinlock and it was hitting lock order issue when it tries to
enable IOPF. Hence Commit 526606b ("iommu/amd: Fix Invalid wait
context issue") moved IOPF enablement outside dev_data->lock.
Previous patch converted dev_data lock to mutex. Now its safe to call
amd_iommu_iopf_add_device() with dev_data->mutex. Hence move back PCI
device capability enablement (ATS, PRI, PASID) and IOPF enablement code
inside the lock. Also in attach_device(), update 'dev_data->domain' at
the end so that error handling becomes simple.
Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20241030063556.6104-11-vasant.hegde@amd.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Stable-dep-of: 4a552f7 ("iommu/amd: Put list_add/del(dev_data) back under the domain->lock")
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent 3c3abbc commit 3a04446
1 file changed
Lines changed: 29 additions & 36 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2291 | 2291 | | |
2292 | 2292 | | |
2293 | 2293 | | |
| 2294 | + | |
2294 | 2295 | | |
2295 | 2296 | | |
2296 | 2297 | | |
| |||
2300 | 2301 | | |
2301 | 2302 | | |
2302 | 2303 | | |
2303 | | - | |
2304 | | - | |
2305 | | - | |
2306 | | - | |
2307 | 2304 | | |
2308 | 2305 | | |
2309 | 2306 | | |
| |||
2318 | 2315 | | |
2319 | 2316 | | |
2320 | 2317 | | |
| 2318 | + | |
| 2319 | + | |
| 2320 | + | |
| 2321 | + | |
| 2322 | + | |
| 2323 | + | |
| 2324 | + | |
| 2325 | + | |
| 2326 | + | |
| 2327 | + | |
| 2328 | + | |
| 2329 | + | |
| 2330 | + | |
| 2331 | + | |
| 2332 | + | |
| 2333 | + | |
| 2334 | + | |
| 2335 | + | |
| 2336 | + | |
| 2337 | + | |
| 2338 | + | |
| 2339 | + | |
2321 | 2340 | | |
2322 | 2341 | | |
2323 | 2342 | | |
| |||
2332 | 2351 | | |
2333 | 2352 | | |
2334 | 2353 | | |
2335 | | - | |
2336 | 2354 | | |
2337 | 2355 | | |
2338 | 2356 | | |
| |||
2346 | 2364 | | |
2347 | 2365 | | |
2348 | 2366 | | |
2349 | | - | |
| 2367 | + | |
| 2368 | + | |
2350 | 2369 | | |
2351 | | - | |
2352 | | - | |
2353 | | - | |
| 2370 | + | |
2354 | 2371 | | |
2355 | 2372 | | |
| 2373 | + | |
| 2374 | + | |
| 2375 | + | |
2356 | 2376 | | |
2357 | 2377 | | |
2358 | 2378 | | |
| |||
2374 | 2394 | | |
2375 | 2395 | | |
2376 | 2396 | | |
2377 | | - | |
2378 | | - | |
2379 | | - | |
2380 | | - | |
2381 | | - | |
2382 | | - | |
2383 | | - | |
2384 | | - | |
2385 | 2397 | | |
2386 | 2398 | | |
2387 | 2399 | | |
| |||
2670 | 2682 | | |
2671 | 2683 | | |
2672 | 2684 | | |
2673 | | - | |
2674 | 2685 | | |
2675 | 2686 | | |
2676 | 2687 | | |
| |||
2703 | 2714 | | |
2704 | 2715 | | |
2705 | 2716 | | |
2706 | | - | |
2707 | | - | |
2708 | | - | |
2709 | | - | |
2710 | | - | |
2711 | | - | |
2712 | | - | |
2713 | | - | |
2714 | | - | |
2715 | | - | |
2716 | | - | |
2717 | | - | |
2718 | | - | |
2719 | | - | |
2720 | | - | |
2721 | | - | |
2722 | | - | |
2723 | | - | |
2724 | 2717 | | |
2725 | 2718 | | |
2726 | 2719 | | |
| |||
0 commit comments