aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorBrian King <brking@linux.vnet.ibm.com>2014-05-23 11:52:11 -0400
committerChristoph Hellwig <hch@lst.de>2014-06-25 07:29:32 -0400
commit7114aae02742d6b5c5a0d39a41deb61d415d3717 (patch)
treecf6d4c0153c99b262ee07a050afb3d6262d758fd /drivers/scsi
parent9ee755974bea2f9880e517ec985dc9dede1b3a36 (diff)
ibmvscsi: Add memory barriers for send / receive
Add a memory barrier prior to sending a new command to the VIOS to ensure the VIOS does not receive stale data in the command buffer. Also add a memory barrier when processing the CRQ for completed commands. Signed-off-by: Brian King <brking@linux.vnet.ibm.com> Acked-by: Nathan Fontenot <nfont@linux.vnet.ibm.com> Cc: stable@vger.kernel.org Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 9caf9a979659..7b23f21f22f1 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -185,6 +185,11 @@ static struct viosrp_crq *crq_queue_next_crq(struct crq_queue *queue)
185 if (crq->valid & 0x80) { 185 if (crq->valid & 0x80) {
186 if (++queue->cur == queue->size) 186 if (++queue->cur == queue->size)
187 queue->cur = 0; 187 queue->cur = 0;
188
189 /* Ensure the read of the valid bit occurs before reading any
190 * other bits of the CRQ entry
191 */
192 rmb();
188 } else 193 } else
189 crq = NULL; 194 crq = NULL;
190 spin_unlock_irqrestore(&queue->lock, flags); 195 spin_unlock_irqrestore(&queue->lock, flags);
@@ -203,6 +208,11 @@ static int ibmvscsi_send_crq(struct ibmvscsi_host_data *hostdata,
203{ 208{
204 struct vio_dev *vdev = to_vio_dev(hostdata->dev); 209 struct vio_dev *vdev = to_vio_dev(hostdata->dev);
205 210
211 /*
212 * Ensure the command buffer is flushed to memory before handing it
213 * over to the VIOS to prevent it from fetching any stale data.
214 */
215 mb();
206 return plpar_hcall_norets(H_SEND_CRQ, vdev->unit_address, word1, word2); 216 return plpar_hcall_norets(H_SEND_CRQ, vdev->unit_address, word1, word2);
207} 217}
208 218