Dear QEMU developers,

I hope this message finds you well.

I would like to propose a feature request regarding the TCG plugin interface, 
aiming to enhance its usability as a golden model in CPU development 
environments.

It would be extremely valuable for me if the TCG plugin framework could provide 
hooks or mechanisms to capture and propagate interruption or exception events ― 
including synchronous exceptions (e.g., traps, faults) and asynchronous 
interrupts (e.g., external IRQs, timer interrupts). This would allow plugins to 
gain observability into CPU control flow changes that are not directly visible 
through basic instruction instrumentation.

At present, the QEMU plugin interface offers the following event types, as 
defined in `enum qemu_plugin_event`:

QEMU_PLUGIN_EV_VCPU_INIT
QEMU_PLUGIN_EV_VCPU_EXIT
QEMU_PLUGIN_EV_VCPU_TB_TRANS
QEMU_PLUGIN_EV_VCPU_IDLE
QEMU_PLUGIN_EV_VCPU_RESUME
QEMU_PLUGIN_EV_VCPU_SYSCALL
QEMU_PLUGIN_EV_VCPU_SYSCALL_RET
QEMU_PLUGIN_EV_FLUSH
QEMU_PLUGIN_EV_ATEXIT
QEMU_PLUGIN_EV_MAX

To better support exception and interrupt observability in plugins, I propose 
introducing a new plugin event, for example:
QEMU_PLUGIN_EV_VCPU_INT
This event would be triggered when the virtual CPU receives or processes an 
interrupt or exception. Ideally, the associated callback should receive 
detailed context ― such as the exception or interrupt type, current PC, 
privilege level, and cause ― and should support a return value, such as bool, 
to indicate whether the propagation of the event should continue or be blocked 
to have the control of the interrupting timing.

Thank you very much for your time and for the amazing work on QEMU.

Reply via email to