diff options
-rw-r--r-- | drivers/iommu/arm-smmu-v3.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 4d6ec444a9d6..6c4111cb19ff 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c | |||
@@ -412,6 +412,9 @@ | |||
412 | /* High-level queue structures */ | 412 | /* High-level queue structures */ |
413 | #define ARM_SMMU_POLL_TIMEOUT_US 100 | 413 | #define ARM_SMMU_POLL_TIMEOUT_US 100 |
414 | 414 | ||
415 | #define MSI_IOVA_BASE 0x8000000 | ||
416 | #define MSI_IOVA_LENGTH 0x100000 | ||
417 | |||
415 | static bool disable_bypass; | 418 | static bool disable_bypass; |
416 | module_param_named(disable_bypass, disable_bypass, bool, S_IRUGO); | 419 | module_param_named(disable_bypass, disable_bypass, bool, S_IRUGO); |
417 | MODULE_PARM_DESC(disable_bypass, | 420 | MODULE_PARM_DESC(disable_bypass, |
@@ -1883,6 +1886,29 @@ static int arm_smmu_of_xlate(struct device *dev, struct of_phandle_args *args) | |||
1883 | return iommu_fwspec_add_ids(dev, args->args, 1); | 1886 | return iommu_fwspec_add_ids(dev, args->args, 1); |
1884 | } | 1887 | } |
1885 | 1888 | ||
1889 | static void arm_smmu_get_resv_regions(struct device *dev, | ||
1890 | struct list_head *head) | ||
1891 | { | ||
1892 | struct iommu_resv_region *region; | ||
1893 | int prot = IOMMU_WRITE | IOMMU_NOEXEC | IOMMU_MMIO; | ||
1894 | |||
1895 | region = iommu_alloc_resv_region(MSI_IOVA_BASE, MSI_IOVA_LENGTH, | ||
1896 | prot, IOMMU_RESV_MSI); | ||
1897 | if (!region) | ||
1898 | return; | ||
1899 | |||
1900 | list_add_tail(®ion->list, head); | ||
1901 | } | ||
1902 | |||
1903 | static void arm_smmu_put_resv_regions(struct device *dev, | ||
1904 | struct list_head *head) | ||
1905 | { | ||
1906 | struct iommu_resv_region *entry, *next; | ||
1907 | |||
1908 | list_for_each_entry_safe(entry, next, head, list) | ||
1909 | kfree(entry); | ||
1910 | } | ||
1911 | |||
1886 | static struct iommu_ops arm_smmu_ops = { | 1912 | static struct iommu_ops arm_smmu_ops = { |
1887 | .capable = arm_smmu_capable, | 1913 | .capable = arm_smmu_capable, |
1888 | .domain_alloc = arm_smmu_domain_alloc, | 1914 | .domain_alloc = arm_smmu_domain_alloc, |
@@ -1898,6 +1924,8 @@ static struct iommu_ops arm_smmu_ops = { | |||
1898 | .domain_get_attr = arm_smmu_domain_get_attr, | 1924 | .domain_get_attr = arm_smmu_domain_get_attr, |
1899 | .domain_set_attr = arm_smmu_domain_set_attr, | 1925 | .domain_set_attr = arm_smmu_domain_set_attr, |
1900 | .of_xlate = arm_smmu_of_xlate, | 1926 | .of_xlate = arm_smmu_of_xlate, |
1927 | .get_resv_regions = arm_smmu_get_resv_regions, | ||
1928 | .put_resv_regions = arm_smmu_put_resv_regions, | ||
1901 | .pgsize_bitmap = -1UL, /* Restricted during device attach */ | 1929 | .pgsize_bitmap = -1UL, /* Restricted during device attach */ |
1902 | }; | 1930 | }; |
1903 | 1931 | ||