Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1211353

[PATCH v1 14/15] scsi: ufs: commit descriptors before setting the doorbell

From Yaniv Gardi <ygardi@codeaurora.org>
Newsgroups linux.kernel
Subject [PATCH v1 14/15] scsi: ufs: commit descriptors before setting the doorbell
Date 2015-08-22 00:20 +0200
Message-ID <q02Pg-8pP-33@gated-at.bofh.it> (permalink)
References <q02Pf-8pP-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Add a write memory barrier to make sure descriptors prepared are actually
written to memory before ringing the doorbell. We have also added the
write memory barrier after ringing the doorbell register so that
controller sees the new request immediately.

Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>

---
 drivers/scsi/ufs/ufshcd.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index fef0660..876148b 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -833,6 +833,8 @@ void ufshcd_send_command(struct ufs_hba *hba, unsigned int task_tag)
 	ufshcd_clk_scaling_start_busy(hba);
 	__set_bit(task_tag, &hba->outstanding_reqs);
 	ufshcd_writel(hba, 1 << task_tag, REG_UTP_TRANSFER_REQ_DOOR_BELL);
+	/* Make sure that doorbell is committed immediately */
+	wmb();
 }
 
 /**
@@ -1418,6 +1420,8 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
 		goto out;
 	}
 
+	/* Make sure descriptors are ready before ringing the doorbell */
+	wmb();
 	/* issue command to the controller */
 	spin_lock_irqsave(hba->host->host_lock, flags);
 	ufshcd_send_command(hba, tag);
@@ -1627,6 +1631,8 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,
 
 	hba->dev_cmd.complete = &wait;
 
+	/* Make sure descriptors are ready before ringing the doorbell */
+	wmb();
 	spin_lock_irqsave(hba->host->host_lock, flags);
 	ufshcd_send_command(hba, tag);
 	spin_unlock_irqrestore(hba->host->host_lock, flags);
-- 
1.8.5.2

-- 
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v1 00/15] Big fixes, retries, handle a race condition Yaniv Gardi <ygardi@codeaurora.org> - 2015-08-22 00:20 +0200
  [PATCH v1 02/15] scsi: ufs: clear fields UTRD, UPIU req and rsp before new transfers Yaniv Gardi <ygardi@codeaurora.org> - 2015-08-22 00:20 +0200
  [PATCH v1 03/15] scsi: ufs: verify command tag validity Yaniv Gardi <ygardi@codeaurora.org> - 2015-08-22 00:20 +0200
  [PATCH v1 15/15] scsi: ufs: add wrapper for retrying sending query attribute Yaniv Gardi <ygardi@codeaurora.org> - 2015-08-22 00:20 +0200
    Re: [PATCH v1 15/15] scsi: ufs: add wrapper for retrying sending  query attribute Rob Herring <robherring2@gmail.com> - 2015-08-23 23:10 +0200
      Re: [PATCH v1 15/15] scsi: ufs: add wrapper for retrying sending  query attribute ygardi@codeaurora.org - 2015-08-25 14:50 +0200
        Re: [PATCH v1 15/15] scsi: ufs: add wrapper for retrying sending  query attribute ygardi@codeaurora.org - 2015-08-25 15:30 +0200
  [PATCH v1 04/15] scsi: ufs: clear outstanding_request bit in case query timeout Yaniv Gardi <ygardi@codeaurora.org> - 2015-08-22 00:20 +0200
  [PATCH v1 11/15] scsi: ufs: retry failed query flag requests Yaniv Gardi <ygardi@codeaurora.org> - 2015-08-22 00:20 +0200
  [PATCH v1 14/15] scsi: ufs: commit descriptors before setting the doorbell Yaniv Gardi <ygardi@codeaurora.org> - 2015-08-22 00:20 +0200
    Re: [PATCH v1 14/15] scsi: ufs: commit descriptors before setting the doorbell Rob Herring <robherring2@gmail.com> - 2015-08-23 23:20 +0200
      Re: [PATCH v1 14/15] scsi: ufs: commit descriptors before setting  the doorbell ygardi@codeaurora.org - 2015-08-25 14:40 +0200
        Re: [PATCH v1 14/15] scsi: ufs: commit descriptors before setting the doorbell Rob Herring <robherring2@gmail.com> - 2015-08-25 20:30 +0200
          Re: [PATCH v1 14/15] scsi: ufs: commit descriptors before setting  the doorbell ygardi@codeaurora.org - 2015-08-27 14:20 +0200
            Re: [PATCH v1 14/15] scsi: ufs: commit descriptors before setting the doorbell Rob Herring <robherring2@gmail.com> - 2015-08-27 19:30 +0200
              Re: [PATCH v1 14/15] scsi: ufs: commit descriptors before setting  the doorbell ygardi@codeaurora.org - 2015-08-30 12:00 +0200
        Re: [PATCH v1 14/15] scsi: ufs: commit descriptors before setting  the doorbell ygardi@codeaurora.org - 2015-08-27 14:30 +0200
          Re: [PATCH v1 14/15] scsi: ufs: commit descriptors before setting the doorbell Rob Herring <robherring2@gmail.com> - 2015-08-27 19:10 +0200
  [PATCH v1 10/15] scsi: ufs: fix error recovery after the hibern8 exit failure Yaniv Gardi <ygardi@codeaurora.org> - 2015-08-22 00:20 +0200
  [PATCH v1 05/15] scsi: ufs: increase fDeviceInit query response timeout Yaniv Gardi <ygardi@codeaurora.org> - 2015-08-22 00:20 +0200
  [PATCH v1 13/15] scsi: ufs: add missing memory barriers Yaniv Gardi <ygardi@codeaurora.org> - 2015-08-22 00:20 +0200
  [PATCH v1 12/15] scsi: ufs: reduce the interrupts for power mode change requests Yaniv Gardi <ygardi@codeaurora.org> - 2015-08-22 00:20 +0200
  [PATCH v1 08/15] scsi: ufs: add retries to dme_peer get and set attribute Yaniv Gardi <ygardi@codeaurora.org> - 2015-08-22 00:20 +0200

csiph-web