@@ -111,6 +111,19 @@ 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+
121+ struct opal_accelerator_ipc_event_handle_t {
122+ size_t size ;
123+ uint8_t handle [MAX_IPC_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 ;
@@ -366,6 +379,87 @@ typedef int (*opal_accelerator_base_module_mem_release_fn_t)(
366379typedef int (* opal_accelerator_base_module_get_address_range_fn_t )(
367380 int dev_id , const void * ptr , void * * base , size_t * size );
368381
382+ /*********************************************************/
383+ /**** Inter Process Communication (IPC) Functions ****/
384+ /*********************************************************/
385+
386+ /**
387+ * Queries whether the device supports IPC or not.
388+ *
389+ * If true, the functions:
390+ *
391+ * opal_accelerator_base_module_get_ipc_handle_fn_t()
392+ * opal_accelerator_base_module_open_ipc_handle_fn_t()
393+ * opal_accelerator_base_module_close_ipc_handle_fn_t()
394+ *
395+ * must be implemented.
396+ *
397+ * @return true IPC supported
398+ * @return false IPC not supported
399+ */
400+ typedef bool (* opal_accelerator_base_module_is_ipc_enabled_fn_t )(void );
401+
402+ /**
403+ * Gets an IPC memory handle for an existing device memory allocation.
404+ *
405+ * @param[IN] dev_id Associated device for the IPC memory handle or
406+ * MCA_ACCELERATOR_NO_DEVICE_ID
407+ * @param[IN] dev_ptr Device memory address
408+ * @param[OUT] handle Pointer to IPC handle object
409+ *
410+ * @return OPAL_SUCCESS or error status on failure
411+ *
412+ */
413+ typedef int (* opal_accelerator_base_module_get_ipc_handle_fn_t )(
414+ int dev_id , void * dev_ptr , opal_accelerator_ipc_handle_t * handle );
415+
416+ /**
417+ * Opens an IPC memory handle from another process and returns
418+ * a device pointer usable in the local process.
419+ *
420+ * @param[IN] dev_id Associated device for the IPC memory handle or
421+ * MCA_ACCELERATOR_NO_DEVICE_ID
422+ * @param[IN] handle IPC handle object from another process
423+ * @param[OUT] dev_ptr Returned device pointer
424+ *
425+ * @return OPAL_SUCCESS or error status on failure
426+ */
427+ typedef int (* opal_accelerator_base_module_open_ipc_handle_fn_t )(
428+ int dev_id , opal_accelerator_ipc_handle_t * handle , void * * dev_ptr );
429+
430+ /**
431+ * Gets an IPC event handle for an event created by opal_accelerator_base_module_create_event_fn_t.
432+ *
433+ * @param[IN] event Event created previously
434+ * @param[OUT] handle Pointer to IPC event handle object
435+ *
436+ * @return OPAL_SUCCESS or error status on failure
437+ */
438+ typedef int (* opal_accelerator_base_module_get_ipc_event_handle_fn_t )(
439+ opal_accelerator_event_t * event , opal_accelerator_ipc_event_handle_t * handle );
440+
441+ /**
442+ * Opens an IPC event handle from another process opened by
443+ * opal_accelerator_base_module_get_ipc_event_handle_fn_t.
444+ *
445+ * @param[IN] handle IPC event handle from another process
446+ * @param[OUT] event Pointer to store the opened event
447+ *
448+ * @return OPAL_SUCCESS or error status on failure
449+ */
450+ typedef int (* opal_accelerator_base_module_open_ipc_event_handle_fn_t )(
451+ opal_accelerator_ipc_event_handle_t * handle , opal_accelerator_event_t * event );
452+
453+ /**
454+ * Closes IPC memory mapped with opal_accelerator_base_module_open_ipc_handle_fn_t().
455+ *
456+ * @param[IN] dev_id Associated device for the IPC memory handle or
457+ * MCA_ACCELERATOR_NO_DEVICE_ID
458+ * @param[IN] dev_ptr IPC device pointer returned from
459+ * opal_accelerator_base_module_open_ipc_handle_fn_t()
460+ */
461+ typedef int (* opal_accelerator_base_module_close_ipc_handle_fn_t )(int dev_id , void * dev_ptr );
462+
369463/**
370464 * Page-locks the memory range specified by ptr and size
371465 *
@@ -466,6 +560,13 @@ typedef struct {
466560 opal_accelerator_base_module_mem_release_fn_t mem_release ;
467561 opal_accelerator_base_module_get_address_range_fn_t get_address_range ;
468562
563+ opal_accelerator_base_module_is_ipc_enabled_fn_t is_ipc_enabled ;
564+ opal_accelerator_base_module_get_ipc_handle_fn_t get_ipc_handle ;
565+ opal_accelerator_base_module_open_ipc_handle_fn_t open_ipc_handle ;
566+ opal_accelerator_base_module_close_ipc_handle_fn_t close_ipc_handle ;
567+ opal_accelerator_base_module_get_ipc_event_handle_fn_t get_ipc_event_handle ;
568+ opal_accelerator_base_module_open_ipc_event_handle_fn_t open_ipc_event_handle ;
569+
469570 opal_accelerator_base_module_host_register_fn_t host_register ;
470571 opal_accelerator_base_module_host_unregister_fn_t host_unregister ;
471572
0 commit comments