Re: [PATCHv5 4/9] iommu/tegra: smmu: register device to iommudynamically

From: Hiroshi Doyu
Date: Thu Nov 21 2013 - 08:39:26 EST


On Thu, 21 Nov 2013 14:23:22 +0100
Grant Likely <grant.likely@xxxxxxxxxx> wrote:

> > > +static int smmu_iommu_add_device(struct device *dev)
> > > +{
> > > + int err = -EPROBE_DEFER;
> > > + u32 swgroups = dev->platform_data;
> > > + struct dma_iommu_mapping *map = NULL;
> > > +
> > > + if (test_bit(TEGRA_SWGROUP_PPCS, swgroups))
> > > + map = smmu_handle->map[SYSTEM_PROTECTED];
> > > + else
> > > + map = smmu_handle->map[SYSTEM_DEFAULT];
> > > +
> > > + if (map)
> > > + err = arm_iommu_attach_device(dev, map);
> > > + else
> > > + return -EPROBE_DEFER;
> >
> > Given that patch 2 exists, if this test fails, then surely the
> > appropriate error code is some fatal error, not -EPROBE_DEFER; any
> > deferrals should have happened long before this point.
>
> Will need to be revisited. Patching into the core really_probe() like
> patch #2 does is a really bad approach which would mean that returning
> EPROBE_DEFER is appropriate here.

I'm going to send PATCHv6, where it's a little bit easier to discuss
further since some code are cleaned up with feedback.

We once discussed to make use of bus_notifier instead of embedding a
hook in really_probe(). This would require some change where
bus_notifer return code needs to be used to postpone device
population.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/