From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Anthony Liguori" <aliguori@us.ibm.com>,
"Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [PATCH RFC 2/7] qom: Register QOM infrastructure early
Date: Sun, 29 Jan 2012 14:25:26 +0100 [thread overview]
Message-ID: <1327843531-32403-3-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1327843531-32403-1-git-send-email-afaerber@suse.de>
QOM TYPE_INTERFACE was registered with device_init(), whose
constructors are executed rather late in vl.c's main().
Introduce a new module init type and register it very early so that QOM
can safely be used for machines and CPUs.
Note that *_init() defines an attributed function, so no semicolon is
needed after the brace.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Anthony Liguori <aliguori@us.ibm.com>
---
module.h | 2 ++
qom/object.c | 2 +-
vl.c | 2 ++
3 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/module.h b/module.h
index ef66730..567ff3a 100644
--- a/module.h
+++ b/module.h
@@ -21,6 +21,7 @@ static void __attribute__((constructor)) do_qemu_init_ ## function(void) { \
}
typedef enum {
+ MODULE_INIT_EARLY,
MODULE_INIT_BLOCK,
MODULE_INIT_DEVICE,
MODULE_INIT_MACHINE,
@@ -28,6 +29,7 @@ typedef enum {
MODULE_INIT_MAX
} module_init_type;
+#define early_init(function) module_init(function, MODULE_INIT_EARLY)
#define block_init(function) module_init(function, MODULE_INIT_BLOCK)
#define device_init(function) module_init(function, MODULE_INIT_DEVICE)
#define machine_init(function) module_init(function, MODULE_INIT_MACHINE)
diff --git a/qom/object.c b/qom/object.c
index 1821959..3c79e1d 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -388,7 +388,7 @@ static void register_interface(void)
type_register_static(&interface_info);
}
-device_init(register_interface);
+early_init(register_interface)
Object *object_dynamic_cast_assert(Object *obj, const char *typename)
{
diff --git a/vl.c b/vl.c
index d88a18c..379ca4e 100644
--- a/vl.c
+++ b/vl.c
@@ -2208,6 +2208,8 @@ int main(int argc, char **argv, char **envp)
#endif
}
+ module_call_init(MODULE_INIT_EARLY);
+
runstate_init();
init_clocks();
--
1.7.7
next prev parent reply other threads:[~2012-01-29 13:27 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-29 13:25 [Qemu-devel] [PATCH RFC 0/7] Introduce QOM CPU and use for target-arm Andreas Färber
2012-01-29 13:25 ` [Qemu-devel] [PATCH 1/7][RESEND] qom: Introduce object_class_is_abstract() Andreas Färber
2012-01-29 13:25 ` Andreas Färber [this message]
2012-01-29 13:25 ` [Qemu-devel] [PATCH RFC 3/7] qom: Add QOM support to user emulators Andreas Färber
2012-01-29 13:25 ` [Qemu-devel] [PATCH RFC 4/7] qom: Introduce CPU class Andreas Färber
2012-01-30 2:14 ` Anthony Liguori
2012-01-30 11:58 ` Andreas Färber
2012-01-31 10:36 ` Andreas Färber
2012-01-29 13:25 ` [Qemu-devel] [PATCH RFC 5/7] cpu: Introduce cpu_class_foreach() Andreas Färber
2012-01-30 2:16 ` Anthony Liguori
2012-01-30 12:02 ` Andreas Färber
2012-01-29 13:25 ` [Qemu-devel] [PATCH RFC 6/7] target-arm: Introduce QOM CPU and use for it CPUID lookup Andreas Färber
2012-01-30 2:19 ` Anthony Liguori
2012-01-30 12:11 ` Andreas Färber
2012-01-29 13:25 ` [Qemu-devel] [PATCH RFC 7/7] target-arm: Embed CPUARMState in QOM ARMCPU Andreas Färber
2012-01-30 2:22 ` Anthony Liguori
2012-01-30 12:52 ` Andreas Färber
2012-01-30 16:01 ` Andreas Färber
2012-01-29 23:50 ` [Qemu-devel] [PATCH RFC 8/7] target-arm: Use IoC for CPU init Andreas Färber
2012-01-30 2:23 ` Anthony Liguori
2012-01-29 23:50 ` [Qemu-devel] [PATCH RFC 9/7] target-arm: Move CPU feature flags to class Andreas Färber
2012-01-30 19:27 ` Andreas Färber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1327843531-32403-3-git-send-email-afaerber@suse.de \
--to=afaerber@suse.de \
--cc=aliguori@us.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).