From a782a88e602a4bcc6e15d6b6d5bb818537f215d1 Mon Sep 17 00:00:00 2001 From: hgchu Date: Fri, 12 Jan 2018 13:41:16 +0900 Subject: [PATCH] scsi: ufs: move unmap from ISR to Soft IRQ Change-Id: I4cbdb3904838ffdb82338b71463f523020d51f53 Signed-off-by: hgchu --- drivers/scsi/ufs/ufshcd.c | 11 ++++++++++- drivers/scsi/ufs/ufshcd.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index a4e2a7b34544..16a52479713d 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -2377,6 +2377,7 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) goto out_unlock; case UFSHCD_STATE_ERROR: set_host_byte(cmd, DID_ERROR); + scsi_dma_map(cmd); cmd->scsi_done(cmd); goto out_unlock; default: @@ -4552,6 +4553,13 @@ static inline void ufshcd_get_lu_power_on_wp_status(struct ufs_hba *hba, } } +static void ufshcd_done(struct request *rq) +{ + struct scsi_cmnd *cmd = rq->special; + scsi_dma_unmap(cmd); + scsi_softirq_done(rq); +} + /** * ufshcd_slave_alloc - handle initial SCSI device configurations * @sdev: pointer to SCSI device @@ -4578,6 +4586,8 @@ static int ufshcd_slave_alloc(struct scsi_device *sdev) ufshcd_get_lu_power_on_wp_status(hba, sdev); + blk_queue_softirq_done(sdev->request_queue, ufshcd_done); + return 0; } @@ -4834,7 +4844,6 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba, int reason, if (cmd) { ufshcd_add_command_trace(hba, index, "complete"); result = ufshcd_transfer_rsp_status(hba, lrbp); - scsi_dma_unmap(cmd); cmd->result = result; if (reason) set_host_byte(cmd, reason); diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 0d85630b7536..cc45d99f4dcc 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -811,6 +811,7 @@ extern int ufshcd_dme_get_attr(struct ufs_hba *hba, u32 attr_sel, u32 *mib_val, u8 peer); extern int ufshcd_config_pwr_mode(struct ufs_hba *hba, struct ufs_pa_layer_attr *desired_pwr_mode); +extern void scsi_softirq_done(struct request *rq); /* UIC command interfaces for DME primitives */ #define DME_LOCAL 0 -- 2.20.1