diff options
author | Alex Bennée <alex.bennee@linaro.org> | 2024-06-20 16:22:16 +0100 |
---|---|---|
committer | Alex Bennée <alex.bennee@linaro.org> | 2024-06-24 10:15:04 +0100 |
commit | 847a65dd76bf1868c7966a2b2608dcd00cb68dc7 (patch) | |
tree | 16b4986d25cca97ed4fa82cfa52c57b62e5a3dff /include/qemu/qemu-plugin.h | |
parent | d4d133a34b300b574d446316491828867205d17f (diff) | |
download | qemu-847a65dd76bf1868c7966a2b2608dcd00cb68dc7.zip qemu-847a65dd76bf1868c7966a2b2608dcd00cb68dc7.tar.gz qemu-847a65dd76bf1868c7966a2b2608dcd00cb68dc7.tar.bz2 |
plugins: add time control API
Expose the ability to control time through the plugin API. Only one
plugin can control time so it has to request control when loaded.
There are probably more corner cases to catch here.
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
[AJB: tweaked user-mode handling, merged QEMU_PLUGIN_API fix]
Message-Id: <20240530220610.1245424-6-pierrick.bouvier@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20240620152220.2192768-9-alex.bennee@linaro.org>
Diffstat (limited to 'include/qemu/qemu-plugin.h')
-rw-r--r-- | include/qemu/qemu-plugin.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 95703d8..c71c705 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -661,6 +661,33 @@ void qemu_plugin_register_vcpu_mem_inline_per_vcpu( qemu_plugin_u64 entry, uint64_t imm); +/** + * qemu_plugin_request_time_control() - request the ability to control time + * + * This grants the plugin the ability to control system time. Only one + * plugin can control time so if multiple plugins request the ability + * all but the first will fail. + * + * Returns an opaque handle or NULL if fails + */ +QEMU_PLUGIN_API +const void *qemu_plugin_request_time_control(void); + +/** + * qemu_plugin_update_ns() - update system emulation time + * @handle: opaque handle returned by qemu_plugin_request_time_control() + * @time: time in nanoseconds + * + * This allows an appropriately authorised plugin (i.e. holding the + * time control handle) to move system time forward to @time. For + * user-mode emulation the time is not changed by this as all reported + * time comes from the host kernel. + * + * Start time is 0. + */ +QEMU_PLUGIN_API +void qemu_plugin_update_ns(const void *handle, int64_t time); + typedef void (*qemu_plugin_vcpu_syscall_cb_t)(qemu_plugin_id_t id, unsigned int vcpu_index, int64_t num, uint64_t a1, uint64_t a2, |