Skip to content

iommu/amd: Fix init teardown and IOMMU interrupt setup

Vasant Hegde linux-iommu 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5iommu/amd: Destroy protection domain IDs after the domains are freeddrivers/iommu/amd/init.c+1 -10 replies
2/5iommu/amd: Unregister the IOMMUs before disabling them on init failuredrivers/iommu/amd/init.c+13 -30 replies
3/5iommu/amd: Select XT mode only when the kernel supports x2APICdrivers/iommu/amd/init.c+8 -40 replies
4/5iommu/amd: Log error message when IOMMU interrupt setup faileddrivers/iommu/amd/init.c+11 -50 replies
5/5iommu/amd: Remove the shared INTCAPXT domain only after its IRQs are freeddrivers/iommu/amd/amd_iommu_types.h drivers/iommu/amd/init.c+58 -70 replies

Reviews trailers per patch

2 of 5 patches have a Reviewed-by or Acked-by.

PatchDheeraj Kumar Srivastava
1/5R-b T-b
2/5R-b T-b
3/5
4/5
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/5] iommu/amd: Fix init teardown and IOMMU interrupt setup

Init failure tears the IOMMUs down in an order the hardware and the protection-domain IDA cannot survive, and interrupt setup can select XT mode or drop the shared INTCAPXT domain while IRQs are still mapped.

- free_dma_resources() destroyed the protection-domain IDA before the group default domains were freed, so ida_free() warned for every domain released during init failure. Destroy the IDA after the domains have released their IDs.

- The failure path disabled the IOMMUs and then unregistered them. Clearing a DTE queues a completion wait, and the command processor was already off, so every wait timed out. Unregister first, while the IOMMUs still accept commands, then disable the hardware.

- IVHD XTSup was treated as the mode to run in, so CONTROL_XT_EN and INTCAPXT were enabled even when the kernel cannot use x2APIC. Stay in xAPIC mode and use MSI unless x2apic_supported() is true. iommu_init_irq() logs the missing MSI capability and the errno when interrupt allocation fails.

- The INTCAPXT irq domain is shared by every IOMMU and by the event, PPR, and GA interrupts. Removing it when one request failed tripped the revmap warning and left iommu_irqdomain pointing at a freed domain. Free only the failed IRQ, and remove the domain once its

Full series is available at :
https://github.com/AMDESE/linux-iommu/tree/iommu_code_audit_7.4_v1

Vasant Hegde (5):
iommu/amd: Destroy protection domain IDs after the domains are freed iommu/amd: Unregister the IOMMUs before disabling them on init failure iommu/amd: Select XT mode only when the kernel supports x2APIC iommu/amd: Log error message when IOMMU interrupt setup failed iommu/amd: Remove the shared INTCAPXT domain only after its IRQs are freed

 drivers/iommu/amd/amd_iommu_types.h |   3 +
 drivers/iommu/amd/init.c            | 108 ++++++++++++++++++++++------
 2 files changed, 91 insertions(+), 20 deletions(-)
Signature · 1 line
2.31.1