iommu/arm-smmu: add support for DOMAIN_ATTR_DYNAMIC
Implement support for dynamic domain switching. This feature is only enabled when the qcom,dynamic device tree attribute for an smmu instance. In order to use dynamic domains, a non-dynamic domain must first be created and attached. This non-dynamic domain must remain attached while the device is in use. All domains must be attached before calling any mapping functions, such as iommu_map(). This allows the pagetable setup to be set up during attach based on the hardware configuration for the smmu. Before attaching a dynamic domain, the DOMAIN_ATTR_CONTEXT_BANK must be set to indicate which context bank registers should be used for any register programming. Attaching dynamic domain doesn't cause hardware register programming, but mapping operations may cause TLBI operations. Additionally, the upstream driver or hardware may do other register programming. Because the arm-smmu driver assigns context banks dynamically, the upstream driver should query DOMAIN_ATTR_CONTEXT_BANK on its non-dynamic domain, to ensure the correct value is used for all dynamic domains created. To switch domains dynamically, the upstream driver or hardware must program the TTBR0 and CONTEXTIDR registers with the values from the DOMAIN_ATTR_TTBR0 and DOMAIN_ATTR_CONTEXTIDR attributes for the desired domain. The upstream driver may also need to do other hardware specific register programming to properly synchronize the domain switch. It must ensure that all register state, except for CONTEXTIDR and TTBR0 registers, is restored at the end of the domain switch operation. DOMAIN_ATTR_PROCID may be set to any value for each domain before it is attached. This value is part of the CONTEXTIDR register, but it is not used by the SMMU hardware. Setting a unique value for this attribute in every domain can be useful for debugging. Change-Id: Ib92d06db06832700bdf56265b169ccddfb192698 Signed-off-by:Jeremy Gebben <jgebben@codeaurora.org> Signed-off-by:
Patrick Daly <pdaly@codeaurora.org>
Loading
Please register or sign in to comment