summaryrefslogtreecommitdiff
path: root/drivers/ufs
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2023-09-21 22:22:49 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2023-09-27 18:12:50 +0300
commit00d2fa28da0aa371ad215e92ebf5297c0e7d4861 (patch)
tree3f7d0783ec639557dd462518b2b9c709c506fc3f /drivers/ufs
parentc788cf8a21cd3b12a1823869878e3fd93132859f (diff)
downloadlinux-00d2fa28da0aa371ad215e92ebf5297c0e7d4861.tar.xz
scsi: ufs: core: Set the Command Priority (CP) flag for RT requests
Make the UFS device execute realtime (RT) requests before other requests. This will be used in Android to reduce the I/O latency of the foreground app. Note: UFS devices do not support CDL so using CDL is not a viable alternative. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20230921192335.676924-5-bvanassche@acm.org Reviewed-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/ufs')
-rw-r--r--drivers/ufs/core/ufshcd.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 13957ca8055b..d430e2e7fb39 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -2717,6 +2717,8 @@ static int ufshcd_compose_devman_upiu(struct ufs_hba *hba,
*/
static void ufshcd_comp_scsi_upiu(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
{
+ struct request *rq = scsi_cmd_to_rq(lrbp->cmd);
+ unsigned int ioprio_class = IOPRIO_PRIO_CLASS(req_get_ioprio(rq));
u8 upiu_flags;
if (hba->ufs_version <= ufshci_version(1, 1))
@@ -2726,6 +2728,8 @@ static void ufshcd_comp_scsi_upiu(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
ufshcd_prepare_req_desc_hdr(lrbp, &upiu_flags,
lrbp->cmd->sc_data_direction, 0);
+ if (ioprio_class == IOPRIO_CLASS_RT)
+ upiu_flags |= UPIU_CMD_FLAGS_CP;
ufshcd_prepare_utp_scsi_cmd_upiu(lrbp, upiu_flags);
}