iommu/io-pgtable-arm: Support IOMMU_MMIO flag

Teach the LPAE format to create Device mappings when asked.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Tested-by: Eric Auger <eric.auger@linaro.org>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
Robin Murphy 2016-04-05 12:39:31 +01:00 committed by Joerg Roedel
parent 31e6850e0f
commit fb948251e4
1 changed files with 7 additions and 2 deletions

View File

@ -355,7 +355,10 @@ static arm_lpae_iopte arm_lpae_prot_to_pte(struct arm_lpae_io_pgtable *data,
if (!(prot & IOMMU_WRITE) && (prot & IOMMU_READ)) if (!(prot & IOMMU_WRITE) && (prot & IOMMU_READ))
pte |= ARM_LPAE_PTE_AP_RDONLY; pte |= ARM_LPAE_PTE_AP_RDONLY;
if (prot & IOMMU_CACHE) if (prot & IOMMU_MMIO)
pte |= (ARM_LPAE_MAIR_ATTR_IDX_DEV
<< ARM_LPAE_PTE_ATTRINDX_SHIFT);
else if (prot & IOMMU_CACHE)
pte |= (ARM_LPAE_MAIR_ATTR_IDX_CACHE pte |= (ARM_LPAE_MAIR_ATTR_IDX_CACHE
<< ARM_LPAE_PTE_ATTRINDX_SHIFT); << ARM_LPAE_PTE_ATTRINDX_SHIFT);
} else { } else {
@ -364,7 +367,9 @@ static arm_lpae_iopte arm_lpae_prot_to_pte(struct arm_lpae_io_pgtable *data,
pte |= ARM_LPAE_PTE_HAP_READ; pte |= ARM_LPAE_PTE_HAP_READ;
if (prot & IOMMU_WRITE) if (prot & IOMMU_WRITE)
pte |= ARM_LPAE_PTE_HAP_WRITE; pte |= ARM_LPAE_PTE_HAP_WRITE;
if (prot & IOMMU_CACHE) if (prot & IOMMU_MMIO)
pte |= ARM_LPAE_PTE_MEMATTR_DEV;
else if (prot & IOMMU_CACHE)
pte |= ARM_LPAE_PTE_MEMATTR_OIWB; pte |= ARM_LPAE_PTE_MEMATTR_OIWB;
else else
pte |= ARM_LPAE_PTE_MEMATTR_NC; pte |= ARM_LPAE_PTE_MEMATTR_NC;