aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2009-11-26 09:04:38 -0500
committerJoerg Roedel <joerg.roedel@amd.com>2009-11-27 08:20:35 -0500
commit3fa43655d81d471d47c44b0db4e2be1f8af32207 (patch)
tree2cf0d1bffbb3a84262fa6f528a4611bf096b122c /arch
parent7f760ddd702d162d693bc79f62c3bdd7fe55bd9d (diff)
x86/amd-iommu: Introduce iommu_flush_device() function
This patch adds a function to flush a DTE entry for a given struct device and replaces iommu_queue_inv_dev_entry calls with this function where appropriate. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/amd_iommu.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index e3363fd5eef5..41c4ebecced4 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -494,6 +494,17 @@ static int iommu_queue_inv_dev_entry(struct amd_iommu *iommu, u16 devid)
494 return ret; 494 return ret;
495} 495}
496 496
497static int iommu_flush_device(struct device *dev)
498{
499 struct amd_iommu *iommu;
500 u16 devid;
501
502 devid = get_device_id(dev);
503 iommu = amd_iommu_rlookup_table[devid];
504
505 return iommu_queue_inv_dev_entry(iommu, devid);
506}
507
497static void __iommu_build_inv_iommu_pages(struct iommu_cmd *cmd, u64 address, 508static void __iommu_build_inv_iommu_pages(struct iommu_cmd *cmd, u64 address,
498 u16 domid, int pde, int s) 509 u16 domid, int pde, int s)
499{ 510{
@@ -1382,7 +1393,7 @@ static void do_attach(struct device *dev, struct protection_domain *domain)
1382 domain->dev_cnt += 1; 1393 domain->dev_cnt += 1;
1383 1394
1384 /* Flush the DTE entry */ 1395 /* Flush the DTE entry */
1385 iommu_queue_inv_dev_entry(iommu, devid); 1396 iommu_flush_device(dev);
1386} 1397}
1387 1398
1388static void do_detach(struct device *dev) 1399static void do_detach(struct device *dev)
@@ -1405,7 +1416,7 @@ static void do_detach(struct device *dev)
1405 clear_dte_entry(devid); 1416 clear_dte_entry(devid);
1406 1417
1407 /* Flush the DTE entry */ 1418 /* Flush the DTE entry */
1408 iommu_queue_inv_dev_entry(iommu, devid); 1419 iommu_flush_device(dev);
1409} 1420}
1410 1421
1411/* 1422/*
@@ -1610,7 +1621,7 @@ static int device_change_notifier(struct notifier_block *nb,
1610 goto out; 1621 goto out;
1611 } 1622 }
1612 1623
1613 iommu_queue_inv_dev_entry(iommu, devid); 1624 iommu_flush_device(dev);
1614 iommu_completion_wait(iommu); 1625 iommu_completion_wait(iommu);
1615 1626
1616out: 1627out:
@@ -2393,7 +2404,7 @@ static void amd_iommu_detach_device(struct iommu_domain *dom,
2393 if (!iommu) 2404 if (!iommu)
2394 return; 2405 return;
2395 2406
2396 iommu_queue_inv_dev_entry(iommu, devid); 2407 iommu_flush_device(dev);
2397 iommu_completion_wait(iommu); 2408 iommu_completion_wait(iommu);
2398} 2409}
2399 2410