]> Pileus Git - ~andy/linux/commitdiff
iommu: Add domain window handling functions
authorJoerg Roedel <joro@8bytes.org>
Tue, 29 Jan 2013 13:26:20 +0000 (14:26 +0100)
committerJoerg Roedel <joro@8bytes.org>
Wed, 6 Feb 2013 09:47:22 +0000 (10:47 +0100)
Add the iommu_domain_window_enable() and iommu_domain_window_disable()
functions to the IOMMU-API. These functions will be used to setup
domains that are based on subwindows and not on paging.

Signed-off-by: Joerg Roedel <joro@8bytes.org>
drivers/iommu/iommu.c
include/linux/iommu.h

index 0e0e5f2e0ccc33ae79a2ebdeafce20495459bdb1..b3aced7356cc13a91423fe695cf2974c59b11611 100644 (file)
@@ -852,6 +852,26 @@ size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, size_t size)
 }
 EXPORT_SYMBOL_GPL(iommu_unmap);
 
+
+int iommu_domain_window_enable(struct iommu_domain *domain, u32 wnd_nr,
+                              phys_addr_t paddr, u64 size)
+{
+       if (unlikely(domain->ops->domain_window_enable == NULL))
+               return -ENODEV;
+
+       return domain->ops->domain_window_enable(domain, wnd_nr, paddr, size);
+}
+EXPORT_SYMBOL_GPL(iommu_domain_window_enable);
+
+void iommu_domain_window_disable(struct iommu_domain *domain, u32 wnd_nr)
+{
+       if (unlikely(domain->ops->domain_window_disable == NULL))
+               return;
+
+       return domain->ops->domain_window_disable(domain, wnd_nr);
+}
+EXPORT_SYMBOL_GPL(iommu_domain_window_disable);
+
 static int __init iommu_init(void)
 {
        iommu_group_kset = kset_create_and_add("iommu_groups",
index 26066f54a849b0939179808088551b2a7717edcf..5ea3d725091746374c6d4dc5d29616700c8f5fe7 100644 (file)
@@ -101,6 +101,12 @@ struct iommu_ops {
                               enum iommu_attr attr, void *data);
        int (*domain_set_attr)(struct iommu_domain *domain,
                               enum iommu_attr attr, void *data);
+
+       /* Window handling functions */
+       int (*domain_window_enable)(struct iommu_domain *domain, u32 wnd_nr,
+                                   phys_addr_t paddr, u64 size);
+       void (*domain_window_disable)(struct iommu_domain *domain, u32 wnd_nr);
+
        unsigned long pgsize_bitmap;
 };
 
@@ -158,6 +164,10 @@ extern int iommu_domain_get_attr(struct iommu_domain *domain, enum iommu_attr,
 extern int iommu_domain_set_attr(struct iommu_domain *domain, enum iommu_attr,
                                 void *data);
 
+/* Window handling function prototypes */
+extern int iommu_domain_window_enable(struct iommu_domain *domain, u32 wnd_nr,
+                                     phys_addr_t offset, u64 size);
+extern void iommu_domain_window_disable(struct iommu_domain *domain, u32 wnd_nr);
 /**
  * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework
  * @domain: the iommu domain where the fault has happened
@@ -240,6 +250,18 @@ static inline int iommu_unmap(struct iommu_domain *domain, unsigned long iova,
        return -ENODEV;
 }
 
+static inline int iommu_domain_window_enable(struct iommu_domain *domain,
+                                            u32 wnd_nr, phys_addr_t paddr,
+                                            u64 size)
+{
+       return -ENODEV;
+}
+
+static inline void iommu_domain_window_disable(struct iommu_domain *domain,
+                                              u32 wnd_nr)
+{
+}
+
 static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain,
                                             unsigned long iova)
 {