Skip to content

Commit eeb9341

Browse files
aikdjbw
authored andcommitted
iommu/amd: Report SEV-TIO support
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>
1 parent c3859de commit eeb9341

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

drivers/iommu/amd/amd_iommu_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107

108108

109109
/* Extended Feature 2 Bits */
110+
#define FEATURE_SEVSNPIO_SUP BIT_ULL(1)
110111
#define FEATURE_SNPAVICSUP GENMASK_ULL(7, 5)
111112
#define FEATURE_SNPAVICSUP_GAM(x) \
112113
(FIELD_GET(FEATURE_SNPAVICSUP, x) == 0x1)

drivers/iommu/amd/init.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2252,6 +2252,9 @@ static void print_iommu_info(void)
22522252
if (check_feature(FEATURE_SNP))
22532253
pr_cont(" SNP");
22542254

2255+
if (check_feature2(FEATURE_SEVSNPIO_SUP))
2256+
pr_cont(" SEV-TIO");
2257+
22552258
pr_cont("\n");
22562259
}
22572260

@@ -4015,4 +4018,10 @@ int amd_iommu_snp_disable(void)
40154018
return 0;
40164019
}
40174020
EXPORT_SYMBOL_GPL(amd_iommu_snp_disable);
4021+
4022+
bool amd_iommu_sev_tio_supported(void)
4023+
{
4024+
return check_feature2(FEATURE_SEVSNPIO_SUP);
4025+
}
4026+
EXPORT_SYMBOL_GPL(amd_iommu_sev_tio_supported);
40184027
#endif

include/linux/amd-iommu.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ struct task_struct;
1818
struct pci_dev;
1919

2020
extern void amd_iommu_detect(void);
21+
extern bool amd_iommu_sev_tio_supported(void);
2122

2223
#else /* CONFIG_AMD_IOMMU */
2324

2425
static inline void amd_iommu_detect(void) { }
26+
static inline bool amd_iommu_sev_tio_supported(void) { return false; }
2527

2628
#endif /* CONFIG_AMD_IOMMU */
2729

0 commit comments

Comments
 (0)