diff options
author | Joerg Roedel <jroedel@suse.de> | 2016-07-05 07:07:53 -0400 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2016-07-13 06:46:05 -0400 |
commit | 33b21a6b203f70e2012b02753134e59c3ab38779 (patch) | |
tree | dee32522644e5dd8b3e2bc52169eae2ea6facf50 | |
parent | b548e786ce47017107765bbeb0f100202525ea83 (diff) |
iommu: Add apply_dm_region call-back to iommu-ops
This new call-back will be used by the iommu driver to do
reserve the given dm_region in its iova space before the
mapping is created.
The call-back is temporary until the dma-ops implementation
is part of the common iommu code.
Signed-off-by: Joerg Roedel <jroedel@suse.de>
-rw-r--r-- | drivers/iommu/iommu.c | 3 | ||||
-rw-r--r-- | include/linux/iommu.h | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 3000051f48b4..e8d2fb02d88e 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c | |||
@@ -348,6 +348,9 @@ static int iommu_group_create_direct_mappings(struct iommu_group *group, | |||
348 | list_for_each_entry(entry, &mappings, list) { | 348 | list_for_each_entry(entry, &mappings, list) { |
349 | dma_addr_t start, end, addr; | 349 | dma_addr_t start, end, addr; |
350 | 350 | ||
351 | if (domain->ops->apply_dm_region) | ||
352 | domain->ops->apply_dm_region(dev, domain, entry); | ||
353 | |||
351 | start = ALIGN(entry->start, pg_size); | 354 | start = ALIGN(entry->start, pg_size); |
352 | end = ALIGN(entry->start + entry->length, pg_size); | 355 | end = ALIGN(entry->start + entry->length, pg_size); |
353 | 356 | ||
diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 664683aedcce..a35fb8b42e1a 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h | |||
@@ -152,6 +152,7 @@ struct iommu_dm_region { | |||
152 | * @domain_set_attr: Change domain attributes | 152 | * @domain_set_attr: Change domain attributes |
153 | * @get_dm_regions: Request list of direct mapping requirements for a device | 153 | * @get_dm_regions: Request list of direct mapping requirements for a device |
154 | * @put_dm_regions: Free list of direct mapping requirements for a device | 154 | * @put_dm_regions: Free list of direct mapping requirements for a device |
155 | * @apply_dm_region: Temporary helper call-back for iova reserved ranges | ||
155 | * @domain_window_enable: Configure and enable a particular window for a domain | 156 | * @domain_window_enable: Configure and enable a particular window for a domain |
156 | * @domain_window_disable: Disable a particular window for a domain | 157 | * @domain_window_disable: Disable a particular window for a domain |
157 | * @domain_set_windows: Set the number of windows for a domain | 158 | * @domain_set_windows: Set the number of windows for a domain |
@@ -186,6 +187,8 @@ struct iommu_ops { | |||
186 | /* Request/Free a list of direct mapping requirements for a device */ | 187 | /* Request/Free a list of direct mapping requirements for a device */ |
187 | void (*get_dm_regions)(struct device *dev, struct list_head *list); | 188 | void (*get_dm_regions)(struct device *dev, struct list_head *list); |
188 | void (*put_dm_regions)(struct device *dev, struct list_head *list); | 189 | void (*put_dm_regions)(struct device *dev, struct list_head *list); |
190 | void (*apply_dm_region)(struct device *dev, struct iommu_domain *domain, | ||
191 | struct iommu_dm_region *region); | ||
189 | 192 | ||
190 | /* Window handling functions */ | 193 | /* Window handling functions */ |
191 | int (*domain_window_enable)(struct iommu_domain *domain, u32 wnd_nr, | 194 | int (*domain_window_enable)(struct iommu_domain *domain, u32 wnd_nr, |