@@ -111,6 +111,13 @@ struct opal_accelerator_stream_t {
111111};
112112typedef struct opal_accelerator_stream_t opal_accelerator_stream_t ;
113113
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+
114121struct opal_accelerator_pci_attr_t {
115122 uint16_t domain_id ;
116123 uint8_t bus_id ;
@@ -318,6 +325,64 @@ typedef int (*opal_accelerator_base_module_mem_release_fn_t)(
318325typedef int (* opal_accelerator_base_module_get_address_range_fn_t )(
319326 int dev_id , const void * ptr , void * * base , size_t * size );
320327
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+
321386/**
322387 * Page-locks the memory range specified by ptr and size
323388 *
@@ -414,6 +479,11 @@ typedef struct {
414479 opal_accelerator_base_module_mem_release_fn_t mem_release ;
415480 opal_accelerator_base_module_get_address_range_fn_t get_address_range ;
416481
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+
417487 opal_accelerator_base_module_host_register_fn_t host_register ;
418488 opal_accelerator_base_module_host_unregister_fn_t host_unregister ;
419489
0 commit comments