[PATCH 7/9] VT-d: add domain map and iova_to_phys functions for IOMMU API

From: Joerg Roedel
Date: Thu Nov 27 2008 - 10:43:55 EST


Signed-off-by: Joerg Roedel <joerg.roedel@xxxxxxx>
---
drivers/pci/intel-iommu.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index a90c832..8fa0269 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -2492,3 +2492,25 @@ static void intel_iommu_detach_device(struct iommu_domain *domain,

intel_iommu_detach_dev(dmar_domain, pdev->bus->number, pdev->devfn);
}
+
+static int intel_iommu_map(struct iommu_domain *domain, dma_addr_t iova,
+ phys_addr_t paddr, size_t size, int prot)
+{
+ struct dmar_domain *dmar_domain = domain->priv;
+
+ return intel_iommu_page_mapping(dmar_domain, iova, paddr, size, prot);
+}
+
+static phys_addr_t intel_iova_to_phys(struct iommu_domain *domain,
+ dma_addr_t iova)
+{
+ struct dmar_domain *dmar_domain = domain->priv;
+ u64 pfn;
+ u64 offset = iova & ~PAGE_MASK;
+
+ pfn = intel_iommu_iova_to_pfn(dmar_domain, iova);
+ if (!pfn)
+ return pfn;
+
+ return (pfn << PAGE_SHIFT) & offset;
+}
--
1.5.6.4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/