Re: [PATCH v4 17/18] nvmet: New NVMe PCI endpoint target driver

Christoph Hellwig
2024-12-19T05:47:05Z

On Tue, Dec 17, 2024 at 10:11:49PM +0530, Manivannan Sadhasivam wrote:
> 'iomem' is just a token that is used by sparse tool to verify correctness of
> MMIO address handling.

That is true, but we don't have the token just for fun, but because iomem
needs to be treated differently.

> I know that the memory here is returned by
> dma_alloc_coherent() and is not exactly a MMIO. But since you are using
> READ_ONCE() and le32_to_cpu() on these addresses, I thought about suggesting
> readl/writel that does exactly the same internally. If you do not need ordering,
> then you can use relaxed variants as well.

No, using readl/writel on dma_alloc_coherent buffers is simply wrong.