Re: [PATCH] scsi: ufs: core: Limit DMA alignment check

From: Bart Van Assche
Date: Wed Feb 01 2023 - 12:20:53 EST


On 1/31/23 19:49, Bjorn Andersson wrote:
The three DMA memory regions allocated for the host memory space is
documented to require alignment of 128, 1024 and 1024 respectively, but
the returned address is checked for PAGE_SIZE alignment.

In the case these allocations are serviced by e.g. the Arm SMMU, the
size and alignment will be determined by its supported page sizes. In
most cases SZ_4K and a few larger sizes are available.

In the typical configuration this does not cause problems, but in the
event that the system PAGE_SIZE is increased beyond 4k, it's no longer
reasonable to expect that the allocation will be PAGE_SIZE aligned.

Limit the DMA alignment check to the actual alignment requirements
written in the comments in the code, to avoid the UFS core refusing to
initialize with such configuration.

Reviewed-by: Bart Van Assche <bvanassche@xxxxxxx>