[RFC PATCH v4 0/8] Introduce automatic DMA configuration for IOMMU masters

Laurent Pinchart laurent.pinchart at ideasonboard.com
Mon Dec 15 09:55:03 PST 2014


Hi Will,

On Monday 15 December 2014 17:34:16 Will Deacon wrote:
> On Mon, Dec 15, 2014 at 05:21:16PM +0000, Laurent Pinchart wrote:
> > On Wednesday 19 November 2014 11:41:50 Will Deacon wrote:
> > > +static void __remove_iommu_mapping_entry(struct kref *kref)
> > > +{
> > > +	struct dma_iommu_mapping_entry *entry;
> > > +
> > > +	entry = container_of(kref, struct dma_iommu_mapping_entry, kref);
> > > +	list_del(&entry->list);
> > > +}
> > > +
> > > +static bool arm_setup_iommu_dma_ops(struct device *dev, u64 dma_base,
> > > u64
> > > size,
> > > +				    struct iommu_ops *iommu)
> > > +{
> > > +	struct iommu_domain *domain;
> > > +	struct dma_iommu_mapping_entry *entry = NULL;
> > > +
> > > +	if (!iommu->get_default_domain)
> > > +		return false;
> > > +
> > > +	domain = iommu->get_default_domain(dev);
> > > +	if (!domain)
> > > +		return false;
> > > +
> > > +	spin_lock(&dma_iommu_mapping_lock);
> > > +
> > > +	list_for_each_entry(entry, &dma_iommu_mapping_table, list) {
> > > +		if (entry->domain == domain)
> > > +			break;
> > > +	}
> > 
> > That might be a stupid question (fighting my impostor syndrome again
> > here), but is there a fundamental reason why we can't store the VA
> > allocation data (probably using iova) in the domain instead of having to
> > go through hoops and loops here to associate that data to the domain ?
> 
> Well, this was very much a work-in-progress that I ended up abandoning :)
> 
> Ultimately, I'd really like to see the default domain management moved into
> core code, at which point extending struct iommu_domain seems perfectly
> plausible to me (not sure if we'd have a new structure for that).
> 
> Then we'd have a fairly clean device -> group -> domain -> allocator
> abstraction for each master.

I like that. Thank you for confirming that some of my questions are sensible 
:-)

-- 
Regards,

Laurent Pinchart




More information about the linux-arm-kernel mailing list