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);
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,
.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,