[PATCH] ieee1394: sbp2: enforce 32bit DMA mapping

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In order to use OHCI physical DMA, all s/g elements, s/g tables, ORBs,
and response buffers have to reside within the first 4 GB of the
FireWire controller's physical address space.  Set the correct mask for
DMA mappings.

Also ensure that the memory allocated for command ORBs and s/g tables is
suitable for DMA.

Signed-off-by: Stefan Richter <stefanr@xxxxxxxxxxxxxxxxx>
---
Should I use GFP_DMA32 instead of GFP_DMA?


 drivers/ieee1394/sbp2.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Index: linux-2.6.20-rc5/drivers/ieee1394/sbp2.c
===================================================================
--- linux-2.6.20-rc5.orig/drivers/ieee1394/sbp2.c
+++ linux-2.6.20-rc5/drivers/ieee1394/sbp2.c
@@ -477,7 +477,7 @@ static int sbp2util_create_command_orb_p
 
 	spin_lock_irqsave(&lu->cmd_orb_lock, flags);
 	for (i = 0; i < orbs; i++) {
-		cmd = kzalloc(sizeof(*cmd), GFP_ATOMIC);
+		cmd = kzalloc(sizeof(*cmd), GFP_ATOMIC | GFP_DMA);
 		if (!cmd) {
 			spin_unlock_irqrestore(&lu->cmd_orb_lock, flags);
 			return -ENOMEM;
@@ -757,6 +757,11 @@ static struct sbp2_lu *sbp2_alloc_device
 			SBP2_ERR("failed to register lower 4GB address range");
 			goto failed_alloc;
 		}
+#else
+		if (dma_set_mask(hi->host->device.parent, DMA_32BIT_MASK)) {
+			SBP2_ERR("failed to set 4GB DMA mask");
+			goto failed_alloc;
+		}
 #endif
 	}
 


-- 
Stefan Richter
-=====-=-=== --=- --=--
http://arcgraph.de/sr/

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux