[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231127093210.GA3662@lst.de>
Date: Mon, 27 Nov 2023 10:32:10 +0100
From: Christoph Hellwig <hch@....de>
To: Zhaoyang Huang <huangzhaoyang@...il.com>
Cc: Christoph Hellwig <hch@....de>,
"zhaoyang.huang" <zhaoyang.huang@...soc.com>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Robin Murphy <robin.murphy@....com>, iommu@...ts.linux.dev,
linux-kernel@...r.kernel.org, steve.kang@...soc.com
Subject: Re: [PATCH] kernel: dma: let dma use vmalloc area
On Mon, Nov 27, 2023 at 04:56:45PM +0800, Zhaoyang Huang wrote:
> Sorry for the confusion, please find below codes for more information.
> dma_init_coherent_memory
> memremap
> addr = ioremap_wt(offset, size);
> What I mean is addr is a vmalloc address, which is implicitly mapped
> by dma's framework and not be aware of to the driver.
Yes. And it is only returned from dma_alloc_coherent, which should
never be passed to dma_map_<anything>.
> Please correct me if I am wrong. According to my understanding, cache
> consistency could be solved inside dma_map_page via either
> dma_direct_map_page(swio/arch_sync_dma_for_device) or ops->map_page.
> The original thought of rejecting vmalloc is that this pa is not safe
> as this mapping could go in any time. What I am suggesting is to let
> this kind of va be enrolled.
But that only works for the direct mapping. It does not work for the
additional aliases created by vmap/ioremap/memremap. Now that only
matters if the cache is virtually indexed, which is rather unusual
these days.
Powered by blists - more mailing lists