[PATCH v8 08/19] arm/xen: get_dma_ops: return xen_dma_ops if we are running as xen_initial_domain

Stefano Stabellini stefano.stabellini at eu.citrix.com
Fri Oct 18 11:59:47 EDT 2013


On Fri, 18 Oct 2013, Russell King - ARM Linux wrote:
> On Fri, Oct 18, 2013 at 04:46:00PM +0100, Stefano Stabellini wrote:
> > On Fri, 18 Oct 2013, Russell King - ARM Linux wrote:
> > > On Fri, Oct 18, 2013 at 01:22:18PM +0100, Stefano Stabellini wrote:
> > > > Russell,
> > > > are you OK with this patch?
> > > 
> > > Only concern is why the change is soo large.
> > > 
> > > > > -static inline struct dma_map_ops *get_dma_ops(struct device *dev)
> > > > > +static inline struct dma_map_ops *__generic_dma_ops(struct device *dev)
> > > > >  {
> > > > >  	if (dev && dev->archdata.dma_ops)
> > > > >  		return dev->archdata.dma_ops;
> > > > >  	return &arm_dma_ops;
> > > > >  }
> > > > >  
> > > > > +static inline struct dma_map_ops *get_dma_ops(struct device *dev)
> > > > > +{
> > > > > +	if (xen_initial_domain())
> > > > > +		return xen_dma_ops;
> > > > > +	else
> > > > > +		return __generic_dma_ops(dev);
> > > > > +}
> > > > > +
> > > 
> > > What's wrong with:
> > > 
> > >  static inline struct dma_map_ops *get_dma_ops(struct device *dev)
> > >  {
> > > +	if (xen_initial_domain())
> > > +		return xen_dma_ops;
> > >  	if (dev && dev->archdata.dma_ops)
> > >  		return dev->archdata.dma_ops;
> > >  	return &arm_dma_ops;
> > >  }
> > 
> > 
> > xen_dma_ops functions might have to call back the native implementation.
> > With the above there is no way for a xen_dma_ops function to get to
> > archdata.dma_ops or arm_dma_ops.
> > This is the reason why this patch introduces __generic_dma_ops.
> 
> Ah, that's fine then, but having that described in the commit message
> would be useful.
> 
> Acked-by: Russell King <rmk+kernel at arm.linux.org.uk>
> 
> Thanks.

Thank you. I'll add a note to the commit message.



More information about the linux-arm-kernel mailing list