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>
This commit is contained in:
parent
a3250a9555
commit
680e07481c
1 changed files with 18 additions and 3 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue