diff options
author | Baptiste Reynal <b.reynal@virtualopensystems.com> | 2015-03-04 10:51:06 -0500 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2015-03-23 10:21:26 -0400 |
commit | 83a60ed8f0b5ce550afd5802b60468578db4e055 (patch) | |
tree | 9794a804ce571a32042363c983aa00a3d9c3c7a7 | |
parent | bc465aa9d045feb0e13b4a8f32cc33c1943f62d6 (diff) |
iommu/arm-smmu: fix ARM_SMMU_FEAT_TRANS_OPS condition
This patch is a fix to "iommu/arm-smmu: add support for iova_to_phys
through ATS1PR".
According to ARM documentation, translation registers are optional even
in SMMUv1, so ID0_S1TS needs to be checked to verify their presence.
Also, we check that the domain is a stage-1 domain.
Signed-off-by: Baptiste Reynal <b.reynal@virtualopensystems.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
-rw-r--r-- | drivers/iommu/arm-smmu.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index fc13dd56953e..a3adde6519f0 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c | |||
@@ -1288,10 +1288,13 @@ static phys_addr_t arm_smmu_iova_to_phys(struct iommu_domain *domain, | |||
1288 | return 0; | 1288 | return 0; |
1289 | 1289 | ||
1290 | spin_lock_irqsave(&smmu_domain->pgtbl_lock, flags); | 1290 | spin_lock_irqsave(&smmu_domain->pgtbl_lock, flags); |
1291 | if (smmu_domain->smmu->features & ARM_SMMU_FEAT_TRANS_OPS) | 1291 | if (smmu_domain->smmu->features & ARM_SMMU_FEAT_TRANS_OPS && |
1292 | smmu_domain->stage == ARM_SMMU_DOMAIN_S1) { | ||
1292 | ret = arm_smmu_iova_to_phys_hard(domain, iova); | 1293 | ret = arm_smmu_iova_to_phys_hard(domain, iova); |
1293 | else | 1294 | } else { |
1294 | ret = ops->iova_to_phys(ops, iova); | 1295 | ret = ops->iova_to_phys(ops, iova); |
1296 | } | ||
1297 | |||
1295 | spin_unlock_irqrestore(&smmu_domain->pgtbl_lock, flags); | 1298 | spin_unlock_irqrestore(&smmu_domain->pgtbl_lock, flags); |
1296 | 1299 | ||
1297 | return ret; | 1300 | return ret; |
@@ -1556,7 +1559,7 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu) | |||
1556 | return -ENODEV; | 1559 | return -ENODEV; |
1557 | } | 1560 | } |
1558 | 1561 | ||
1559 | if (smmu->version == 1 || (!(id & ID0_ATOSNS) && (id & ID0_S1TS))) { | 1562 | if ((id & ID0_S1TS) && ((smmu->version == 1) || (id & ID0_ATOSNS))) { |
1560 | smmu->features |= ARM_SMMU_FEAT_TRANS_OPS; | 1563 | smmu->features |= ARM_SMMU_FEAT_TRANS_OPS; |
1561 | dev_notice(smmu->dev, "\taddress translation ops\n"); | 1564 | dev_notice(smmu->dev, "\taddress translation ops\n"); |
1562 | } | 1565 | } |