[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20130912150451.GA25905@darko.cambridge.arm.com>
Date: Thu, 12 Sep 2013 16:04:51 +0100
From: Catalin Marinas <catalin.marinas@....com>
To: Stefano Stabellini <stefano.stabellini@...citrix.com>
Cc: "xen-devel@...ts.xensource.com" <xen-devel@...ts.xensource.com>,
"Ian.Campbell@...rix.com" <Ian.Campbell@...rix.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"konrad.wilk@...cle.com" <konrad.wilk@...cle.com>
Subject: Re: [PATCH v5 11/13] xen: introduce xen_alloc/free_coherent_pages
On Thu, Sep 12, 2013 at 03:44:50PM +0100, Stefano Stabellini wrote:
> On Thu, 12 Sep 2013, Catalin Marinas wrote:
> > On Wed, Sep 11, 2013 at 06:34:17PM +0100, Stefano Stabellini wrote:
> > > On Wed, 11 Sep 2013, Catalin Marinas wrote:
> > > > static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops)
> > > > {
> > > > BUG_ON(!dev);
> > > > @@ -32,7 +39,7 @@ static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops)
> > > >
> > > > static inline int dma_set_mask(struct device *dev, u64 mask)
> > > > {
> > > > - return get_dma_ops(dev)->set_dma_mask(dev, mask);
> > > > + return __get_dma_ops(dev)->set_dma_mask(dev, mask);
> > > > }
> > > >
> > > > #ifdef __arch_page_to_dma
> > >
> > > I don't understand the reason for this change though: shouldn't
> > > set_dma_mask go via the "default" (whatever that is), like the others?
> >
> > Under Xen, this would mean xen_dma_ops->set_dma_mask(). I thought you
> > want to set the default dma address.
> >
> > I can see why you may want set_dma_mask() for xen_dma_ops but in also
> > needs to be passed to __get_dma_ops(dev)->set_dma_ops() otherwise the
> > actual dma_alloc_attrs() will miss the mask (and on arm64 it does
> > bouncing via swiotlb).
>
> xen_dma_ops->set_dma_mask() is implemented by
> drivers/xen/swiotlb-xen.c:xen_swiotlb_set_dma_mask (provided by this
> patch series). The function takes care of setting:
>
> *dev->dma_mask = dma_mask;
>
> I think that should be enough to make dma_alloc_attrs happy.
I think it would be safer to call __get_dma_ops()->set_dma_mask() in
case the driver overrides that and does more than dev->dma_mask setting.
I don't know whether this is the case though.
--
Catalin
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists