From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:45814) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QnqEc-000494-4p for qemu-devel@nongnu.org; Mon, 01 Aug 2011 07:00:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QnqEa-0003fm-PR for qemu-devel@nongnu.org; Mon, 01 Aug 2011 07:00:34 -0400 Received: from mail.valinux.co.jp ([210.128.90.3]:34911) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QnqEa-0003fb-6w for qemu-devel@nongnu.org; Mon, 01 Aug 2011 07:00:32 -0400 Date: Mon, 1 Aug 2011 20:00:28 +0900 From: Isaku Yamahata Message-ID: <20110801110028.GL31494@valinux.co.jp> References: <1311020546-9769-1-git-send-email-weil@mail.berlios.de> <20110719023910.GC25737@valinux.co.jp> <4E251C99.9000600@mail.berlios.de> <20110719072212.GA29608@valinux.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110719072212.GA29608@valinux.co.jp> Subject: Re: [Qemu-devel] [PATCH] Fix duplicate device reset List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil Cc: qemu-devel@nongnu.org Hi, here is the patch. Can you please give it a try? >>From 41039df3174fa46477c4faf93d13eab360dccc22 Mon Sep 17 00:00:00 2001 Message-Id: <41039df3174fa46477c4faf93d13eab360dccc22.1312196365.git.yamahata@valinux.co.jp> From: Isaku Yamahata Date: Mon, 1 Aug 2011 19:56:42 +0900 Subject: [PATCH] qdev: Fix duplicate reset qbus_reset_all_fn was registered twice, so a lot of device reset functions were also called twice when QEMU started. Which was introduced by 80376c3fc2c38fdd45354e4b0eb45031f35587ed This patch fixes it by making the main_sytem_bus creation not register reset handler. Cc: Stefan Weil Signed-off-by: Isaku Yamahata --- hw/qdev.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/hw/qdev.c b/hw/qdev.c index b4ea8e1..6819537 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -36,6 +36,7 @@ static bool qdev_hot_removed = false; /* This is a nasty hack to allow passing a NULL bus to qdev_create. */ static BusState *main_system_bus; +static void main_system_bus_create(void); DeviceInfo *device_info_list; @@ -328,8 +329,7 @@ static int qdev_reset_one(DeviceState *dev, void *opaque) BusState *sysbus_get_default(void) { if (!main_system_bus) { - main_system_bus = qbus_create(&system_bus_info, NULL, - "main-system-bus"); + main_system_bus_create(); } return main_system_bus; } @@ -784,6 +784,16 @@ BusState *qbus_create(BusInfo *info, DeviceState *parent, const char *name) return bus; } +static void main_system_bus_create(void) +{ + /* assign main_system_bus before qbus_create_inplace() + * in order to make "if (bus != main_system_bus)" work */ + main_system_bus = qemu_mallocz(system_bus_info.size); + main_system_bus->qdev_allocated = 1; + qbus_create_inplace(main_system_bus, &system_bus_info, NULL, + "main-system-bus"); +} + void qbus_free(BusState *bus) { DeviceState *dev; -- 1.7.1.1 -- yamahata