aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2011-04-06 12:51:26 -0400
committerJoerg Roedel <joerg.roedel@amd.com>2011-04-07 04:46:07 -0400
commitd8c13085775c72e2d46edc54ed0c803c3a944ddb (patch)
tree7303a7caf3ba2f80cb6ddc20daaf8e4bfc1e6b99
parentac0ea6e92b2227c86fe4f7f9eb429071d617a25d (diff)
x86/amd-iommu: Rename iommu_flush_device
This function operates on a struct device, so give it a name that represents that. As a side effect a new function is introduced which operates on am iommu and a device-id. It will be used again in a later patch. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
-rw-r--r--arch/x86/kernel/amd_iommu.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index 75c7f8c3fe12..3557f223f40b 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -530,21 +530,27 @@ static int iommu_completion_wait(struct amd_iommu *iommu)
530 return wait_on_sem(&sem); 530 return wait_on_sem(&sem);
531} 531}
532 532
533static int iommu_flush_dte(struct amd_iommu *iommu, u16 devid)
534{
535 struct iommu_cmd cmd;
536
537 build_inv_dte(&cmd, devid);
538
539 return iommu_queue_command(iommu, &cmd);
540}
541
533/* 542/*
534 * Command send function for invalidating a device table entry 543 * Command send function for invalidating a device table entry
535 */ 544 */
536static int iommu_flush_device(struct device *dev) 545static int device_flush_dte(struct device *dev)
537{ 546{
538 struct amd_iommu *iommu; 547 struct amd_iommu *iommu;
539 struct iommu_cmd cmd;
540 u16 devid; 548 u16 devid;
541 549
542 devid = get_device_id(dev); 550 devid = get_device_id(dev);
543 iommu = amd_iommu_rlookup_table[devid]; 551 iommu = amd_iommu_rlookup_table[devid];
544 552
545 build_inv_dte(&cmd, devid); 553 return iommu_flush_dte(iommu, devid);
546
547 return iommu_queue_command(iommu, &cmd);
548} 554}
549 555
550/* 556/*
@@ -620,7 +626,7 @@ static void domain_flush_devices(struct protection_domain *domain)
620 spin_lock_irqsave(&domain->lock, flags); 626 spin_lock_irqsave(&domain->lock, flags);
621 627
622 list_for_each_entry(dev_data, &domain->dev_list, list) 628 list_for_each_entry(dev_data, &domain->dev_list, list)
623 iommu_flush_device(dev_data->dev); 629 device_flush_dte(dev_data->dev);
624 630
625 spin_unlock_irqrestore(&domain->lock, flags); 631 spin_unlock_irqrestore(&domain->lock, flags);
626} 632}
@@ -1424,7 +1430,7 @@ static void do_attach(struct device *dev, struct protection_domain *domain)
1424 domain->dev_cnt += 1; 1430 domain->dev_cnt += 1;
1425 1431
1426 /* Flush the DTE entry */ 1432 /* Flush the DTE entry */
1427 iommu_flush_device(dev); 1433 device_flush_dte(dev);
1428} 1434}
1429 1435
1430static void do_detach(struct device *dev) 1436static void do_detach(struct device *dev)
@@ -1447,7 +1453,7 @@ static void do_detach(struct device *dev)
1447 clear_dte_entry(devid); 1453 clear_dte_entry(devid);
1448 1454
1449 /* Flush the DTE entry */ 1455 /* Flush the DTE entry */
1450 iommu_flush_device(dev); 1456 device_flush_dte(dev);
1451} 1457}
1452 1458
1453/* 1459/*
@@ -1663,7 +1669,7 @@ static int device_change_notifier(struct notifier_block *nb,
1663 goto out; 1669 goto out;
1664 } 1670 }
1665 1671
1666 iommu_flush_device(dev); 1672 device_flush_dte(dev);
1667 iommu_completion_wait(iommu); 1673 iommu_completion_wait(iommu);
1668 1674
1669out: 1675out:
@@ -2448,7 +2454,7 @@ static void amd_iommu_detach_device(struct iommu_domain *dom,
2448 if (!iommu) 2454 if (!iommu)
2449 return; 2455 return;
2450 2456
2451 iommu_flush_device(dev); 2457 device_flush_dte(dev);
2452 iommu_completion_wait(iommu); 2458 iommu_completion_wait(iommu);
2453} 2459}
2454 2460