From: Mitchel Humpherys <mitch...@codeaurora.org>

The pgtbl_cfg object has a few handy properties that we'd like to make
use of later (returning the pgd in a domain attribute, for example).
Keep track of the domain pgtbl_cfg in the domain structure.

Signed-off-by: Mitchel Humpherys <mitch...@codeaurora.org>
---
 drivers/iommu/arm-smmu.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index 57bcf14..c47f883 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -409,6 +409,7 @@ enum arm_smmu_domain_stage {
 struct arm_smmu_domain {
        struct arm_smmu_device          *smmu;
        struct io_pgtable_ops           *pgtbl_ops;
+       struct io_pgtable_cfg           pgtbl_cfg;
        spinlock_t                      pgtbl_lock;
        struct arm_smmu_cfg             cfg;
        enum arm_smmu_domain_stage      stage;
@@ -840,7 +841,6 @@ static int arm_smmu_init_domain_context(struct iommu_domain 
*domain,
        int irq, start, ret = 0;
        unsigned long ias, oas;
        struct io_pgtable_ops *pgtbl_ops;
-       struct io_pgtable_cfg pgtbl_cfg;
        enum io_pgtable_fmt fmt;
        struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain);
        struct arm_smmu_cfg *cfg = &smmu_domain->cfg;
@@ -952,7 +952,7 @@ static int arm_smmu_init_domain_context(struct iommu_domain 
*domain,
                cfg->irptndx = cfg->cbndx;
        }
 
-       pgtbl_cfg = (struct io_pgtable_cfg) {
+       smmu_domain->pgtbl_cfg = (struct io_pgtable_cfg) {
                .pgsize_bitmap  = smmu->pgsize_bitmap,
                .ias            = ias,
                .oas            = oas,
@@ -961,19 +961,20 @@ static int arm_smmu_init_domain_context(struct 
iommu_domain *domain,
        };
 
        smmu_domain->smmu = smmu;
-       pgtbl_ops = alloc_io_pgtable_ops(fmt, &pgtbl_cfg, smmu_domain);
+       pgtbl_ops = alloc_io_pgtable_ops(fmt, &smmu_domain->pgtbl_cfg,
+                                        smmu_domain);
        if (!pgtbl_ops) {
                ret = -ENOMEM;
                goto out_clear_smmu;
        }
 
        /* Update the domain's page sizes to reflect the page table format */
-       domain->pgsize_bitmap = pgtbl_cfg.pgsize_bitmap;
+       domain->pgsize_bitmap = smmu_domain->pgtbl_cfg.pgsize_bitmap;
        domain->geometry.aperture_end = (1UL << ias) - 1;
        domain->geometry.force_aperture = true;
 
        /* Initialise the context bank with our page table cfg */
-       arm_smmu_init_context_bank(smmu_domain, &pgtbl_cfg);
+       arm_smmu_init_context_bank(smmu_domain, &smmu_domain->pgtbl_cfg);
 
        /*
         * Request context fault interrupt. Do this last to avoid the
-- 
1.9.1

_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

Reply via email to