summaryrefslogtreecommitdiffstats
path: root/include/misc
diff options
context:
space:
mode:
authorAlastair D'Silva <alastair@d-silva.org>2019-03-27 01:31:33 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2019-05-02 12:55:02 -0400
commitb9721d275cc2c5e6c07371239c827e0faf05a6b9 (patch)
tree06ac877469c44d3c14a93a013440150818c6567a /include/misc
parent75ca758adbafc81804c39b2c200ecdc819a6c042 (diff)
ocxl: Allow external drivers to use OpenCAPI contexts
Most OpenCAPI operations require a valid context, so exposing these functions to external drivers is necessary. Signed-off-by: Alastair D'Silva <alastair@d-silva.org> Reviewed-by: Greg Kurz <groug@kaod.org> Acked-by: Frederic Barrat <fbarrat@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'include/misc')
-rw-r--r--include/misc/ocxl.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/include/misc/ocxl.h b/include/misc/ocxl.h
index 8bafd748e380..e4704632eac5 100644
--- a/include/misc/ocxl.h
+++ b/include/misc/ocxl.h
@@ -48,6 +48,7 @@ struct ocxl_fn_config {
48// These are opaque outside the ocxl driver 48// These are opaque outside the ocxl driver
49struct ocxl_afu; 49struct ocxl_afu;
50struct ocxl_fn; 50struct ocxl_fn;
51struct ocxl_context;
51 52
52// Device detection & initialisation 53// Device detection & initialisation
53 54
@@ -116,6 +117,44 @@ const struct ocxl_fn_config *ocxl_function_config(struct ocxl_fn *fn);
116 */ 117 */
117void ocxl_function_close(struct ocxl_fn *fn); 118void ocxl_function_close(struct ocxl_fn *fn);
118 119
120// Context allocation
121
122/**
123 * Allocate an OpenCAPI context
124 *
125 * @context: The OpenCAPI context to allocate, must be freed with ocxl_context_free
126 * @afu: The AFU the context belongs to
127 * @mapping: The mapping to unmap when the context is closed (may be NULL)
128 */
129int ocxl_context_alloc(struct ocxl_context **context, struct ocxl_afu *afu,
130 struct address_space *mapping);
131
132/**
133 * Free an OpenCAPI context
134 *
135 * @ctx: The OpenCAPI context to free
136 */
137void ocxl_context_free(struct ocxl_context *ctx);
138
139/**
140 * Grant access to an MM to an OpenCAPI context
141 * @ctx: The OpenCAPI context to attach
142 * @amr: The value of the AMR register to restrict access
143 * @mm: The mm to attach to the context
144 *
145 * Returns 0 on success, negative on failure
146 */
147int ocxl_context_attach(struct ocxl_context *ctx, u64 amr,
148 struct mm_struct *mm);
149
150/**
151 * Detach an MM from an OpenCAPI context
152 * @ctx: The OpenCAPI context to attach
153 *
154 * Returns 0 on success, negative on failure
155 */
156int ocxl_context_detach(struct ocxl_context *ctx);
157
119// AFU Metadata 158// AFU Metadata
120 159
121/** 160/**