|
@@ -515,6 +515,12 @@ static long tce_iommu_build_v2(struct tce_container *container,
|
|
|
unsigned long hpa;
|
|
|
enum dma_data_direction dirtmp;
|
|
|
|
|
|
+ if (!tbl->it_userspace) {
|
|
|
+ ret = tce_iommu_userspace_view_alloc(tbl);
|
|
|
+ if (ret)
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+
|
|
|
for (i = 0; i < pages; ++i) {
|
|
|
struct mm_iommu_table_group_mem_t *mem = NULL;
|
|
|
unsigned long *pua = IOMMU_TABLE_USERSPACE_ENTRY(tbl,
|
|
@@ -588,15 +594,6 @@ static long tce_iommu_create_table(struct tce_container *container,
|
|
|
WARN_ON(!ret && !(*ptbl)->it_ops->free);
|
|
|
WARN_ON(!ret && ((*ptbl)->it_allocated_size != table_size));
|
|
|
|
|
|
- if (!ret && container->v2) {
|
|
|
- ret = tce_iommu_userspace_view_alloc(*ptbl);
|
|
|
- if (ret)
|
|
|
- (*ptbl)->it_ops->free(*ptbl);
|
|
|
- }
|
|
|
-
|
|
|
- if (ret)
|
|
|
- decrement_locked_vm(table_size >> PAGE_SHIFT);
|
|
|
-
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
@@ -1068,10 +1065,7 @@ static int tce_iommu_take_ownership(struct tce_container *container,
|
|
|
if (!tbl || !tbl->it_map)
|
|
|
continue;
|
|
|
|
|
|
- rc = tce_iommu_userspace_view_alloc(tbl);
|
|
|
- if (!rc)
|
|
|
- rc = iommu_take_ownership(tbl);
|
|
|
-
|
|
|
+ rc = iommu_take_ownership(tbl);
|
|
|
if (rc) {
|
|
|
for (j = 0; j < i; ++j)
|
|
|
iommu_release_ownership(
|