These functions allow the allocation and handling of AFU IRQs.
More...
|
ocxl_err | ocxl_irq_alloc (ocxl_afu_h afu, void *info, ocxl_irq_h *irq) |
| Allocate an IRQ for an open AFU. More...
|
|
uint64_t | ocxl_irq_get_handle (ocxl_afu_h afu, ocxl_irq_h irq) |
| Get the 64 bit IRQ handle for an IRQ. More...
|
|
int | ocxl_irq_get_fd (ocxl_afu_h afu, ocxl_irq_h irq) |
| Get the file descriptor associated with an IRQ. More...
|
|
int | ocxl_afu_get_event_fd (ocxl_afu_h afu) |
| Get a descriptor that will trigger a poll when an AFU event occurs. More...
|
|
int | ocxl_afu_event_check_versioned (ocxl_afu_h afu, int timeout, ocxl_event *events, uint16_t event_count, uint16_t event_api_version) |
| Check for pending IRQs and other events. More...
|
|
int | ocxl_afu_event_check (ocxl_afu_h afu, int timeout, ocxl_event *events, uint16_t event_count) |
| Check for pending IRQs and other events. More...
|
|
These functions allow the allocation and handling of AFU IRQs.
IRQs can be handled either via requesting an array of triggered IRQ handles (via ocxl_afu_check), or by issuing callbacks via ocxl_afu_handle_callbacks().
Each IRQ has an opaque pointer attached, which is communicated to the caller via the event struct passed back from ocxl_afu_event_check(). This pointer can be used by the caller to save identifying information against the IRQ.
◆ ocxl_kernel_event_header
◆ ocxl_kernel_event_xsl_fault_error
◆ ocxl_afu_event_check()
Check for pending IRQs and other events.
Waits for the AFU to report an event or IRQs. On return, events will be populated with the reported number of events. Each event may be either an AFU event, or an IRQ, which can be determined by checking the value of events[i].type:
Value | Action |
OCXL_EVENT_IRQ | An IRQ was triggered, and events[i].irq is populated with the IRQ information identifying which IRQ was triggered |
OCXL_EVENT_TRANSLATION_FAULT | An OpenCAPI translation fault error has been issued, that is, the system has been unable to resolve an effective address. Events[i].translation_fault will be populated with the details of the error |
- Parameters
-
| afu | the AFU holding the interrupts |
| timeout | how long to wait (in milliseconds) for interrupts to arrive, set to -1 to wait indefinitely, or 0 to return immediately if no events are available |
[out] | events | the triggered events (caller allocated) |
| event_count | the number of triggered events |
- Returns
- the number of events triggered, if this is the same as event_count, you should call ocxl_afu_event_check again
- Return values
-
Definition at line 206 of file libocxl.h.
◆ ocxl_afu_event_check_versioned()
int ocxl_afu_event_check_versioned |
( |
ocxl_afu_h |
afu, |
|
|
int |
timeout, |
|
|
ocxl_event * |
events, |
|
|
uint16_t |
event_count, |
|
|
uint16_t |
event_api_version |
|
) |
| |
Check for pending IRQs and other events.
This function should not be called directly, instead, use the ocxl_afu_event_check() wrapper.
Waits for the AFU to report an event or IRQs. On return, events will be populated with the reported number of events. Each event may be either an AFU event, or an IRQ, which can be determined by checking the value of events[i].type:
Value | Action |
OCXL_EVENT_IRQ | An IRQ was triggered, and events[i].irq is populated with the IRQ information identifying which IRQ was triggered |
OCXL_EVENT_TRANSLATION_FAULT | An OpenCAPI translation fault error has been issued, that is, the system has been unable to resolve an effective address. Events[i].translation_fault will be populated with the details of the error |
- See also
- ocxl_afu_event_check
- Parameters
-
| afu | the AFU holding the interrupts |
| timeout | how long to wait (in milliseconds) for interrupts to arrive, set to -1 to wait indefinitely, or 0 to return immediately if no events are available |
[out] | events | the triggered events (caller allocated) |
| event_count | the number of events that can fit into the events array |
| event_api_version | the version of the event API that the caller wants to see |
- Returns
- the number of events triggered, if this is the same as event_count, you should call ocxl_afu_event_check again
- Return values
-
Definition at line 407 of file irq.c.
◆ ocxl_afu_get_event_fd()
Get a descriptor that will trigger a poll when an AFU event occurs.
When triggered, call ocxl_read_afu_event() to extract the event information.
- See also
- ocxl_afu_event_check()
- Precondition
- the AFU has been opened
- Parameters
-
afu | the AFU the IRQ belongs to |
- Returns
- the handle
Definition at line 247 of file irq.c.
◆ ocxl_irq_alloc()
Allocate an IRQ for an open AFU.
Once allocated, the IRQ handle can be retrieved with ocxl_irq_get_handle(), and written into an AFU specific register in the AFU's MMIO area. The AFU can then trigger the IRQ, which can be listened for with ocxl_afu_event_check(), or by obtaining an event descriptor via ocxl_irq_get_fd() and using it with poll(), select(), etc.
- Parameters
-
| afu | the AFU to allocate IRQs for |
| info | user information to associate with the handle (may be NULL) |
[out] | irq | the 0 indexed IRQ number that was allocated. This will be monotonically incremented by each subsequent call. |
- Return values
-
OCXL_OK | if the IRQs have been allocated |
OCXL_NO_MEM | if a memory allocation error occurred |
Definition at line 166 of file irq.c.
◆ ocxl_irq_get_fd()
Get the file descriptor associated with an IRQ.
This descriptor may be used with select/poll to determine if an IRQ is triggered.
- Parameters
-
afu | the AFU the IRQ belongs to |
irq | the IRQ to get the descriptor of |
- Returns
- the handle, or -1 if the descriptor is invalid
Definition at line 222 of file irq.c.
◆ ocxl_irq_get_handle()
Get the 64 bit IRQ handle for an IRQ.
This handle can be written to the AFU's MMIO area to allow the AFU to trigger the IRQ.
- Parameters
-
afu | the AFU the IRQ belongs to |
irq | the IRQ to get the handle of |
- Returns
- the handle, or 0 if the handle is invalid
Definition at line 201 of file irq.c.