qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [PATCH RFC v2 2/8] qom: Register QOM infrastructure early
Date: Wed,  1 Feb 2012 13:57:19 +0100	[thread overview]
Message-ID: <1328101045-10717-3-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1328101045-10717-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().

Rename the module init type from DEVICE to QOM and call it very early
so that QOM can safely be used for machines and CPUs.

device_init() is left for legacy types. New ones should use type_init().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Anthony Liguori <anthony@codemonkey.ws>
---
 module.h |    5 +++--
 vl.c     |    4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/module.h b/module.h
index ef66730..56391a5 100644
--- a/module.h
+++ b/module.h
@@ -21,15 +21,16 @@ static void __attribute__((constructor)) do_qemu_init_ ## function(void) {  \
 }
 
 typedef enum {
+    MODULE_INIT_QOM,
     MODULE_INIT_BLOCK,
-    MODULE_INIT_DEVICE,
     MODULE_INIT_MACHINE,
     MODULE_INIT_QAPI,
     MODULE_INIT_MAX
 } module_init_type;
 
+#define type_init(function) module_init(function, MODULE_INIT_QOM)
 #define block_init(function) module_init(function, MODULE_INIT_BLOCK)
-#define device_init(function) module_init(function, MODULE_INIT_DEVICE)
+#define device_init(function) module_init(function, MODULE_INIT_QOM)
 #define machine_init(function) module_init(function, MODULE_INIT_MACHINE)
 #define qapi_init(function) module_init(function, MODULE_INIT_QAPI)
 
diff --git a/vl.c b/vl.c
index d88a18c..69110f2 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_QOM);
+
     runstate_init();
 
     init_clocks();
@@ -3347,8 +3349,6 @@ int main(int argc, char **argv, char **envp)
     if (foreach_device_config(DEV_DEBUGCON, debugcon_parse) < 0)
         exit(1);
 
-    module_call_init(MODULE_INIT_DEVICE);
-
     /* must be after qdev registration but before machine init */
     if (vga_model) {
         select_vgahw(vga_model);
-- 
1.7.7

  parent reply	other threads:[~2012-02-01 13:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-01 12:57 [Qemu-devel] [PATCH RFC v2 0/8] Introduce QOM CPU and use for ARM Andreas Färber
2012-02-01 12:57 ` [Qemu-devel] [PATCH RFC v2 1/8] qom: Allow object_class_foreach() to take additional parameters to refine search Andreas Färber
2012-02-01 12:57 ` Andreas Färber [this message]
2012-02-01 12:57 ` [Qemu-devel] [PATCH RFC v2 3/8] qom: Add QOM support to user emulators Andreas Färber
2012-02-01 12:57 ` [Qemu-devel] [PATCH RFC v2 4/8] qom: Introduce CPU class Andreas Färber
2012-02-01 22:25   ` Peter Maydell
2012-02-01 12:57 ` [Qemu-devel] [PATCH RFC v2 5/8] target-arm: Introduce QOM CPU and use it for CPUID lookup Andreas Färber
2012-02-01 16:16   ` Andreas Färber
2012-02-01 12:57 ` [Qemu-devel] [PATCH RFC v2 6/8] target-arm: Embed CPUARMState in QOM ARMCPU Andreas Färber
2012-02-01 12:57 ` [Qemu-devel] [PATCH RFC v2 7/8] target-arm: Prepare model-specific class_init function Andreas Färber
2012-02-01 12:57 ` [Qemu-devel] [PATCH RFC v2 8/8] target-arm: Move CPU feature flags out of CPUState 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=1328101045-10717-3-git-send-email-afaerber@suse.de \
    --to=afaerber@suse.de \
    --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).