[openib-general] problem with 2.6.19?

Steve Wise swise at opengridcomputing.com
Thu Oct 26 15:20:18 PDT 2006


Hey Roland,

I'm testing the Ammasso rnic on linus's latest (2.6.19-rc3+) and I'm
having problems with dma_map_single().  The systems are Intel Dempsey
processors (x86_64).  

The adapter seems to be dma'ing into the wrong memory.  The patch below
backs the usage of dma_map_single() back to using __pa() for converting
kernel virtual addresses (from kmalloc) into bus addresses, and things
work ok.  

So I'm wondering if the Ammasso driver is misusing dma_map_single()??

Or maybe the driver needs to do something at init time to request dma
mappings?

Any thoughts?


Steve.


---- hack to use __pa() instead of dma_map_single() ----


diff --git a/drivers/infiniband/hw/amso1100/c2_alloc.c b/drivers/infiniband/hw/amso1100/c2_alloc.c
index 028a60b..adf7fb3 100644
--- a/drivers/infiniband/hw/amso1100/c2_alloc.c
+++ b/drivers/infiniband/hw/amso1100/c2_alloc.c
@@ -47,8 +47,12 @@ static int c2_alloc_mqsp_chunk(struct c2
 	if (new_head == NULL)
 		return -ENOMEM;
 
+#if 0
 	new_head->dma_addr = dma_map_single(c2dev->ibdev.dma_device, new_head,
 					    PAGE_SIZE, DMA_FROM_DEVICE);
+#else
+	new_head->dma_addr = __pa(new_head);
+#endif
 	pci_unmap_addr_set(new_head, mapping, new_head->dma_addr);
 
 	new_head->next = NULL;
diff --git a/drivers/infiniband/hw/amso1100/c2_cq.c b/drivers/infiniband/hw/amso1100/c2_cq.c
index 9d7bcc5..f3452f1 100644
--- a/drivers/infiniband/hw/amso1100/c2_cq.c
+++ b/drivers/infiniband/hw/amso1100/c2_cq.c
@@ -270,10 +270,13 @@ static int c2_alloc_cq_buf(struct c2_dev
 		       (u8 *) pool_start,
 		       NULL,	/* peer (currently unknown) */
 		       C2_MQ_HOST_TARGET);
-
+#if 0
 	mq->host_dma = dma_map_single(c2dev->ibdev.dma_device,
 				      (void *)pool_start,
 				      q_size * msg_size, DMA_FROM_DEVICE);
+#else
+	mq->host_dma = __pa(pool_start);
+#endif
 	pci_unmap_addr_set(mq, mapping, mq->host_dma);
 
 	return 0;
diff --git a/drivers/infiniband/hw/amso1100/c2_rnic.c b/drivers/infiniband/hw/amso1100/c2_rnic.c
index 30409e1..d2f9344 100644
--- a/drivers/infiniband/hw/amso1100/c2_rnic.c
+++ b/drivers/infiniband/hw/amso1100/c2_rnic.c
@@ -522,9 +522,13 @@ int c2_rnic_init(struct c2_dev *c2dev)
 		err = -ENOMEM;
 		goto bail1;
 	}
+#if 0
 	c2dev->rep_vq.host_dma = dma_map_single(c2dev->ibdev.dma_device,
 					        (void *)q1_pages, qsize * msgsize,
 				      		DMA_FROM_DEVICE);
+#else
+	c2dev->rep_vq.host_dma = __pa(q1_pages);
+#endif
 	pci_unmap_addr_set(&c2dev->rep_vq, mapping, c2dev->rep_vq.host_dma);
 	pr_debug("%s rep_vq va %p dma %llx\n", __FUNCTION__, q1_pages,
 		 (unsigned long long) c2dev->rep_vq.host_dma);
@@ -545,9 +549,13 @@ int c2_rnic_init(struct c2_dev *c2dev)
 		err = -ENOMEM;
 		goto bail2;
 	}
+#if 0
 	c2dev->aeq.host_dma = dma_map_single(c2dev->ibdev.dma_device,
 					        (void *)q2_pages, qsize * msgsize,
 				      		DMA_FROM_DEVICE);
+#else
+	c2dev->aeq.host_dma = __pa(q2_pages);
+#endif
 	pci_unmap_addr_set(&c2dev->aeq, mapping, c2dev->aeq.host_dma);
 	pr_debug("%s aeq va %p dma %llx\n", __FUNCTION__, q1_pages,
 		 (unsigned long long) c2dev->rep_vq.host_dma);






More information about the general mailing list