iommu/amd: Add SNP page mode 0 support
Subsystems (2)
Vasant Hegde
maintainerPATCH v2 1/1 iommu/amd: Add SNP page mode 0 support
Newer AMD IOMMUs supports DTE[Mode]=0 for SNP-enabled system. This is detected using new feature bit (EFR2[SNP_Page_Mode_0_Sup]). If this feature is enabled, then IOMMU supports:
- Passthrough mode (i.e. iommu=pt)
- amd_iommu=pgtbl_v2: Forcing Linux DMA-API to use IOMMU v2 page table
- Setting up device for SVA mode in the host.
---
Joerg,
I have rebased this on top of amd/amd-vi branch and it should apply cleanly.
Sorry. I missed to include this one along with PRI series. I think think one is ready. Can you please pick this up for 7.3
-Vasant
drivers/iommu/amd/amd_iommu_types.h | 4 +++ drivers/iommu/amd/init.c | 42 ++++++++++++++++++++--------- drivers/iommu/amd/iommu.c | 4 +-- 3 files changed, 35 insertions(+), 15 deletions(-)
drivers/iommu/amd/amd_iommu_types.h +4 -0
@@ -113,6 +113,7 @@#define FEATURE_SNPAVICSUP_GAM (x) \ (FIELD_GET(FEATURE_SNPAVICSUP, x) == 0x1)#define FEATURE_HT_RANGE_IGNORE BIT_ULL(11) +#define FEATURE_SNP_PAGE_MODE0_SUP BIT_ULL(13)#define FEATURE_NUM_INT_REMAP_SUP GENMASK_ULL(9, 8)#define FEATURE_NUM_INT_REMAP_SUP_2K (x) \
@@ -416,6 +417,9 @@ extern bool amd_iommu_dump; pr_info(format, ## arg); \ }while (0 ); +/* SNP page mode 0 support */ +extern bool amd_iommu_snp_mode0_sup; +/* global flag if IOMMUs cache non-present entries */ extern bool amd_iommu_np_cache;/* Only true if all IOMMUs support device IOTLBs */
drivers/iommu/amd/init.c +29 -13
65 lines not on this page · raw message
drivers/iommu/amd/iommu.c +2 -2
@@ -2910,9 +2910,9 @@ static int amd_iommu_identity_attach(struct iommu_domain *dom, struct device *de {/* * Don't allow attaching a device to the identity domain if SNP is -* enabled. +* enabled and SNP Mode0 support is not present. */ -if (amd_iommu_snp_en) +if (amd_iommu_snp_en && !amd_iommu_snp_mode0_sup)return -EINVAL ;return amd_iommu_attach_device (dom, dev, old);
Signature · 1 line
2.31.1
Jörg Rödel
maintainerQuoted 6 lines · Vasant Hegde
Joerg,
I have rebased this on top of amd/amd-vi branch and it should apply cleanly.Sorry. I missed to include this one along with PRI series. I think think one is ready. Can you please pick this up for 7.3
All good, this now applied as well.