lkml.org 
[lkml]   [2014]   [Jul]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.15 004/122] ibmvscsi: Add memory barriers for send / receive
    Date
    3.15-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Brian King <brking@linux.vnet.ibm.com>

    commit 7114aae02742d6b5c5a0d39a41deb61d415d3717 upstream.

    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>
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    drivers/scsi/ibmvscsi/ibmvscsi.c | 10 ++++++++++
    1 file changed, 10 insertions(+)

    --- a/drivers/scsi/ibmvscsi/ibmvscsi.c
    +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
    @@ -185,6 +185,11 @@ static struct viosrp_crq *crq_queue_next
    if (crq->valid & 0x80) {
    if (++queue->cur == queue->size)
    queue->cur = 0;
    +
    + /* Ensure the read of the valid bit occurs before reading any
    + * other bits of the CRQ entry
    + */
    + rmb();
    } else
    crq = NULL;
    spin_unlock_irqrestore(&queue->lock, flags);
    @@ -203,6 +208,11 @@ static int ibmvscsi_send_crq(struct ibmv
    {
    struct vio_dev *vdev = to_vio_dev(hostdata->dev);

    + /*
    + * Ensure the command buffer is flushed to memory before handing it
    + * over to the VIOS to prevent it from fetching any stale data.
    + */
    + mb();
    return plpar_hcall_norets(H_SEND_CRQ, vdev->unit_address, word1, word2);
    }




    \
     
     \ /
      Last update: 2014-07-08 04:01    [W:4.127 / U:0.172 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site