Skip to content

Commit

Permalink
iommu/amd: Introduce amd_iommu_init_dma routine
Browse files Browse the repository at this point in the history
This function will initialize everthing necessary so that
devices can do DMA. This includes dma_ops and iommu_ops.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
  • Loading branch information
Joerg Roedel committed Jul 17, 2012
1 parent 62410ee commit b9b1ce7
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions drivers/iommu/amd_iommu_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1627,8 +1627,6 @@ int __init amd_iommu_init_hardware(void)

enable_iommus();

amd_iommu_init_notifier();

register_syscore_ops(&amd_iommu_syscore_ops);

return ret;
Expand Down Expand Up @@ -1669,6 +1667,25 @@ static bool detect_ivrs(void)
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 function is called from the generic x86 DMA layer initialization
Expand All @@ -1690,11 +1707,7 @@ static int __init amd_iommu_init(void)
if (ret)
goto free;

if (iommu_pass_through)
ret = amd_iommu_init_passthrough();
else
ret = amd_iommu_init_dma_ops();

ret = amd_iommu_init_dma();
if (ret)
goto free;

Expand Down

0 comments on commit b9b1ce7

Please sign in to comment.