[RESEND PATCH v6 14/14] iommu/rockchip: Support sharing IOMMU between masters

JeffyChen jeffy.chen at rock-chips.com
Thu Mar 1 03:14:10 PST 2018


Hi Robin,

On 03/01/2018 07:03 PM, Robin Murphy wrote:
>>
>> +static struct iommu_group *rk_iommu_device_group(struct device *dev)
>> +{
>> +    struct rk_iommu *iommu;
>> +
>> +    iommu = rk_iommu_from_dev(dev);
>> +
>> +    return iommu->group;
>
> Oops, seems I overlooked this in my previous review - it should really be:
>
>      return iommu_group_get(iommu->group);
>
> or the refcounting will be unbalanced on those future systems where it
> really will be called more than once.
>
hmmm, right, it should be return iommu_group_ref_get(iommu->group);

i was following omap iommu:
static struct iommu_group *omap_iommu_device_group(struct device *dev)
{
         struct omap_iommu_arch_data *arch_data = dev->archdata.iommu;
         struct iommu_group *group = ERR_PTR(-EINVAL);

         if (arch_data->iommu_dev)
                 group = arch_data->iommu_dev->group;

         return group;
}

will fix it too in the version.

> Robin.





More information about the Linux-rockchip mailing list