aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mthca/mthca_memfree.h
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@mellanox.co.il>2007-02-10 16:15:08 -0500
committerRoland Dreier <rolandd@cisco.com>2007-02-12 19:16:29 -0500
commit391e4dea7189eef32b0c2d121e7e047110c1b83c (patch)
tree99cfb7f912837fb6f37ae290c9f1345d218eab06 /drivers/infiniband/hw/mthca/mthca_memfree.h
parent1d1f19cfce7687b557cebdc41bf8a5eeba8a9882 (diff)
IB/mthca: Fix access to MTT and MPT tables on non-cache-coherent CPUs
We allocate the MTT table with alloc_pages() and then do pci_map_sg(), so we must call pci_dma_sync_sg() after the CPU writes to the MTT table. This works since the device will never write MTTs on mem-free HCAs, once we get rid of the use of the WRITE_MTT firmware command. This change is needed to make that work, and is an improvement for now, since it gives FMRs a chance at working. For MPTs, both the device and CPU might write there, so we must allocate DMA coherent memory for these. Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/mthca/mthca_memfree.h')
-rw-r--r--drivers/infiniband/hw/mthca/mthca_memfree.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_memfree.h b/drivers/infiniband/hw/mthca/mthca_memfree.h
index 6d42947e1dc4..594144145f45 100644
--- a/drivers/infiniband/hw/mthca/mthca_memfree.h
+++ b/drivers/infiniband/hw/mthca/mthca_memfree.h
@@ -69,6 +69,7 @@ struct mthca_icm_table {
69 int num_obj; 69 int num_obj;
70 int obj_size; 70 int obj_size;
71 int lowmem; 71 int lowmem;
72 int coherent;
72 struct mutex mutex; 73 struct mutex mutex;
73 struct mthca_icm *icm[0]; 74 struct mthca_icm *icm[0];
74}; 75};
@@ -82,17 +83,17 @@ struct mthca_icm_iter {
82struct mthca_dev; 83struct mthca_dev;
83 84
84struct mthca_icm *mthca_alloc_icm(struct mthca_dev *dev, int npages, 85struct mthca_icm *mthca_alloc_icm(struct mthca_dev *dev, int npages,
85 gfp_t gfp_mask); 86 gfp_t gfp_mask, int coherent);
86void mthca_free_icm(struct mthca_dev *dev, struct mthca_icm *icm); 87void mthca_free_icm(struct mthca_dev *dev, struct mthca_icm *icm, int coherent);
87 88
88struct mthca_icm_table *mthca_alloc_icm_table(struct mthca_dev *dev, 89struct mthca_icm_table *mthca_alloc_icm_table(struct mthca_dev *dev,
89 u64 virt, int obj_size, 90 u64 virt, int obj_size,
90 int nobj, int reserved, 91 int nobj, int reserved,
91 int use_lowmem); 92 int use_lowmem, int use_coherent);
92void mthca_free_icm_table(struct mthca_dev *dev, struct mthca_icm_table *table); 93void mthca_free_icm_table(struct mthca_dev *dev, struct mthca_icm_table *table);
93int mthca_table_get(struct mthca_dev *dev, struct mthca_icm_table *table, int obj); 94int mthca_table_get(struct mthca_dev *dev, struct mthca_icm_table *table, int obj);
94void mthca_table_put(struct mthca_dev *dev, struct mthca_icm_table *table, int obj); 95void mthca_table_put(struct mthca_dev *dev, struct mthca_icm_table *table, int obj);
95void *mthca_table_find(struct mthca_icm_table *table, int obj); 96void *mthca_table_find(struct mthca_icm_table *table, int obj, dma_addr_t *dma_handle);
96int mthca_table_get_range(struct mthca_dev *dev, struct mthca_icm_table *table, 97int mthca_table_get_range(struct mthca_dev *dev, struct mthca_icm_table *table,
97 int start, int end); 98 int start, int end);
98void mthca_table_put_range(struct mthca_dev *dev, struct mthca_icm_table *table, 99void mthca_table_put_range(struct mthca_dev *dev, struct mthca_icm_table *table,