summaryrefslogtreecommitdiff
path: root/include/rdma
diff options
context:
space:
mode:
authorJérôme Glisse <jglisse@redhat.com>2015-03-27 08:15:35 -0400
committerJérôme Glisse <jglisse@redhat.com>2016-04-07 13:24:05 -0400
commitaa375130210a9941e84d4f4cf41e6bef7a728599 (patch)
tree49d9e97be15b3e375688e3a2902ead7a7d2fb3a7 /include/rdma
parentd77c4e5adedc4ce363d35a18c3ee380b0eef92a5 (diff)
ib/mlx5/hmm: add mlx5 hmm device initialization and callback v3
This add the core hmm callback for mlx5 device driver and initialize the hmm device for the mlx5 infiniband device driver. Changed since v1: - Adapt to new hmm_mirror lifetime rules. - HMM_ISDIRTY no longer exist. Changed since v2: - Adapt to HMM page table changes. Signed-off-by: Jérôme Glisse <jglisse@redhat.com> Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Diffstat (limited to 'include/rdma')
-rw-r--r--include/rdma/ib_umem_odp.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/rdma/ib_umem_odp.h b/include/rdma/ib_umem_odp.h
index 6df3a05fdbce..0d20a86023ca 100644
--- a/include/rdma/ib_umem_odp.h
+++ b/include/rdma/ib_umem_odp.h
@@ -133,6 +133,23 @@ struct umem_odp_node *rbt_ib_umem_iter_next(struct umem_odp_node *node,
#if IS_ENABLED(CONFIG_INFINIBAND_ON_DEMAND_PAGING_HMM)
+
+/*
+ * HMM have few bits reserved for hardware specific bits inside the mirror page
+ * table. For IB we record the mapping protection per page there.
+ */
+#define ODP_READ_ALLOWED_SHIFT (HMM_PTE_HW_SHIFT + 0)
+#define ODP_WRITE_ALLOWED_SHIFT (HMM_PTE_HW_SHIFT + 1)
+#define ODP_READ_ALLOWED_BIT (1 << ODP_READ_ALLOWED_SHIFT)
+#define ODP_WRITE_ALLOWED_BIT (1 << ODP_WRITE_ALLOWED_SHIFT)
+
+/* Make sure we are not overwritting valid address bit on target arch. */
+#if (HMM_PTE_HW_SHIFT + 2) > PAGE_SHIFT
+#error (HMM_PTE_HW_SHIFT + 2) > PAGE_SHIFT
+#endif
+
+#define ODP_DMA_ADDR_MASK HMM_PTE_DMA_MASK
+
#else /* CONFIG_INFINIBAND_ON_DEMAND_PAGING_HMM */