lkml.org 
[lkml]   [2022]   [Jun]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject[PATCH v3 0/7] iommu/amd: Enforce IOMMU restrictions for SNP-enabled system
Date
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/20220511072141.15485-29-vasant.hegde@amd.com/T/

Chanages from V2:
(https://lists.linuxfoundation.org/pipermail/iommu/2022-June/066392.html)
- Patch 4:
* Update pr_err message to report SNP not supported.
* Remove export GPL.
* Remove function stub when CONFIG_AMD_MEM_ENCRYPT is not set.
- Patch 6: Change to WARN_ONCE.

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 | 109 +++++++++++++++++++++++-----
drivers/iommu/amd/iommu.c | 27 ++++++-
include/linux/amd-iommu.h | 4 +
4 files changed, 123 insertions(+), 22 deletions(-)

--
2.32.0

\
 
 \ /
  Last update: 2022-06-22 19:13    [W:0.463 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site