aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2011-06-09 11:07:31 -0400
committerJoerg Roedel <joerg.roedel@amd.com>2011-06-14 06:49:57 -0400
commit6c542047937ad66db1d31e290fd2a3b290424ffa (patch)
tree29b0a72206aa423c28ce32ca48bcae0206455333
parentea61cddb9dcb9da9bcabd40f1620c24abaf645c9 (diff)
x86/amd-iommu: Use only dev_data for dte and iotlb flushing routines
This patch make the functions flushing the DTE and IOTLBs only take the dev_data structure instead of the struct device directly. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
-rw-r--r--arch/x86/kernel/amd_iommu.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index 9e07ef65a016..0a5b46504b5d 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -693,14 +693,13 @@ void iommu_flush_all_caches(struct amd_iommu *iommu)
693/* 693/*
694 * Command send function for flushing on-device TLB 694 * Command send function for flushing on-device TLB
695 */ 695 */
696static int device_flush_iotlb(struct device *dev, u64 address, size_t size) 696static int device_flush_iotlb(struct iommu_dev_data *dev_data,
697 u64 address, size_t size)
697{ 698{
698 struct iommu_dev_data *dev_data;
699 struct amd_iommu *iommu; 699 struct amd_iommu *iommu;
700 struct iommu_cmd cmd; 700 struct iommu_cmd cmd;
701 int qdep; 701 int qdep;
702 702
703 dev_data = get_dev_data(dev);
704 qdep = dev_data->ats.qdep; 703 qdep = dev_data->ats.qdep;
705 iommu = amd_iommu_rlookup_table[dev_data->devid]; 704 iommu = amd_iommu_rlookup_table[dev_data->devid];
706 705
@@ -712,23 +711,19 @@ static int device_flush_iotlb(struct device *dev, u64 address, size_t size)
712/* 711/*
713 * Command send function for invalidating a device table entry 712 * Command send function for invalidating a device table entry
714 */ 713 */
715static int device_flush_dte(struct device *dev) 714static int device_flush_dte(struct iommu_dev_data *dev_data)
716{ 715{
717 struct iommu_dev_data *dev_data;
718 struct amd_iommu *iommu; 716 struct amd_iommu *iommu;
719 struct pci_dev *pdev;
720 int ret; 717 int ret;
721 718
722 pdev = to_pci_dev(dev); 719 iommu = amd_iommu_rlookup_table[dev_data->devid];
723 dev_data = get_dev_data(dev);
724 iommu = amd_iommu_rlookup_table[dev_data->devid];
725 720
726 ret = iommu_flush_dte(iommu, dev_data->devid); 721 ret = iommu_flush_dte(iommu, dev_data->devid);
727 if (ret) 722 if (ret)
728 return ret; 723 return ret;
729 724
730 if (dev_data->ats.enabled) 725 if (dev_data->ats.enabled)
731 ret = device_flush_iotlb(dev, 0, ~0UL); 726 ret = device_flush_iotlb(dev_data, 0, ~0UL);
732 727
733 return ret; 728 return ret;
734} 729}
@@ -763,7 +758,7 @@ static void __domain_flush_pages(struct protection_domain *domain,
763 if (!dev_data->ats.enabled) 758 if (!dev_data->ats.enabled)
764 continue; 759 continue;
765 760
766 ret |= device_flush_iotlb(dev_data->dev, address, size); 761 ret |= device_flush_iotlb(dev_data, address, size);
767 } 762 }
768 763
769 WARN_ON(ret); 764 WARN_ON(ret);
@@ -815,7 +810,7 @@ static void domain_flush_devices(struct protection_domain *domain)
815 spin_lock_irqsave(&domain->lock, flags); 810 spin_lock_irqsave(&domain->lock, flags);
816 811
817 list_for_each_entry(dev_data, &domain->dev_list, list) 812 list_for_each_entry(dev_data, &domain->dev_list, list)
818 device_flush_dte(dev_data->dev); 813 device_flush_dte(dev_data);
819 814
820 spin_unlock_irqrestore(&domain->lock, flags); 815 spin_unlock_irqrestore(&domain->lock, flags);
821} 816}
@@ -1586,7 +1581,7 @@ static void do_attach(struct device *dev, struct protection_domain *domain)
1586 domain->dev_cnt += 1; 1581 domain->dev_cnt += 1;
1587 1582
1588 /* Flush the DTE entry */ 1583 /* Flush the DTE entry */
1589 device_flush_dte(dev); 1584 device_flush_dte(dev_data);
1590} 1585}
1591 1586
1592static void do_detach(struct device *dev) 1587static void do_detach(struct device *dev)
@@ -1607,7 +1602,7 @@ static void do_detach(struct device *dev)
1607 clear_dte_entry(dev_data->devid); 1602 clear_dte_entry(dev_data->devid);
1608 1603
1609 /* Flush the DTE entry */ 1604 /* Flush the DTE entry */
1610 device_flush_dte(dev); 1605 device_flush_dte(dev_data);
1611} 1606}
1612 1607
1613/* 1608/*