Skip to content

Commit 02c6f31

Browse files
ssuthiku-amdjoergroedel
authored andcommitted
iommu/amd: Globally detect SNP support
Modify existing SNP feature check to use the helper function check_feature_on_all_iommus() to ensure consistency among all IOMMUs. Also report IOMMU SNP support information for each IOMMU. Signed-off-by: Suravee Suthikulpanit <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent ae180ba commit 02c6f31

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/iommu/amd/init.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ static void iommu_set_cwwb_range(struct amd_iommu *iommu)
389389
u64 start = iommu_virt_to_phys((void *)iommu->cmd_sem);
390390
u64 entry = start & PM_ADDR_MASK;
391391

392-
if (!iommu_feature(iommu, FEATURE_SNP))
392+
if (!check_feature_on_all_iommus(FEATURE_SNP))
393393
return;
394394

395395
/* Note:
@@ -804,7 +804,7 @@ static void *__init iommu_alloc_4k_pages(struct amd_iommu *iommu,
804804
void *buf = (void *)__get_free_pages(gfp, order);
805805

806806
if (buf &&
807-
iommu_feature(iommu, FEATURE_SNP) &&
807+
check_feature_on_all_iommus(FEATURE_SNP) &&
808808
set_memory_4k((unsigned long)buf, (1 << order))) {
809809
free_pages((unsigned long)buf, order);
810810
buf = NULL;
@@ -2143,6 +2143,9 @@ static void print_iommu_info(void)
21432143
if (iommu->features & FEATURE_GAM_VAPIC)
21442144
pr_cont(" GA_vAPIC");
21452145

2146+
if (iommu->features & FEATURE_SNP)
2147+
pr_cont(" SNP");
2148+
21462149
pr_cont("\n");
21472150
}
21482151
}

0 commit comments

Comments
 (0)