Commit b9b1ce70 authored by Joerg Roedel's avatar Joerg Roedel

iommu/amd: Introduce amd_iommu_init_dma routine

This function will initialize everthing necessary so that
devices can do DMA. This includes dma_ops and iommu_ops.
Signed-off-by: default avatarJoerg Roedel <joerg.roedel@amd.com>
parent 62410eeb
...@@ -1627,8 +1627,6 @@ int __init amd_iommu_init_hardware(void) ...@@ -1627,8 +1627,6 @@ int __init amd_iommu_init_hardware(void)
enable_iommus(); enable_iommus();
amd_iommu_init_notifier();
register_syscore_ops(&amd_iommu_syscore_ops); register_syscore_ops(&amd_iommu_syscore_ops);
return ret; return ret;
...@@ -1669,6 +1667,25 @@ static bool detect_ivrs(void) ...@@ -1669,6 +1667,25 @@ static bool detect_ivrs(void)
return true; return true;
} }
static int amd_iommu_init_dma(void)
{
int ret;
if (iommu_pass_through)
ret = amd_iommu_init_passthrough();
else
ret = amd_iommu_init_dma_ops();
if (ret)
return ret;
amd_iommu_init_api();
amd_iommu_init_notifier();
return 0;
}
/* /*
* This is the core init function for AMD IOMMU hardware in the system. * This is the core init function for AMD IOMMU hardware in the system.
* This function is called from the generic x86 DMA layer initialization * This function is called from the generic x86 DMA layer initialization
...@@ -1690,11 +1707,7 @@ static int __init amd_iommu_init(void) ...@@ -1690,11 +1707,7 @@ static int __init amd_iommu_init(void)
if (ret) if (ret)
goto free; goto free;
if (iommu_pass_through) ret = amd_iommu_init_dma();
ret = amd_iommu_init_passthrough();
else
ret = amd_iommu_init_dma_ops();
if (ret) if (ret)
goto free; goto free;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment