* [PATCH 0/3] plugins: Move declarations around and rename 'hwaddr' argument
@ 2020-05-10 17:11 Philippe Mathieu-Daudé
2020-05-10 17:11 ` [PATCH 1/3] qemu/plugin: Trivial code movement Philippe Mathieu-Daudé
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-10 17:11 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-trivial, Emilio G . Cota, Alex Bennée,
Philippe Mathieu-Daudé
Rename qemu_plugin_hwaddr_is_io() 'hwaddr' argument to later
allow declaration of the 'hwaddr' type to be poisoned (see [*]).
[*] https://lists.gnu.org/archive/html/qemu-devel/2020-05/msg02254.html
"exec/cpu: Poison 'hwaddr' type in user-mode emulation"
Philippe Mathieu-Daudé (3):
qemu/plugin: Trivial code movement
qemu/plugin: Move !CONFIG_PLUGIN stubs altogether
qemu/qemu-plugin: Make qemu_plugin_hwaddr_is_io() hwaddr argument
const
include/qemu/plugin.h | 65 ++++++++++++++++++--------------------
include/qemu/qemu-plugin.h | 2 +-
plugins/api.c | 4 +--
3 files changed, 34 insertions(+), 37 deletions(-)
--
2.21.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] qemu/plugin: Trivial code movement
2020-05-10 17:11 [PATCH 0/3] plugins: Move declarations around and rename 'hwaddr' argument Philippe Mathieu-Daudé
@ 2020-05-10 17:11 ` Philippe Mathieu-Daudé
2020-05-10 17:11 ` [PATCH 2/3] qemu/plugin: Move !CONFIG_PLUGIN stubs altogether Philippe Mathieu-Daudé
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-10 17:11 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-trivial, Michael Tokarev, Philippe Mathieu-Daudé,
Laurent Vivier, Emilio G . Cota, Alex Bennée
Move the qemu_plugin_event enum declaration earlier.
This will make the next commit easier to review.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
include/qemu/plugin.h | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h
index 11687e8cdc..e45f950fe3 100644
--- a/include/qemu/plugin.h
+++ b/include/qemu/plugin.h
@@ -13,6 +13,22 @@
#include "qemu/queue.h"
#include "qemu/option.h"
+/*
+ * Events that plugins can subscribe to.
+ */
+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, /* total number of plugin events we support */
+};
+
/*
* Option parsing/processing.
* Note that we can load an arbitrary number of plugins.
@@ -47,22 +63,6 @@ static inline int qemu_plugin_load_list(QemuPluginList *head)
}
#endif /* !CONFIG_PLUGIN */
-/*
- * Events that plugins can subscribe to.
- */
-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, /* total number of plugin events we support */
-};
-
union qemu_plugin_cb_sig {
qemu_plugin_simple_cb_t simple;
qemu_plugin_udata_cb_t udata;
--
2.21.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] qemu/plugin: Move !CONFIG_PLUGIN stubs altogether
2020-05-10 17:11 [PATCH 0/3] plugins: Move declarations around and rename 'hwaddr' argument Philippe Mathieu-Daudé
2020-05-10 17:11 ` [PATCH 1/3] qemu/plugin: Trivial code movement Philippe Mathieu-Daudé
@ 2020-05-10 17:11 ` Philippe Mathieu-Daudé
2020-05-10 17:11 ` [PATCH 3/3] qemu/qemu-plugin: Make qemu_plugin_hwaddr_is_io() hwaddr argument const Philippe Mathieu-Daudé
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-10 17:11 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-trivial, Emilio G . Cota, Alex Bennée,
Philippe Mathieu-Daudé
Simplify the ifdef'ry by moving all stubs together.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
include/qemu/plugin.h | 33 +++++++++++++++------------------
1 file changed, 15 insertions(+), 18 deletions(-)
diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h
index e45f950fe3..ab790ad105 100644
--- a/include/qemu/plugin.h
+++ b/include/qemu/plugin.h
@@ -46,22 +46,6 @@ static inline void qemu_plugin_add_opts(void)
void qemu_plugin_opt_parse(const char *optarg, QemuPluginList *head);
int qemu_plugin_load_list(QemuPluginList *head);
-#else /* !CONFIG_PLUGIN */
-static inline void qemu_plugin_add_opts(void)
-{ }
-
-static inline void qemu_plugin_opt_parse(const char *optarg,
- QemuPluginList *head)
-{
- error_report("plugin interface not enabled in this build");
- exit(1);
-}
-
-static inline int qemu_plugin_load_list(QemuPluginList *head)
-{
- return 0;
-}
-#endif /* !CONFIG_PLUGIN */
union qemu_plugin_cb_sig {
qemu_plugin_simple_cb_t simple;
@@ -182,8 +166,6 @@ struct qemu_plugin_insn *qemu_plugin_tb_insn_get(struct qemu_plugin_tb *tb)
return insn;
}
-#ifdef CONFIG_PLUGIN
-
void qemu_plugin_vcpu_init_hook(CPUState *cpu);
void qemu_plugin_vcpu_exit_hook(CPUState *cpu);
void qemu_plugin_tb_trans_cb(CPUState *cpu, struct qemu_plugin_tb *tb);
@@ -207,6 +189,21 @@ void qemu_plugin_disable_mem_helpers(CPUState *cpu);
#else /* !CONFIG_PLUGIN */
+static inline void qemu_plugin_add_opts(void)
+{ }
+
+static inline void qemu_plugin_opt_parse(const char *optarg,
+ QemuPluginList *head)
+{
+ error_report("plugin interface not enabled in this build");
+ exit(1);
+}
+
+static inline int qemu_plugin_load_list(QemuPluginList *head)
+{
+ return 0;
+}
+
static inline void qemu_plugin_vcpu_init_hook(CPUState *cpu)
{ }
--
2.21.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] qemu/qemu-plugin: Make qemu_plugin_hwaddr_is_io() hwaddr argument const
2020-05-10 17:11 [PATCH 0/3] plugins: Move declarations around and rename 'hwaddr' argument Philippe Mathieu-Daudé
2020-05-10 17:11 ` [PATCH 1/3] qemu/plugin: Trivial code movement Philippe Mathieu-Daudé
2020-05-10 17:11 ` [PATCH 2/3] qemu/plugin: Move !CONFIG_PLUGIN stubs altogether Philippe Mathieu-Daudé
@ 2020-05-10 17:11 ` Philippe Mathieu-Daudé
2020-05-10 20:14 ` [PATCH 0/3] plugins: Move declarations around and rename 'hwaddr' argument Emilio G. Cota
2020-05-12 18:44 ` Alex Bennée
4 siblings, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-10 17:11 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-trivial, Emilio G . Cota, Alex Bennée,
Philippe Mathieu-Daudé
Rename qemu_plugin_hwaddr_is_io() address argument 'haddr'
similarly to qemu_plugin_hwaddr_device_offset(), and make
it const.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
Having the variable named similarly to the 'hwaddr' typedef is
slighly confusing. Also if we declare 'hwaddr' typedef poisoned,
GCC complains qemu_plugin_hwaddr_is_io() use a poisoned variable...
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
include/qemu/qemu-plugin.h | 2 +-
plugins/api.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h
index 5502e112c8..89ed579f55 100644
--- a/include/qemu/qemu-plugin.h
+++ b/include/qemu/qemu-plugin.h
@@ -331,7 +331,7 @@ struct qemu_plugin_hwaddr *qemu_plugin_get_hwaddr(qemu_plugin_meminfo_t info,
* to return information about it. For non-IO accesses the device
* offset will be into the appropriate block of RAM.
*/
-bool qemu_plugin_hwaddr_is_io(struct qemu_plugin_hwaddr *hwaddr);
+bool qemu_plugin_hwaddr_is_io(const struct qemu_plugin_hwaddr *haddr);
uint64_t qemu_plugin_hwaddr_device_offset(const struct qemu_plugin_hwaddr *haddr);
typedef void
diff --git a/plugins/api.c b/plugins/api.c
index 53c8a73582..bbdc5a4eb4 100644
--- a/plugins/api.c
+++ b/plugins/api.c
@@ -275,10 +275,10 @@ struct qemu_plugin_hwaddr *qemu_plugin_get_hwaddr(qemu_plugin_meminfo_t info,
}
#endif
-bool qemu_plugin_hwaddr_is_io(struct qemu_plugin_hwaddr *hwaddr)
+bool qemu_plugin_hwaddr_is_io(const struct qemu_plugin_hwaddr *haddr)
{
#ifdef CONFIG_SOFTMMU
- return hwaddr->is_io;
+ return haddr->is_io;
#else
return false;
#endif
--
2.21.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] plugins: Move declarations around and rename 'hwaddr' argument
2020-05-10 17:11 [PATCH 0/3] plugins: Move declarations around and rename 'hwaddr' argument Philippe Mathieu-Daudé
` (2 preceding siblings ...)
2020-05-10 17:11 ` [PATCH 3/3] qemu/qemu-plugin: Make qemu_plugin_hwaddr_is_io() hwaddr argument const Philippe Mathieu-Daudé
@ 2020-05-10 20:14 ` Emilio G. Cota
2020-05-12 18:44 ` Alex Bennée
4 siblings, 0 replies; 6+ messages in thread
From: Emilio G. Cota @ 2020-05-10 20:14 UTC (permalink / raw)
To: Philippe Mathieu-Daudé; +Cc: qemu-trivial, Alex Bennée, qemu-devel
On Sun, May 10, 2020 at 19:11:16 +0200, Philippe Mathieu-Daudé wrote:
> Rename qemu_plugin_hwaddr_is_io() 'hwaddr' argument to later
> allow declaration of the 'hwaddr' type to be poisoned (see [*]).
>
> [*] https://lists.gnu.org/archive/html/qemu-devel/2020-05/msg02254.html
> "exec/cpu: Poison 'hwaddr' type in user-mode emulation"
>
> Philippe Mathieu-Daudé (3):
> qemu/plugin: Trivial code movement
> qemu/plugin: Move !CONFIG_PLUGIN stubs altogether
> qemu/qemu-plugin: Make qemu_plugin_hwaddr_is_io() hwaddr argument
> const
Reviewed-by: Emilio G. Cota <cota@braap.org>
for the series.
Thanks,
E.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] plugins: Move declarations around and rename 'hwaddr' argument
2020-05-10 17:11 [PATCH 0/3] plugins: Move declarations around and rename 'hwaddr' argument Philippe Mathieu-Daudé
` (3 preceding siblings ...)
2020-05-10 20:14 ` [PATCH 0/3] plugins: Move declarations around and rename 'hwaddr' argument Emilio G. Cota
@ 2020-05-12 18:44 ` Alex Bennée
4 siblings, 0 replies; 6+ messages in thread
From: Alex Bennée @ 2020-05-12 18:44 UTC (permalink / raw)
To: Philippe Mathieu-Daudé; +Cc: qemu-trivial, Emilio G . Cota, qemu-devel
Philippe Mathieu-Daudé <f4bug@amsat.org> writes:
> Rename qemu_plugin_hwaddr_is_io() 'hwaddr' argument to later
> allow declaration of the 'hwaddr' type to be poisoned (see [*]).
>
> [*] https://lists.gnu.org/archive/html/qemu-devel/2020-05/msg02254.html
> "exec/cpu: Poison 'hwaddr' type in user-mode emulation"
Queued to plugins/next, thanks.
>
> Philippe Mathieu-Daudé (3):
> qemu/plugin: Trivial code movement
> qemu/plugin: Move !CONFIG_PLUGIN stubs altogether
> qemu/qemu-plugin: Make qemu_plugin_hwaddr_is_io() hwaddr argument
> const
>
> include/qemu/plugin.h | 65 ++++++++++++++++++--------------------
> include/qemu/qemu-plugin.h | 2 +-
> plugins/api.c | 4 +--
> 3 files changed, 34 insertions(+), 37 deletions(-)
--
Alex Bennée
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-05-12 18:48 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-10 17:11 [PATCH 0/3] plugins: Move declarations around and rename 'hwaddr' argument Philippe Mathieu-Daudé
2020-05-10 17:11 ` [PATCH 1/3] qemu/plugin: Trivial code movement Philippe Mathieu-Daudé
2020-05-10 17:11 ` [PATCH 2/3] qemu/plugin: Move !CONFIG_PLUGIN stubs altogether Philippe Mathieu-Daudé
2020-05-10 17:11 ` [PATCH 3/3] qemu/qemu-plugin: Make qemu_plugin_hwaddr_is_io() hwaddr argument const Philippe Mathieu-Daudé
2020-05-10 20:14 ` [PATCH 0/3] plugins: Move declarations around and rename 'hwaddr' argument Emilio G. Cota
2020-05-12 18:44 ` Alex Bennée
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.