Re: [PATCH] [PATCH] Adding offset keeping option when mapping data via SWIOTLB.

From: Christoph Hellwig
Date: Tue Nov 24 2020 - 06:49:13 EST


On Mon, Nov 23, 2020 at 02:18:07PM -0800, Jianxiong Gao wrote:
> NVMe driver and other applications may depend on the data offset
> to operate correctly. Currently when unaligned data is mapped via
> SWIOTLB, the data is mapped as slab aligned with the SWIOTLB. When
> booting with --swiotlb=force option and using NVMe as interface,
> running mkfs.xfs on Rhel fails because of the unalignment issue.
> This patch adds an option to make sure the mapped data preserves
> its offset of the orginal addrss. Tested on latest kernel that
> this patch fixes the issue.
>
> Signed-off-by: Jianxiong Gao <jxgao@xxxxxxxxxx>
> Acked-by: David Rientjes <rientjes@xxxxxxxxxx>

I think we actually need to do this by default. There are plenty
of other hardware designs that rely on dma mapping not adding
offsets that did not exist, e.g. ahci and various RDMA NICs.