Commit f5b16b8
PCI: Suspend iommu function prior to resetting a device
PCIe permits a device to ignore ATS invalidation TLPs while processing a
reset. This creates a problem visible to the OS where an ATS invalidation
command will time out: e.g. an SVA domain will have no coordination with a
reset event and can racily issue ATS invalidations to a resetting device.
The PCIe r6.0, sec 10.3.1 IMPLEMENTATION NOTE recommends SW to disable and
block ATS before initiating a Function Level Reset. It also mentions that
other reset methods could have the same vulnerability as well.
The IOMMU subsystem provides pci_dev_reset_iommu_prepare/done() callback
helpers for this matter. Use them in all the existing reset functions.
This will attach the device to its iommu_group->blocking_domain during the
device reset, so as to allow IOMMU driver to:
- invoke pci_disable_ats() and pci_enable_ats(), if necessary
- wait for all ATS invalidations to complete
- stop issuing new ATS invalidations
- fence any incoming ATS queries
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Tested-by: Dheeraj Kumar Srivastava <dheerajkumar.srivastava@amd.com>
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>1 parent c279e83 commit f5b16b8
3 files changed
Lines changed: 87 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
971 | 972 | | |
972 | 973 | | |
973 | 974 | | |
| 975 | + | |
974 | 976 | | |
975 | 977 | | |
976 | 978 | | |
977 | 979 | | |
978 | 980 | | |
979 | 981 | | |
980 | 982 | | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
981 | 989 | | |
982 | 990 | | |
983 | | - | |
| 991 | + | |
984 | 992 | | |
985 | 993 | | |
986 | | - | |
| 994 | + | |
| 995 | + | |
987 | 996 | | |
988 | 997 | | |
989 | 998 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
4330 | 4332 | | |
4331 | 4333 | | |
4332 | 4334 | | |
| 4335 | + | |
| 4336 | + | |
4333 | 4337 | | |
4334 | 4338 | | |
4335 | 4339 | | |
| 4340 | + | |
| 4341 | + | |
| 4342 | + | |
| 4343 | + | |
| 4344 | + | |
| 4345 | + | |
| 4346 | + | |
4336 | 4347 | | |
4337 | 4348 | | |
4338 | 4349 | | |
4339 | | - | |
| 4350 | + | |
4340 | 4351 | | |
4341 | 4352 | | |
4342 | 4353 | | |
| |||
4345 | 4356 | | |
4346 | 4357 | | |
4347 | 4358 | | |
4348 | | - | |
| 4359 | + | |
| 4360 | + | |
| 4361 | + | |
| 4362 | + | |
4349 | 4363 | | |
4350 | 4364 | | |
4351 | 4365 | | |
| |||
4373 | 4387 | | |
4374 | 4388 | | |
4375 | 4389 | | |
| 4390 | + | |
4376 | 4391 | | |
4377 | 4392 | | |
4378 | 4393 | | |
| |||
4399 | 4414 | | |
4400 | 4415 | | |
4401 | 4416 | | |
| 4417 | + | |
| 4418 | + | |
| 4419 | + | |
| 4420 | + | |
| 4421 | + | |
| 4422 | + | |
| 4423 | + | |
4402 | 4424 | | |
4403 | 4425 | | |
4404 | 4426 | | |
4405 | | - | |
| 4427 | + | |
4406 | 4428 | | |
4407 | 4429 | | |
4408 | 4430 | | |
| |||
4412 | 4434 | | |
4413 | 4435 | | |
4414 | 4436 | | |
4415 | | - | |
| 4437 | + | |
| 4438 | + | |
| 4439 | + | |
| 4440 | + | |
4416 | 4441 | | |
4417 | 4442 | | |
4418 | 4443 | | |
| |||
4433 | 4458 | | |
4434 | 4459 | | |
4435 | 4460 | | |
| 4461 | + | |
4436 | 4462 | | |
4437 | 4463 | | |
4438 | 4464 | | |
| |||
4447 | 4473 | | |
4448 | 4474 | | |
4449 | 4475 | | |
| 4476 | + | |
| 4477 | + | |
| 4478 | + | |
| 4479 | + | |
| 4480 | + | |
| 4481 | + | |
4450 | 4482 | | |
4451 | 4483 | | |
4452 | 4484 | | |
| |||
4457 | 4489 | | |
4458 | 4490 | | |
4459 | 4491 | | |
4460 | | - | |
| 4492 | + | |
| 4493 | + | |
| 4494 | + | |
4461 | 4495 | | |
4462 | 4496 | | |
4463 | 4497 | | |
| |||
4885 | 4919 | | |
4886 | 4920 | | |
4887 | 4921 | | |
| 4922 | + | |
| 4923 | + | |
| 4924 | + | |
| 4925 | + | |
| 4926 | + | |
| 4927 | + | |
4888 | 4928 | | |
4889 | 4929 | | |
4890 | | - | |
4891 | | - | |
| 4930 | + | |
| 4931 | + | |
| 4932 | + | |
| 4933 | + | |
| 4934 | + | |
| 4935 | + | |
4892 | 4936 | | |
4893 | 4937 | | |
4894 | 4938 | | |
| |||
4912 | 4956 | | |
4913 | 4957 | | |
4914 | 4958 | | |
| 4959 | + | |
| 4960 | + | |
| 4961 | + | |
| 4962 | + | |
| 4963 | + | |
| 4964 | + | |
4915 | 4965 | | |
4916 | 4966 | | |
4917 | 4967 | | |
| |||
4926 | 4976 | | |
4927 | 4977 | | |
4928 | 4978 | | |
| 4979 | + | |
4929 | 4980 | | |
4930 | 4981 | | |
4931 | 4982 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
4228 | 4229 | | |
4229 | 4230 | | |
4230 | 4231 | | |
| 4232 | + | |
| 4233 | + | |
| 4234 | + | |
| 4235 | + | |
| 4236 | + | |
| 4237 | + | |
| 4238 | + | |
| 4239 | + | |
| 4240 | + | |
| 4241 | + | |
| 4242 | + | |
| 4243 | + | |
| 4244 | + | |
| 4245 | + | |
| 4246 | + | |
| 4247 | + | |
4231 | 4248 | | |
4232 | 4249 | | |
4233 | 4250 | | |
| |||
4242 | 4259 | | |
4243 | 4260 | | |
4244 | 4261 | | |
4245 | | - | |
| 4262 | + | |
4246 | 4263 | | |
4247 | 4264 | | |
4248 | 4265 | | |
| |||
0 commit comments