summaryrefslogtreecommitdiffstats
path: root/drivers/iommu/iommu.c
diff options
context:
space:
mode:
authorEric Auger <eric.auger@redhat.com>2017-01-19 20:57:49 +0000
committerWill Deacon <will.deacon@arm.com>2017-01-23 11:48:16 +0000
commit2b20cbba3390a55c511acba2f0f517dd27a528b2 (patch)
treef88d74a181db5f6d0b7c801c51ab18db26ab16ed /drivers/iommu/iommu.c
parentd30ddcaa7b028049cdfee3a40248002d07b2bbf3 (diff)
downloadlinux-stable-2b20cbba3390a55c511acba2f0f517dd27a528b2.tar.gz
linux-stable-2b20cbba3390a55c511acba2f0f517dd27a528b2.tar.bz2
linux-stable-2b20cbba3390a55c511acba2f0f517dd27a528b2.zip
iommu: iommu_alloc_resv_region
Introduce a new helper serving the purpose to allocate a reserved region. This will be used in iommu driver implementing reserved region callbacks. Signed-off-by: Eric Auger <eric.auger@redhat.com> Reviewed-by: Tomasz Nowicki <tomasz.nowicki@caviumnetworks.com> Tested-by: Tomasz Nowicki <tomasz.nowicki@caviumnetworks.com> Tested-by: Bharat Bhushan <bharat.bhushan@nxp.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'drivers/iommu/iommu.c')
-rw-r--r--drivers/iommu/iommu.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 1cee5c361c21..927878d0a612 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -1575,6 +1575,24 @@ void iommu_put_resv_regions(struct device *dev, struct list_head *list)
ops->put_resv_regions(dev, list);
}
+struct iommu_resv_region *iommu_alloc_resv_region(phys_addr_t start,
+ size_t length,
+ int prot, int type)
+{
+ struct iommu_resv_region *region;
+
+ region = kzalloc(sizeof(*region), GFP_KERNEL);
+ if (!region)
+ return NULL;
+
+ INIT_LIST_HEAD(&region->list);
+ region->start = start;
+ region->length = length;
+ region->prot = prot;
+ region->type = type;
+ return region;
+}
+
/* Request that a device is direct mapped by the IOMMU */
int iommu_request_dm_for_dev(struct device *dev)
{