Skip to content

Commit d15f55d

Browse files
hegdevasantjoergroedel
authored andcommitted
iommu/amd: Move V2 page table support check to early_amd_iommu_init()
amd_iommu_pgtable validation has to be done before calling iommu_snp_enable(). It can be done immediately after reading IOMMU features. Hence move this check to early_amd_iommu_init(). Signed-off-by: Vasant Hegde <vasant.hegde@amd.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/20241028093810.5901-7-vasant.hegde@amd.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent b0ffdb2 commit d15f55d

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

drivers/iommu/amd/init.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2070,13 +2070,6 @@ static int __init iommu_init_pci(struct amd_iommu *iommu)
20702070

20712071
init_iommu_perf_ctr(iommu);
20722072

2073-
if (amd_iommu_pgtable == AMD_IOMMU_V2) {
2074-
if (!amd_iommu_v2_pgtbl_supported()) {
2075-
pr_warn("Cannot enable v2 page table for DMA-API. Fallback to v1.\n");
2076-
amd_iommu_pgtable = AMD_IOMMU_V1;
2077-
}
2078-
}
2079-
20802073
if (is_rd890_iommu(iommu->dev)) {
20812074
int i, j;
20822075

@@ -3090,6 +3083,13 @@ static int __init early_amd_iommu_init(void)
30903083
FIELD_GET(FEATURE_GATS, amd_iommu_efr) == GUEST_PGTABLE_5_LEVEL)
30913084
amd_iommu_gpt_level = PAGE_MODE_5_LEVEL;
30923085

3086+
if (amd_iommu_pgtable == AMD_IOMMU_V2) {
3087+
if (!amd_iommu_v2_pgtbl_supported()) {
3088+
pr_warn("Cannot enable v2 page table for DMA-API. Fallback to v1.\n");
3089+
amd_iommu_pgtable = AMD_IOMMU_V1;
3090+
}
3091+
}
3092+
30933093
/* Disable any previously enabled IOMMUs */
30943094
if (!is_kdump_kernel() || amd_iommu_disabled)
30953095
disable_iommus();

0 commit comments

Comments
 (0)