On Thu, Jul 13, 2023 at 04:14:45AM -0700, Christoph Hellwig wrote: > On Mon, Jul 10, 2023 at 11:42:30AM +0800, Xuan Zhuo wrote: > > This helper allows the driver change the dma mode to premapped mode. > > Under the premapped mode, the virtio core do not do dma mapping > > internally. > > > > This just work when the use_dma_api is true. If the use_dma_api is false, > > the dma options is not through the DMA APIs, that is not the standard > > way of the linux kernel. > > I have a hard time parsing this. > > More importantly having two modes seems very error prone going down > the route. If the premapping is so important, why don't we do it > always? There are a gazillion virtio drivers and most of them just use the virtio API, without bothering with these micro-optimizations. virtio already tracks addresses so mapping/unmapping them for DMA is easier done in the core. It's only networking and only with XDP where the difference becomes measureable. -- MST