amso1100 - Use dma_alloc_coherent instead of kmalloc/dma_map_single.
Subsystems (3)
PATCH v2 1/2 amso1100 - Use dma_alloc_coherent instead of kmalloc/dma_map_single.
v2 of this patch fixes a compiler warning I missed...
Steve.
-----
The Ammasso driver needs to use dma_alloc_coherent() for allocating memory that will be used by the HW for dma.
Signed-off-by Steve Wise <[email protected]>
---
drivers/infiniband/hw/amso1100/c2_alloc.c | 13 +++---- drivers/infiniband/hw/amso1100/c2_cq.c | 18 +++------- drivers/infiniband/hw/amso1100/c2_rnic.c | 52 ++++++++++++----------------- 3 files changed, 33 insertions(+), 50 deletions(-)
drivers/infiniband/hw/amso1100/c2_alloc.c +6 -7
@@ -42,13 +42,14 @@ static int c2_alloc_mqsp_chunk(struct c2 {int i;struct sp_chunk *new_head; +dma_addr_t dma_addr; - new_head = (struct sp_chunk *)__get_free_page (gfp_mask); + new_head =dma_alloc_coherent (&c2dev->pcidev->dev,PAGE_SIZE , + &dma_addr, gfp_mask);if (new_head ==NULL )return -ENOMEM ; - new_head->dma_addr =dma_map_single (c2dev->ibdev.dma_device, new_head, -PAGE_SIZE ,DMA_FROM_DEVICE ); + new_head->dma_addr = dma_addr;pci_unmap_addr_set (new_head, mapping, new_head->dma_addr); new_head->next =NULL ;
@@ -80,10 +81,8 @@ void c2_free_mqsp_pool(struct c2_dev *c2while (root) { next = root->next; -dma_unmap_single (c2dev->ibdev.dma_device, -pci_unmap_addr (root, mapping),PAGE_SIZE , -DMA_FROM_DEVICE ); -__free_page ((struct page *) root); +dma_free_coherent (&c2dev->pcidev->dev,PAGE_SIZE , root, +pci_unmap_addr (root, mapping)); root = next; } }
drivers/infiniband/hw/amso1100/c2_cq.c +6 -12
@@ -246,20 +246,17 @@ int c2_arm_cq(struct ib_cq *ibcq, enum istatic void c2_free_cq_buf (struct c2_dev *c2dev,struct c2_mq *mq) { - -dma_unmap_single (c2dev->ibdev.dma_device,pci_unmap_addr (mq, mapping), - mq->q_size * mq->msg_size,DMA_FROM_DEVICE ); -free_pages ((unsigned long ) mq->msg_pool.host, -get_order (mq->q_size * mq->msg_size)); +dma_free_coherent (&c2dev->pcidev->dev, mq->q_size * mq->msg_size, + mq->msg_pool.host,pci_unmap_addr (mq, mapping)); }static int c2_alloc_cq_buf (struct c2_dev *c2dev,struct c2_mq *mq,int q_size,int msg_size) { -unsigned long pool_start; +u8 *pool_start; - pool_start =__get_free_pages (GFP_KERNEL , -get_order (q_size * msg_size)); + pool_start =dma_alloc_coherent (&c2dev->pcidev->dev, q_size * msg_size, + &mq->host_dma,GFP_KERNEL );if (!pool_start)return -ENOMEM ;
@@ -267,13 +264,10 @@ static int c2_alloc_cq_buf(struct c2_dev0 ,/* index (currently unknown) */ q_size, msg_size, - (u8 *) pool_start, + pool_start,NULL ,/* peer (currently unknown) */ C2_MQ_HOST_TARGET); - mq->host_dma =dma_map_single (c2dev->ibdev.dma_device, - (void *)pool_start, - q_size * msg_size,DMA_FROM_DEVICE );pci_unmap_addr_set (mq, mapping, mq->host_dma);return 0 ;
drivers/infiniband/hw/amso1100/c2_rnic.c +21 -31
85 lines not on this page · raw message
PATCH v2 2/2 amso1100 - Fix incorrect pr_debug().
pr_debug() was printing the wrong stuff.
Signed-off-by Steve Wise <[email protected]>
---
drivers/infiniband/hw/amso1100/c2_rnic.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/amso1100/c2_rnic.c +2 -2
@@ -545,8 +545,8 @@ int c2_rnic_init(struct c2_dev *c2dev) goto bail2; }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); +pr_debug ("%s aeq va %p dma %llx\n" , __FUNCTION__, q2_pages, + (unsigned long long ) c2dev->aeq.host_dma); c2_mq_rep_init(&c2dev->aeq, 2, qsize,
Roland Dreier
AppliedRe: [PATCH 2.6.19-rc3 v2 2/2] amso1100 - Fix incorrect pr_debug().
Applied, thanks.
Roland Dreier
Appliedtsk, tsk:
fatal: 7 lines add trailing whitespaces.
applied to for-2.6.19 anyway, thanks.