From patchwork Sun Dec 19 13:24:32 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 76126 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 5CEF5B7080 for ; Mon, 20 Dec 2010 00:26:03 +1100 (EST) Received: from localhost ([127.0.0.1]:38278 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PUJGy-0001i9-Lr for incoming@patchwork.ozlabs.org; Sun, 19 Dec 2010 08:26:00 -0500 Received: from [140.186.70.92] (port=44506 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PUJG8-0001gI-Dh for qemu-devel@nongnu.org; Sun, 19 Dec 2010 08:25:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PUJG7-0002EF-Dk for qemu-devel@nongnu.org; Sun, 19 Dec 2010 08:25:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:21634) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PUJG7-0002E4-1V for qemu-devel@nongnu.org; Sun, 19 Dec 2010 08:25:07 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oBJDOrKr000402 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 19 Dec 2010 08:24:53 -0500 Received: from redhat.com (vpn-200-18.tlv.redhat.com [10.35.200.18]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id oBJDOnVs017353; Sun, 19 Dec 2010 08:24:50 -0500 Date: Sun, 19 Dec 2010 15:24:32 +0200 From: "Michael S. Tsirkin" To: Isaku Yamahata Message-ID: <20101219132432.GA19224@redhat.com> References: <20101219131922.GA19158@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20101219131922.GA19158@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org, aurelien@aurel32.net Subject: [Qemu-devel] Re: [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 On Sun, Dec 19, 2010 at 03:19:22PM +0200, Michael S. Tsirkin wrote: > On Sun, Dec 19, 2010 at 10:22:50AM +0900, Isaku Yamahata wrote: > > 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 > > So - I think the following on top addresses the issues. Comments? > Compile-tested only. And maybe this on top: diff --git a/hw/qdev.c b/hw/qdev.c index e04bd4c..96aba18 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -782,7 +782,7 @@ void qbus_free(BusState *bus) if (bus->parent) { QLIST_REMOVE(bus, sibling); bus->parent->num_child_bus--; - } else { + } else if (bus != main_system_bus) { /* TODO: once all bus devices are qdevified, only reset handler for * main_system_bus should be unregistered here. */ qemu_unregister_reset(qbus_reset_all, bus);