|
@@ -231,12 +231,14 @@ static struct iovm_struct *__find_iovm_area(struct omap_iommu *obj,
|
|
|
|
|
|
/**
|
|
/**
|
|
* omap_find_iovm_area - find iovma which includes @da
|
|
* omap_find_iovm_area - find iovma which includes @da
|
|
|
|
+ * @dev: client device
|
|
* @da: iommu device virtual address
|
|
* @da: iommu device virtual address
|
|
*
|
|
*
|
|
* Find the existing iovma starting at @da
|
|
* Find the existing iovma starting at @da
|
|
*/
|
|
*/
|
|
-struct iovm_struct *omap_find_iovm_area(struct omap_iommu *obj, u32 da)
|
|
|
|
|
|
+struct iovm_struct *omap_find_iovm_area(struct device *dev, u32 da)
|
|
{
|
|
{
|
|
|
|
+ struct omap_iommu *obj = dev_to_omap_iommu(dev);
|
|
struct iovm_struct *area;
|
|
struct iovm_struct *area;
|
|
|
|
|
|
mutex_lock(&obj->mmap_lock);
|
|
mutex_lock(&obj->mmap_lock);
|
|
@@ -343,14 +345,15 @@ static void free_iovm_area(struct omap_iommu *obj, struct iovm_struct *area)
|
|
|
|
|
|
/**
|
|
/**
|
|
* omap_da_to_va - convert (d) to (v)
|
|
* omap_da_to_va - convert (d) to (v)
|
|
- * @obj: objective iommu
|
|
|
|
|
|
+ * @dev: client device
|
|
* @da: iommu device virtual address
|
|
* @da: iommu device virtual address
|
|
* @va: mpu virtual address
|
|
* @va: mpu virtual address
|
|
*
|
|
*
|
|
* Returns mpu virtual addr which corresponds to a given device virtual addr
|
|
* Returns mpu virtual addr which corresponds to a given device virtual addr
|
|
*/
|
|
*/
|
|
-void *omap_da_to_va(struct omap_iommu *obj, u32 da)
|
|
|
|
|
|
+void *omap_da_to_va(struct device *dev, u32 da)
|
|
{
|
|
{
|
|
|
|
+ struct omap_iommu *obj = dev_to_omap_iommu(dev);
|
|
void *va = NULL;
|
|
void *va = NULL;
|
|
struct iovm_struct *area;
|
|
struct iovm_struct *area;
|
|
|
|
|
|
@@ -582,16 +585,18 @@ __iommu_vmap(struct iommu_domain *domain, struct omap_iommu *obj,
|
|
|
|
|
|
/**
|
|
/**
|
|
* omap_iommu_vmap - (d)-(p)-(v) address mapper
|
|
* omap_iommu_vmap - (d)-(p)-(v) address mapper
|
|
- * @obj: objective iommu
|
|
|
|
|
|
+ * @domain: iommu domain
|
|
|
|
+ * @dev: client device
|
|
* @sgt: address of scatter gather table
|
|
* @sgt: address of scatter gather table
|
|
* @flags: iovma and page property
|
|
* @flags: iovma and page property
|
|
*
|
|
*
|
|
* Creates 1-n-1 mapping with given @sgt and returns @da.
|
|
* Creates 1-n-1 mapping with given @sgt and returns @da.
|
|
* All @sgt element must be io page size aligned.
|
|
* All @sgt element must be io page size aligned.
|
|
*/
|
|
*/
|
|
-u32 omap_iommu_vmap(struct iommu_domain *domain, struct omap_iommu *obj, u32 da,
|
|
|
|
|
|
+u32 omap_iommu_vmap(struct iommu_domain *domain, struct device *dev, u32 da,
|
|
const struct sg_table *sgt, u32 flags)
|
|
const struct sg_table *sgt, u32 flags)
|
|
{
|
|
{
|
|
|
|
+ struct omap_iommu *obj = dev_to_omap_iommu(dev);
|
|
size_t bytes;
|
|
size_t bytes;
|
|
void *va = NULL;
|
|
void *va = NULL;
|
|
|
|
|
|
@@ -622,15 +627,17 @@ EXPORT_SYMBOL_GPL(omap_iommu_vmap);
|
|
|
|
|
|
/**
|
|
/**
|
|
* omap_iommu_vunmap - release virtual mapping obtained by 'omap_iommu_vmap()'
|
|
* omap_iommu_vunmap - release virtual mapping obtained by 'omap_iommu_vmap()'
|
|
- * @obj: objective iommu
|
|
|
|
|
|
+ * @domain: iommu domain
|
|
|
|
+ * @dev: client device
|
|
* @da: iommu device virtual address
|
|
* @da: iommu device virtual address
|
|
*
|
|
*
|
|
* Free the iommu virtually contiguous memory area starting at
|
|
* Free the iommu virtually contiguous memory area starting at
|
|
* @da, which was returned by 'omap_iommu_vmap()'.
|
|
* @da, which was returned by 'omap_iommu_vmap()'.
|
|
*/
|
|
*/
|
|
struct sg_table *
|
|
struct sg_table *
|
|
-omap_iommu_vunmap(struct iommu_domain *domain, struct omap_iommu *obj, u32 da)
|
|
|
|
|
|
+omap_iommu_vunmap(struct iommu_domain *domain, struct device *dev, u32 da)
|
|
{
|
|
{
|
|
|
|
+ struct omap_iommu *obj = dev_to_omap_iommu(dev);
|
|
struct sg_table *sgt;
|
|
struct sg_table *sgt;
|
|
/*
|
|
/*
|
|
* 'sgt' is allocated before 'omap_iommu_vmalloc()' is called.
|
|
* 'sgt' is allocated before 'omap_iommu_vmalloc()' is called.
|
|
@@ -647,7 +654,7 @@ EXPORT_SYMBOL_GPL(omap_iommu_vunmap);
|
|
|
|
|
|
/**
|
|
/**
|
|
* omap_iommu_vmalloc - (d)-(p)-(v) address allocator and mapper
|
|
* omap_iommu_vmalloc - (d)-(p)-(v) address allocator and mapper
|
|
- * @obj: objective iommu
|
|
|
|
|
|
+ * @dev: client device
|
|
* @da: contiguous iommu virtual memory
|
|
* @da: contiguous iommu virtual memory
|
|
* @bytes: allocation size
|
|
* @bytes: allocation size
|
|
* @flags: iovma and page property
|
|
* @flags: iovma and page property
|
|
@@ -656,9 +663,10 @@ EXPORT_SYMBOL_GPL(omap_iommu_vunmap);
|
|
* @da again, which might be adjusted if 'IOVMF_DA_FIXED' is not set.
|
|
* @da again, which might be adjusted if 'IOVMF_DA_FIXED' is not set.
|
|
*/
|
|
*/
|
|
u32
|
|
u32
|
|
-omap_iommu_vmalloc(struct iommu_domain *domain, struct omap_iommu *obj, u32 da,
|
|
|
|
|
|
+omap_iommu_vmalloc(struct iommu_domain *domain, struct device *dev, u32 da,
|
|
size_t bytes, u32 flags)
|
|
size_t bytes, u32 flags)
|
|
{
|
|
{
|
|
|
|
+ struct omap_iommu *obj = dev_to_omap_iommu(dev);
|
|
void *va;
|
|
void *va;
|
|
struct sg_table *sgt;
|
|
struct sg_table *sgt;
|
|
|
|
|
|
@@ -698,15 +706,16 @@ EXPORT_SYMBOL_GPL(omap_iommu_vmalloc);
|
|
|
|
|
|
/**
|
|
/**
|
|
* omap_iommu_vfree - release memory allocated by 'omap_iommu_vmalloc()'
|
|
* omap_iommu_vfree - release memory allocated by 'omap_iommu_vmalloc()'
|
|
- * @obj: objective iommu
|
|
|
|
|
|
+ * @dev: client device
|
|
* @da: iommu device virtual address
|
|
* @da: iommu device virtual address
|
|
*
|
|
*
|
|
* Frees the iommu virtually continuous memory area starting at
|
|
* Frees the iommu virtually continuous memory area starting at
|
|
* @da, as obtained from 'omap_iommu_vmalloc()'.
|
|
* @da, as obtained from 'omap_iommu_vmalloc()'.
|
|
*/
|
|
*/
|
|
-void omap_iommu_vfree(struct iommu_domain *domain, struct omap_iommu *obj,
|
|
|
|
|
|
+void omap_iommu_vfree(struct iommu_domain *domain, struct device *dev,
|
|
const u32 da)
|
|
const u32 da)
|
|
{
|
|
{
|
|
|
|
+ struct omap_iommu *obj = dev_to_omap_iommu(dev);
|
|
struct sg_table *sgt;
|
|
struct sg_table *sgt;
|
|
|
|
|
|
sgt = unmap_vm_area(domain, obj, da, vfree,
|
|
sgt = unmap_vm_area(domain, obj, da, vfree,
|