aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2012-03-15 11:39:21 -0400
committerJoerg Roedel <joerg.roedel@amd.com>2012-03-15 11:39:21 -0400
commit3d9761e7a55b429ccee305a53669577b9cc20dac (patch)
tree1dfd475d5272c77dc9bb206f7e2f3be6083b4da7 /drivers/iommu
parent9ddd592a191b32f2ee6c4b6ed2bd52665c3a49f5 (diff)
iommu/amd: Move interrupt setup code into seperate function
For interrupt remapping the enablement of the IOMMU MSI interrupt needs to be deferred because the IOMMU itself will be initialized before the io-apics are up and running. So the code to setup the MSI is moved seperated from the hardware-setup routine now. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/amd_iommu_init.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 182b80ba79c5..8b026bfe05d1 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -196,6 +196,8 @@ static u32 rlookup_table_size; /* size if the rlookup table */
196 */ 196 */
197extern void iommu_flush_all_caches(struct amd_iommu *iommu); 197extern void iommu_flush_all_caches(struct amd_iommu *iommu);
198 198
199static int __init amd_iommu_enable_interrupts(void);
200
199static inline void update_last_devid(u16 devid) 201static inline void update_last_devid(u16 devid)
200{ 202{
201 if (devid > amd_iommu_last_bdf) 203 if (devid > amd_iommu_last_bdf)
@@ -1383,7 +1385,6 @@ static void enable_iommus(void)
1383 iommu_enable_ppr_log(iommu); 1385 iommu_enable_ppr_log(iommu);
1384 iommu_enable_gt(iommu); 1386 iommu_enable_gt(iommu);
1385 iommu_set_exclusion_range(iommu); 1387 iommu_set_exclusion_range(iommu);
1386 iommu_init_msi(iommu);
1387 iommu_enable(iommu); 1388 iommu_enable(iommu);
1388 iommu_flush_all_caches(iommu); 1389 iommu_flush_all_caches(iommu);
1389 } 1390 }
@@ -1411,6 +1412,8 @@ static void amd_iommu_resume(void)
1411 1412
1412 /* re-load the hardware */ 1413 /* re-load the hardware */
1413 enable_iommus(); 1414 enable_iommus();
1415
1416 amd_iommu_enable_interrupts();
1414} 1417}
1415 1418
1416static int amd_iommu_suspend(void) 1419static int amd_iommu_suspend(void)
@@ -1595,6 +1598,21 @@ free:
1595 return ret; 1598 return ret;
1596} 1599}
1597 1600
1601static int __init amd_iommu_enable_interrupts(void)
1602{
1603 struct amd_iommu *iommu;
1604 int ret = 0;
1605
1606 for_each_iommu(iommu) {
1607 ret = iommu_init_msi(iommu);
1608 if (ret)
1609 goto out;
1610 }
1611
1612out:
1613 return ret;
1614}
1615
1598/* 1616/*
1599 * This is the core init function for AMD IOMMU hardware in the system. 1617 * This is the core init function for AMD IOMMU hardware in the system.
1600 * This function is called from the generic x86 DMA layer initialization 1618 * This function is called from the generic x86 DMA layer initialization
@@ -1612,6 +1630,10 @@ static int __init amd_iommu_init(void)
1612 if (ret) 1630 if (ret)
1613 goto out; 1631 goto out;
1614 1632
1633 ret = amd_iommu_enable_interrupts();
1634 if (ret)
1635 goto free;
1636
1615 if (iommu_pass_through) 1637 if (iommu_pass_through)
1616 ret = amd_iommu_init_passthrough(); 1638 ret = amd_iommu_init_passthrough();
1617 else 1639 else