iommu/amd: Fix GCR3 lifetime and PPR completion
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest12 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/12 | iommu/amd: Disable PRI before ATS and PASIDdrivers/ | +1 | 0 replies | |
| 2/12 | iommu/amd: Derive the PPR completion GN bit from the requestdrivers/ drivers/ drivers/ | +15 | 0 replies | |
| 3/12 | iommu/amd: Complete a PPR from a device the IOMMU did not probedrivers/ drivers/ drivers/ | +30 | 0 replies | |
| 4/12 | iommu/amd: Keep the GCR3 table while PASIDs are attacheddrivers/ | +5 | 0 replies | |
| 5/12 | iommu/amd: Restore an SVA PASID after PCI resetdrivers/ | +6 | 0 replies | |
| 6/12 | iommu/amd: Disable GCR3 entries from the SVA mm release notifierdrivers/ drivers/ drivers/ | +21 | 0 replies | |
| 7/12 | iommu/amd: Complete an aborted PPR group only on its last pagedrivers/ | +11 | 0 replies | |
| 8/12 | iommu/amd: Discard partial page requests when the PPR log overflowsdrivers/ | +15 | 0 replies | |
| 9/12 | iommu/amd: Allocate the GCR3 table from the devicedrivers/ | +58 | 0 replies | |
| 10/12 | iommu/amd: Return -ENOMEM when SVA PASID allocation failsdrivers/ | +1 | 0 replies | |
| 11/12 | iommu/amd: Drain the PPR log before detaching an SVA PASIDdrivers/ drivers/ drivers/ +2 more | +41 | 0 replies | |
| 12/12 | iommu/amd: Drain the PPR log before removing a device from the IOPF queuedrivers/ | +12 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 00/12] iommu/amd: Fix GCR3 lifetime and PPR completion
This series fixes a number of issues in the SVA/PRI path. It does not address all of them: a follow-up series will move PASID/PRI enablement to the probe/release path and fix the remaining PRI issues.
Note that this series also does not fully address the issue during
the mmu_notifier release path, which was discussed in an earlier thread [1]. We are still running some experiments internally, and I intend to address it in v2.
[1] https://lore.kernel.org/linux-iommu/[email protected]/
Summary of changes:
-------------------
SVA teardown and page-request completion have several ordering bugs. The GCR3 table can be freed while PASIDs are still attached, and a PPR response can complete the wrong request or run after its attach handle is gone.
- amd_iommu_complete_ppr() takes the GN bit from the request. Page-table mode does not cover passthrough, which also uses PASID.
- The GCR3 table stays allocated while PASIDs are attached, so the blocked-domain attach during PCI reset does not free the root out from under a later clear. A PASID-capable device allocates the table at probe and frees it at release. A non-PASID v2 domain still allocates it on attach and frees it on detach. The mm release notifier only disables GCR3 entries and leaves the PASID attachment for the core to remove. After reset, a blocking old domain is programmed again as a fresh SVA attach. A failed tracking allocation returns -ENOMEM.
- An aborted multi-page group is completed only on its last page. Overflow discards partial groups whose last page never reached the log. Detach drains the PPR log before the SVA attach handle is freed, and before a device is removed from the IOPF queue. The DTE is cleared first so the IOMMU stops logging new requests, and PCI capabilities are disabled after those requests have been answered.
Full series including other cleanup is available at:
https://github.com/AMDESE/linux-iommu/tree/iommu_code_audit_7.4_v1
Santosh Shukla (1):
iommu/amd: Restore an SVA PASID after PCI reset
Vasant Hegde (11):
iommu/amd: Disable PRI before ATS and PASID
iommu/amd: Derive the PPR completion GN bit from the request iommu/amd: Complete a PPR from a device the IOMMU did not probe iommu/amd: Keep the GCR3 table while PASIDs are attached iommu/amd: Disable GCR3 entries from the SVA mm release notifier iommu/amd: Complete an aborted PPR group only on its last page iommu/amd: Discard partial page requests when the PPR log overflows iommu/amd: Allocate the GCR3 table from the device iommu/amd: Return -ENOMEM when SVA PASID allocation fails iommu/amd: Drain the PPR log before detaching an SVA PASID iommu/amd: Drain the PPR log before removing a device from the IOPF
queue
drivers/iommu/amd/amd_iommu.h | 5 +- drivers/iommu/amd/amd_iommu_types.h | 2 + drivers/iommu/amd/init.c | 1 + drivers/iommu/amd/iommu.c | 187 +++++++++++++--------------- drivers/iommu/amd/pasid.c | 32 +++-- drivers/iommu/amd/ppr.c | 92 ++++++++++++-- 6 files changed, 203 insertions(+), 116 deletions(-)
Signature · 1 line
2.31.1