Commit 33b21a6b authored by Joerg Roedel's avatar Joerg Roedel

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: default avatarJoerg Roedel <jroedel@suse.de>
parent b548e786
...@@ -348,6 +348,9 @@ static int iommu_group_create_direct_mappings(struct iommu_group *group, ...@@ -348,6 +348,9 @@ static int iommu_group_create_direct_mappings(struct iommu_group *group,
list_for_each_entry(entry, &mappings, list) { list_for_each_entry(entry, &mappings, list) {
dma_addr_t start, end, addr; dma_addr_t start, end, addr;
if (domain->ops->apply_dm_region)
domain->ops->apply_dm_region(dev, domain, entry);
start = ALIGN(entry->start, pg_size); start = ALIGN(entry->start, pg_size);
end = ALIGN(entry->start + entry->length, pg_size); end = ALIGN(entry->start + entry->length, pg_size);
......
...@@ -152,6 +152,7 @@ struct iommu_dm_region { ...@@ -152,6 +152,7 @@ struct iommu_dm_region {
* @domain_set_attr: Change domain attributes * @domain_set_attr: Change domain attributes
* @get_dm_regions: Request list of direct mapping requirements for a device * @get_dm_regions: Request list of direct mapping requirements for a device
* @put_dm_regions: Free list of direct mapping requirements for a device * @put_dm_regions: Free list of direct mapping requirements for a device
* @apply_dm_region: Temporary helper call-back for iova reserved ranges
* @domain_window_enable: Configure and enable a particular window for a domain * @domain_window_enable: Configure and enable a particular window for a domain
* @domain_window_disable: Disable a particular window for a domain * @domain_window_disable: Disable a particular window for a domain
* @domain_set_windows: Set the number of windows for a domain * @domain_set_windows: Set the number of windows for a domain
...@@ -186,6 +187,8 @@ struct iommu_ops { ...@@ -186,6 +187,8 @@ struct iommu_ops {
/* Request/Free a list of direct mapping requirements for a device */ /* Request/Free a list of direct mapping requirements for a device */
void (*get_dm_regions)(struct device *dev, struct list_head *list); void (*get_dm_regions)(struct device *dev, struct list_head *list);
void (*put_dm_regions)(struct device *dev, struct list_head *list); void (*put_dm_regions)(struct device *dev, struct list_head *list);
void (*apply_dm_region)(struct device *dev, struct iommu_domain *domain,
struct iommu_dm_region *region);
/* Window handling functions */ /* Window handling functions */
int (*domain_window_enable)(struct iommu_domain *domain, u32 wnd_nr, int (*domain_window_enable)(struct iommu_domain *domain, u32 wnd_nr,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment