pvscsi: Fix uninitialized sense buffer with swiotlb
Subsystems (2)
PATCH 3/3 pvscsi: Fix uninitialized sense buffer with swiotlb
It seems like the device sometimes leaves part of the
sense buffer uninitialized. This causes massive problems with swiotlb where any previous initialization of the sense buffer by the scsi middle-layer is not propagated to the device since we use DMA_FROM_DEVICE when dma-mapping the sense buffer. Fix this by specifying DMA_BIDIRECTIONAL instead. Makes the scsi errors go away.
Tested using a bonnie++ run on an swiotlb=force booted kernel.
Signed-off-by Thomas Hellstrom <[email protected]>
[[email protected]: Forwarding patch on behalf of thellstrom]
Acked-by [email protected]
--- drivers/scsi/vmw_pvscsi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/vmw_pvscsi.c +3 -3
@@ -429,7 +429,7 @@ static void pvscsi_unmap_buffers(const struct pvscsi_adapter *adapter, }if (cmd->sense_buffer)dma_unmap_single (&adapter->dev->dev, ctx->sensePA, -SCSI_SENSE_BUFFERSIZE ,DMA_FROM_DEVICE ); +SCSI_SENSE_BUFFERSIZE ,DMA_BIDIRECTIONAL ); }static int pvscsi_allocate_rings (struct pvscsi_adapter *adapter)
@@ -714,7 +714,7 @@ static int pvscsi_queue_ring(struct pvscsi_adapter *adapter,if (cmd->sense_buffer) { ctx->sensePA =dma_map_single (&adapter->dev->dev, cmd->sense_buffer,SCSI_SENSE_BUFFERSIZE , -DMA_FROM_DEVICE ); +DMA_BIDIRECTIONAL );if (dma_mapping_error (&adapter->dev->dev, ctx->sensePA)) {scmd_printk (KERN_DEBUG , cmd,"vmw_pvscsi: Failed to map sense buffer for DMA.\n" );
@@ -746,7 +746,7 @@ static int pvscsi_queue_ring(struct pvscsi_adapter *adapter,if (cmd->sense_buffer) {dma_unmap_single (&adapter->dev->dev, ctx->sensePA,SCSI_SENSE_BUFFERSIZE , -DMA_FROM_DEVICE ); +DMA_BIDIRECTIONAL ); ctx->sensePA =0 ; }return -ENOMEM ;
Signature · 1 line
2.7.4