Loading drivers/iommu/arm-smmu.c +22 −3 Original line number Diff line number Diff line Loading @@ -5086,12 +5086,31 @@ static phys_addr_t qsmmuv500_iova_to_phys_hard( { u16 sid; struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain); struct arm_smmu_cfg *cfg = &smmu_domain->cfg; struct arm_smmu_device *smmu = smmu_domain->smmu; struct iommu_fwspec *fwspec; void __iomem *gr1_base; u32 frsynra; /* Select a sid */ /* 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 (domain->is_debug_domain) { fwspec = smmu_domain->dev->iommu_fwspec; sid = (u16)fwspec->ids[0]; } else { /* If the domain belongs to an actual device, read * SID from the corresponding frsynra register */ gr1_base = ARM_SMMU_GR1(smmu); frsynra = readl_relaxed(gr1_base + ARM_SMMU_GR1_CBFRSYNRA(cfg->cbndx)); frsynra &= CBFRSYNRA_SID_MASK; sid = frsynra; } return qsmmuv500_iova_to_phys(domain, iova, sid); } Loading drivers/iommu/iommu-debug.c +4 −0 Original line number Diff line number Diff line Loading @@ -1273,6 +1273,8 @@ static int iommu_debug_attach_do_attach(struct iommu_debug_device *ddev, return -ENOMEM; } ddev->domain->is_debug_domain = true; if (is_secure && iommu_domain_set_attr(ddev->domain, DOMAIN_ATTR_SECURE_VMID, &val)) { Loading Loading @@ -1328,6 +1330,8 @@ static ssize_t __iommu_debug_dma_attach_write(struct file *file, if (!dma_mapping) goto out; dma_mapping->domain->is_debug_domain = true; if (arm_iommu_attach_device(dev, dma_mapping)) goto out_release_mapping; Loading drivers/iommu/iommu.c +1 −0 Original line number Diff line number Diff line Loading @@ -1266,6 +1266,7 @@ static struct iommu_domain *__iommu_domain_alloc(struct bus_type *bus, domain->type = type; /* Assume all sizes by default; the driver may override this later */ domain->pgsize_bitmap = bus->iommu_ops->pgsize_bitmap; domain->is_debug_domain = false; return domain; } Loading include/linux/iommu.h +1 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,7 @@ struct iommu_domain { void *handler_token; struct iommu_domain_geometry geometry; void *iova_cookie; bool is_debug_domain; }; enum iommu_cap { Loading Loading
drivers/iommu/arm-smmu.c +22 −3 Original line number Diff line number Diff line Loading @@ -5086,12 +5086,31 @@ static phys_addr_t qsmmuv500_iova_to_phys_hard( { u16 sid; struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain); struct arm_smmu_cfg *cfg = &smmu_domain->cfg; struct arm_smmu_device *smmu = smmu_domain->smmu; struct iommu_fwspec *fwspec; void __iomem *gr1_base; u32 frsynra; /* Select a sid */ /* 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 (domain->is_debug_domain) { fwspec = smmu_domain->dev->iommu_fwspec; sid = (u16)fwspec->ids[0]; } else { /* If the domain belongs to an actual device, read * SID from the corresponding frsynra register */ gr1_base = ARM_SMMU_GR1(smmu); frsynra = readl_relaxed(gr1_base + ARM_SMMU_GR1_CBFRSYNRA(cfg->cbndx)); frsynra &= CBFRSYNRA_SID_MASK; sid = frsynra; } return qsmmuv500_iova_to_phys(domain, iova, sid); } Loading
drivers/iommu/iommu-debug.c +4 −0 Original line number Diff line number Diff line Loading @@ -1273,6 +1273,8 @@ static int iommu_debug_attach_do_attach(struct iommu_debug_device *ddev, return -ENOMEM; } ddev->domain->is_debug_domain = true; if (is_secure && iommu_domain_set_attr(ddev->domain, DOMAIN_ATTR_SECURE_VMID, &val)) { Loading Loading @@ -1328,6 +1330,8 @@ static ssize_t __iommu_debug_dma_attach_write(struct file *file, if (!dma_mapping) goto out; dma_mapping->domain->is_debug_domain = true; if (arm_iommu_attach_device(dev, dma_mapping)) goto out_release_mapping; Loading
drivers/iommu/iommu.c +1 −0 Original line number Diff line number Diff line Loading @@ -1266,6 +1266,7 @@ static struct iommu_domain *__iommu_domain_alloc(struct bus_type *bus, domain->type = type; /* Assume all sizes by default; the driver may override this later */ domain->pgsize_bitmap = bus->iommu_ops->pgsize_bitmap; domain->is_debug_domain = false; return domain; } Loading
include/linux/iommu.h +1 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,7 @@ struct iommu_domain { void *handler_token; struct iommu_domain_geometry geometry; void *iova_cookie; bool is_debug_domain; }; enum iommu_cap { Loading