@@ -111,6 +111,19 @@ struct opal_accelerator_stream_t {
111111};
112112typedef struct opal_accelerator_stream_t opal_accelerator_stream_t ;
113113
114+ #define IPC_MAX_HANDLE_SIZE 64
115+ struct opal_accelerator_ipc_handle_t {
116+ size_t size ;
117+ uint8_t handle [IPC_MAX_HANDLE_SIZE ];
118+ };
119+ typedef struct opal_accelerator_ipc_handle_t opal_accelerator_ipc_handle_t ;
120+
121+ struct opal_accelerator_ipc_event_handle_t {
122+ size_t size ;
123+ uint8_t handle [IPC_MAX_HANDLE_SIZE ];
124+ };
125+ typedef struct opal_accelerator_ipc_event_handle_t opal_accelerator_ipc_event_handle_t ;
126+
114127struct opal_accelerator_pci_attr_t {
115128 uint16_t domain_id ;
116129 uint8_t bus_id ;
@@ -318,6 +331,78 @@ typedef int (*opal_accelerator_base_module_mem_release_fn_t)(
318331typedef int (* opal_accelerator_base_module_get_address_range_fn_t )(
319332 int dev_id , const void * ptr , void * * base , size_t * size );
320333
334+ /*********************************************************/
335+ /**** Inter Process Communication (IPC) Functions ****/
336+ /*********************************************************/
337+
338+ /**
339+ * Queries whether the device supports IPC or not.
340+ *
341+ * If true, the functions:
342+ *
343+ * opal_accelerator_base_module_get_ipc_handle_fn_t()
344+ * opal_accelerator_base_module_open_ipc_handle_fn_t()
345+ * opal_accelerator_base_module_get_ipc_event_handle_fn_t()
346+ * opal_accelerator_base_module_open_ipc_event_handle_fn_t()
347+ *
348+ * must be implemented.
349+ *
350+ * @return true IPC supported
351+ * @return false IPC not supported
352+ */
353+ typedef bool (* opal_accelerator_base_module_is_ipc_enabled_fn_t )(void );
354+
355+ /**
356+ * Gets an IPC memory handle for an existing device memory allocation.
357+ *
358+ * @param[IN] dev_id Associated device for the IPC memory handle or
359+ * MCA_ACCELERATOR_NO_DEVICE_ID
360+ * @param[IN] dev_ptr Device memory address
361+ * @param[OUT] handle Pointer to IPC handle object
362+ *
363+ * @return OPAL_SUCCESS or error status on failure
364+ *
365+ */
366+ typedef int (* opal_accelerator_base_module_get_ipc_handle_fn_t )(
367+ int dev_id , void * dev_ptr , opal_accelerator_ipc_handle_t * handle );
368+
369+ /**
370+ * Opens an IPC memory handle from another process and returns
371+ * a device pointer usable in the local process.
372+ *
373+ * @param[IN] dev_id Associated device for the IPC memory handle or
374+ * MCA_ACCELERATOR_NO_DEVICE_ID
375+ * @param[IN] handle IPC handle object from another process
376+ * @param[OUT] dev_ptr Returned device pointer
377+ *
378+ * @return OPAL_SUCCESS or error status on failure
379+ */
380+ typedef int (* opal_accelerator_base_module_open_ipc_handle_fn_t )(
381+ int dev_id , opal_accelerator_ipc_handle_t * handle , void * * dev_ptr );
382+
383+ /**
384+ * Gets an IPC event handle for an event created by opal_accelerator_base_module_create_event_fn_t.
385+ *
386+ * @param[IN] event Event created previously
387+ * @param[OUT] handle Pointer to IPC event handle object
388+ *
389+ * @return OPAL_SUCCESS or error status on failure
390+ */
391+ typedef int (* opal_accelerator_base_module_get_ipc_event_handle_fn_t )(
392+ opal_accelerator_event_t * event , opal_accelerator_ipc_event_handle_t * handle );
393+
394+ /**
395+ * Opens an IPC event handle from another process opened by
396+ * opal_accelerator_base_module_get_ipc_event_handle_fn_t.
397+ *
398+ * @param[IN] handle IPC event handle from another process
399+ * @param[OUT] event Pointer to store the opened event
400+ *
401+ * @return OPAL_SUCCESS or error status on failure
402+ */
403+ typedef int (* opal_accelerator_base_module_open_ipc_event_handle_fn_t )(
404+ opal_accelerator_ipc_event_handle_t * handle , opal_accelerator_event_t * event );
405+
321406/**
322407 * Page-locks the memory range specified by ptr and size
323408 *
@@ -414,6 +499,12 @@ typedef struct {
414499 opal_accelerator_base_module_mem_release_fn_t mem_release ;
415500 opal_accelerator_base_module_get_address_range_fn_t get_address_range ;
416501
502+ opal_accelerator_base_module_is_ipc_enabled_fn_t is_ipc_enabled ;
503+ opal_accelerator_base_module_get_ipc_handle_fn_t get_ipc_handle ;
504+ opal_accelerator_base_module_open_ipc_handle_fn_t open_ipc_handle ;
505+ opal_accelerator_base_module_get_ipc_event_handle_fn_t get_ipc_event_handle ;
506+ opal_accelerator_base_module_open_ipc_event_handle_fn_t open_ipc_event_handle ;
507+
417508 opal_accelerator_base_module_host_register_fn_t host_register ;
418509 opal_accelerator_base_module_host_unregister_fn_t host_unregister ;
419510
0 commit comments