summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchel Humpherys <mitchelh@codeaurora.org>2016-03-22 10:57:24 -0700
committerJeevan Shriram <jshriram@codeaurora.org>2016-05-20 19:23:51 -0700
commit680e07481cf7e87ddd2ff4835d05e018e61b189e (patch)
tree80eaca7ce0ed8b3b28ec56d6766240a2e5299608
parenta3250a9555f1adf9367d2c82329671b2ef35311a (diff)
iommu/arm-smmu: Implement .get_pgsize_bitmap for domain
Currently we restrict the pgsize_bitmap for the entire SMMU every time we allocate some new page tables. However, certain io-pgtable implementations might wish to restrict the formats beyond the restrictions of the SMMU itself, which forces all domains on that SMMU to the same pgsize_bitmap, even if the other domains would prefer to use a more permissive page table format. Besides that, some SMMUs in the system might have different supported page sizes at the hardware level, so applying those to everyone else is wrong. Fix these issues by implementing the new .get_pgsize_bitmap IOMMU op. CRs-Fixed: 997751 Change-Id: I9a73a31ee63a054cc44c50a21f7a616efd4af964 Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
-rw-r--r--drivers/iommu/arm-smmu.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index 88cfb4df163c..9ee9acef7264 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -1663,9 +1663,6 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain,
arm_smmu_secure_domain_unlock(smmu_domain);
}
- /* Update our support page sizes to reflect the page table format */
- arm_smmu_ops.pgsize_bitmap = smmu_domain->pgtbl_cfg.pgsize_bitmap;
-
/* Initialise the context bank with our page table cfg */
arm_smmu_init_context_bank(smmu_domain, &smmu_domain->pgtbl_cfg);
@@ -3053,6 +3050,23 @@ static int arm_smmu_dma_supported(struct iommu_domain *domain,
return ret;
}
+static unsigned long arm_smmu_get_pgsize_bitmap(struct iommu_domain *domain)
+{
+ struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain);
+
+ /*
+ * if someone is calling map before attach just return the
+ * supported page sizes for the hardware itself.
+ */
+ if (!smmu_domain->pgtbl_cfg.pgsize_bitmap)
+ return arm_smmu_ops.pgsize_bitmap;
+ /*
+ * otherwise return the page sizes supported by this specific page
+ * table configuration
+ */
+ return smmu_domain->pgtbl_cfg.pgsize_bitmap;
+}
+
static struct iommu_ops arm_smmu_ops = {
.capable = arm_smmu_capable,
.domain_alloc = arm_smmu_domain_alloc,
@@ -3070,6 +3084,7 @@ static struct iommu_ops arm_smmu_ops = {
.domain_get_attr = arm_smmu_domain_get_attr,
.domain_set_attr = arm_smmu_domain_set_attr,
.pgsize_bitmap = -1UL, /* Restricted during device attach */
+ .get_pgsize_bitmap = arm_smmu_get_pgsize_bitmap,
.dma_supported = arm_smmu_dma_supported,
.trigger_fault = arm_smmu_trigger_fault,
.reg_read = arm_smmu_reg_read,