Re: [PATCH v6 4/6] iommu/tegra-smmu: Use swgrp pointer instead of swgroup id

2021-10-07 Thread Thierry Reding
On Mon, Sep 13, 2021 at 06:38:56PM -0700, Nicolin Chen wrote:
> This patch changes in struct tegra_smmu_group to use swgrp
> pointer instead of swgroup, as a preparational change for
> the "mappings" debugfs feature.
> 
> Signed-off-by: Nicolin Chen 
> ---
>  drivers/iommu/tegra-smmu.c | 12 
>  1 file changed, 8 insertions(+), 4 deletions(-)

Seems fine:

Acked-by: Thierry Reding 


signature.asc
Description: PGP signature
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

[PATCH v6 4/6] iommu/tegra-smmu: Use swgrp pointer instead of swgroup id

2021-09-13 Thread Nicolin Chen
This patch changes in struct tegra_smmu_group to use swgrp
pointer instead of swgroup, as a preparational change for
the "mappings" debugfs feature.

Signed-off-by: Nicolin Chen 
---
 drivers/iommu/tegra-smmu.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
index 0f3883045ffa..8fd4985ac91e 100644
--- a/drivers/iommu/tegra-smmu.c
+++ b/drivers/iommu/tegra-smmu.c
@@ -23,8 +23,8 @@ struct tegra_smmu_group {
struct list_head list;
struct tegra_smmu *smmu;
const struct tegra_smmu_group_soc *group_soc;
+   const struct tegra_smmu_swgroup *swgrp;
struct iommu_group *grp;
-   unsigned int swgroup;
 };
 
 struct tegra_smmu {
@@ -897,18 +897,22 @@ static struct iommu_group *tegra_smmu_device_group(struct 
device *dev)
struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
struct tegra_smmu *smmu = dev_iommu_priv_get(dev);
const struct tegra_smmu_group_soc *group_soc;
+   const struct tegra_smmu_swgroup *swgrp;
unsigned int swgroup = fwspec->ids[0];
struct tegra_smmu_group *group;
struct iommu_group *grp;
 
+   /* Find swgrp according to the swgroup id */
+   swgrp = tegra_smmu_find_swgrp(smmu, swgroup);
+
/* Find group_soc associating with swgroup */
group_soc = tegra_smmu_find_group_soc(smmu, swgroup);
 
mutex_lock(>lock);
 
-   /* Find existing iommu_group associating with swgroup or group_soc */
+   /* Find existing iommu_group associating with swgrp or group_soc */
list_for_each_entry(group, >groups, list)
-   if ((group->swgroup == swgroup) ||
+   if ((swgrp && group->swgrp == swgrp) ||
(group_soc && group->group_soc == group_soc)) {
grp = iommu_group_ref_get(group->grp);
mutex_unlock(>lock);
@@ -923,7 +927,7 @@ static struct iommu_group *tegra_smmu_device_group(struct 
device *dev)
 
INIT_LIST_HEAD(>list);
group->group_soc = group_soc;
-   group->swgroup = swgroup;
+   group->swgrp = swgrp;
group->smmu = smmu;
 
if (dev_is_pci(dev))
-- 
2.17.1

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu