From patchwork Sun Dec 19 01:22:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 76108 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C65B2B70A4 for ; Sun, 19 Dec 2010 12:24:23 +1100 (EST) Received: from localhost ([127.0.0.1]:54288 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PU80a-0006bh-37 for incoming@patchwork.ozlabs.org; Sat, 18 Dec 2010 20:24:20 -0500 Received: from [140.186.70.92] (port=56765 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PU7zG-0005vZ-Io for qemu-devel@nongnu.org; Sat, 18 Dec 2010 20:22:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PU7zF-0007cB-6o for qemu-devel@nongnu.org; Sat, 18 Dec 2010 20:22:58 -0500 Received: from mail.valinux.co.jp ([210.128.90.3]:51160) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PU7zE-0007c2-Ly for qemu-devel@nongnu.org; Sat, 18 Dec 2010 20:22:57 -0500 Received: from ps.local.valinux.co.jp (vagw.valinux.co.jp [210.128.90.14]) by mail.valinux.co.jp (Postfix) with SMTP id 1C49927FFC; Sun, 19 Dec 2010 10:22:51 +0900 (JST) Received: (nullmailer pid 30122 invoked by uid 1000); Sun, 19 Dec 2010 01:22:50 -0000 From: Isaku Yamahata To: qemu-devel@nongnu.org Date: Sun, 19 Dec 2010 10:22:50 +0900 Message-Id: X-Mailer: git-send-email 1.7.1.1 X-Virus-Scanned: clamav-milter 0.95.2 at va-mail.local.valinux.co.jp X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: aliguori@us.ibm.com, yamahata@valinux.co.jp, aurelien@aurel32.net, mst@redhat.com Subject: [Qemu-devel] [PATCH] qbus: register reset handler for qbus whose parent is NULL X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Stefan Weil reported the regression caused by ec990eb622ad46df5ddcb1e94c418c271894d416 as follows > The second regression also occurs with MIPS malta. > Networking no longer works with the default pcnet nic. > > This is caused because the reset function for pcnet is no > longer called during system boot. The result in an invalid > mac address (all zero) and a non-working nic. > > For this second regression I still have no simple solution. > Of course mips_malta.c should be converted to qdev which > would fix both problems (but only for malta system emulation). The issue is, it is assumed that all qbuses, qdeves are under main_system_bus. But there are qbuses whose parent is NULL. So it is necessary to trigger reset for those qbuses. (On the other hand, if NULL is passed to qdev_create(), its parent bus is main_system_bus.) Ideally those buses should be moved under bus controller device which is qdev. But it's not done yet. So register qbus reset handler for qbus whose parent is NULL. Reported-by: Stefan Weil Signed-off-by: Isaku Yamahata Tested-by: Stefan Weil --- hw/qdev.c | 5 ++++- vl.c | 2 ++ 2 files changed, 6 insertions(+), 1 deletions(-) diff --git a/hw/qdev.c b/hw/qdev.c index 10e28df..774c53b 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -753,8 +753,11 @@ void qbus_create_inplace(BusState *bus, BusInfo *info, if (parent) { QLIST_INSERT_HEAD(&parent->child_bus, bus, sibling); parent->num_child_bus++; + } else if (bus != main_system_bus) { + /* TODO: once all device is qdevified, + reset handler for main_system_bus should also be registered here */ + qemu_register_reset((void *)qbus_reset_all, bus); } - } BusState *qbus_create(BusInfo *info, DeviceState *parent, const char *name) diff --git a/vl.c b/vl.c index c4d3fc0..2ec3989 100644 --- a/vl.c +++ b/vl.c @@ -3088,6 +3088,8 @@ int main(int argc, char **argv, char **envp) exit(1); } + /* TODO: once all device is qdevified, this should be done by + qbus_create_inplace() */ qemu_register_reset((void *)qbus_reset_all, sysbus_get_default()); qemu_run_machine_init_done_notifiers();