aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2012-06-12 06:09:35 -0400
committerJoerg Roedel <joerg.roedel@amd.com>2012-07-17 06:14:58 -0400
commit643511b37eb72d831646bacafaeace1eeadf5a54 (patch)
treeb541b53f37fe8a49b4edccd96c924099dfaee201 /drivers/iommu
parent4d121c3256edc66fe8a8e7f975eba72add120a26 (diff)
iommu/amd: Introduce early_amd_iommu_init routine
Split out the code to parse the ACPI table and setup relevant data structures into a new function. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/amd_iommu.c1
-rw-r--r--drivers/iommu/amd_iommu_init.c38
2 files changed, 23 insertions, 16 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 7f8e7a8bf504..0d0dc8598c72 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -384,7 +384,6 @@ DECLARE_STATS_COUNTER(invalidate_iotlb);
384DECLARE_STATS_COUNTER(invalidate_iotlb_all); 384DECLARE_STATS_COUNTER(invalidate_iotlb_all);
385DECLARE_STATS_COUNTER(pri_requests); 385DECLARE_STATS_COUNTER(pri_requests);
386 386
387
388static struct dentry *stats_dir; 387static struct dentry *stats_dir;
389static struct dentry *de_fflush; 388static struct dentry *de_fflush;
390 389
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index b18034a8fdb3..a5dbefb8e260 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -1491,17 +1491,14 @@ static void __init free_on_init_error(void)
1491 * After everything is set up the IOMMUs are enabled and the necessary 1491 * After everything is set up the IOMMUs are enabled and the necessary
1492 * hotplug and suspend notifiers are registered. 1492 * hotplug and suspend notifiers are registered.
1493 */ 1493 */
1494int __init amd_iommu_init_hardware(void) 1494static int __init early_amd_iommu_init(void)
1495{ 1495{
1496 struct acpi_table_header *ivrs_base; 1496 struct acpi_table_header *ivrs_base;
1497 acpi_size ivrs_size; 1497 acpi_size ivrs_size;
1498 acpi_status status; 1498 acpi_status status;
1499 int i, ret = 0; 1499 int i, ret = 0;
1500 1500
1501 if (no_iommu || (iommu_detected && !gart_iommu_aperture)) 1501 if (!amd_iommu_detected)
1502 return -ENODEV;
1503
1504 if (amd_iommu_disabled || !amd_iommu_detected)
1505 return -ENODEV; 1502 return -ENODEV;
1506 1503
1507 if (amd_iommu_dev_table != NULL) { 1504 if (amd_iommu_dev_table != NULL) {
@@ -1588,16 +1585,6 @@ int __init amd_iommu_init_hardware(void)
1588 if (ret) 1585 if (ret)
1589 goto free; 1586 goto free;
1590 1587
1591 ret = amd_iommu_init_pci();
1592 if (ret)
1593 goto free;
1594
1595 enable_iommus();
1596
1597 amd_iommu_init_notifier();
1598
1599 register_syscore_ops(&amd_iommu_syscore_ops);
1600
1601out: 1588out:
1602 /* Don't leak any ACPI memory */ 1589 /* Don't leak any ACPI memory */
1603 early_acpi_os_unmap_memory((char __iomem *)ivrs_base, ivrs_size); 1590 early_acpi_os_unmap_memory((char __iomem *)ivrs_base, ivrs_size);
@@ -1611,6 +1598,27 @@ free:
1611 goto out; 1598 goto out;
1612} 1599}
1613 1600
1601int __init amd_iommu_init_hardware(void)
1602{
1603 int ret = 0;
1604
1605 ret = early_amd_iommu_init();
1606 if (ret)
1607 return ret;
1608
1609 ret = amd_iommu_init_pci();
1610 if (ret)
1611 return ret;
1612
1613 enable_iommus();
1614
1615 amd_iommu_init_notifier();
1616
1617 register_syscore_ops(&amd_iommu_syscore_ops);
1618
1619 return ret;
1620}
1621
1614static int amd_iommu_enable_interrupts(void) 1622static int amd_iommu_enable_interrupts(void)
1615{ 1623{
1616 struct amd_iommu *iommu; 1624 struct amd_iommu *iommu;