@@ -111,6 +111,13 @@ struct opal_accelerator_stream_t {
111
111
};
112
112
typedef struct opal_accelerator_stream_t opal_accelerator_stream_t ;
113
113
114
+ #define MAX_IPC_HANDLE_SIZE 64
115
+ struct opal_accelerator_ipc_handle_t {
116
+ size_t size ;
117
+ uint8_t handle [MAX_IPC_HANDLE_SIZE ];
118
+ };
119
+ typedef struct opal_accelerator_ipc_handle_t opal_accelerator_ipc_handle_t ;
120
+
114
121
struct opal_accelerator_pci_attr_t {
115
122
uint16_t domain_id ;
116
123
uint8_t bus_id ;
@@ -318,6 +325,64 @@ typedef int (*opal_accelerator_base_module_mem_release_fn_t)(
318
325
typedef int (* opal_accelerator_base_module_get_address_range_fn_t )(
319
326
int dev_id , const void * ptr , void * * base , size_t * size );
320
327
328
+ /*********************************************************/
329
+ /**** Inter Process Communication (IPC) Functions ****/
330
+ /*********************************************************/
331
+
332
+ /**
333
+ * Queries whether the device supports IPC or not.
334
+ *
335
+ * If true, the functions:
336
+ *
337
+ * opal_accelerator_base_module_get_ipc_handle_fn_t()
338
+ * opal_accelerator_base_module_open_ipc_handle_fn_t()
339
+ * opal_accelerator_base_module_close_ipc_handle_fn_t()
340
+ *
341
+ * must be implemented.
342
+ *
343
+ * @return true IPC supported
344
+ * @return false IPC not supported
345
+ */
346
+ typedef bool (* opal_accelerator_base_module_is_ipc_enabled_fn_t )(void );
347
+
348
+ /**
349
+ * Gets an IPC memory handle for an existing device memory allocation.
350
+ *
351
+ * @param[IN] dev_id Associated device for the IPC memory handle or
352
+ * MCA_ACCELERATOR_NO_DEVICE_ID
353
+ * @param[IN] dev_ptr Device memory address
354
+ * @param[OUT] handle Pointer to IPC handle object
355
+ *
356
+ * @return OPAL_SUCCESS or error status on failure
357
+ *
358
+ */
359
+ typedef int (* opal_accelerator_base_module_get_ipc_handle_fn_t )(
360
+ int dev_id , void * dev_ptr , opal_accelerator_ipc_handle_t * handle );
361
+
362
+ /**
363
+ * Opens an IPC memory handle from another process and returns
364
+ * a device pointer usable in the local process.
365
+ *
366
+ * @param[IN] dev_id Associated device for the IPC memory handle or
367
+ * MCA_ACCELERATOR_NO_DEVICE_ID
368
+ * @param[IN] handle IPC handle object from another process
369
+ * @param[OUT] dev_ptr Returned device pointer
370
+ *
371
+ * @return OPAL_SUCCESS or error status on failure
372
+ */
373
+ typedef int (* opal_accelerator_base_module_open_ipc_handle_fn_t )(
374
+ int dev_id , opal_accelerator_ipc_handle_t * handle , void * * dev_ptr );
375
+
376
+ /**
377
+ * Closes IPC memory mapped with opal_accelerator_base_module_open_ipc_handle_fn_t().
378
+ *
379
+ * @param[IN] dev_id Associated device for the IPC memory handle or
380
+ * MCA_ACCELERATOR_NO_DEVICE_ID
381
+ * @param[IN] dev_ptr IPC device pointer returned from
382
+ * opal_accelerator_base_module_open_ipc_handle_fn_t()
383
+ */
384
+ typedef int (* opal_accelerator_base_module_close_ipc_handle_fn_t )(int dev_id , void * dev_ptr );
385
+
321
386
/**
322
387
* Page-locks the memory range specified by ptr and size
323
388
*
@@ -414,6 +479,11 @@ typedef struct {
414
479
opal_accelerator_base_module_mem_release_fn_t mem_release ;
415
480
opal_accelerator_base_module_get_address_range_fn_t get_address_range ;
416
481
482
+ opal_accelerator_base_module_is_ipc_enabled_fn_t is_ipc_enabled ;
483
+ opal_accelerator_base_module_get_ipc_handle_fn_t get_ipc_handle ;
484
+ opal_accelerator_base_module_open_ipc_handle_fn_t open_ipc_handle ;
485
+ opal_accelerator_base_module_close_ipc_handle_fn_t close_ipc_handle ;
486
+
417
487
opal_accelerator_base_module_host_register_fn_t host_register ;
418
488
opal_accelerator_base_module_host_unregister_fn_t host_unregister ;
419
489
0 commit comments