Skip to content

Commit b0ffdb2

Browse files
hegdevasantjoergroedel
authored andcommitted
iommu/amd: Add helper function to check GIOSUP/GTSUP
amd_iommu_gt_ppr_supported() only checks for GTSUP. To support PASID with V2 page table we need GIOSUP as well. Hence add new helper function to check GIOSUP/GTSUP. Signed-off-by: Vasant Hegde <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 60c30aa commit b0ffdb2

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

drivers/iommu/amd/amd_iommu.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,14 @@ static inline bool check_feature2(u64 mask)
118118
return (amd_iommu_efr2 & mask);
119119
}
120120

121+
static inline bool amd_iommu_v2_pgtbl_supported(void)
122+
{
123+
return (check_feature(FEATURE_GIOSUP) && check_feature(FEATURE_GT));
124+
}
125+
121126
static inline bool amd_iommu_gt_ppr_supported(void)
122127
{
123-
return (check_feature(FEATURE_GT) &&
128+
return (amd_iommu_v2_pgtbl_supported() &&
124129
check_feature(FEATURE_PPR) &&
125130
check_feature(FEATURE_EPHSUP));
126131
}

drivers/iommu/amd/init.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2071,8 +2071,7 @@ static int __init iommu_init_pci(struct amd_iommu *iommu)
20712071
init_iommu_perf_ctr(iommu);
20722072

20732073
if (amd_iommu_pgtable == AMD_IOMMU_V2) {
2074-
if (!check_feature(FEATURE_GIOSUP) ||
2075-
!check_feature(FEATURE_GT)) {
2074+
if (!amd_iommu_v2_pgtbl_supported()) {
20762075
pr_warn("Cannot enable v2 page table for DMA-API. Fallback to v1.\n");
20772076
amd_iommu_pgtable = AMD_IOMMU_V1;
20782077
}

0 commit comments

Comments
 (0)