[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20181218190412.GE21992@ziepe.ca>
Date: Tue, 18 Dec 2018 12:04:12 -0700
From: Jason Gunthorpe <jgg@...pe.ca>
To: Christoph Hellwig <hch@....de>
Cc: Stephen Warren <swarren@...dotorg.org>,
Tariq Toukan <tariqt@...lanox.com>, xavier.huwei@...wei.com,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
Doug Ledford <dledford@...hat.com>
Subject: Re: [RFC PATCH] net/mlx4: Get rid of page operation after
dma_alloc_coherent
On Tue, Dec 18, 2018 at 07:50:12PM +0100, Christoph Hellwig wrote:
> On Tue, Dec 18, 2018 at 11:43:08AM -0700, Jason Gunthorpe wrote:
> > So the problem here is that on some arches
> >
> > sg_set_buf(sg, dma_coherent_buf, size)
> > p = sg_virt(sg);
> > assert(p == dma_coherent_buf);
>
> dma allocations purely return a virtual address, you must never
> call virt_to_page or virt_to_phys on them, which sg_set_buf
> will do. On many architectures this will give your the wrong
> result as the coherent DMA address is a vmap or ioremap address.
Yes, that is what I gathered - if that is the design then I'd say that
drivers shouldn't be stuffing these DMA coherent virtual addresses
into a sg at all.
Jason
Powered by blists - more mailing lists