Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 317

kernel-2.6.18-238.el5.src.rpm

From: Tomas Henzl <thenzl@redhat.com>
Date: Sun, 29 Aug 2010 15:49:43 -0400
Subject: [block] cciss: fix DMA direction kludge
Message-id: <1283097002-3341-45-git-send-email-thenzl@redhat.com>
Patchwork-id: 27902
O-Subject: [RHEL6 PATCH 44/63] cciss: fix DMA direction kludge
Bugzilla: 568830
RH-Acked-by: Neil Horman <nhorman@redhat.com>

The DMA direction for the scatter gather chain block should always
be TO the device, and should not be always the same as the direction
of the data transfer.  Previously a workaround using
pci_dma_sync_single_for_device or _for_cpu was used to make this work.
This is not needed if the direction is set correctly in the first place.

diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 7016974..c7f2b25 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1775,10 +1775,8 @@ static void cciss_softirq_done(struct request *rq)
 		if (curr_sg[sg_index].Ext == CCISS_SG_CHAIN) {
 			temp64.val32.lower = cmd->SG[i].Addr.lower;
 			temp64.val32.upper = cmd->SG[i].Addr.upper;
-			pci_dma_sync_single_for_cpu(h->pdev, temp64.val,
-						cmd->SG[i].Len, ddir);
 			pci_unmap_single(h->pdev, temp64.val,
-						cmd->SG[i].Len, ddir);
+				cmd->SG[i].Len, PCI_DMA_TODEVICE);
 			/* Point to the next block */
 			curr_sg = h->cmd_sg_list[cmd->cmdindex];
 			sg_index = 0;
@@ -3282,11 +3280,11 @@ static void do_cciss_request(request_queue_t *q)
 		 * block with address of next chain block.
 		 */
 		temp64.val = pci_map_single(h->pdev,
-					h->cmd_sg_list[c->cmdindex], len, dir);
+					h->cmd_sg_list[c->cmdindex], len,
+					PCI_DMA_TODEVICE);
 		dma_addr = temp64.val;
 		curr_sg[sg_index].Addr.lower = temp64.val32.lower;
 		curr_sg[sg_index].Addr.upper = temp64.val32.upper;
-		pci_dma_sync_single_for_device(h->pdev, dma_addr, len, dir);
 	}
 
 	/* track how many SG entries we are using */