Commit 0b13649
iommu/amd: Reorder attach device code
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>1 parent e843aed commit 0b13649
1 file changed
+29
-36
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2090 | 2090 | | |
2091 | 2091 | | |
2092 | 2092 | | |
| 2093 | + | |
2093 | 2094 | | |
2094 | 2095 | | |
2095 | 2096 | | |
| |||
2099 | 2100 | | |
2100 | 2101 | | |
2101 | 2102 | | |
2102 | | - | |
2103 | | - | |
2104 | | - | |
2105 | | - | |
2106 | 2103 | | |
2107 | 2104 | | |
2108 | 2105 | | |
| |||
2117 | 2114 | | |
2118 | 2115 | | |
2119 | 2116 | | |
| 2117 | + | |
| 2118 | + | |
| 2119 | + | |
| 2120 | + | |
| 2121 | + | |
| 2122 | + | |
| 2123 | + | |
| 2124 | + | |
| 2125 | + | |
| 2126 | + | |
| 2127 | + | |
| 2128 | + | |
| 2129 | + | |
| 2130 | + | |
| 2131 | + | |
| 2132 | + | |
| 2133 | + | |
| 2134 | + | |
| 2135 | + | |
| 2136 | + | |
| 2137 | + | |
| 2138 | + | |
2120 | 2139 | | |
2121 | 2140 | | |
2122 | 2141 | | |
| |||
2131 | 2150 | | |
2132 | 2151 | | |
2133 | 2152 | | |
2134 | | - | |
2135 | 2153 | | |
2136 | 2154 | | |
2137 | 2155 | | |
| |||
2145 | 2163 | | |
2146 | 2164 | | |
2147 | 2165 | | |
2148 | | - | |
| 2166 | + | |
| 2167 | + | |
2149 | 2168 | | |
2150 | | - | |
2151 | | - | |
2152 | | - | |
| 2169 | + | |
2153 | 2170 | | |
2154 | 2171 | | |
| 2172 | + | |
| 2173 | + | |
| 2174 | + | |
2155 | 2175 | | |
2156 | 2176 | | |
2157 | 2177 | | |
| |||
2173 | 2193 | | |
2174 | 2194 | | |
2175 | 2195 | | |
2176 | | - | |
2177 | | - | |
2178 | | - | |
2179 | | - | |
2180 | | - | |
2181 | | - | |
2182 | | - | |
2183 | | - | |
2184 | 2196 | | |
2185 | 2197 | | |
2186 | 2198 | | |
| |||
2509 | 2521 | | |
2510 | 2522 | | |
2511 | 2523 | | |
2512 | | - | |
2513 | 2524 | | |
2514 | 2525 | | |
2515 | 2526 | | |
| |||
2542 | 2553 | | |
2543 | 2554 | | |
2544 | 2555 | | |
2545 | | - | |
2546 | | - | |
2547 | | - | |
2548 | | - | |
2549 | | - | |
2550 | | - | |
2551 | | - | |
2552 | | - | |
2553 | | - | |
2554 | | - | |
2555 | | - | |
2556 | | - | |
2557 | | - | |
2558 | | - | |
2559 | | - | |
2560 | | - | |
2561 | | - | |
2562 | | - | |
2563 | 2556 | | |
2564 | 2557 | | |
2565 | 2558 | | |
| |||
0 commit comments