iommu/arm-smmu: add support for privileged mappings

ARM SMMUs support memory access control via some bits in the translation
table descriptor memory attributes. Currently we assume all translations
are "unprivileged". Add support for privileged mappings, controlled by
the IOMMU_PRIV prot flag.

Also sneak in a whitespace change for consistency with nearby code.

Change-Id: I9d922c19d7dc8e64e07b216fc1bab373aa2e733d
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
This commit is contained in:
Mitchel Humpherys 2014-09-17 12:40:40 -07:00 committed by David Keitel
parent dbb94a8568
commit 26f0709162

View file

@ -1528,18 +1528,19 @@ static int arm_smmu_alloc_init_pte(struct arm_smmu_domain *smmu_domain,
}
if (stage == 1) {
pteval |= ARM_SMMU_PTE_AP_UNPRIV | ARM_SMMU_PTE_nG;
pteval |= ARM_SMMU_PTE_nG;
if (!(prot & IOMMU_PRIV))
pteval |= ARM_SMMU_PTE_AP_UNPRIV;
if (!(prot & IOMMU_WRITE) && (prot & IOMMU_READ))
pteval |= ARM_SMMU_PTE_AP_RDONLY;
if (prot & IOMMU_CACHE)
pteval |= (MAIR_ATTR_IDX_CACHE <<
ARM_SMMU_PTE_ATTRINDX_SHIFT);
} else {
pteval |= ARM_SMMU_PTE_HAP_FAULT;
if (prot & IOMMU_READ)
if (prot & IOMMU_READ && !(prot & IOMMU_PRIV))
pteval |= ARM_SMMU_PTE_HAP_READ;
if (prot & IOMMU_WRITE)
if (prot & IOMMU_WRITE && !(prot & IOMMU_PRIV))
pteval |= ARM_SMMU_PTE_HAP_WRITE;
if (prot & IOMMU_CACHE)
pteval |= ARM_SMMU_PTE_MEMATTR_OIWB;