From 229d93709d772ce6a98802b2bb4440b3dd4e9987 Mon Sep 17 00:00:00 2001 From: Phil Cayton Date: Mon, 25 May 2015 16:32:41 +0300 Subject: [PATCH] Fix XEON PHI compilation issue: http://bugs.openfabrics.org/bugzilla/show_bug.cgi?id=2543 Signed-off-by: Phil Cayton Signed-off-by: Vladimir Sokolovsky --- .../0004-add-context-based-umem-support.patch | 133 ------------------ 1 file changed, 133 deletions(-) diff --git a/tech-preview/xeon-phi/0004-add-context-based-umem-support.patch b/tech-preview/xeon-phi/0004-add-context-based-umem-support.patch index 41970be..a483e59 100644 --- a/tech-preview/xeon-phi/0004-add-context-based-umem-support.patch +++ b/tech-preview/xeon-phi/0004-add-context-based-umem-support.patch @@ -7,8 +7,6 @@ The ib_umem_get routine calls get_user_pages to pin pages and create the ib_umem structure. Memory on MIC, however, must be mapped through SCIF for access across PCI. This patch allows setup of context-based ib_umem mapping routines. - -Also update mthca to support these changes --- diff -urN a3/drivers/infiniband/core/umem.c a4/drivers/infiniband/core/umem.c --- a3/drivers/infiniband/core/umem.c 2015-01-05 14:12:52.117593540 -0800 @@ -198,137 +196,6 @@ diff -urN a3/drivers/infiniband/core/umem.c a4/drivers/infiniband/core/umem.c + ops->page_count(umem) : ib_page_count_umem(umem); +} EXPORT_SYMBOL(ib_umem_page_count); -diff -urN a3/drivers/infiniband/hw/mthca/mthca_memfree.c a4/drivers/infiniband/hw/mthca/mthca_memfree.c ---- a3/drivers/infiniband/hw/mthca/mthca_memfree.c 2015-01-05 14:12:52.112593540 -0800 -+++ a4/drivers/infiniband/hw/mthca/mthca_memfree.c 2015-01-05 14:36:00.825535043 -0800 -@@ -39,6 +39,12 @@ - - #include - -+/* Must use the ib_umem routines to support the IB proxy server. */ -+#define MTHCA_IB_UMEM -+#ifdef MTHCA_IB_UMEM -+#include -+#endif -+ - #include "mthca_memfree.h" - #include "mthca_dev.h" - #include "mthca_cmd.h" -@@ -56,7 +62,11 @@ - struct mutex mutex; - struct { - u64 uvirt; -+#ifdef MTHCA_IB_UMEM -+ struct ib_umem *umem; -+#else - struct scatterlist mem; -+#endif - int refcount; - } page[0]; - }; -@@ -446,7 +456,12 @@ - int mthca_map_user_db(struct mthca_dev *dev, struct mthca_uar *uar, - struct mthca_user_db_table *db_tab, int index, u64 uaddr) - { -+#ifdef MTHCA_IB_UMEM -+ struct mthca_ucontext *context; -+ struct ib_umem_chunk *chunk; -+#else - struct page *pages[1]; -+#endif - int ret = 0; - int i; - -@@ -472,6 +487,22 @@ - goto out; - } - -+#ifdef MTHCA_IB_UMEM -+ context = container_of(uar, struct mthca_ucontext, uar); -+ -+ db_tab->page[i].umem = ib_umem_get(&context->ibucontext, -+ uaddr & PAGE_MASK, PAGE_SIZE, 0, 0); -+ if (IS_ERR(db_tab->page[i].umem)) { -+ ret = PTR_ERR(db_tab->page[i].umem); -+ goto out; -+ } -+ -+ chunk = list_entry(db_tab->page[i].umem->chunk_list.next, -+ struct ib_umem_chunk, list); -+ -+ ret = mthca_MAP_ICM_page(dev, sg_dma_address(&chunk->page_list[0]), -+ mthca_uarc_virt(dev, uar, i)); -+#else - ret = get_user_pages(current, current->mm, uaddr & PAGE_MASK, 1, 1, 0, - pages, NULL); - if (ret < 0) -@@ -488,9 +519,14 @@ - - ret = mthca_MAP_ICM_page(dev, sg_dma_address(&db_tab->page[i].mem), - mthca_uarc_virt(dev, uar, i)); -+#endif - if (ret) { -+#ifdef MTHCA_IB_UMEM -+ ib_umem_release(db_tab->page[i].umem); -+#else - pci_unmap_sg(dev->pdev, &db_tab->page[i].mem, 1, PCI_DMA_TODEVICE); - put_page(sg_page(&db_tab->page[i].mem)); -+#endif - goto out; - } - -@@ -505,6 +541,9 @@ - void mthca_unmap_user_db(struct mthca_dev *dev, struct mthca_uar *uar, - struct mthca_user_db_table *db_tab, int index) - { -+#ifdef MTHCA_IB_UMEM -+ int i; -+#endif - if (!mthca_is_memfree(dev)) - return; - -@@ -515,7 +554,16 @@ - - mutex_lock(&db_tab->mutex); - -+#ifdef MTHCA_IB_UMEM -+ i = index / MTHCA_DB_REC_PER_PAGE; -+ if (!--db_tab->page[i].refcount) { -+ mthca_UNMAP_ICM(dev, mthca_uarc_virt(dev, uar, i), 1); -+ ib_umem_release(db_tab->page[i].umem); -+ db_tab->page[i].uvirt = 0; -+ } -+#else - --db_tab->page[index / MTHCA_DB_REC_PER_PAGE].refcount; -+#endif - - mutex_unlock(&db_tab->mutex); - } -@@ -538,7 +586,11 @@ - for (i = 0; i < npages; ++i) { - db_tab->page[i].refcount = 0; - db_tab->page[i].uvirt = 0; -+#ifdef MTHCA_IB_UMEM -+ db_tab->page[i].umem = NULL; -+#else - sg_init_table(&db_tab->page[i].mem, 1); -+#endif - } - - return db_tab; -@@ -555,8 +607,12 @@ - for (i = 0; i < dev->uar_table.uarc_size / MTHCA_ICM_PAGE_SIZE; ++i) { - if (db_tab->page[i].uvirt) { - mthca_UNMAP_ICM(dev, mthca_uarc_virt(dev, uar, i), 1); -+#ifdef MTHCA_IB_UMEM -+ ib_umem_release(db_tab->page[i].umem); -+#else - pci_unmap_sg(dev->pdev, &db_tab->page[i].mem, 1, PCI_DMA_TODEVICE); - put_page(sg_page(&db_tab->page[i].mem)); -+#endif - } - } - diff -urN a3/include/rdma/ib_verbs.h a4/include/rdma/ib_verbs.h --- a3/include/rdma/ib_verbs.h 2015-01-05 14:18:48.871578512 -0800 +++ a4/include/rdma/ib_verbs.h 2015-01-05 14:36:00.826535043 -0800 -- 2.46.0