Skip to content

iommu/amd: Enforce IOMMU restrictions for SNP-enabled system

Suravee Suthikulpanit via iommu linux-iommu 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest7 patches 4 repliesIn review
  2. v17 patches 5 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7iommu/amd: Warn when found inconsistency EFR maskdrivers/iommu/amd/init.c+15 -40 replies
2/7iommu/amd: Process all IVHDs before enabling IOMMU featuresdrivers/iommu/amd/init.c+18 -60 replies
3/7iommu/amd: Introduce an iommu variable for tracking SNP support statusdrivers/iommu/amd/init.c+8 -40 replies
4/7iommu/amd: Introduce function to check and enable SNPdrivers/iommu/amd/amd_iommu_types.h drivers/iommu/amd/init.c drivers/iommu/amd/iommu.c +1 more+56 -43 replies
5/7iommu/amd: Set translation valid bit only when IO page tables are in usedrivers/iommu/amd/init.c drivers/iommu/amd/iommu.c+15 -30 replies
6/7iommu/amd: Do not support IOMMU_DOMAIN_IDENTITY after SNP is enableddrivers/iommu/amd/iommu.c+9 -01 reply
7/7iommu/amd: Do not support IOMMUv2 APIs when SNP is enableddrivers/iommu/amd/init.c+6 -10 replies

Reviews trailers per patch

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

PatchRobin Murphy
1/7
2/7
3/7
4/7R-b
5/7
6/7R-b
7/7

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

Read the v2 thread

Cover letter [PATCH v2 0/7] iommu/amd: Enforce IOMMU restrictions for SNP-enabled system

SNP-enabled system requires IOMMU v1 page table to be configured with non-zero DTE[Mode] for DMA-capable devices. This effects a number of usecases such as IOMMU pass-through mode and AMD IOMMUv2 APIs for binding/unbinding pasid.

The series introduce a global variable to check SNP-enabled state during driver initialization, and use it to enforce the SNP restrictions during runtime.

Also, for non-DMA-capable devices such as IOAPIC, the recommendation is to set DTE[TV] and DTE[Mode] to zero on SNP-enabled system. Therefore, additinal checks is added before setting DTE[TV].

Testing:
- Tested booting and verify dmesg.
- Tested booting with iommu=pt
- Tested loading amd_iommu_v2 driver
- Tested changing the iommu domain at runtime
- Tested booting SEV/SNP-enabled guest
- Tested when CONFIG_AMD_MEM_ENCRYPT is not set

Pre-requisite:
- [PATCH v3 00/35] iommu/amd: Add multiple PCI segments support

    https://lore.kernel.org/linux-iommu/[email protected]/T/

Chanages from V1:
(https://lore.kernel.org/linux-iommu/[email protected]/T/#t )
- Remove the newly introduced domain_type_supported() callback.
- Patch 1: Modify existing check_feature_on_all_iommus() instead of
introducing another helper function to do similar check.
- Patch 3: Modify to use check_feature_on_all_iommus().
- Patch 4: Add IOMMU init_state check before enabling SNP.
Also move the function declaration to include/linux/amd-iommu.h
- Patch 6: Modify amd_iommu_domain_alloc() to fail when allocating identity domain and SNP is enabled.

Best Regards,
Suravee

Brijesh Singh (1):
iommu/amd: Introduce function to check and enable SNP

Suravee Suthikulpanit (6):
iommu/amd: Warn when found inconsistency EFR mask iommu/amd: Process all IVHDs before enabling IOMMU features iommu/amd: Introduce an iommu variable for tracking SNP support status iommu/amd: Set translation valid bit only when IO page tables are in
use
iommu/amd: Do not support IOMMU_DOMAIN_IDENTITY after SNP is enabled iommu/amd: Do not support IOMMUv2 APIs when SNP is enabled

 drivers/iommu/amd/amd_iommu_types.h |   5 ++
 drivers/iommu/amd/init.c            | 110 +++++++++++++++++++++++-----
 drivers/iommu/amd/iommu.c           |  28 ++++++-
 include/linux/amd-iommu.h           |   6 ++
 4 files changed, 127 insertions(+), 22 deletions(-)
Signature · 6 lines
2.32.0

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu