iommu/arm-smmu: Convert to iommu_capable() API function
Joerg Roedel [Fri, 5 Sep 2014 08:49:34 +0000 (10:49 +0200)]
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>

Conflicts:
drivers/iommu/arm-smmu.c

Change-Id: I397c80b29833d815ae6714777da2943b1626a9bd
(cherry-picked from next-20141106)
Signed-off-by: Hiroshi Doyu <hdoyu@nvidia.com>
Reviewed-by: Sri Krishna Chowdary <schowdary@nvidia.com>
Reviewed-on: http://git-master/r/594890

drivers/iommu/arm-smmu.c

index 951c873..43feb1d 100644 (file)
@@ -1843,20 +1843,19 @@ static phys_addr_t arm_smmu_iova_to_phys(struct iommu_domain *domain,
        return __pfn_to_phys(pte_pfn(pte)) | (iova & ~PAGE_MASK);
 }
 
-static int arm_smmu_domain_has_cap(struct iommu_domain *domain,
-                                  unsigned long cap)
+static bool arm_smmu_capable(enum iommu_cap cap)
 {
-       struct arm_smmu_domain *smmu_domain = domain->priv;
-       struct arm_smmu_device *smmu = smmu_domain->smmu;
-       u32 features = smmu ? smmu->features : 0;
-
        switch (cap) {
        case IOMMU_CAP_CACHE_COHERENCY:
-               return features & ARM_SMMU_FEAT_COHERENT_WALK;
+               /*
+                * Return true here as the SMMU can always send out coherent
+                * requests.
+                */
+               return true;
        case IOMMU_CAP_INTR_REMAP:
-               return 1; /* MSIs are just memory writes */
+               return true; /* MSIs are just memory writes */
        default:
-               return 0;
+               return false;
        }
 }
 
@@ -1961,6 +1960,7 @@ static void arm_smmu_remove_device(struct device *dev)
 }
 
 static struct iommu_ops arm_smmu_ops = {
+       .capable        = arm_smmu_capable,
        .domain_init    = arm_smmu_domain_init,
        .domain_destroy = arm_smmu_domain_destroy,
        .attach_dev     = arm_smmu_attach_dev,
@@ -1969,7 +1969,6 @@ static struct iommu_ops arm_smmu_ops = {
        .map            = arm_smmu_map,
        .unmap          = arm_smmu_unmap,
        .iova_to_phys   = arm_smmu_iova_to_phys,
-       .domain_has_cap = arm_smmu_domain_has_cap,
        .add_device     = arm_smmu_add_device,
        .remove_device  = arm_smmu_remove_device,
        .pgsize_bitmap  = (SECTION_SIZE |