diff mbox series

[v2,2/3] scsi: ufs: Exynos: Fix the maximum segment size

Message ID 20230112234215.2630817-3-bvanassche@acm.org
State New
Headers show
Series Enable DMA clustering in the UFS driver | expand

Commit Message

Bart Van Assche Jan. 12, 2023, 11:42 p.m. UTC
Prepare for enabling DMA clustering and also for supporting
PAGE_SIZE != 4096 by declaring explicitly that the maximum segment
size is 4096 bytes for Exynos UFS host controllers. Add this code
in exynos_ufs_hce_enable_notify() such that it happens after
scsi_host_alloc() and before __scsi_init_queue() is called by the
LUN scanning code.

Cc: Alim Akhtar <alim.akhtar@samsung.com>
Cc: Kiwoong Kim <kwmad.kim@samsung.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/ufs/host/ufs-exynos.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Martin K. Petersen Jan. 18, 2023, 11:30 p.m. UTC | #1
Alim,

> Prepare for enabling DMA clustering and also for supporting
> PAGE_SIZE != 4096 by declaring explicitly that the maximum segment
> size is 4096 bytes for Exynos UFS host controllers. Add this code
> in exynos_ufs_hce_enable_notify() such that it happens after
> scsi_host_alloc() and before __scsi_init_queue() is called by the
> LUN scanning code.

Now that you're Exynos maintainer it falls upon you to review Bart's
patch.

Thanks!
Alim Akhtar Jan. 19, 2023, 4:49 p.m. UTC | #2
>-----Original Message-----
>From: Bart Van Assche [mailto:bvanassche@acm.org]
>Sent: Friday, January 13, 2023 5:12 AM
>To: Martin K . Petersen <martin.petersen@oracle.com>
>Cc: Jaegeuk Kim <jaegeuk@kernel.org>; linux-scsi@vger.kernel.org; Adrian
>Hunter <adrian.hunter@intel.com>; Alim Akhtar
><alim.akhtar@samsung.com>; Bart Van Assche <bvanassche@acm.org>;
>Kiwoong Kim <kwmad.kim@samsung.com>; James E.J. Bottomley
><jejb@linux.ibm.com>; Krzysztof Kozlowski
><krzysztof.kozlowski@linaro.org>; Chanho Park
><chanho61.park@samsung.com>; Bean Huo <beanhuo@micron.com>
>Subject: [PATCH v2 2/3] scsi: ufs: Exynos: Fix the maximum segment size
>
>Prepare for enabling DMA clustering and also for supporting PAGE_SIZE !=
>4096 by declaring explicitly that the maximum segment size is 4096 bytes
for
>Exynos UFS host controllers. Add this code in
>exynos_ufs_hce_enable_notify() such that it happens after
>scsi_host_alloc() and before __scsi_init_queue() is called by the LUN
scanning
>code.
>
>Cc: Alim Akhtar <alim.akhtar@samsung.com>
>Cc: Kiwoong Kim <kwmad.kim@samsung.com>
>Signed-off-by: Bart Van Assche <bvanassche@acm.org>
>---

Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>

Tested basic read/write on platform containing Exynos UFS HCI, so 

Tested-by: Alim Akhtar <alim.akhtar@samsung.com>

> drivers/ufs/host/ufs-exynos.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
>diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c
>index 3cdac89a28b8..7c985fc38db1 100644
>--- a/drivers/ufs/host/ufs-exynos.c
>+++ b/drivers/ufs/host/ufs-exynos.c
>@@ -1300,6 +1300,14 @@ static int exynos_ufs_hce_enable_notify(struct
>ufs_hba *hba,
>
> 	switch (status) {
> 	case PRE_CHANGE:
>+		/*
>+		 * The maximum segment size must be set after
>scsi_host_alloc()
>+		 * has been called and before LUN scanning starts
>+		 * (ufshcd_async_scan()). Note: this callback may also be
>called
>+		 * from other functions than ufshcd_init().
>+		 */
>+		hba->host->max_segment_size = 4096;
>+
> 		if (ufs->drv_data->pre_hce_enable) {
> 			ret = ufs->drv_data->pre_hce_enable(ufs);
> 			if (ret)
diff mbox series

Patch

diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c
index 3cdac89a28b8..7c985fc38db1 100644
--- a/drivers/ufs/host/ufs-exynos.c
+++ b/drivers/ufs/host/ufs-exynos.c
@@ -1300,6 +1300,14 @@  static int exynos_ufs_hce_enable_notify(struct ufs_hba *hba,
 
 	switch (status) {
 	case PRE_CHANGE:
+		/*
+		 * The maximum segment size must be set after scsi_host_alloc()
+		 * has been called and before LUN scanning starts
+		 * (ufshcd_async_scan()). Note: this callback may also be called
+		 * from other functions than ufshcd_init().
+		 */
+		hba->host->max_segment_size = 4096;
+
 		if (ufs->drv_data->pre_hce_enable) {
 			ret = ufs->drv_data->pre_hce_enable(ufs);
 			if (ret)