diff options
author | Jag Raman <jag.raman@oracle.com> | 2022-06-07 16:21:40 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-07 21:21:40 +0100 |
commit | a767ebd126157c4aa55ff0fe5786681507fb7ea8 (patch) | |
tree | 6876e347860a2ab1871d0e413312fe507fd006d6 /include | |
parent | d307dbcab74aef3680ba99d7f836f2bc0b4bc81e (diff) | |
download | libvfio-user-a767ebd126157c4aa55ff0fe5786681507fb7ea8.zip libvfio-user-a767ebd126157c4aa55ff0fe5786681507fb7ea8.tar.gz libvfio-user-a767ebd126157c4aa55ff0fe5786681507fb7ea8.tar.bz2 |
irq: inform device of IRQ mask & unmask via callback (#694)
Client masks or unmasks a device IRQ using the
VFIO_USER_DEVICE_SET_IRQS message. Inform the device of such changes to
the IRQ state.
Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
Reviewed-by: John Levon <john.levon@nutanix.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/libvfio-user.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/libvfio-user.h b/include/libvfio-user.h index ba599b5..84eb2d8 100644 --- a/include/libvfio-user.h +++ b/include/libvfio-user.h @@ -549,6 +549,31 @@ int vfu_setup_device_nr_irqs(vfu_ctx_t *vfu_ctx, enum vfu_dev_irq_type type, uint32_t count); +/* + * Function that is called when the guest masks or unmasks an IRQ vector. + * + * @vfu_ctx: the libvfio-user context + * @start: starting IRQ vector + * @count: number of vectors + * @mask: indicates if the IRQ is masked or unmasked + */ +typedef void (vfu_dev_irq_state_cb_t)(vfu_ctx_t *vfu_ctx, uint32_t start, + uint32_t count, bool mask); + +/** + * Set up IRQ state change callback. When libvfio-user is notified of a + * change to IRQ state, whether masked or unmasked, it invokes + * this callback. + * + * @vfu_ctx: the libvfio-user context + * @type: IRQ type such as VFU_DEV_MSIX_IRQ - defined by vfu_dev_irq_type + * @cb: IRQ state change callback + * + * @returns 0 on success, -1 on error, sets errno. + */ +int +vfu_setup_irq_state_callback(vfu_ctx_t *vfu_ctx, enum vfu_dev_irq_type type, + vfu_dev_irq_state_cb_t *cb); typedef enum { VFU_MIGR_STATE_STOP, |