Re: [PATCH V2 3/3] Adding device_dma_parameters->offset_preserve_mask to NVMe driver.

From: Robin Murphy
Date: Tue Feb 02 2021 - 07:10:09 EST


On 2021-02-02 11:21, Andy Shevchenko wrote:
On Mon, Feb 01, 2021 at 04:25:55PM -0800, Jianxiong Gao wrote:

+ if (dma_set_min_align_mask(dev->dev, NVME_CTRL_PAGE_SIZE - 1))

Side note: we have DMA_BIT_MASK(), please use it.

FWIW I'd actually disagree on that point. Conceptually, this is a very different thing from dev->{coherent_}dma_mask. It does not need to handle everything up to 2^64-1 correctly without overflow issues, and data alignments typically *are* defined in terms of sizes rather than numbers of bits.

In fact, it might be neat to just have callers pass a size directly to a dma_set_min_align() interface which asserts that it is a power of two and stores it as a mask internally.

Robin.


+ dev_warn(dev->dev, "dma_set_min_align_mask failed to
set offset\n");