From patchwork Fri Feb 3 02:59:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 139283 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4EE6C104797 for ; Fri, 3 Feb 2012 14:28:05 +1100 (EST) Received: from localhost ([::1]:48209 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rt9RV-0003wE-G3 for incoming@patchwork.ozlabs.org; Thu, 02 Feb 2012 22:04:05 -0500 Received: from eggs.gnu.org ([140.186.70.92]:38699) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rt9Pz-00080D-92 for qemu-devel@nongnu.org; Thu, 02 Feb 2012 22:02:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rt9Pt-000619-AV for qemu-devel@nongnu.org; Thu, 02 Feb 2012 22:02:31 -0500 Received: from cantor2.suse.de ([195.135.220.15]:55610 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rt9Pt-00060q-1i for qemu-devel@nongnu.org; Thu, 02 Feb 2012 22:02:25 -0500 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 0A34E8FC92; Fri, 3 Feb 2012 04:02:22 +0100 (CET) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Fri, 3 Feb 2012 03:59:32 +0100 Message-Id: <1328237992-14953-2-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1328237992-14953-1-git-send-email-afaerber@suse.de> References: <1328237992-14953-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 195.135.220.15 Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PATCH v3 01/21] qom: Register QOM infrastructure early X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 Cc: Anthony Liguori --- 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 2d464cf..8f2fc3c 100644 --- a/vl.c +++ b/vl.c @@ -2221,6 +2221,8 @@ int main(int argc, char **argv, char **envp) #endif } + module_call_init(MODULE_INIT_QOM); + runstate_init(); init_clocks(); @@ -3357,8 +3359,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);