diff options
-rw-r--r-- | drivers/iommu/arm-smmu.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index a60cded8a6ed..a354572491c8 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c | |||
@@ -281,6 +281,9 @@ enum arm_smmu_s2cr_privcfg { | |||
281 | 281 | ||
282 | #define FSYNR0_WNR (1 << 4) | 282 | #define FSYNR0_WNR (1 << 4) |
283 | 283 | ||
284 | #define MSI_IOVA_BASE 0x8000000 | ||
285 | #define MSI_IOVA_LENGTH 0x100000 | ||
286 | |||
284 | static int force_stage; | 287 | static int force_stage; |
285 | module_param(force_stage, int, S_IRUGO); | 288 | module_param(force_stage, int, S_IRUGO); |
286 | MODULE_PARM_DESC(force_stage, | 289 | MODULE_PARM_DESC(force_stage, |
@@ -1549,6 +1552,29 @@ static int arm_smmu_of_xlate(struct device *dev, struct of_phandle_args *args) | |||
1549 | return iommu_fwspec_add_ids(dev, &fwid, 1); | 1552 | return iommu_fwspec_add_ids(dev, &fwid, 1); |
1550 | } | 1553 | } |
1551 | 1554 | ||
1555 | static void arm_smmu_get_resv_regions(struct device *dev, | ||
1556 | struct list_head *head) | ||
1557 | { | ||
1558 | struct iommu_resv_region *region; | ||
1559 | int prot = IOMMU_WRITE | IOMMU_NOEXEC | IOMMU_MMIO; | ||
1560 | |||
1561 | region = iommu_alloc_resv_region(MSI_IOVA_BASE, MSI_IOVA_LENGTH, | ||
1562 | prot, IOMMU_RESV_MSI); | ||
1563 | if (!region) | ||
1564 | return; | ||
1565 | |||
1566 | list_add_tail(®ion->list, head); | ||
1567 | } | ||
1568 | |||
1569 | static void arm_smmu_put_resv_regions(struct device *dev, | ||
1570 | struct list_head *head) | ||
1571 | { | ||
1572 | struct iommu_resv_region *entry, *next; | ||
1573 | |||
1574 | list_for_each_entry_safe(entry, next, head, list) | ||
1575 | kfree(entry); | ||
1576 | } | ||
1577 | |||
1552 | static struct iommu_ops arm_smmu_ops = { | 1578 | static struct iommu_ops arm_smmu_ops = { |
1553 | .capable = arm_smmu_capable, | 1579 | .capable = arm_smmu_capable, |
1554 | .domain_alloc = arm_smmu_domain_alloc, | 1580 | .domain_alloc = arm_smmu_domain_alloc, |
@@ -1564,6 +1590,8 @@ static struct iommu_ops arm_smmu_ops = { | |||
1564 | .domain_get_attr = arm_smmu_domain_get_attr, | 1590 | .domain_get_attr = arm_smmu_domain_get_attr, |
1565 | .domain_set_attr = arm_smmu_domain_set_attr, | 1591 | .domain_set_attr = arm_smmu_domain_set_attr, |
1566 | .of_xlate = arm_smmu_of_xlate, | 1592 | .of_xlate = arm_smmu_of_xlate, |
1593 | .get_resv_regions = arm_smmu_get_resv_regions, | ||
1594 | .put_resv_regions = arm_smmu_put_resv_regions, | ||
1567 | .pgsize_bitmap = -1UL, /* Restricted during device attach */ | 1595 | .pgsize_bitmap = -1UL, /* Restricted during device attach */ |
1568 | }; | 1596 | }; |
1569 | 1597 | ||