* [PATCH 0/2] *** This is based on pull request from Alex Bennée *** @ 2021-03-17 19:11 Yonggang Luo 2021-03-17 19:11 ` [PATCH 1/2] plugins: Update qemu-plugins.symbols to match qemu-plugins.h Yonggang Luo ` (2 more replies) 0 siblings, 3 replies; 7+ messages in thread From: Yonggang Luo @ 2021-03-17 19:11 UTC (permalink / raw) To: qemu-devel; +Cc: Yonggang Luo, Alex Bennée *** BLURB HERE *** The pull request https://patchew.org/QEMU/20210317072216.16316-1-alex.bennee@linaro.org/ Yonggang Luo (2): plugins: Update qemu-plugins.symbols to match qemu-plugins.h plugins: Move all typedef and type declaration to the front of the qemu-plugin.h include/qemu/qemu-plugin.h | 187 +++++++++++++++++------------------ plugins/qemu-plugins.symbols | 25 +++-- 2 files changed, 104 insertions(+), 108 deletions(-) -- 2.29.2.windows.3 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] plugins: Update qemu-plugins.symbols to match qemu-plugins.h 2021-03-17 19:11 [PATCH 0/2] *** This is based on pull request from Alex Bennée *** Yonggang Luo @ 2021-03-17 19:11 ` Yonggang Luo 2021-03-17 19:11 ` [PATCH 2/2] plugins: Move all typedef and type declaration to the front of the qemu-plugin.h Yonggang Luo 2021-03-18 8:50 ` [PATCH 0/2] *** This is based on pull request from Alex Bennée *** Markus Armbruster 2 siblings, 0 replies; 7+ messages in thread From: Yonggang Luo @ 2021-03-17 19:11 UTC (permalink / raw) To: qemu-devel; +Cc: Yonggang Luo, Alex Bennée Reorder the function symbols that consistence with qemu-plugins.h Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> --- plugins/qemu-plugins.symbols | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/plugins/qemu-plugins.symbols b/plugins/qemu-plugins.symbols index 4bdb381f48..a0ac1df62a 100644 --- a/plugins/qemu-plugins.symbols +++ b/plugins/qemu-plugins.symbols @@ -5,35 +5,34 @@ qemu_plugin_register_vcpu_exit_cb; qemu_plugin_register_vcpu_idle_cb; qemu_plugin_register_vcpu_resume_cb; - qemu_plugin_register_vcpu_insn_exec_cb; - qemu_plugin_register_vcpu_insn_exec_inline; - qemu_plugin_register_vcpu_mem_cb; - qemu_plugin_register_vcpu_mem_haddr_cb; - qemu_plugin_register_vcpu_mem_inline; - qemu_plugin_ram_addr_from_host; qemu_plugin_register_vcpu_tb_trans_cb; qemu_plugin_register_vcpu_tb_exec_cb; qemu_plugin_register_vcpu_tb_exec_inline; - qemu_plugin_register_flush_cb; - qemu_plugin_register_vcpu_syscall_cb; - qemu_plugin_register_vcpu_syscall_ret_cb; - qemu_plugin_register_atexit_cb; + qemu_plugin_register_vcpu_insn_exec_cb; + qemu_plugin_register_vcpu_insn_exec_inline; qemu_plugin_tb_n_insns; - qemu_plugin_tb_get_insn; qemu_plugin_tb_vaddr; + qemu_plugin_tb_get_insn; qemu_plugin_insn_data; qemu_plugin_insn_size; qemu_plugin_insn_vaddr; qemu_plugin_insn_haddr; - qemu_plugin_insn_disas; qemu_plugin_mem_size_shift; qemu_plugin_mem_is_sign_extended; qemu_plugin_mem_is_big_endian; qemu_plugin_mem_is_store; qemu_plugin_get_hwaddr; qemu_plugin_hwaddr_is_io; - qemu_plugin_hwaddr_to_raddr; + qemu_plugin_hwaddr_phys_addr; + qemu_plugin_hwaddr_device_name; + qemu_plugin_register_vcpu_mem_cb; + qemu_plugin_register_vcpu_mem_inline; + qemu_plugin_register_vcpu_syscall_cb; + qemu_plugin_register_vcpu_syscall_ret_cb; + qemu_plugin_insn_disas; qemu_plugin_vcpu_for_each; + qemu_plugin_register_flush_cb; + qemu_plugin_register_atexit_cb; qemu_plugin_n_vcpus; qemu_plugin_n_max_vcpus; qemu_plugin_outs; -- 2.29.2.windows.3 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] plugins: Move all typedef and type declaration to the front of the qemu-plugin.h 2021-03-17 19:11 [PATCH 0/2] *** This is based on pull request from Alex Bennée *** Yonggang Luo 2021-03-17 19:11 ` [PATCH 1/2] plugins: Update qemu-plugins.symbols to match qemu-plugins.h Yonggang Luo @ 2021-03-17 19:11 ` Yonggang Luo 2021-03-18 8:50 ` [PATCH 0/2] *** This is based on pull request from Alex Bennée *** Markus Armbruster 2 siblings, 0 replies; 7+ messages in thread From: Yonggang Luo @ 2021-03-17 19:11 UTC (permalink / raw) To: qemu-devel; +Cc: Yonggang Luo, Alex Bennée Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> --- include/qemu/qemu-plugin.h | 187 ++++++++++++++++++------------------- 1 file changed, 92 insertions(+), 95 deletions(-) diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 97cdfd7761..2cb17f3051 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -81,27 +81,6 @@ typedef struct qemu_info_t { }; } qemu_info_t; -/** - * qemu_plugin_install() - Install a plugin - * @id: this plugin's opaque ID - * @info: a block describing some details about the guest - * @argc: number of arguments - * @argv: array of arguments (@argc elements) - * - * All plugins must export this symbol which is called when the plugin - * is first loaded. Calling qemu_plugin_uninstall() from this function - * is a bug. - * - * Note: @info is only live during the call. Copy any information we - * want to keep. @argv remains valid throughout the lifetime of the - * loaded plugin. - * - * Return: 0 on successful loading, !0 for an error. - */ -QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id, - const qemu_info_t *info, - int argc, char **argv); - /** * typedef qemu_plugin_simple_cb_t - simple callback * @id: the unique qemu_plugin_id_t @@ -135,6 +114,98 @@ typedef void (*qemu_plugin_vcpu_simple_cb_t)(qemu_plugin_id_t id, typedef void (*qemu_plugin_vcpu_udata_cb_t)(unsigned int vcpu_index, void *userdata); +/** struct qemu_plugin_tb - Opaque handle for a translation block */ +struct qemu_plugin_tb; +/** struct qemu_plugin_insn - Opaque handle for a translated instruction */ +struct qemu_plugin_insn; + +/** + * enum qemu_plugin_cb_flags - type of callback + * + * @QEMU_PLUGIN_CB_NO_REGS: callback does not access the CPU's regs + * @QEMU_PLUGIN_CB_R_REGS: callback reads the CPU's regs + * @QEMU_PLUGIN_CB_RW_REGS: callback reads and writes the CPU's regs + * + * Note: currently unused, plugins cannot read or change system + * register state. + */ +enum qemu_plugin_cb_flags { + QEMU_PLUGIN_CB_NO_REGS, + QEMU_PLUGIN_CB_R_REGS, + QEMU_PLUGIN_CB_RW_REGS, +}; + +enum qemu_plugin_mem_rw { + QEMU_PLUGIN_MEM_R = 1, + QEMU_PLUGIN_MEM_W, + QEMU_PLUGIN_MEM_RW, +}; + +/** + * typedef qemu_plugin_vcpu_tb_trans_cb_t - translation callback + * @id: unique plugin id + * @tb: opaque handle used for querying and instrumenting a block. + */ +typedef void (*qemu_plugin_vcpu_tb_trans_cb_t)(qemu_plugin_id_t id, + struct qemu_plugin_tb *tb); + +/** + * enum qemu_plugin_op - describes an inline op + * + * @QEMU_PLUGIN_INLINE_ADD_U64: add an immediate value uint64_t + * + * Note: currently only a single inline op is supported. + */ + +enum qemu_plugin_op { + QEMU_PLUGIN_INLINE_ADD_U64, +}; + +/** + * typedef qemu_plugin_meminfo_t - opaque memory transaction handle + * + * This can be further queried using the qemu_plugin_mem_* query + * functions. + */ +typedef uint32_t qemu_plugin_meminfo_t; +/** struct qemu_plugin_hwaddr - opaque hw address handle */ +struct qemu_plugin_hwaddr; + +typedef void +(*qemu_plugin_vcpu_mem_cb_t)(unsigned int vcpu_index, + qemu_plugin_meminfo_t info, uint64_t vaddr, + void *userdata); + +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, + uint64_t a3, uint64_t a4, uint64_t a5, + uint64_t a6, uint64_t a7, uint64_t a8); +typedef void +(*qemu_plugin_vcpu_syscall_ret_cb_t)(qemu_plugin_id_t id, unsigned int vcpu_idx, + int64_t num, int64_t ret); + +/** + * qemu_plugin_install() - Install a plugin + * @id: this plugin's opaque ID + * @info: a block describing some details about the guest + * @argc: number of arguments + * @argv: array of arguments (@argc elements) + * + * All plugins must export this symbol which is called when the plugin + * is first loaded. Calling qemu_plugin_uninstall() from this function + * is a bug. + * + * Note: @info is only live during the call. Copy any information we + * want to keep. @argv remains valid throughout the lifetime of the + * loaded plugin. + * + * Return: 0 on successful loading, !0 for an error. + */ +QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id, + const qemu_info_t *info, + int argc, char **argv); + /** * qemu_plugin_uninstall() - Uninstall a plugin * @id: this plugin's opaque ID @@ -205,41 +276,6 @@ void qemu_plugin_register_vcpu_idle_cb(qemu_plugin_id_t id, void qemu_plugin_register_vcpu_resume_cb(qemu_plugin_id_t id, qemu_plugin_vcpu_simple_cb_t cb); -/** struct qemu_plugin_tb - Opaque handle for a translation block */ -struct qemu_plugin_tb; -/** struct qemu_plugin_insn - Opaque handle for a translated instruction */ -struct qemu_plugin_insn; - -/** - * enum qemu_plugin_cb_flags - type of callback - * - * @QEMU_PLUGIN_CB_NO_REGS: callback does not access the CPU's regs - * @QEMU_PLUGIN_CB_R_REGS: callback reads the CPU's regs - * @QEMU_PLUGIN_CB_RW_REGS: callback reads and writes the CPU's regs - * - * Note: currently unused, plugins cannot read or change system - * register state. - */ -enum qemu_plugin_cb_flags { - QEMU_PLUGIN_CB_NO_REGS, - QEMU_PLUGIN_CB_R_REGS, - QEMU_PLUGIN_CB_RW_REGS, -}; - -enum qemu_plugin_mem_rw { - QEMU_PLUGIN_MEM_R = 1, - QEMU_PLUGIN_MEM_W, - QEMU_PLUGIN_MEM_RW, -}; - -/** - * typedef qemu_plugin_vcpu_tb_trans_cb_t - translation callback - * @id: unique plugin id - * @tb: opaque handle used for querying and instrumenting a block. - */ -typedef void (*qemu_plugin_vcpu_tb_trans_cb_t)(qemu_plugin_id_t id, - struct qemu_plugin_tb *tb); - /** * qemu_plugin_register_vcpu_tb_trans_cb() - register a translate cb * @id: plugin ID @@ -269,18 +305,6 @@ void qemu_plugin_register_vcpu_tb_exec_cb(struct qemu_plugin_tb *tb, enum qemu_plugin_cb_flags flags, void *userdata); -/** - * enum qemu_plugin_op - describes an inline op - * - * @QEMU_PLUGIN_INLINE_ADD_U64: add an immediate value uint64_t - * - * Note: currently only a single inline op is supported. - */ - -enum qemu_plugin_op { - QEMU_PLUGIN_INLINE_ADD_U64, -}; - /** * qemu_plugin_register_vcpu_tb_exec_inline() - execution inline op * @tb: the opaque qemu_plugin_tb handle for the translation @@ -393,16 +417,6 @@ uint64_t qemu_plugin_insn_vaddr(const struct qemu_plugin_insn *insn); */ void *qemu_plugin_insn_haddr(const struct qemu_plugin_insn *insn); -/** - * typedef qemu_plugin_meminfo_t - opaque memory transaction handle - * - * This can be further queried using the qemu_plugin_mem_* query - * functions. - */ -typedef uint32_t qemu_plugin_meminfo_t; -/** struct qemu_plugin_hwaddr - opaque hw address handle */ -struct qemu_plugin_hwaddr; - /** * qemu_plugin_mem_size_shift() - get size of access * @info: opaque memory transaction handle @@ -480,11 +494,6 @@ uint64_t qemu_plugin_hwaddr_phys_addr(const struct qemu_plugin_hwaddr *haddr); */ const char *qemu_plugin_hwaddr_device_name(const struct qemu_plugin_hwaddr *h); -typedef void -(*qemu_plugin_vcpu_mem_cb_t)(unsigned int vcpu_index, - qemu_plugin_meminfo_t info, uint64_t vaddr, - void *userdata); - void qemu_plugin_register_vcpu_mem_cb(struct qemu_plugin_insn *insn, qemu_plugin_vcpu_mem_cb_t cb, enum qemu_plugin_cb_flags flags, @@ -496,21 +505,9 @@ void qemu_plugin_register_vcpu_mem_inline(struct qemu_plugin_insn *insn, enum qemu_plugin_op op, void *ptr, uint64_t imm); - - -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, - uint64_t a3, uint64_t a4, uint64_t a5, - uint64_t a6, uint64_t a7, uint64_t a8); - void qemu_plugin_register_vcpu_syscall_cb(qemu_plugin_id_t id, qemu_plugin_vcpu_syscall_cb_t cb); -typedef void -(*qemu_plugin_vcpu_syscall_ret_cb_t)(qemu_plugin_id_t id, unsigned int vcpu_idx, - int64_t num, int64_t ret); - void qemu_plugin_register_vcpu_syscall_ret_cb(qemu_plugin_id_t id, qemu_plugin_vcpu_syscall_ret_cb_t cb); -- 2.29.2.windows.3 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] *** This is based on pull request from Alex Bennée *** 2021-03-17 19:11 [PATCH 0/2] *** This is based on pull request from Alex Bennée *** Yonggang Luo 2021-03-17 19:11 ` [PATCH 1/2] plugins: Update qemu-plugins.symbols to match qemu-plugins.h Yonggang Luo 2021-03-17 19:11 ` [PATCH 2/2] plugins: Move all typedef and type declaration to the front of the qemu-plugin.h Yonggang Luo @ 2021-03-18 8:50 ` Markus Armbruster 2021-03-18 9:40 ` 罗勇刚(Yonggang Luo) 2 siblings, 1 reply; 7+ messages in thread From: Markus Armbruster @ 2021-03-18 8:50 UTC (permalink / raw) To: Yonggang Luo; +Cc: Alex Bennée, qemu-devel Please use the subject line for explaining the purpose of the series. "Based on" information should go into the body. Ideally also in machine-readable form, like Based-on: <20171220185924.32756-1-armbru@redhat.com> where the thing in <anglular brackets> is the pull request's Message-id. Note: I used one of my pull requests, not Alex's, for this example. Yonggang Luo <luoyonggang@gmail.com> writes: > *** BLURB HERE *** Recommend to delete this placeholder next time :) > The pull request > https://patchew.org/QEMU/20210317072216.16316-1-alex.bennee@linaro.org/ > > Yonggang Luo (2): > plugins: Update qemu-plugins.symbols to match qemu-plugins.h > plugins: Move all typedef and type declaration to the front of the > qemu-plugin.h > > include/qemu/qemu-plugin.h | 187 +++++++++++++++++------------------ > plugins/qemu-plugins.symbols | 25 +++-- > 2 files changed, 104 insertions(+), 108 deletions(-) ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] *** This is based on pull request from Alex Bennée *** 2021-03-18 8:50 ` [PATCH 0/2] *** This is based on pull request from Alex Bennée *** Markus Armbruster @ 2021-03-18 9:40 ` 罗勇刚(Yonggang Luo) 0 siblings, 0 replies; 7+ messages in thread From: 罗勇刚(Yonggang Luo) @ 2021-03-18 9:40 UTC (permalink / raw) To: Markus Armbruster; +Cc: Alex Bennée, qemu-level [-- Attachment #1: Type: text/plain, Size: 1197 bytes --] On Thu, Mar 18, 2021 at 8:50 AM Markus Armbruster <armbru@redhat.com> wrote: > > Please use the subject line for explaining the purpose of the series. > "Based on" information should go into the body. Ideally also in > machine-readable form, like > > Based-on: <20171220185924.32756-1-armbru@redhat.com> > > where the thing in <anglular brackets> is the pull request's Message-id. > > Note: I used one of my pull requests, not Alex's, for this example. > > Yonggang Luo <luoyonggang@gmail.com> writes: > > > *** BLURB HERE *** > > Recommend to delete this placeholder next time :) Thanks, i'll do it next time > > > The pull request > > https://patchew.org/QEMU/20210317072216.16316-1-alex.bennee@linaro.org/ > > > > Yonggang Luo (2): > > plugins: Update qemu-plugins.symbols to match qemu-plugins.h > > plugins: Move all typedef and type declaration to the front of the > > qemu-plugin.h > > > > include/qemu/qemu-plugin.h | 187 +++++++++++++++++------------------ > > plugins/qemu-plugins.symbols | 25 +++-- > > 2 files changed, 104 insertions(+), 108 deletions(-) > -- 此致 礼 罗勇刚 Yours sincerely, Yonggang Luo [-- Attachment #2: Type: text/html, Size: 1729 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 0/2] Fix qemu-plugins.symbols and improve qemu-plugins.h @ 2021-03-18 18:55 Yonggang Luo 2021-03-18 18:55 ` [PATCH 2/2] plugins: Move all typedef and type declaration to the front of the qemu-plugin.h Yonggang Luo 0 siblings, 1 reply; 7+ messages in thread From: Yonggang Luo @ 2021-03-18 18:55 UTC (permalink / raw) To: qemu-devel; +Cc: Yonggang Luo, Alex Bennée Yonggang Luo (2): plugins: Update qemu-plugins.symbols to match qemu-plugins.h plugins: Move all typedef and type declaration to the front of the qemu-plugin.h include/qemu/qemu-plugin.h | 187 +++++++++++++++++------------------ plugins/qemu-plugins.symbols | 25 +++-- 2 files changed, 104 insertions(+), 108 deletions(-) -- 2.29.2.windows.3 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] plugins: Move all typedef and type declaration to the front of the qemu-plugin.h 2021-03-18 18:55 [PATCH 0/2] Fix qemu-plugins.symbols and improve qemu-plugins.h Yonggang Luo @ 2021-03-18 18:55 ` Yonggang Luo 2021-04-26 16:28 ` Alex Bennée 0 siblings, 1 reply; 7+ messages in thread From: Yonggang Luo @ 2021-03-18 18:55 UTC (permalink / raw) To: qemu-devel; +Cc: Yonggang Luo, Alex Bennée Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> --- include/qemu/qemu-plugin.h | 187 ++++++++++++++++++------------------- 1 file changed, 92 insertions(+), 95 deletions(-) diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 97cdfd7761..2cb17f3051 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -81,27 +81,6 @@ typedef struct qemu_info_t { }; } qemu_info_t; -/** - * qemu_plugin_install() - Install a plugin - * @id: this plugin's opaque ID - * @info: a block describing some details about the guest - * @argc: number of arguments - * @argv: array of arguments (@argc elements) - * - * All plugins must export this symbol which is called when the plugin - * is first loaded. Calling qemu_plugin_uninstall() from this function - * is a bug. - * - * Note: @info is only live during the call. Copy any information we - * want to keep. @argv remains valid throughout the lifetime of the - * loaded plugin. - * - * Return: 0 on successful loading, !0 for an error. - */ -QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id, - const qemu_info_t *info, - int argc, char **argv); - /** * typedef qemu_plugin_simple_cb_t - simple callback * @id: the unique qemu_plugin_id_t @@ -135,6 +114,98 @@ typedef void (*qemu_plugin_vcpu_simple_cb_t)(qemu_plugin_id_t id, typedef void (*qemu_plugin_vcpu_udata_cb_t)(unsigned int vcpu_index, void *userdata); +/** struct qemu_plugin_tb - Opaque handle for a translation block */ +struct qemu_plugin_tb; +/** struct qemu_plugin_insn - Opaque handle for a translated instruction */ +struct qemu_plugin_insn; + +/** + * enum qemu_plugin_cb_flags - type of callback + * + * @QEMU_PLUGIN_CB_NO_REGS: callback does not access the CPU's regs + * @QEMU_PLUGIN_CB_R_REGS: callback reads the CPU's regs + * @QEMU_PLUGIN_CB_RW_REGS: callback reads and writes the CPU's regs + * + * Note: currently unused, plugins cannot read or change system + * register state. + */ +enum qemu_plugin_cb_flags { + QEMU_PLUGIN_CB_NO_REGS, + QEMU_PLUGIN_CB_R_REGS, + QEMU_PLUGIN_CB_RW_REGS, +}; + +enum qemu_plugin_mem_rw { + QEMU_PLUGIN_MEM_R = 1, + QEMU_PLUGIN_MEM_W, + QEMU_PLUGIN_MEM_RW, +}; + +/** + * typedef qemu_plugin_vcpu_tb_trans_cb_t - translation callback + * @id: unique plugin id + * @tb: opaque handle used for querying and instrumenting a block. + */ +typedef void (*qemu_plugin_vcpu_tb_trans_cb_t)(qemu_plugin_id_t id, + struct qemu_plugin_tb *tb); + +/** + * enum qemu_plugin_op - describes an inline op + * + * @QEMU_PLUGIN_INLINE_ADD_U64: add an immediate value uint64_t + * + * Note: currently only a single inline op is supported. + */ + +enum qemu_plugin_op { + QEMU_PLUGIN_INLINE_ADD_U64, +}; + +/** + * typedef qemu_plugin_meminfo_t - opaque memory transaction handle + * + * This can be further queried using the qemu_plugin_mem_* query + * functions. + */ +typedef uint32_t qemu_plugin_meminfo_t; +/** struct qemu_plugin_hwaddr - opaque hw address handle */ +struct qemu_plugin_hwaddr; + +typedef void +(*qemu_plugin_vcpu_mem_cb_t)(unsigned int vcpu_index, + qemu_plugin_meminfo_t info, uint64_t vaddr, + void *userdata); + +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, + uint64_t a3, uint64_t a4, uint64_t a5, + uint64_t a6, uint64_t a7, uint64_t a8); +typedef void +(*qemu_plugin_vcpu_syscall_ret_cb_t)(qemu_plugin_id_t id, unsigned int vcpu_idx, + int64_t num, int64_t ret); + +/** + * qemu_plugin_install() - Install a plugin + * @id: this plugin's opaque ID + * @info: a block describing some details about the guest + * @argc: number of arguments + * @argv: array of arguments (@argc elements) + * + * All plugins must export this symbol which is called when the plugin + * is first loaded. Calling qemu_plugin_uninstall() from this function + * is a bug. + * + * Note: @info is only live during the call. Copy any information we + * want to keep. @argv remains valid throughout the lifetime of the + * loaded plugin. + * + * Return: 0 on successful loading, !0 for an error. + */ +QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id, + const qemu_info_t *info, + int argc, char **argv); + /** * qemu_plugin_uninstall() - Uninstall a plugin * @id: this plugin's opaque ID @@ -205,41 +276,6 @@ void qemu_plugin_register_vcpu_idle_cb(qemu_plugin_id_t id, void qemu_plugin_register_vcpu_resume_cb(qemu_plugin_id_t id, qemu_plugin_vcpu_simple_cb_t cb); -/** struct qemu_plugin_tb - Opaque handle for a translation block */ -struct qemu_plugin_tb; -/** struct qemu_plugin_insn - Opaque handle for a translated instruction */ -struct qemu_plugin_insn; - -/** - * enum qemu_plugin_cb_flags - type of callback - * - * @QEMU_PLUGIN_CB_NO_REGS: callback does not access the CPU's regs - * @QEMU_PLUGIN_CB_R_REGS: callback reads the CPU's regs - * @QEMU_PLUGIN_CB_RW_REGS: callback reads and writes the CPU's regs - * - * Note: currently unused, plugins cannot read or change system - * register state. - */ -enum qemu_plugin_cb_flags { - QEMU_PLUGIN_CB_NO_REGS, - QEMU_PLUGIN_CB_R_REGS, - QEMU_PLUGIN_CB_RW_REGS, -}; - -enum qemu_plugin_mem_rw { - QEMU_PLUGIN_MEM_R = 1, - QEMU_PLUGIN_MEM_W, - QEMU_PLUGIN_MEM_RW, -}; - -/** - * typedef qemu_plugin_vcpu_tb_trans_cb_t - translation callback - * @id: unique plugin id - * @tb: opaque handle used for querying and instrumenting a block. - */ -typedef void (*qemu_plugin_vcpu_tb_trans_cb_t)(qemu_plugin_id_t id, - struct qemu_plugin_tb *tb); - /** * qemu_plugin_register_vcpu_tb_trans_cb() - register a translate cb * @id: plugin ID @@ -269,18 +305,6 @@ void qemu_plugin_register_vcpu_tb_exec_cb(struct qemu_plugin_tb *tb, enum qemu_plugin_cb_flags flags, void *userdata); -/** - * enum qemu_plugin_op - describes an inline op - * - * @QEMU_PLUGIN_INLINE_ADD_U64: add an immediate value uint64_t - * - * Note: currently only a single inline op is supported. - */ - -enum qemu_plugin_op { - QEMU_PLUGIN_INLINE_ADD_U64, -}; - /** * qemu_plugin_register_vcpu_tb_exec_inline() - execution inline op * @tb: the opaque qemu_plugin_tb handle for the translation @@ -393,16 +417,6 @@ uint64_t qemu_plugin_insn_vaddr(const struct qemu_plugin_insn *insn); */ void *qemu_plugin_insn_haddr(const struct qemu_plugin_insn *insn); -/** - * typedef qemu_plugin_meminfo_t - opaque memory transaction handle - * - * This can be further queried using the qemu_plugin_mem_* query - * functions. - */ -typedef uint32_t qemu_plugin_meminfo_t; -/** struct qemu_plugin_hwaddr - opaque hw address handle */ -struct qemu_plugin_hwaddr; - /** * qemu_plugin_mem_size_shift() - get size of access * @info: opaque memory transaction handle @@ -480,11 +494,6 @@ uint64_t qemu_plugin_hwaddr_phys_addr(const struct qemu_plugin_hwaddr *haddr); */ const char *qemu_plugin_hwaddr_device_name(const struct qemu_plugin_hwaddr *h); -typedef void -(*qemu_plugin_vcpu_mem_cb_t)(unsigned int vcpu_index, - qemu_plugin_meminfo_t info, uint64_t vaddr, - void *userdata); - void qemu_plugin_register_vcpu_mem_cb(struct qemu_plugin_insn *insn, qemu_plugin_vcpu_mem_cb_t cb, enum qemu_plugin_cb_flags flags, @@ -496,21 +505,9 @@ void qemu_plugin_register_vcpu_mem_inline(struct qemu_plugin_insn *insn, enum qemu_plugin_op op, void *ptr, uint64_t imm); - - -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, - uint64_t a3, uint64_t a4, uint64_t a5, - uint64_t a6, uint64_t a7, uint64_t a8); - void qemu_plugin_register_vcpu_syscall_cb(qemu_plugin_id_t id, qemu_plugin_vcpu_syscall_cb_t cb); -typedef void -(*qemu_plugin_vcpu_syscall_ret_cb_t)(qemu_plugin_id_t id, unsigned int vcpu_idx, - int64_t num, int64_t ret); - void qemu_plugin_register_vcpu_syscall_ret_cb(qemu_plugin_id_t id, qemu_plugin_vcpu_syscall_ret_cb_t cb); -- 2.29.2.windows.3 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] plugins: Move all typedef and type declaration to the front of the qemu-plugin.h 2021-03-18 18:55 ` [PATCH 2/2] plugins: Move all typedef and type declaration to the front of the qemu-plugin.h Yonggang Luo @ 2021-04-26 16:28 ` Alex Bennée 0 siblings, 0 replies; 7+ messages in thread From: Alex Bennée @ 2021-04-26 16:28 UTC (permalink / raw) To: Yonggang Luo; +Cc: qemu-devel Yonggang Luo <luoyonggang@gmail.com> writes: What's the rationale for moving everything around in the file. As it currently stands the typedefs are create as we get to each new set of helpers/plugin points. Doing it all up front seems like a lot of churn for not particular reason. > Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> > --- > include/qemu/qemu-plugin.h | 187 ++++++++++++++++++------------------- > 1 file changed, 92 insertions(+), 95 deletions(-) > > diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h > index 97cdfd7761..2cb17f3051 100644 > --- a/include/qemu/qemu-plugin.h > +++ b/include/qemu/qemu-plugin.h > @@ -81,27 +81,6 @@ typedef struct qemu_info_t { > }; > } qemu_info_t; > > -/** > - * qemu_plugin_install() - Install a plugin > - * @id: this plugin's opaque ID > - * @info: a block describing some details about the guest > - * @argc: number of arguments > - * @argv: array of arguments (@argc elements) > - * > - * All plugins must export this symbol which is called when the plugin > - * is first loaded. Calling qemu_plugin_uninstall() from this function > - * is a bug. > - * > - * Note: @info is only live during the call. Copy any information we > - * want to keep. @argv remains valid throughout the lifetime of the > - * loaded plugin. > - * > - * Return: 0 on successful loading, !0 for an error. > - */ > -QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id, > - const qemu_info_t *info, > - int argc, char **argv); > - > /** > * typedef qemu_plugin_simple_cb_t - simple callback > * @id: the unique qemu_plugin_id_t > @@ -135,6 +114,98 @@ typedef void (*qemu_plugin_vcpu_simple_cb_t)(qemu_plugin_id_t id, > typedef void (*qemu_plugin_vcpu_udata_cb_t)(unsigned int vcpu_index, > void *userdata); > > +/** struct qemu_plugin_tb - Opaque handle for a translation block */ > +struct qemu_plugin_tb; > +/** struct qemu_plugin_insn - Opaque handle for a translated instruction */ > +struct qemu_plugin_insn; > + > +/** > + * enum qemu_plugin_cb_flags - type of callback > + * > + * @QEMU_PLUGIN_CB_NO_REGS: callback does not access the CPU's regs > + * @QEMU_PLUGIN_CB_R_REGS: callback reads the CPU's regs > + * @QEMU_PLUGIN_CB_RW_REGS: callback reads and writes the CPU's regs > + * > + * Note: currently unused, plugins cannot read or change system > + * register state. > + */ > +enum qemu_plugin_cb_flags { > + QEMU_PLUGIN_CB_NO_REGS, > + QEMU_PLUGIN_CB_R_REGS, > + QEMU_PLUGIN_CB_RW_REGS, > +}; > + > +enum qemu_plugin_mem_rw { > + QEMU_PLUGIN_MEM_R = 1, > + QEMU_PLUGIN_MEM_W, > + QEMU_PLUGIN_MEM_RW, > +}; > + > +/** > + * typedef qemu_plugin_vcpu_tb_trans_cb_t - translation callback > + * @id: unique plugin id > + * @tb: opaque handle used for querying and instrumenting a block. > + */ > +typedef void (*qemu_plugin_vcpu_tb_trans_cb_t)(qemu_plugin_id_t id, > + struct qemu_plugin_tb *tb); > + > +/** > + * enum qemu_plugin_op - describes an inline op > + * > + * @QEMU_PLUGIN_INLINE_ADD_U64: add an immediate value uint64_t > + * > + * Note: currently only a single inline op is supported. > + */ > + > +enum qemu_plugin_op { > + QEMU_PLUGIN_INLINE_ADD_U64, > +}; > + > +/** > + * typedef qemu_plugin_meminfo_t - opaque memory transaction handle > + * > + * This can be further queried using the qemu_plugin_mem_* query > + * functions. > + */ > +typedef uint32_t qemu_plugin_meminfo_t; > +/** struct qemu_plugin_hwaddr - opaque hw address handle */ > +struct qemu_plugin_hwaddr; > + > +typedef void > +(*qemu_plugin_vcpu_mem_cb_t)(unsigned int vcpu_index, > + qemu_plugin_meminfo_t info, uint64_t vaddr, > + void *userdata); > + > +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, > + uint64_t a3, uint64_t a4, uint64_t a5, > + uint64_t a6, uint64_t a7, uint64_t a8); > +typedef void > +(*qemu_plugin_vcpu_syscall_ret_cb_t)(qemu_plugin_id_t id, unsigned int vcpu_idx, > + int64_t num, int64_t ret); > + > +/** > + * qemu_plugin_install() - Install a plugin > + * @id: this plugin's opaque ID > + * @info: a block describing some details about the guest > + * @argc: number of arguments > + * @argv: array of arguments (@argc elements) > + * > + * All plugins must export this symbol which is called when the plugin > + * is first loaded. Calling qemu_plugin_uninstall() from this function > + * is a bug. > + * > + * Note: @info is only live during the call. Copy any information we > + * want to keep. @argv remains valid throughout the lifetime of the > + * loaded plugin. > + * > + * Return: 0 on successful loading, !0 for an error. > + */ > +QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id, > + const qemu_info_t *info, > + int argc, char **argv); > + > /** > * qemu_plugin_uninstall() - Uninstall a plugin > * @id: this plugin's opaque ID > @@ -205,41 +276,6 @@ void qemu_plugin_register_vcpu_idle_cb(qemu_plugin_id_t id, > void qemu_plugin_register_vcpu_resume_cb(qemu_plugin_id_t id, > qemu_plugin_vcpu_simple_cb_t cb); > > -/** struct qemu_plugin_tb - Opaque handle for a translation block */ > -struct qemu_plugin_tb; > -/** struct qemu_plugin_insn - Opaque handle for a translated instruction */ > -struct qemu_plugin_insn; > - > -/** > - * enum qemu_plugin_cb_flags - type of callback > - * > - * @QEMU_PLUGIN_CB_NO_REGS: callback does not access the CPU's regs > - * @QEMU_PLUGIN_CB_R_REGS: callback reads the CPU's regs > - * @QEMU_PLUGIN_CB_RW_REGS: callback reads and writes the CPU's regs > - * > - * Note: currently unused, plugins cannot read or change system > - * register state. > - */ > -enum qemu_plugin_cb_flags { > - QEMU_PLUGIN_CB_NO_REGS, > - QEMU_PLUGIN_CB_R_REGS, > - QEMU_PLUGIN_CB_RW_REGS, > -}; > - > -enum qemu_plugin_mem_rw { > - QEMU_PLUGIN_MEM_R = 1, > - QEMU_PLUGIN_MEM_W, > - QEMU_PLUGIN_MEM_RW, > -}; > - > -/** > - * typedef qemu_plugin_vcpu_tb_trans_cb_t - translation callback > - * @id: unique plugin id > - * @tb: opaque handle used for querying and instrumenting a block. > - */ > -typedef void (*qemu_plugin_vcpu_tb_trans_cb_t)(qemu_plugin_id_t id, > - struct qemu_plugin_tb *tb); > - > /** > * qemu_plugin_register_vcpu_tb_trans_cb() - register a translate cb > * @id: plugin ID > @@ -269,18 +305,6 @@ void qemu_plugin_register_vcpu_tb_exec_cb(struct qemu_plugin_tb *tb, > enum qemu_plugin_cb_flags flags, > void *userdata); > > -/** > - * enum qemu_plugin_op - describes an inline op > - * > - * @QEMU_PLUGIN_INLINE_ADD_U64: add an immediate value uint64_t > - * > - * Note: currently only a single inline op is supported. > - */ > - > -enum qemu_plugin_op { > - QEMU_PLUGIN_INLINE_ADD_U64, > -}; > - > /** > * qemu_plugin_register_vcpu_tb_exec_inline() - execution inline op > * @tb: the opaque qemu_plugin_tb handle for the translation > @@ -393,16 +417,6 @@ uint64_t qemu_plugin_insn_vaddr(const struct qemu_plugin_insn *insn); > */ > void *qemu_plugin_insn_haddr(const struct qemu_plugin_insn *insn); > > -/** > - * typedef qemu_plugin_meminfo_t - opaque memory transaction handle > - * > - * This can be further queried using the qemu_plugin_mem_* query > - * functions. > - */ > -typedef uint32_t qemu_plugin_meminfo_t; > -/** struct qemu_plugin_hwaddr - opaque hw address handle */ > -struct qemu_plugin_hwaddr; > - > /** > * qemu_plugin_mem_size_shift() - get size of access > * @info: opaque memory transaction handle > @@ -480,11 +494,6 @@ uint64_t qemu_plugin_hwaddr_phys_addr(const struct qemu_plugin_hwaddr *haddr); > */ > const char *qemu_plugin_hwaddr_device_name(const struct qemu_plugin_hwaddr *h); > > -typedef void > -(*qemu_plugin_vcpu_mem_cb_t)(unsigned int vcpu_index, > - qemu_plugin_meminfo_t info, uint64_t vaddr, > - void *userdata); > - > void qemu_plugin_register_vcpu_mem_cb(struct qemu_plugin_insn *insn, > qemu_plugin_vcpu_mem_cb_t cb, > enum qemu_plugin_cb_flags flags, > @@ -496,21 +505,9 @@ void qemu_plugin_register_vcpu_mem_inline(struct qemu_plugin_insn *insn, > enum qemu_plugin_op op, void *ptr, > uint64_t imm); > > - > - > -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, > - uint64_t a3, uint64_t a4, uint64_t a5, > - uint64_t a6, uint64_t a7, uint64_t a8); > - > void qemu_plugin_register_vcpu_syscall_cb(qemu_plugin_id_t id, > qemu_plugin_vcpu_syscall_cb_t cb); > > -typedef void > -(*qemu_plugin_vcpu_syscall_ret_cb_t)(qemu_plugin_id_t id, unsigned int vcpu_idx, > - int64_t num, int64_t ret); > - > void > qemu_plugin_register_vcpu_syscall_ret_cb(qemu_plugin_id_t id, > qemu_plugin_vcpu_syscall_ret_cb_t cb); -- Alex Bennée ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-04-26 16:30 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-03-17 19:11 [PATCH 0/2] *** This is based on pull request from Alex Bennée *** Yonggang Luo 2021-03-17 19:11 ` [PATCH 1/2] plugins: Update qemu-plugins.symbols to match qemu-plugins.h Yonggang Luo 2021-03-17 19:11 ` [PATCH 2/2] plugins: Move all typedef and type declaration to the front of the qemu-plugin.h Yonggang Luo 2021-03-18 8:50 ` [PATCH 0/2] *** This is based on pull request from Alex Bennée *** Markus Armbruster 2021-03-18 9:40 ` 罗勇刚(Yonggang Luo) 2021-03-18 18:55 [PATCH 0/2] Fix qemu-plugins.symbols and improve qemu-plugins.h Yonggang Luo 2021-03-18 18:55 ` [PATCH 2/2] plugins: Move all typedef and type declaration to the front of the qemu-plugin.h Yonggang Luo 2021-04-26 16:28 ` Alex Bennée
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).