aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2012-06-12 10:51:12 -0400
committerJoerg Roedel <joerg.roedel@amd.com>2012-07-17 06:17:12 -0400
commitb9b1ce707d81ec63c04e4fd8c34699ada950e6dc (patch)
tree987bf73e990db4268325e25149cd7397de0dfea9 /drivers/iommu
parent62410eeb40ef355fa47f63886542f4dacef13ba9 (diff)
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: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/amd_iommu_init.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 966d8ac9e14..53828b61e9a 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -1627,8 +1627,6 @@ int __init amd_iommu_init_hardware(void)
1627 1627
1628 enable_iommus(); 1628 enable_iommus();
1629 1629
1630 amd_iommu_init_notifier();
1631
1632 register_syscore_ops(&amd_iommu_syscore_ops); 1630 register_syscore_ops(&amd_iommu_syscore_ops);
1633 1631
1634 return ret; 1632 return ret;
@@ -1669,6 +1667,25 @@ static bool detect_ivrs(void)
1669 return true; 1667 return true;
1670} 1668}
1671 1669
1670static int amd_iommu_init_dma(void)
1671{
1672 int ret;
1673
1674 if (iommu_pass_through)
1675 ret = amd_iommu_init_passthrough();
1676 else
1677 ret = amd_iommu_init_dma_ops();
1678
1679 if (ret)
1680 return ret;
1681
1682 amd_iommu_init_api();
1683
1684 amd_iommu_init_notifier();
1685
1686 return 0;
1687}
1688
1672/* 1689/*
1673 * This is the core init function for AMD IOMMU hardware in the system. 1690 * This is the core init function for AMD IOMMU hardware in the system.
1674 * This function is called from the generic x86 DMA layer initialization 1691 * This function is called from the generic x86 DMA layer initialization
@@ -1690,11 +1707,7 @@ static int __init amd_iommu_init(void)
1690 if (ret) 1707 if (ret)
1691 goto free; 1708 goto free;
1692 1709
1693 if (iommu_pass_through) 1710 ret = amd_iommu_init_dma();
1694 ret = amd_iommu_init_passthrough();
1695 else
1696 ret = amd_iommu_init_dma_ops();
1697
1698 if (ret) 1711 if (ret)
1699 goto free; 1712 goto free;
1700 1713