]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
scsi: ufs: Introduce a quirk to allow only page-aligned sg entries
authorKiwoong Kim <kwmad.kim@samsung.com>
Tue, 19 Jan 2021 03:33:41 +0000 (12:33 +0900)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 21 Jan 2021 02:53:44 +0000 (21:53 -0500)
commit2b2bfc8aa519f696087475ed8e8c61850c673272
treed74967d2dc89cda465b0c416c02d0abccf0bd78b
parent60ec37555d05b023721a08005f5dbf716ab5394f
scsi: ufs: Introduce a quirk to allow only page-aligned sg entries

Some SoCs require a single scatterlist entry for smaller than page size,
i.e. 4KB. When dispatching commands with more than one scatterlist entry
under 4KB in size the following behavior is observed:

A command to read a block range is dispatched with two scatterlist entries
that are named AAA and BBB. After dispatching, the host builds two PRDT
entries and during transmission, device sends just one DATA IN because
device doesn't care about host DMA. The host then transfers the combined
amount of data from start address of the area named AAA. As a consequence,
the area that follows AAA in memory would be corrupted.

    |<------------->|
    +-------+------------         +-------+
    +  AAA  + (corrupted)   ...   +  BBB  +
    +-------+------------         +-------+

To avoid this we need to enforce page size alignment for sg entries.

Link: https://lore.kernel.org/r/56dddef94f60bd9466fd77e69f64bbbd657ed2a1.1611026909.git.kwmad.kim@samsung.com
Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ufs/ufshcd.c
drivers/scsi/ufs/ufshcd.h