[Freedreno] [PATCH 5/7] iommu/arm-smmu: add support for TTBR0 attribute
Jordan Crouse
jcrouse at codeaurora.org
Tue Mar 7 16:39:53 UTC 2017
From: Jeremy Gebben <jgebben at codeaurora.org>
Add support to return the value of the TTBR0 register in response
to a request via DOMAIN_ATTR_TTBR0.
Signed-off-by: Jeremy Gebben <jgebben at codeaurora.org>
Signed-off-by: Jordan Crouse <jcrouse at codeaurora.org>
---
drivers/iommu/arm-smmu.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index 2e3879f..e051750 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -1544,6 +1544,19 @@ static int arm_smmu_domain_get_attr(struct iommu_domain *domain,
*((int *)data) = !!(smmu_domain->attributes
& (1 << DOMAIN_ATTR_ENABLE_TTBR1));
return 0;
+ case DOMAIN_ATTR_TTBR0: {
+ u64 val;
+ /* not valid until we are attached */
+ if (smmu_domain->smmu == NULL)
+ return -ENODEV;
+
+ val = smmu_domain->pgtbl_cfg.arm_lpae_s1_cfg.ttbr[0];
+ if (smmu_domain->cfg.cbar != CBAR_TYPE_S2_TRANS)
+ val |= (u64)ARM_SMMU_CB_ASID(smmu_domain->smmu,
+ &smmu_domain->cfg) << TTBRn_ASID_SHIFT;
+ *((u64 *)data) = val;
+ return 0;
+ }
default:
return -ENODEV;
}
--
1.9.1
More information about the Freedreno
mailing list