diff options
author | Antonios Motakis <a.motakis@virtualopensystems.com> | 2014-10-13 09:06:16 -0400 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2014-11-14 09:41:38 -0500 |
commit | a720b41c41f5a7e4c51558cf087882c57331581f (patch) | |
tree | f5db3829bd360f1e29d06594018805e16cb23f02 | |
parent | f114040e3ea6e07372334ade75d1ee0775c355e1 (diff) |
iommu/arm-smmu: change IOMMU_EXEC to IOMMU_NOEXEC
Exposing the XN flag of the SMMU driver as IOMMU_NOEXEC instead of
IOMMU_EXEC makes it enforceable, since for IOMMUs that don't support
the XN flag pages will always be executable.
Signed-off-by: Antonios Motakis <a.motakis@virtualopensystems.com>
Acked-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Will Deacon <will.deacon@arm.com>
-rw-r--r-- | drivers/iommu/arm-smmu.c | 9 | ||||
-rw-r--r-- | include/linux/iommu.h | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 60558f794922..566c1769d9bd 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c | |||
@@ -1281,7 +1281,7 @@ static int arm_smmu_alloc_init_pte(struct arm_smmu_device *smmu, pmd_t *pmd, | |||
1281 | unsigned long pfn, int prot, int stage) | 1281 | unsigned long pfn, int prot, int stage) |
1282 | { | 1282 | { |
1283 | pte_t *pte, *start; | 1283 | pte_t *pte, *start; |
1284 | pteval_t pteval = ARM_SMMU_PTE_PAGE | ARM_SMMU_PTE_AF | ARM_SMMU_PTE_XN; | 1284 | pteval_t pteval = ARM_SMMU_PTE_PAGE | ARM_SMMU_PTE_AF; |
1285 | 1285 | ||
1286 | if (pmd_none(*pmd)) { | 1286 | if (pmd_none(*pmd)) { |
1287 | /* Allocate a new set of tables */ | 1287 | /* Allocate a new set of tables */ |
@@ -1315,10 +1315,11 @@ static int arm_smmu_alloc_init_pte(struct arm_smmu_device *smmu, pmd_t *pmd, | |||
1315 | pteval |= ARM_SMMU_PTE_MEMATTR_NC; | 1315 | pteval |= ARM_SMMU_PTE_MEMATTR_NC; |
1316 | } | 1316 | } |
1317 | 1317 | ||
1318 | if (prot & IOMMU_NOEXEC) | ||
1319 | pteval |= ARM_SMMU_PTE_XN; | ||
1320 | |||
1318 | /* If no access, create a faulting entry to avoid TLB fills */ | 1321 | /* If no access, create a faulting entry to avoid TLB fills */ |
1319 | if (prot & IOMMU_EXEC) | 1322 | if (!(prot & (IOMMU_READ | IOMMU_WRITE))) |
1320 | pteval &= ~ARM_SMMU_PTE_XN; | ||
1321 | else if (!(prot & (IOMMU_READ | IOMMU_WRITE))) | ||
1322 | pteval &= ~ARM_SMMU_PTE_PAGE; | 1323 | pteval &= ~ARM_SMMU_PTE_PAGE; |
1323 | 1324 | ||
1324 | pteval |= ARM_SMMU_PTE_SH_IS; | 1325 | pteval |= ARM_SMMU_PTE_SH_IS; |
diff --git a/include/linux/iommu.h b/include/linux/iommu.h index e6a7c9ff72f2..f47383a05d34 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h | |||
@@ -27,7 +27,7 @@ | |||
27 | #define IOMMU_READ (1 << 0) | 27 | #define IOMMU_READ (1 << 0) |
28 | #define IOMMU_WRITE (1 << 1) | 28 | #define IOMMU_WRITE (1 << 1) |
29 | #define IOMMU_CACHE (1 << 2) /* DMA cache coherency */ | 29 | #define IOMMU_CACHE (1 << 2) /* DMA cache coherency */ |
30 | #define IOMMU_EXEC (1 << 3) | 30 | #define IOMMU_NOEXEC (1 << 3) |
31 | 31 | ||
32 | struct iommu_ops; | 32 | struct iommu_ops; |
33 | struct iommu_group; | 33 | struct iommu_group; |