Re: [PATCH v2] scsi: ibmvscsi_tgt: Use dma_alloc_noncoherent() instead of get_zeroed_page/dma_map_single()

Christoph Hellwig
2021-10-12T05:22:09Z

On Tue, Oct 12, 2021 at 11:21:09AM +0800, Cai Huoqing wrote:
> Replacing get_zeroed_page/free_page/dma_map_single/dma_unmap_single()
> with dma_alloc_noncoherent/dma_free_noncoherent() helps to reduce
> code size, and simplify the code, and the hardware keep DMA coherent
> itself.

It might also be worth to mention that this also avoids potential
bounce buffering. Although for pseries vio devices this probably can't
happen anyway.

> + vscsi->cmd_q.base_addr = dma_alloc_noncoherent(&vdev->dev, PAGE_SIZE,
> + &vscsi->cmd_q.crq_token,
> + DMA_BIDIRECTIONAL, GFP_KERNEL);

Please avoid the overly long line.

The same comments also apply to the other patch.