introduce a quirk to allow only page-aligned sg entries
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): CGME20210119034502epcas2p1b78378690bcbdc6453f657a3379ab90a@epcas2p1.samsung.com
v6 cover introduce a quirk to allow only page-aligned sg entries
v5 -> v6: replace the way with using a quirk
v4 -> v5: collect received tags
v3 -> v4: fix some typos
v2 -> v3: rename exynos functions
v1 -> v2: rename the vops and fix some typos
Kiwoong Kim (2):
ufs: introduce a quirk to allow only page-aligned sg entries
ufs: ufs-exynos: use UFSHCD_QUIRK_ALIGN_SG_WITH_PAGE_SIZE
drivers/scsi/ufs/ufs-exynos.c | 3 ++- drivers/scsi/ufs/ufshcd.c | 2 ++ drivers/scsi/ufs/ufshcd.h | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-)
Signature · 1 line
2.7.4
PATCH RESEND v6 1/2 ufs: introduce a quirk to allow only page-aligned sg entries
Some SoCs could require one scatterlist entry for smaller than page size, i.e. 4KB. For the cases of dispatching commands with more than one scatterlist entry and under 4KB size, They could behave as follows:
Given that a command to read something
from device is dispatched with two scatterlist entries that are named AAA and BBB. After dispatching, host builds two PRDT entries and during transmission, device sends just one DATA IN because device doesn't care on host dma. The host then tranfers the whole data from start address of the area named AAA. In consequence, the area that follows AAA would be corrupted.
|<------------->|
+-------+------------ +-------+
+ AAA + (corrupted) ... + BBB +
+-------+------------ +-------+In this case, you need to force an aligment with page size for sg entries.
--- drivers/scsi/ufs/ufshcd.c | 2 ++ drivers/scsi/ufs/ufshcd.h | 4 ++++ 2 files changed, 6 insertions(+)
drivers/scsi/ufs/ufshcd.c +2 -0
@@ -4792,6 +4792,8 @@ static int ufshcd_slave_configure(struct scsi_device *sdev)struct request_queue *q = sdev->request_queue;blk_queue_update_dma_pad (q,PRDT_DATA_BYTE_COUNT_PAD -1 ); +if (hba->quirks &UFSHCD_QUIRK_ALIGN_SG_WITH_PAGE_SIZE ) +blk_queue_update_dma_alignment (q,PAGE_SIZE -1 );if (ufshcd_is_rpm_autosuspend_allowed (hba)) sdev->rpm_autosuspend =1 ;
drivers/scsi/ufs/ufshcd.h +4 -0
@@ -549,6 +549,10 @@ enum ufshcd_quirks {*/ UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL =1 <<12 , +/* +* This quirk allows only sg entries aligned with page size. +*/ + UFSHCD_QUIRK_ALIGN_SG_WITH_PAGE_SIZE = 1 << 13, }; enum ufshcd_caps {
Signature · 1 line
2.7.4
PATCH RESEND v6 2/2 ufs: ufs-exynos: use UFSHCD_QUIRK_ALIGN_SG_WITH_PAGE_SIZE
In reply to Kiwoong KimExynos needs alignment with page size because it isn't capable to transfer data in one DATA IN to seversal areas.
--- drivers/scsi/ufs/ufs-exynos.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/ufs/ufs-exynos.c +2 -1
@@ -1236,7 +1236,8 @@ struct exynos_ufs_drv_data exynos_ufs_drvs = {UFSHCI_QUIRK_BROKEN_HCE |UFSHCI_QUIRK_SKIP_RESET_INTR_AGGR |UFSHCD_QUIRK_BROKEN_OCS_FATAL_ERROR | - UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL, +UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL | + UFSHCD_QUIRK_ALIGN_SG_WITH_PAGE_SIZE, .opts =EXYNOS_UFS_OPT_HAS_APB_CLK_CTRL |EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL | EXYNOS_UFS_OPT_BROKEN_RX_SEL_IDX |
Signature · 1 line
2.7.4
Martin K. Petersen
AppliedKiwoong,
Quoted 3 lines
Kiwoong Kim (2):
ufs: introduce a quirk to allow only page-aligned sg entries
ufs: ufs-exynos: useUFSHCD_QUIRK_ALIGN_SG_WITH_PAGE_SIZE
Applied to 5.12/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedQuoted 11 lines · Kiwoong Kim
v5 -> v6: replace the way with using a quirk
v4 -> v5: collect received tags
v3 -> v4: fix some typos
v2 -> v3: rename exynos functions
v1 -> v2: rename the vops and fix some typosKiwoong Kim (2):
ufs: introduce a quirk to allow only page-aligned sg entries
ufs: ufs-exynos: useUFSHCD_QUIRK_ALIGN_SG_WITH_PAGE_SIZE[...]
Applied to 5.12/scsi-queue, thanks!
[1/2] ufs: introduce a quirk to allow only page-aligned sg entries
https://git.kernel.org/mkp/scsi/c/2b2bfc8aa519 [2/2] ufs: ufs-exynos: use UFSHCD_QUIRK_ALIGN_SG_WITH_PAGE_SIZE https://git.kernel.org/mkp/scsi/c/f1ef9047aaab
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering