]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iommu/amd: Report SEV-TIO support
authorAlexey Kardashevskiy <aik@amd.com>
Tue, 2 Dec 2025 02:44:48 +0000 (13:44 +1100)
committerDan Williams <dan.j.williams@intel.com>
Tue, 2 Dec 2025 20:06:45 +0000 (12:06 -0800)
The SEV-TIO switch in the AMD BIOS is reported to the OS via
the IOMMU Extended Feature 2 register (EFR2), bit 1.

Add helper to parse the bit and report the feature presence.

Signed-off-by: Alexey Kardashevskiy <aik@amd.com>
Link: https://patch.msgid.link/20251202024449.542361-4-aik@amd.com
Acked-by: Joerg Roedel <joerg.roedel@amd.com>
Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/iommu/amd/amd_iommu_types.h
drivers/iommu/amd/init.c
include/linux/amd-iommu.h

index a698a2e7ce2a6ecbb11e58f6e0ea4d6d468922f6..a2f72c53d3cca844ca2477a7531db59fa4710154 100644 (file)
 
 
 /* Extended Feature 2 Bits */
+#define FEATURE_SEVSNPIO_SUP   BIT_ULL(1)
 #define FEATURE_SNPAVICSUP     GENMASK_ULL(7, 5)
 #define FEATURE_SNPAVICSUP_GAM(x) \
        (FIELD_GET(FEATURE_SNPAVICSUP, x) == 0x1)
index f2991c11867cbaf354ecad08b399491b345e1ca1..ba95467ba492b41aa1b4639aa73e0244648874b2 100644 (file)
@@ -2252,6 +2252,9 @@ static void print_iommu_info(void)
                if (check_feature(FEATURE_SNP))
                        pr_cont(" SNP");
 
+               if (check_feature2(FEATURE_SEVSNPIO_SUP))
+                       pr_cont(" SEV-TIO");
+
                pr_cont("\n");
        }
 
@@ -4015,4 +4018,10 @@ int amd_iommu_snp_disable(void)
        return 0;
 }
 EXPORT_SYMBOL_GPL(amd_iommu_snp_disable);
+
+bool amd_iommu_sev_tio_supported(void)
+{
+       return check_feature2(FEATURE_SEVSNPIO_SUP);
+}
+EXPORT_SYMBOL_GPL(amd_iommu_sev_tio_supported);
 #endif
index 8cced632ecd031682401456eb9e0bef52a8dc2ec..0f64f09d1f34ff76337118588a8f3dcf824e79f7 100644 (file)
@@ -18,10 +18,12 @@ struct task_struct;
 struct pci_dev;
 
 extern void amd_iommu_detect(void);
+extern bool amd_iommu_sev_tio_supported(void);
 
 #else /* CONFIG_AMD_IOMMU */
 
 static inline void amd_iommu_detect(void) { }
+static inline bool amd_iommu_sev_tio_supported(void) { return false; }
 
 #endif /* CONFIG_AMD_IOMMU */