* [ PATCH v6 0/2] introduce a quirk to allow only page-aligned sg entries [not found] <CGME20210119024011epcas2p45256028f99195958140a6846d40b9143@epcas2p4.samsung.com> @ 2021-01-19 2:28 ` Kiwoong Kim [not found] ` <CGME20210119024012epcas2p2b99e5846e1e04d8a8fab76c75bf534a7@epcas2p2.samsung.com> ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: Kiwoong Kim @ 2021-01-19 2:28 UTC (permalink / raw) To: linux-scsi, alim.akhtar, avri.altman, jejb, martin.petersen, beanhuo, asutoshd, cang, bvanassche, grant.jung, sc.suh, hy50.seo, sh425.lee, bhoon95.kim Cc: Kiwoong Kim v5 -> v6: collect received tags 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(-) -- 2.7.4 ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <CGME20210119024012epcas2p2b99e5846e1e04d8a8fab76c75bf534a7@epcas2p2.samsung.com>]
* [ PATCH v6 1/2] ufs: introduce a quirk to allow only page-aligned sg entries [not found] ` <CGME20210119024012epcas2p2b99e5846e1e04d8a8fab76c75bf534a7@epcas2p2.samsung.com> @ 2021-01-19 2:28 ` Kiwoong Kim 0 siblings, 0 replies; 4+ messages in thread From: Kiwoong Kim @ 2021-01-19 2:28 UTC (permalink / raw) To: linux-scsi, alim.akhtar, avri.altman, jejb, martin.petersen, beanhuo, asutoshd, cang, bvanassche, grant.jung, sc.suh, hy50.seo, sh425.lee, bhoon95.kim Cc: Kiwoong Kim 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. Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com> --- drivers/scsi/ufs/ufshcd.c | 2 ++ drivers/scsi/ufs/ufshcd.h | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index e221add..847eb02 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -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; diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 9bb5f0e..9e7223f 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -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 { -- 2.7.4 ^ permalink raw reply related [flat|nested] 4+ messages in thread
[parent not found: <CGME20210119024013epcas2p1b0ebaa5fbc2e966529a549386535fdbb@epcas2p1.samsung.com>]
* [ PATCH v6 2/2] ufs: ufs-exynos: use UFSHCD_QUIRK_ALIGN_SG_WITH_PAGE_SIZE [not found] ` <CGME20210119024013epcas2p1b0ebaa5fbc2e966529a549386535fdbb@epcas2p1.samsung.com> @ 2021-01-19 2:28 ` Kiwoong Kim 0 siblings, 0 replies; 4+ messages in thread From: Kiwoong Kim @ 2021-01-19 2:28 UTC (permalink / raw) To: linux-scsi, alim.akhtar, avri.altman, jejb, martin.petersen, beanhuo, asutoshd, cang, bvanassche, grant.jung, sc.suh, hy50.seo, sh425.lee, bhoon95.kim Cc: Kiwoong Kim Exynos needs alignment with page size because it isn't capable to transfer data in one DATA IN to seversal areas. Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com> --- drivers/scsi/ufs/ufs-exynos.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c index a8770ff..d1f0031 100644 --- a/drivers/scsi/ufs/ufs-exynos.c +++ b/drivers/scsi/ufs/ufs-exynos.c @@ -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 | -- 2.7.4 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [ PATCH v6 0/2] introduce a quirk to allow only page-aligned sg entries 2021-01-19 2:28 ` [ PATCH v6 0/2] introduce a quirk to allow only page-aligned sg entries Kiwoong Kim [not found] ` <CGME20210119024012epcas2p2b99e5846e1e04d8a8fab76c75bf534a7@epcas2p2.samsung.com> [not found] ` <CGME20210119024013epcas2p1b0ebaa5fbc2e966529a549386535fdbb@epcas2p1.samsung.com> @ 2021-01-19 3:42 ` Kiwoong Kim 2 siblings, 0 replies; 4+ messages in thread From: Kiwoong Kim @ 2021-01-19 3:42 UTC (permalink / raw) To: linux-scsi, alim.akhtar, avri.altman, jejb, martin.petersen, beanhuo, asutoshd, cang, bvanassche, grant.jung, sc.suh, hy50.seo, sh425.lee, bhoon95.kim > v5 -> v6: collect received tags There is a mistake on the part of this commit message. Sorry, I'll post again. Thanks. Kiwoong Kim > 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(-) > > -- > 2.7.4 ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-01-19 3:43 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <CGME20210119024011epcas2p45256028f99195958140a6846d40b9143@epcas2p4.samsung.com> 2021-01-19 2:28 ` [ PATCH v6 0/2] introduce a quirk to allow only page-aligned sg entries Kiwoong Kim [not found] ` <CGME20210119024012epcas2p2b99e5846e1e04d8a8fab76c75bf534a7@epcas2p2.samsung.com> 2021-01-19 2:28 ` [ PATCH v6 1/2] ufs: " Kiwoong Kim [not found] ` <CGME20210119024013epcas2p1b0ebaa5fbc2e966529a549386535fdbb@epcas2p1.samsung.com> 2021-01-19 2:28 ` [ PATCH v6 2/2] ufs: ufs-exynos: use UFSHCD_QUIRK_ALIGN_SG_WITH_PAGE_SIZE Kiwoong Kim 2021-01-19 3:42 ` [ PATCH v6 0/2] introduce a quirk to allow only page-aligned sg entries Kiwoong Kim
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).