aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Auger <eric.auger@redhat.com>2017-01-19 15:57:56 -0500
committerWill Deacon <will.deacon@arm.com>2017-01-23 10:00:44 -0500
commit50019f09a4baa0bd6635d4933c1bfed22d66b640 (patch)
tree094418a5bba9e16a99ec3d7d1ed2099db7528b15
parentf3ebee80b3131d4cdb49d39cf07b32afe40b811c (diff)
iommu/arm-smmu-v3: Implement reserved region get/put callbacks
The get() populates the list with the MSI IOVA reserved window. At the moment an arbitray MSI IOVA window is set at 0x8000000 of size 1MB. This will allow to report those info in iommu-group sysfs. Signed-off-by: Eric Auger <eric.auger@redhat.com> Acked-by: Will Deacon <will.deacon@arm.com> Reviewed-by: Tomasz Nowicki <tomasz.nowicki@caviumnetworks.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
-rw-r--r--drivers/iommu/arm-smmu-v3.c28
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
415static bool disable_bypass; 418static bool disable_bypass;
416module_param_named(disable_bypass, disable_bypass, bool, S_IRUGO); 419module_param_named(disable_bypass, disable_bypass, bool, S_IRUGO);
417MODULE_PARM_DESC(disable_bypass, 420MODULE_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
1889static 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(&region->list, head);
1901}
1902
1903static 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
1886static struct iommu_ops arm_smmu_ops = { 1912static 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