diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index bd8c3d9d1790..a83d294386df 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -3526,11 +3526,6 @@ static int arm_smmu_domain_get_attr(struct iommu_domain *domain, smmu_domain->attributes); ret = 0; break; - case DOMAIN_ATTR_DEBUG: - *((int *)data) = test_bit(DOMAIN_ATTR_DEBUG, - smmu_domain->attributes); - ret = 0; - break; default: ret = -ENODEV; break; @@ -3765,16 +3760,6 @@ static int __arm_smmu_domain_set_attr2(struct iommu_domain *domain, } break; } - case DOMAIN_ATTR_DEBUG: { - int is_debug_domain = *((int *)data); - - if (is_debug_domain) - set_bit(DOMAIN_ATTR_DEBUG, smmu_domain->attributes); - else - clear_bit(DOMAIN_ATTR_DEBUG, smmu_domain->attributes); - ret = 0; - break; - } default: ret = -ENODEV; } @@ -5595,19 +5580,17 @@ static phys_addr_t qsmmuv500_iova_to_phys_hard( { u16 sid; struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain); + struct msm_iommu_domain *msm_domain = to_msm_iommu_domain(domain); struct arm_smmu_cfg *cfg = &smmu_domain->cfg; struct arm_smmu_device *smmu = smmu_domain->smmu; struct iommu_fwspec *fwspec; u32 frsynra; - int is_debug_domain; - - arm_smmu_domain_get_attr(domain, DOMAIN_ATTR_DEBUG, &is_debug_domain); /* Check to see if the domain is associated with the test * device. If the domain belongs to the test device, then * pick the SID from fwspec. */ - if (is_debug_domain) { + if (msm_domain->is_debug_domain) { fwspec = dev_iommu_fwspec_get(smmu_domain->dev); sid = (u16)fwspec->ids[0]; } else { diff --git a/drivers/iommu/iommu-debug.c b/drivers/iommu/iommu-debug.c index 958b11aa49a5..246e44e0b497 100644 --- a/drivers/iommu/iommu-debug.c +++ b/drivers/iommu/iommu-debug.c @@ -209,8 +209,6 @@ static int iommu_debug_set_attrs(struct iommu_debug_device *ddev, iommu_domain_set_attr(domain, DOMAIN_ATTR_SECURE_VMID, &attrs->vmid); - iommu_domain_set_attr(domain, DOMAIN_ATTR_DEBUG, &val); - return 0; } @@ -237,6 +235,7 @@ static int iommu_debug_dma_reconfigure(struct iommu_debug_device *ddev, const struct iommu_ops *iommu; struct iommu_domain *domain; + struct msm_iommu_domain *msm_domain; struct device *dev = ddev->dev; int is_fast; bool coherent; @@ -276,6 +275,9 @@ static int iommu_debug_dma_reconfigure(struct iommu_debug_device *ddev, return -EINVAL; } + msm_domain = to_msm_iommu_domain(domain); + msm_domain->is_debug_domain = true; + if (iommu_debug_set_attrs(ddev, domain, attrs)) { dev_err_ratelimited(dev, "Setting attrs failed\n"); goto out_free_domain; diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 923a8ec9040d..38e470ea32bb 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -117,6 +117,7 @@ struct iommu_domain { struct msm_iommu_domain { char name[IOMMU_DOMAIN_NAME_LEN]; + bool is_debug_domain; struct iommu_domain iommu_domain; }; @@ -178,8 +179,7 @@ enum iommu_attr { #define DOMAIN_ATTR_CB_STALL_DISABLE (EXTENDED_ATTR_BASE + 16) #define DOMAIN_ATTR_USE_LLC_NWA (EXTENDED_ATTR_BASE + 17) #define DOMAIN_ATTR_NO_CFRE (EXTENDED_ATTR_BASE + 18) -#define DOMAIN_ATTR_DEBUG (EXTENDED_ATTR_BASE + 19) -#define DOMAIN_ATTR_EXTENDED_MAX (EXTENDED_ATTR_BASE + 20) +#define DOMAIN_ATTR_EXTENDED_MAX (EXTENDED_ATTR_BASE + 19) /* These are the possible reserved region types */ enum iommu_resv_type {